1 /* Copyright (C) 2001-2007 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: x_.h 8250 2007-09-25 13:31:24Z giles $ */
15 /* Header for including X library calls in Ghostscript X11 driver */
16 
17 #ifndef x__INCLUDED
18 #  define x__INCLUDED
19 
20 /* Most X implementations have _Xdebug, but VMS DECWindows doesn't. */
21 #ifndef VMS
22 #  define have_Xdebug
23 #endif
24 
25 #ifdef VMS
26 
27 #  ifdef __GNUC__
28 
29 /*   Names of external functions which contain upper case letters are
30  *   modified by the VMS GNU C compiler to prevent confusion between
31  *   names such as XOpen and xopen.  GNU C does this by translating a
32  *   name like XOpen into xopen_aaaaaaaax with "aaaaaaaa" a hexadecimal
33  *   string.  However, this causes problems when we link against the
34  *   X library which doesn't contain a routine named xopen_aaaaaaaax.
35  *   So, we use #define's to map all X routine names to lower case.
36  *   (Note that routines like BlackPixelOfScreen, which are [for VMS]
37  *   preprocessor macros, do not appear here.)
38  */
39 
40 /*
41  * The names redefined here are those which the current Ghostscript X11
42  * driver happens to use: this list may grow in the future.
43  */
44 
45 #    define XAllocColor			xalloccolor
46 #    define XAllocNamedColor		xallocnamedcolor
47 #    define XCloseDisplay		xclosedisplay
48 #    define XCopyArea			xcopyarea
49 #    define XCreateGC			xcreategc
50 #    define XCreatePixmap		xcreatepixmap
51 #    define XCreateWindow		xcreatewindow
52 #    define XDestroyImage		xdestroyimage
53 #    define XDisplayString		xdisplaystring
54 #    define XDrawLine			xdrawline
55 #    define XDrawPoint			xdrawpoint
56 #    define XDrawString			xdrawstring
57 #    define XFillPolygon		xfillpolygon
58 #    define XFillRectangle		xfillrectangle
59 #    define XFillRectangles		xfillrectangles
60 #    define XFlush			xflush
61 #    define XFree			xfree
62 #    define XFreeColors			xfreecolors
63 #    define XFreeFont			xfreefont
64 #    define XFreeFontNames		xfreefontnames
65 #    define XFreeGC			xfreegc
66 #    define XFreePixmap			xfreepixmap
67 #    define XGetDefault			xgetdefault
68 #    define XGetGCValues		xgetgcvalues
69 #    define XGetGeometry		xgetgeometry
70 #    define XGetImage			xgetimage
71 #    define XGetRGBColormaps		xgetrgbcolormaps
72 #    define XGetVisualInfo		xgetvisualinfo
73 #    define XGetWindowAttributes	xgetwindowattributes
74 #    define XGetWindowProperty		xgetwindowproperty
75 #    define XInitImage			xinitimage
76 #    define XInternAtom			xinternatom
77 #    define XListFonts			xlistfonts
78 #    define XLoadQueryFont		xloadqueryfont
79 #    define XMapWindow			xmapwindow
80 #    define XNextEvent			xnextevent
81 #    define XOpenDisplay		xopendisplay
82 #    define XPutImage			xputimage
83 #    define XQueryColor			xquerycolor
84 #    define XResizeWindow		xresizewindow
85 #    define XSendEvent			xsendevent
86 #    define XSetBackground		xsetbackground
87 #    define XSetClipMask		xsetclipmask
88 #    define XSetClipOrigin		xsetcliporigin
89 #    define XSetErrorHandler		xseterrorhandler
90 #    define XSetFillStyle		xsetfillstyle
91 #    define XSetFont			xsetfont
92 #    define XSetForeground		xsetforeground
93 #    define XSetFunction		xsetfunction
94 #    define XSetLineAttributes		xsetlineattributes
95 #    define XSetTile			xsettile
96 #    define XSetWindowBackgroundPixmap	xsetwindowbackgroundpixmap
97 #    define XSetWMHints			xsetwmhints
98 #    define XSetWMNormalHints		xsetwmnormalhints
99 #    define XStoreName			xstorename
100 #    define XSync			xsync
101 #    define XVisualIDFromVisual		xvisualidfromvisual
102 #    define XWMGeometry			xwmgeometry
103 #    define XtAppCreateShell		xtappcreateshell
104 #    define XtCloseDisplay		xtclosedisplay
105 #    define XtCreateApplicationContext	xtcreateapplicationcontext
106 #    define XtDestroyApplicationContext	xtdestroyapplicationcontext
107 #    define XtDestroyWidget		xtdestroywidget
108 #    define XtAppSetFallbackResources	xtappsetfallbackresources
109 #    define XtGetApplicationResources	xtgetapplicationresources
110 #    define XtOpenDisplay		xtopendisplay
111 #    define XtToolkitInitialize		xttoolkitinitialize
112 
113 #    define CADDR_T		/* Without this DEFINE, VAX GNUC    */
114 					/* gets trashed reading Intrinsic.h */
115 #else
116 #include <vms_x_fix.h>
117 #   endif			/* ifdef __GNUC__ */
118 
119 #  include <decw$include/Xlib.h>
120 #  include <decw$include/Xproto.h>
121 #  include <decw$include/Xatom.h>
122 #  include <decw$include/Xutil.h>
123 #  include <decw$include/Intrinsic.h>
124 #  include <decw$include/StringDefs.h>
125 #  include <decw$include/Shell.h>
126 
127 #else /* !ifdef VMS */
128 
129 #  include <X11/Xlib.h>
130 #  include <X11/Xproto.h>
131 #  include <X11/Xatom.h>
132 #  include <X11/Xutil.h>
133 #  include <X11/Intrinsic.h>
134 #  include <X11/StringDefs.h>
135 #  include <X11/Shell.h>
136 
137 #endif /* VMS */
138 
139 /* X11R3 doesn't have XtOffsetOf, but it has XtOffset. */
140 #ifndef XtOffsetOf
141 #  ifdef offsetof
142 #    define XtOffsetOf(s_type,field) offsetof(s_type,field)
143 #  else
144 #    define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
145 #  endif
146 #endif
147 
148 /* Include standard colormap stuff only for X11R4 and later. */
149 #  if defined(XtSpecificationRelease) && (XtSpecificationRelease >= 4)
150 #    define HaveStdCMap 1
151 #  else
152 #    define HaveStdCMap 0
153 /* This function is not defined in R3. */
154 #    undef XVisualIDFromVisual
155 #    define XVisualIDFromVisual(vis) ((vis)->visualid)
156 #  endif
157 
158 /* No-op XInitImage before X11R6. */
159 #  if !(defined(XtSpecificationRelease) && (XtSpecificationRelease >= 6))
160 #    undef XInitImage
161 #    define XInitImage(im) 1	/* non-zero = success */
162 #  endif
163 
164 #endif /* x__INCLUDED */
165