Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

xincs.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *              F O X   P r i v a t e   I n c l u d e   F i l e s                *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: xincs.h,v 1.87 2009/01/06 13:07:30 fox Exp $                             *
00022 ********************************************************************************/
00023 #ifndef XINCS_H
00024 #define XINCS_H
00025 
00026 
00027 ////////////////////  DO NOT INCLUDE THIS PRIVATE HEADER FILE  //////////////////
00028 
00029 // Thread safe
00030 #ifndef _POSIX_PTHREAD_SEMANTICS
00031 #define _POSIX_PTHREAD_SEMANTICS
00032 #endif
00033 
00034 // GNU extras if we can get them
00035 #ifndef _GNU_SOURCE
00036 #define _GNU_SOURCE
00037 #endif
00038 
00039 // Use 64-bit files
00040 #ifndef WIN32
00041 #ifndef _FILE_OFFSET_BITS
00042 #define _FILE_OFFSET_BITS 64
00043 #endif
00044 #endif
00045 
00046 // Basic includes
00047 #include <stdio.h>
00048 #include <stdlib.h>
00049 #include <stdarg.h>
00050 #include <limits.h>
00051 #include <math.h>
00052 #include <float.h>
00053 #include <string.h>
00054 #include <errno.h>
00055 #include <signal.h>
00056 #include <time.h>
00057 #include <locale.h>
00058 #include <fcntl.h>
00059 #include <sys/types.h>
00060 #include <sys/stat.h>
00061 
00062 #ifndef WIN32
00063 
00064 #include <grp.h>
00065 #include <pwd.h>
00066 #include <sys/ioctl.h>
00067 #ifdef HAVE_SYS_FILIO_H         // Get FIONREAD on Solaris
00068 #include <sys/filio.h>
00069 #endif
00070 
00071 #else
00072 
00073 #include <io.h>                 // For _access()
00074 #if defined(_MSC_VER) || defined(__WATCOMC__)   // Microsoft Visual C++ or Watcom C++
00075 #include <direct.h>
00076 #define stat _stat
00077 #define lstat _stat
00078 #define getcwd _getcwd
00079 #define mkdir _mkdir
00080 #define access _access
00081 #define execl _execl
00082 #define execlp _execlp
00083 #define execle _execle
00084 #define execv _execv
00085 #define execve _execve
00086 #define execvp _execvp
00087 #define strdup _strdup
00088 #define alloca _alloca
00089 #endif
00090 #ifdef __BORLANDC__         // Borland C++ Builder
00091 #include <dir.h>
00092 #define lstat stat
00093 #endif
00094 #ifdef __MINGW32__              // GCC MingW32
00095 #include <direct.h>
00096 #endif
00097 #ifdef __SC__                   // Digital Mars C++ Compiler
00098 #include <direct.h>
00099 #include <io.h>                 // For _access()
00100 #endif
00101 
00102 #ifndef WM_INPUT
00103 #define WM_INPUT  0x00FF
00104 #endif
00105 
00106 #endif
00107 
00108 #ifdef HAVE_UNISTD_H
00109 #include <unistd.h>
00110 #endif
00111 #ifdef HAVE_SYS_WAIT_H
00112 #include <sys/wait.h>
00113 #endif
00114 #ifdef TIME_WITH_SYS_TIME
00115 #include <sys/time.h>
00116 #include <time.h>
00117 #else
00118 #ifdef HAVE_SYS_TIME_H
00119 #include <sys/time.h>
00120 #else
00121 #include <time.h>
00122 #endif
00123 #endif
00124 #ifdef HAVE_SYS_PARAM_H
00125 #include <sys/param.h>
00126 #endif
00127 #ifdef HAVE_SYS_SELECT_H
00128 #if (!defined(__MINGW32__)) && (!defined(hpux))
00129 #include <sys/select.h>
00130 #endif
00131 #endif
00132 #ifdef HAVE_DIRENT_H
00133 #include <dirent.h>
00134 #define NAMLEN(dirent) strlen((dirent)->d_name)
00135 #else
00136 #define dirent direct
00137 #define NAMLEN(dirent) (dirent)->d_namlen
00138 #ifdef HAVE_SYS_NDIR_H
00139 #include <sys/ndir.h>
00140 #endif
00141 #ifdef HAVE_SYS_DIR_H
00142 #include <sys/dir.h>
00143 #endif
00144 #ifdef HAVE_NDIR_H
00145 #include <ndir.h>
00146 #endif
00147 #endif
00148 #ifdef HAVE_XSHM_H
00149 #include <sys/ipc.h>
00150 #include <sys/shm.h>
00151 #endif
00152 #ifdef HAVE_MMAP
00153 #include <sys/mman.h>
00154 #endif
00155 
00156 
00157 // For thread-safe readdir_r, we sometimes need extra
00158 // space above and beyond the space for dirent itself
00159 #ifdef HAVE_DIRENT_H
00160 #ifndef WIN32
00161 struct fxdirent : public dirent {
00162   char buffer[256];
00163   };
00164 #endif
00165 #endif
00166 
00167 
00168 // MS-Windows
00169 #ifdef WIN32
00170 #ifndef STRICT
00171 #define STRICT
00172 #endif
00173 #ifndef WIN32_LEAN_AND_MEAN
00174 #define WIN32_LEAN_AND_MEAN
00175 #endif
00176 #if _WIN32_WINNT < 0x0400
00177 #define _WIN32_WINNT 0x0400
00178 #endif
00179 #include <windows.h>
00180 #ifndef __CYGWIN__
00181 #include <winsock2.h>
00182 #endif
00183 #include <commctrl.h>           // For _TrackMouseEvent
00184 #include <shellapi.h>
00185 #include <imm.h>                // IME
00186 
00187 // X windows includes
00188 #else
00189 
00190 #include <X11/X.h>
00191 #define XRegisterIMInstantiateCallback broken_XRegisterIMInstantiateCallback
00192 #define XUnregisterIMInstantiateCallback broken_XUnregisterIMInstantiateCallback
00193 #define XSetIMValues broken_XSetIMValues
00194 #include <X11/Xlib.h>
00195 #undef XRegisterIMInstantiateCallback
00196 #undef XUnregisterIMInstantiateCallback
00197 #undef XSetIMValues
00198 #include <X11/Xcms.h>
00199 #include <X11/Xutil.h>
00200 #include <X11/Xresource.h>
00201 #include <X11/Xatom.h>
00202 #include <X11/cursorfont.h>
00203 #ifdef HUMMINGBIRD
00204 #include <X11/XlibXtra.h>
00205 #endif
00206 #ifdef HAVE_XSHM_H
00207 #include <X11/extensions/XShm.h>
00208 #endif
00209 #ifdef HAVE_XCURSOR_H
00210 #include <X11/Xcursor/Xcursor.h>
00211 #endif
00212 #ifdef HAVE_XFT_H
00213 #include <X11/Xft/Xft.h>
00214 #endif
00215 #ifdef HAVE_XSHAPE_H
00216 #include <X11/extensions/shape.h>
00217 #endif
00218 #ifdef HAVE_XRANDR_H
00219 #include <X11/extensions/Xrandr.h>
00220 #endif
00221 #ifdef HAVE_XFIXES_H
00222 #include <X11/extensions/Xfixes.h>
00223 #endif
00224 #ifdef HAVE_XRENDER_H
00225 #include <X11/extensions/Xrender.h>
00226 #endif
00227 #ifdef HAVE_XINPUT_H
00228 #include <X11/extensions/XI.h>
00229 #include <X11/extensions/XInput.h>
00230 #endif
00231 
00232 #ifndef NO_XIM
00233 #ifndef XlibSpecificationRelease        // Not defined until X11R5
00234 #define NO_XIM
00235 #elif XlibSpecificationRelease < 6      // Need at least Xlib X11R6
00236 #define NO_XIM
00237 #endif
00238 #endif
00239 
00240 #ifndef NO_XIM
00241 extern "C" Bool XRegisterIMInstantiateCallback(Display*,struct _XrmHashBucketRec*,char*,char*,XIMProc,XPointer);
00242 extern "C" Bool XUnregisterIMInstantiateCallback(Display*,struct _XrmHashBucketRec*,char*,char*,XIMProc,XPointer);
00243 extern "C" char *XSetIMValues(XIM,...);
00244 #endif
00245 
00246 #endif
00247 
00248 
00249 // OpenGL includes
00250 #ifdef HAVE_GL_H
00251 #ifndef SUN_OGL_NO_VERTEX_MACROS
00252 #define SUN_OGL_NO_VERTEX_MACROS
00253 #endif
00254 #ifndef HPOGL_SUPPRESS_FAST_API
00255 #define HPOGL_SUPPRESS_FAST_API
00256 #endif
00257 #include <GL/gl.h>
00258 #ifndef WIN32
00259 #include <GL/glx.h>
00260 #endif
00261 #endif
00262 #ifndef GLAPIENTRY
00263 #define GLAPIENTRY
00264 #endif
00265 #ifndef GLAPI
00266 #define GLAPI
00267 #endif
00268 #ifdef HAVE_GLU_H
00269 #include <GL/glu.h>
00270 #endif
00271 
00272 //#undef GLX_VERSION_1_3
00273 
00274 // Maximum path length
00275 #ifndef MAXPATHLEN
00276 #if defined(PATH_MAX)
00277 #define MAXPATHLEN   PATH_MAX
00278 #elif defined(_MAX_PATH)
00279 #define MAXPATHLEN   _MAX_PATH
00280 #elif defined(MAX_PATH)
00281 #define MAXPATHLEN   MAX_PATH
00282 #else
00283 #define MAXPATHLEN   1024
00284 #endif
00285 #endif
00286 
00287 // Modes for access(filename,mode) on Windows
00288 #ifdef WIN32
00289 #ifndef R_OK
00290 #define R_OK 4
00291 #endif
00292 #ifndef W_OK
00293 #define W_OK 2
00294 #endif
00295 #ifndef X_OK
00296 #define X_OK 1
00297 #endif
00298 #ifndef F_OK
00299 #define F_OK 0
00300 #endif
00301 #endif
00302 
00303 // File open modes on Windows
00304 #ifdef WIN32
00305 #if defined(_MSC_VER)
00306 #define O_APPEND _O_APPEND
00307 #define O_CREAT  _O_CREAT
00308 #define O_EXCL   _O_EXCL
00309 #define O_RDONLY _O_RDONLY
00310 #define O_RDWR   _O_RDWR
00311 #define O_TRUNC  _O_TRUNC
00312 #define O_WRONLY _O_WRONLY
00313 #define O_BINARY _O_BINARY
00314 #endif
00315 #endif
00316 
00317 // Some systems don't have it
00318 #ifndef SEEK_SET
00319 #define SEEK_SET 0
00320 #endif
00321 #ifndef SEEK_CUR
00322 #define SEEK_CUR 1
00323 #endif
00324 #ifndef SEEK_END
00325 #define SEEK_END 2
00326 #endif
00327 
00328 // Printer stuff
00329 #ifdef WIN32
00330 #include <winspool.h>
00331 #endif
00332 
00333 
00334 // Wheel support (OS >= W98, OS>=NT4.0)
00335 #ifdef WIN32
00336 
00337 // Missing wheel message id's
00338 #ifndef SPI_GETWHEELSCROLLLINES
00339 #define SPI_GETWHEELSCROLLLINES   104
00340 #endif
00341 #ifndef WM_MOUSEWHEEL
00342 #define WM_MOUSEWHEEL             0x020A
00343 #endif
00344 
00345 // GetSystemMetrics parameters missing in header files
00346 #ifndef SM_XVIRTUALSCREEN
00347 #define SM_XVIRTUALSCREEN       76
00348 #endif
00349 #ifndef SM_YVIRTUALSCREEN
00350 #define SM_YVIRTUALSCREEN       77
00351 #endif
00352 #ifndef SM_CXVIRTUALSCREEN
00353 #define SM_CXVIRTUALSCREEN      78
00354 #endif
00355 #ifndef SM_CYVIRTUALSCREEN
00356 #define SM_CYVIRTUALSCREEN      79
00357 #endif
00358 #ifndef SM_CMONITORS
00359 #define SM_CMONITORS            80
00360 #endif
00361 #ifndef SM_SAMEDISPLAYFORMAT
00362 #define SM_SAMEDISPLAYFORMAT    81
00363 #endif
00364 
00365 // Missing in CYGWIN
00366 #ifndef IMAGE_SUBSYSTEM_NATIVE_WINDOWS
00367 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
00368 #endif
00369 #ifndef IMAGE_SUBSYSTEM_WINDOWS_CE_GUI
00370 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
00371 #endif
00372 #endif
00373 
00374 
00375 // IBM VisualAge for C++
00376 #if defined(__IBMCPP__) && defined(WIN32)
00377 #include <direct.h>
00378 #include <io.h>         // for _access()
00379 #define _mkdir(x) mkdir((char *)(x))
00380 #define _vsnprintf(a, b, c, d) vsprintf(a, c, d)
00381 #define ICON_SMALL      0
00382 #define ICON_BIG        1
00383 
00384 // This declarations come from Microsoft SDK
00385 #define TME_HOVER       0x00000001
00386 #define TME_LEAVE       0x00000002
00387 #define TME_QUERY       0x40000000
00388 #define TME_CANCEL      0x80000000
00389 #define HOVER_DEFAULT   0xFFFFFFFF
00390 #define WM_MOUSEHOVER   0x02A1
00391 #define WM_MOUSELEAVE   0x02A3
00392 
00393 typedef struct tagTRACKMOUSEEVENT {
00394   DWORD cbSize;
00395   DWORD dwFlags;
00396   HWND  hwndTrack;
00397   DWORD dwHoverTime;
00398   } TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
00399 
00400 WINUSERAPI BOOL WINAPI TrackMouseEvent(IN OUT LPTRACKMOUSEEVENT lpEventTrack);
00401 
00402 #ifdef __GL_H__
00403 #define GL_COLOR_LOGIC_OP                 0x0BF2
00404 #define GL_POLYGON_OFFSET_POINT           0x2A01
00405 #define GL_POLYGON_OFFSET_LINE            0x2A02
00406 WINGDIAPI void APIENTRY glPolygonOffset(GLfloat factor,GLfloat units);
00407 #endif
00408 
00409 #endif
00410 
00411 #endif

Copyright © 1997-2009 Jeroen van der Zijp