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

Copyright © 1997-2005 Jeroen van der Zijp