1 /********************************************************************************
2 *                                                                               *
3 *              F O X   P r i v a t e   I n c l u d e   F i l e s                *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or                 *
9 * modify it under the terms of the GNU Lesser General Public                    *
10 * License as published by the Free Software Foundation; either                  *
11 * version 2.1 of the License, or (at your option) any later version.            *
12 *                                                                               *
13 * This library is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
16 * Lesser General Public License for more details.                               *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser General Public              *
19 * License along with this library; if not, write to the Free Software           *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
21 *********************************************************************************
22 * $Id: xincs.h 3297 2015-12-14 20:30:04Z arthurcnorman $                             *
23 ********************************************************************************/
24 #ifndef XINCS_H
25 #define XINCS_H
26 
27 
28 ////////////////////  DO NOT INCLUDE THIS PRIVATE HEADER FILE  //////////////////
29 
30 // Thread safe
31 #ifndef _POSIX_PTHREAD_SEMANTICS
32 #define _POSIX_PTHREAD_SEMANTICS
33 #endif
34 
35 // GNU extras if we can get them
36 #ifndef _GNU_SOURCE
37 #define _GNU_SOURCE
38 #endif
39 
40 // Use 64-bit files
41 #ifndef WIN32
42 #ifndef _FILE_OFFSET_BITS
43 #define _FILE_OFFSET_BITS 64
44 #endif
45 #endif
46 
47 // Basic includes
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <stdarg.h>
51 #include <limits.h>
52 #include <math.h>
53 #include <float.h>
54 #include <string.h>
55 #include <errno.h>
56 #include <signal.h>
57 #include <time.h>
58 #include <locale.h>
59 #include <fcntl.h>
60 #include <sys/types.h>
61 #include <sys/stat.h>
62 
63 #ifndef WIN32
64 
65 #include <grp.h>
66 #include <pwd.h>
67 #include <sys/ioctl.h>
68 #ifdef HAVE_SYS_FILIO_H         // Get FIONREAD on Solaris
69 #include <sys/filio.h>
70 #endif
71 #else
72 
73 #include <io.h>                 // For _access()
74 #if defined(_MSC_VER) || defined(__WATCOMC__)		// Microsoft Visual C++ or Watcom C++
75 #include <direct.h>
76 #define stat _stat
77 #define lstat _stat
78 #define getcwd _getcwd
79 #define mkdir _mkdir
80 #define access _access
81 #define vsnprintf _vsnprintf
82 #define execl _execl
83 #define execlp _execlp
84 #define execle _execle
85 #define execv _execv
86 #define execve _execve
87 #define execvp _execvp
88 #define strdup _strdup
89 #define alloca _alloca
90 #endif
91 #ifdef __BORLANDC__	        // Borland C++ Builder
92 #include <dir.h>
93 #if __BORLANDC__ <= 0x0530      // C++ Builder 3.0
94 #define vsnprintf(a, b, c, d) vsprintf(a, c, d)
95 #endif
96 #define lstat stat
97 #endif
98 #ifdef __MINGW32__              // GCC MingW32
99 #include <direct.h>
100 #define vsnprintf _vsnprintf
101 #endif
102 #ifdef __SC__                   // Digital Mars C++ Compiler
103 #include <direct.h>
104 #include <io.h>                 // For _access()
105 #define vsnprintf _vsnprintf
106 #endif
107 
108 #endif
109 
110 #ifdef HAVE_UNISTD_H
111 #include <unistd.h>
112 #endif
113 #ifdef HAVE_SYS_WAIT_H
114 #include <sys/wait.h>
115 #endif
116 #ifdef TIME_WITH_SYS_TIME
117 #include <sys/time.h>
118 #include <time.h>
119 #else
120 #ifdef HAVE_SYS_TIME_H
121 #include <sys/time.h>
122 #else
123 #include <time.h>
124 #endif
125 #endif
126 #ifdef HAVE_SYS_PARAM_H
127 #include <sys/param.h>
128 #endif
129 #ifdef HAVE_SYS_SELECT_H
130 #if (!defined(__MINGW32__)) && (!defined(hpux))
131 #include <sys/select.h>
132 #endif
133 #endif
134 #ifdef HAVE_DIRENT_H
135 #include <dirent.h>
136 #define NAMLEN(dirent) strlen((dirent)->d_name)
137 #else
138 #define dirent direct
139 #define NAMLEN(dirent) (dirent)->d_namlen
140 #ifdef HAVE_SYS_NDIR_H
141 #include <sys/ndir.h>
142 #endif
143 #ifdef HAVE_SYS_DIR_H
144 #include <sys/dir.h>
145 #endif
146 #ifdef HAVE_NDIR_H
147 #include <ndir.h>
148 #endif
149 #endif
150 #ifdef HAVE_XSHM_H
151 #include <sys/ipc.h>
152 #include <sys/shm.h>
153 #endif
154 #ifdef HAVE_MMAP
155 #include <sys/mman.h>
156 #endif
157 
158 
159 // For thread-safe readdir_r, we sometimes need extra
160 // space above and beyond the space for dirent itself
161 #ifdef HAVE_DIRENT_H
162 #ifndef WIN32
163 struct fxdirent : public dirent {
164   char buffer[256];
165   };
166 #endif
167 #endif
168 
169 
170 // MS-Windows
171 #ifdef WIN32
172 #ifndef STRICT
173 #define STRICT
174 #endif
175 #ifndef WIN32_LEAN_AND_MEAN
176 #define WIN32_LEAN_AND_MEAN
177 #endif
178 #include <windows.h>
179 #ifndef __CYGWIN__
180 #include <winsock2.h>
181 #endif
182 #include <commctrl.h>           // For _TrackMouseEvent
183 #include <shellapi.h>
184 
185 // X windows includes
186 #else
187 
188 #include <X11/X.h>
189 #define XRegisterIMInstantiateCallback broken_XRegisterIMInstantiateCallback
190 #define XUnregisterIMInstantiateCallback broken_XUnregisterIMInstantiateCallback
191 #define XSetIMValues broken_XSetIMValues
192 #include <X11/Xlib.h>
193 #undef XRegisterIMInstantiateCallback
194 #undef XUnregisterIMInstantiateCallback
195 #undef XSetIMValues
196 #include <X11/Xcms.h>
197 #include <X11/Xutil.h>
198 #include <X11/Xresource.h>
199 #include <X11/Xatom.h>
200 #include <X11/cursorfont.h>
201 #ifdef HUMMINGBIRD
202 #include <X11/XlibXtra.h>
203 #endif
204 #ifdef HAVE_XSHM_H
205 #include <X11/extensions/XShm.h>
206 #endif
207 #ifdef HAVE_XCURSOR_H
208 #include <X11/Xcursor/Xcursor.h>
209 #endif
210 #ifdef HAVE_XFT_H
211 #include <X11/Xft/Xft.h>
212 #endif
213 #ifdef HAVE_XSHAPE_H
214 #include <X11/extensions/shape.h>
215 #endif
216 #ifdef HAVE_XRANDR_H
217 #include <X11/extensions/Xrandr.h>
218 #endif
219 
220 #ifndef NO_XIM
221 #ifndef XlibSpecificationRelease        // Not defined until X11R5
222 #define NO_XIM
223 #elif XlibSpecificationRelease < 6      // Need at least Xlib X11R6
224 #define NO_XIM
225 #endif
226 #endif
227 
228 #ifndef NO_XIM
229 extern "C" Bool XRegisterIMInstantiateCallback(Display*,struct _XrmHashBucketRec*,char*,char*,XIMProc,XPointer);
230 extern "C" Bool XUnregisterIMInstantiateCallback(Display*,struct _XrmHashBucketRec*,char*,char*,XIMProc,XPointer);
231 extern "C" char *XSetIMValues(XIM,...);
232 #endif
233 
234 #endif
235 
236 
237 
238 
239 // OpenGL includes
240 #ifdef HAVE_GL_H
241 #ifndef SUN_OGL_NO_VERTEX_MACROS
242 #define SUN_OGL_NO_VERTEX_MACROS
243 #endif
244 #ifndef HPOGL_SUPPRESS_FAST_API
245 #define HPOGL_SUPPRESS_FAST_API
246 #endif
247 #include <GL/gl.h>
248 #ifndef WIN32
249 #include <GL/glx.h>
250 #endif
251 #endif
252 #ifndef GLAPIENTRY
253 #define GLAPIENTRY
254 #endif
255 #ifndef GLAPI
256 #define GLAPI
257 #endif
258 #ifdef HAVE_GLU_H
259 #include <GL/glu.h>
260 #endif
261 
262 // Maximum path length
263 #ifndef MAXPATHLEN
264 #if defined(PATH_MAX)
265 #define MAXPATHLEN   PATH_MAX
266 #elif defined(_MAX_PATH)
267 #define MAXPATHLEN   _MAX_PATH
268 #elif defined(MAX_PATH)
269 #define MAXPATHLEN   MAX_PATH
270 #else
271 #define MAXPATHLEN   1024
272 #endif
273 #endif
274 
275 // Modes for access(filename,mode) on Windows
276 #ifdef WIN32
277 #ifndef R_OK
278 #define R_OK 4
279 #endif
280 #ifndef W_OK
281 #define W_OK 2
282 #endif
283 #ifndef X_OK
284 #define X_OK 1
285 #endif
286 #ifndef F_OK
287 #define F_OK 0
288 #endif
289 #endif
290 
291 // File open modes on Windows
292 #ifdef WIN32
293 #if defined(_MSC_VER)
294 #define O_APPEND _O_APPEND
295 #define O_CREAT  _O_CREAT
296 #define O_EXCL   _O_EXCL
297 #define O_RDONLY _O_RDONLY
298 #define O_RDWR   _O_RDWR
299 #define O_TRUNC  _O_TRUNC
300 #define O_WRONLY _O_WRONLY
301 #define O_BINARY _O_BINARY
302 #endif
303 #endif
304 
305 // Some systems don't have it
306 #ifndef SEEK_SET
307 #define SEEK_SET 0
308 #endif
309 #ifndef SEEK_CUR
310 #define SEEK_CUR 1
311 #endif
312 #ifndef SEEK_END
313 #define SEEK_END 2
314 #endif
315 
316 // Printer stuff
317 #ifdef WIN32
318 #include <winspool.h>
319 #endif
320 
321 
322 // Wheel support (OS >= W98, OS>=NT4.0)
323 #ifdef WIN32
324 
325 // Missing wheel message id's
326 #ifndef SPI_GETWHEELSCROLLLINES
327 #define SPI_GETWHEELSCROLLLINES   104
328 #endif
329 #ifndef WM_MOUSEWHEEL
330 #define WM_MOUSEWHEEL             0x020A
331 #endif
332 
333 // GetSystemMetrics parameters missing in header files
334 #ifndef SM_XVIRTUALSCREEN
335 #define SM_XVIRTUALSCREEN       76
336 #endif
337 #ifndef SM_YVIRTUALSCREEN
338 #define SM_YVIRTUALSCREEN       77
339 #endif
340 #ifndef SM_CXVIRTUALSCREEN
341 #define SM_CXVIRTUALSCREEN      78
342 #endif
343 #ifndef SM_CYVIRTUALSCREEN
344 #define SM_CYVIRTUALSCREEN      79
345 #endif
346 #ifndef SM_CMONITORS
347 #define SM_CMONITORS            80
348 #endif
349 #ifndef SM_SAMEDISPLAYFORMAT
350 #define SM_SAMEDISPLAYFORMAT    81
351 #endif
352 
353 // Missing in CYGWIN
354 #ifndef IMAGE_SUBSYSTEM_NATIVE_WINDOWS
355 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
356 #endif
357 #ifndef IMAGE_SUBSYSTEM_WINDOWS_CE_GUI
358 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
359 #endif
360 #endif
361 
362 
363 // IBM VisualAge for C++ 3.5
364 #if defined(__IBMCPP__) && defined(WIN32)
365 #include <direct.h>
366 #include <io.h>         // for _access()
367 #define _mkdir(x) mkdir((char *)(x))
368 #define _vsnprintf(a, b, c, d) vsprintf(a, c, d)
369 #define ICON_SMALL      0
370 #define ICON_BIG        1
371 #define bool            int
372 
373 // This declarations come from Microsoft SDK
374 #define TME_HOVER       0x00000001
375 #define TME_LEAVE       0x00000002
376 #define TME_QUERY       0x40000000
377 #define TME_CANCEL      0x80000000
378 #define HOVER_DEFAULT   0xFFFFFFFF
379 #define WM_MOUSEHOVER   0x02A1
380 #define WM_MOUSELEAVE   0x02A3
381 
382 typedef struct tagTRACKMOUSEEVENT {
383     DWORD cbSize;
384     DWORD dwFlags;
385     HWND  hwndTrack;
386     DWORD dwHoverTime;
387 } TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
388 
389 WINUSERAPI
390 BOOL
391 WINAPI
392 TrackMouseEvent(
393     IN OUT LPTRACKMOUSEEVENT lpEventTrack);
394 
395 #ifdef __GL_H__
396 #define GL_COLOR_LOGIC_OP                 0x0BF2
397 #define GL_POLYGON_OFFSET_POINT           0x2A01
398 #define GL_POLYGON_OFFSET_LINE            0x2A02
399 WINGDIAPI void APIENTRY glPolygonOffset (GLfloat factor,GLfloat units);
400 #endif
401 
402 #endif
403 
404 #endif
405