/******************************************************************************** * * * F O X P r i v a t e I n c l u d e F i l e s * * * ********************************************************************************* * Copyright (C) 1997,2024 by Jeroen van der Zijp. All Rights Reserved. * ********************************************************************************* * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see * ********************************************************************************/ #ifndef XINCS_H #define XINCS_H //////////////////// DO NOT INCLUDE THIS PRIVATE HEADER FILE ////////////////// // Thread safe #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS #endif // GNU extras if we can get them #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // Use 64-bit files #ifndef WIN32 #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #endif #endif // Basic includes #include #include #include #include #include #include #include #include #include #include #include #include #include // Platform includes #if defined(WIN32) /////////////// Windows ///////////////////////////////////// // Windows 2000 is minimum now #if _WIN32_WINNT < 0x0500 #define _WIN32_WINNT 0x0500 #endif // Enforce handle types #ifndef STRICT #define STRICT 1 #endif // Skip some stuff #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #if (_MSC_VER >= 1500) #pragma warning(disable: 4251) #endif // Common headers #include // Core Windows stuff #include // Printer stuff #include #ifndef __CYGWIN__ #include #endif #include "winnt.h" #include // For _TrackMouseEvent #include #include // IME #ifdef UNICODE #include // Wide character support #endif #ifndef PROCESS_SUSPEND_RESUME #define PROCESS_SUSPEND_RESUME 0x0800 #endif #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif #if (_MSC_VER >= 1400) // VC++ 2005 or newer #include #endif // OpenGL includes #ifdef HAVE_GL_H #include #endif //#ifdef WIN32 //#include //#endif #ifndef GLAPIENTRY #define GLAPIENTRY #endif #ifndef GLAPI #define GLAPI #endif #ifndef GL_BGRA #define GL_BGRA GL_BGRA_EXT #endif //#ifdef HAVE_GLU_H //#include //#endif #else ////////////////////////////// Unix /////////////////////////////////////// // Common headers #include #include #include #ifdef HAVE_SYS_STATVFS_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_UNISTD_H #include #include #endif #ifdef HAVE_SYS_FILIO_H // Get FIONREAD on Solaris #include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_DIRENT_H #include #define NAMLEN(dirent) strlen((dirent)->d_name) #else #define dirent direct #define NAMLEN(dirent) (dirent)->d_namlen #ifdef HAVE_SYS_NDIR_H #include #endif #ifdef HAVE_SYS_DIR_H #include #endif #ifdef HAVE_NDIR_H #include #endif #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_SYS_EPOLL_H #include #endif #ifdef HAVE_SYS_TIMERFD_H #include #endif #ifdef HAVE_SYS_RESOURCE_H #include #endif #ifdef HAVE_SYS_IPC_H #include #endif #ifdef HAVE_SYS_SHM_H #include #endif #ifdef HAVE_SYS_MMAN_H #include #endif #ifdef HAVE_SYS_PSTAT_H #include #endif #ifdef HAVE_SYS_INOTIFY_H #include #endif #ifdef HAVE_SYS_UTSNAME_H #include #endif #ifdef HAVE_SYS_SYSCTL_H #if !defined(__linux__) #include #endif #endif #if defined(__APPLE__) #include #endif #include #ifdef HAVE_SEMAPHORE_H #include #endif #if defined(HAVE_PTHREAD_SETAFFINITY_NP) #if defined(__FreeBSD__) #include #if __FreeBSD_version >= 702000 #include #include typedef cpuset_t cpu_set_t; #endif #endif #endif #if defined(__minix) // MINIX #ifdef sleep #undef sleep // We mean sleep not __pthread_sleep #endif #ifdef read #undef read // We mean read not __pthread_read #endif #ifdef write #undef write // We mean write not __pthread_write #endif #ifdef select #undef select // We mean select not __pthread_select #endif #endif // Dynamic library loading #ifdef HAVE_SHL_LOAD #include // HP-UX #ifndef DYNAMIC_PATH #define DYNAMIC_PATH 0 #endif #ifndef BIND_RESTRICTED #define BIND_RESTRICTED 0 #endif #else #ifdef HAVE_DLFCN_H #include // POSIX #endif #endif #ifndef RTLD_GLOBAL #define RTLD_GLOBAL 0 // Does not exist on DEC #endif #ifndef RTLD_NOLOAD // Older GLIBC libraries #define RTLD_NOLOAD 0 #endif #ifndef RTLD_NOW // for OpenBSD #define RTLD_NOW DL_LAZY #endif // SSE Intrinsics only if available and turned on #if ((defined(__GNUC__) || defined(__INTEL_COMPILER)) && (defined(__i386__) || defined(__x86_64__))) #if defined(HAVE_IMMINTRIN_H) #include #if defined(__SSE__) #define FOX_HAS_SSE #endif #if defined(__SSE2__) #define FOX_HAS_SSE2 #endif #if defined(__SSE3__) #define FOX_HAS_SSE3 #endif #if defined(__SSSE3__) #define FOX_HAS_SSSE3 #endif #if defined(__SSE4_1__) && defined(__SSE4_2__) #define FOX_HAS_SSE4 #endif #if defined(__AVX__) #define FOX_HAS_AVX #endif #if defined(__AVX2__) #define FOX_HAS_AVX2 #endif #if defined(__FMA__) #define FOX_HAS_FMA #endif #if defined(__F16C__) #define FOX_HAS_F16 #endif #endif #endif // X11 includes #include #include #include #include #include #include #include #ifdef HAVE_XSHM_H #include #endif #ifdef HAVE_XCURSOR_H #include #endif #ifdef HAVE_XFT_H #include #endif #ifdef HAVE_XSHAPE_H #include #endif #ifdef HAVE_XRANDR_H #include #endif #ifdef HAVE_XFIXES_H #include #endif #ifdef HAVE_XRENDER_H #include #endif #ifdef HAVE_XINPUT2_H #include #endif #ifndef NO_XIM #ifndef XlibSpecificationRelease // Not defined until X11R5 #define NO_XIM #elif XlibSpecificationRelease < 6 // Need at least Xlib X11R6 #define NO_XIM #endif #endif // OpenGL includes #ifdef HAVE_GL_H #ifndef SUN_OGL_NO_VERTEX_MACROS #define SUN_OGL_NO_VERTEX_MACROS #endif #ifndef HPOGL_SUPPRESS_FAST_API #define HPOGL_SUPPRESS_FAST_API #endif #include #ifdef HAVE_GLX_H #include #endif #endif //#ifdef HAVE_GLU_H //#include //#endif #endif ////////////////////////////////////////////////////////////////////////// // Maximum path length #ifndef MAXPATHLEN #if defined(PATH_MAX) #define MAXPATHLEN PATH_MAX #elif defined(_MAX_PATH) #define MAXPATHLEN _MAX_PATH #elif defined(MAX_PATH) #define MAXPATHLEN MAX_PATH #else #define MAXPATHLEN 4096 #endif #endif // Maximum host name length #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif // Some systems don't have it #ifndef SEEK_SET #define SEEK_SET 0 #endif #ifndef SEEK_CUR #define SEEK_CUR 1 #endif #ifndef SEEK_END #define SEEK_END 2 #endif // Remove crap #ifdef VOID #undef VOID #endif #endif