40
46
// Platform independent include for glew: This is a catch-all
41
47
// for all OpenGL definitions and functions, currently up to
49
#if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
43
50
#include "../Screen/glew.h"
45
53
//platform dependent includes stage 1
46
54
#if PSYCH_SYSTEM == PSYCH_LINUX
47
// We need __USE_UNIX98, so pthread.h defines/supports the mutex policy
48
// attribute for mutex priority inheritance for our realtime threads.
49
// For some reason this gets undefined in mex.h at least when building
50
// on Octave 3.2.4. Scary scary...
53
// For testing only: #warning __USE_UNIX98 undefined. Redefining it.
57
// This is the new glew include for GLX extension support:
58
#include "../Screen/glxew.h"
61
#include <X11/keysym.h>
67
#ifndef _POSIX_THREAD_PRIO_INHERIT
68
#error This build system does not support pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); Fix your build system!
55
// We need __USE_UNIX98, so pthread.h defines/supports the mutex policy
56
// attribute for mutex priority inheritance for our realtime threads.
57
// For some reason this gets undefined in mex.h at least when building
58
// on Octave 3.2.4. Scary scary...
61
// For testing only: #warning __USE_UNIX98 undefined. Redefining it.
64
// This is the new glew include for GLX extension support:
65
#if defined(PTBMODULE_Screen)
66
#include "../Screen/glxew.h"
70
#include <X11/keysym.h>
76
#ifndef _POSIX_THREAD_PRIO_INHERIT
77
#error This build system does not support pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); Fix your build system!
72
81
#if PSYCH_SYSTEM == PSYCH_WINDOWS
73
// Need to define #define _WIN32_WINNT as 0x0400 so we can use TryEnterCriticalSection() call for PsychTryLockMutex() implementation.
82
// Need to define #define _WIN32_WINNT as >= 0x0400 so we can use TryEnterCriticalSection() call for PsychTryLockMutex() implementation.
74
83
// We set WINVER and _WIN32_WINNT to 0x0500, which requires Windows 2000 or later as target system:
75
#define _WIN32_WINNT 0x0500
78
#include "../Screen/wglew.h"
81
#define INT64_MAX _I64_MAX
85
#define INT32_MAX _I32_MAX
88
#elif PSYCH_SYSTEM == PSYCH_OS9
84
// Ok, actually we don't. When building on a modern build system like the new Win-7 build
85
// system -- or pretty much against any SDK since WindowsXP -- the MSVC compiler / platform SDK
86
// already defines WINVER et al. to 0x0500 or later, e.g., to Win-7 on the Win-7 system.
87
// That means we'd only need these defines on pre-WinXP build systems, which we no longer
88
// support. We now just have to be careful to not use post-WinXP functionality.
89
// We comment these defines out and trust the platform SDK / compiler,
90
// but leave them here for quick WinXP backwards compatibility testing.
92
#define _WIN32_WINNT 0x0500
94
#endif // Conditional enable.
96
// Master include for windows header file:
99
// For building Screen, include wglew.h - Windows specific GLEW header files:
100
#if defined(PTBMODULE_Screen)
101
#include "../Screen/wglew.h"
97
104
#elif PSYCH_SYSTEM == PSYCH_OSX
98
105
//includes for Apple OpenGL
100
106
#include <sys/time.h>
101
107
#include <pthread.h>
103
// If we are included from PsychScriptingGlue.cc, which
104
// is indicated by PTBINSCRIPTINGGLUE, then we must only
105
// include MacTypes.h, not the rest of Carbon, ApplicationServices
106
// et al. -> Some of the Octave header files conflict with Apple
107
// system header files --> do not include the Apple headers when
108
// building Scriptingglue - they are not needed but would prevent
110
#ifndef PTBINSCRIPTINGGLUE
111
// File included during compile of some PTB file other than ScriptingGlue...
112
#include <Carbon/Carbon.h>
113
#include <CoreServices/CoreServices.h>
114
#include <ApplicationServices/ApplicationServices.h>
115
#include <CoreAudio/HostTime.h>
117
// File included from ScriptingGlue - only import minimal amount of headers...
118
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
109
// If we are included from PsychScriptingGlue.cc, which
110
// is indicated by PTBINSCRIPTINGGLUE, then we must only
111
// include MacTypes.h, not the rest of Carbon, ApplicationServices
112
// et al. -> Some of the Octave header files conflict with Apple
113
// system header files --> do not include the Apple headers when
114
// building Scriptingglue - they are not needed but would prevent
116
#ifndef PTBINSCRIPTINGGLUE
117
// File included during compile of some PTB file other than ScriptingGlue...
118
#include <Carbon/Carbon.h>
119
#include <CoreServices/CoreServices.h>
120
#include <ApplicationServices/ApplicationServices.h>
121
#include <CoreAudio/HostTime.h>
122
#include <CoreVideo/CoreVideo.h>
124
// File included from ScriptingGlue - only import minimal amount of headers...
125
// MK TODO FIXME! OCTAVE!
126
#include <CoreServices/CoreServices.h>
127
// Does not work: #include <CarbonCore.framework/MacTypes.h>
128
// Used to work on Tiger/32-Bit, but does not work now: #include <CoreServices/Frameworks/CarbonCore.framework/Headers/MacTypes.h>
121
#include <OpenGL/OpenGL.h>
122
//#include <OpenGL/gl.h>
123
//#include <OpenGL/glext.h>
124
//#include <OpenGL/glu.h>
131
#if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
132
#include <OpenGL/OpenGL.h>
127
//C standard library headers
136
// C standard library headers:
138
// We can't include stdint.h on Windows if we build against the
139
// MSCRT Windows common C Runtime instead of the MSVC 2010 runtime:
140
#if PSYCH_SYSTEM != PSYCH_WINDOWS
143
// Add defines which would be part of stdint.h on Windows:
145
#define INT64_MAX 0x7fffffffffffffff
148
#define INT32_MAX 0x7fffffff
128
152
#include <math.h>
129
153
#include <stdio.h>
130
154
#include <limits.h>
131
155
#include <string.h>
132
156
#include <float.h>
134
#if PSYCH_LANGUAGE == PSYCH_OCTAVE
135
// File with pseudo MATLAB interface API definitions:
136
// Emulates missing Matlab functions and structures...
137
// Stored in the Source/Octave subfolder...
138
#include <octavemex.h>
141
//SDL_getenv.h includes a macro which redefines getenv() to be
142
//SDL getenv(). This then conflicts with the statement "using
143
//std::getenv" within stdlib.h. To avoid the conflict, include
144
//SDL.h only after the standard includes above.
145
//platform dependent includes stage 2
146
#if PSYCH_SYSTEM == PSYCH_WINDOWS
148
#elif PSYCH_SYSTEM == PSYCH_OS9
152
158
//end include once