File: PsychIncludes.h

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (159 lines) | stat: -rwxr-xr-x 5,404 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
  Psychtoolbox3/Source/Common/PsychIncludes.h

  AUTHORS:

  Allen.Ingling@nyu.edu         awi
  mario.kleiner.de@gmail.com    mk

  PLATFORMS: All

  PROJECTS: All

  HISTORY:
  07/16/02  awi         Pulled out of PsychPlatform.h
  11/15/02  awi         Added includes for OSX.

  DESCRIPTION:

  PsychIncludes.h includes all C, system, and language binding
  header files which a Psychtoolbox library
  would require.

  This file should ONLY be included by PsychConstants.h

*/

#ifndef PSYCH_IS_INCLUDED_PsychIncludes
#define PSYCH_IS_INCLUDED_PsychIncludes

#include "PsychPlatform.h"

// This is needed for compiling with gcc 4.6+ if -std=gnu99
// is set, which we need to set for OML_sync_control support
// and other features. Fixes compile failure on Ubuntu 12.10:
#if defined(__STDC_UTF_16__) && !defined(CHAR16_T)
typedef __CHAR16_TYPE__ char16_t;
#endif

// Includes dependent on runtime environment:
#if PSYCH_LANGUAGE == PSYCH_MATLAB
    // Include File with Matlab interface API definitions:
    #include "mex.h"
#endif

// Platform independent include for glew: This is a catch-all
// for all OpenGL definitions and functions, currently up to
// OpenGL 4.5 + latest extensions beyond that:
#if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
#include "../Screen/GL/glew.h"
#endif

//platform dependent includes stage 1
#if PSYCH_SYSTEM == PSYCH_LINUX
    // We need __USE_UNIX98, so pthread.h defines/supports the mutex policy
    // attribute for mutex priority inheritance for our realtime threads.
    // For some reason this gets undefined in mex.h at least when building
    // on Octave 3.2.4. Scary scary...
    #ifndef __USE_UNIX98
    #define __USE_UNIX98
    // For testing only: #warning __USE_UNIX98 undefined. Redefining it.
    #endif

    // This is the new glew include for GLX extension support:
#if defined(PTBMODULE_Screen)
    #include "../Screen/GL/glxew.h"
#endif

    #include <X11/Xlib.h>
    #include <X11/keysym.h>
    #include <sys/time.h>
    #include <unistd.h>
    #include <stdarg.h>
    #include <pthread.h>

    #ifndef _POSIX_THREAD_PRIO_INHERIT
    #error This build system does not support pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); Fix your build system!
    #endif
#endif

#if PSYCH_SYSTEM == PSYCH_WINDOWS
	// Need to define #define _WIN32_WINNT as >= 0x0400 so we can use TryEnterCriticalSection() call for PsychTryLockMutex() implementation.
    // We set WINVER and _WIN32_WINNT to 0x0500, which requires Windows 2000 or later as target system:
    // Ok, actually we don't. When building on a modern build system like the new Win-7 build
    // system -- or pretty much against any SDK since WindowsXP -- the MSVC compiler / platform SDK
    // already defines WINVER et al. to 0x0500 or later, e.g., to Win-7 on the Win-7 system.
    // That means we'd only need these defines on pre-WinXP build systems, which we no longer
    // support. We now just have to be careful to not use post-WinXP functionality.
    // We comment these defines out and trust the platform SDK / compiler,
    // but leave them here for quick WinXP backwards compatibility testing.
    #if 0
        #define _WIN32_WINNT 0x0500
        #define WINVER       0x0500
    #endif // Conditional enable.

    // Master include for windows header file:
    #include <windows.h>

    // For building Screen, include wglew.h - Windows specific GLEW header files:
    #if defined(PTBMODULE_Screen)
    #include "../Screen/GL/wglew.h"
    #endif

#elif PSYCH_SYSTEM == PSYCH_OSX
	//includes for Apple OpenGL
    #include <sys/time.h>
	#include <pthread.h>

    // If we are included from PsychScriptingGlue.cc, which
    // is indicated by PTBINSCRIPTINGGLUE, then we must only
    // include MacTypes.h, not the rest of Carbon, ApplicationServices
    // et al. -> Some of the Octave header files conflict with Apple
    // system header files --> do not include the Apple headers when
    // building Scriptingglue - they are not needed but would prevent
    // the build.
    #ifndef PTBINSCRIPTINGGLUE
    // File included during compile of some PTB file other than ScriptingGlue...
    #include <Carbon/Carbon.h>
    #include <CoreServices/CoreServices.h>
    #include <ApplicationServices/ApplicationServices.h>
    #include <CoreAudio/HostTime.h>
    #include <CoreVideo/CoreVideo.h>
    #else
    // File included from ScriptingGlue - only import minimal amount of headers...
    // MK TODO FIXME! OCTAVE!
    #include <CoreServices/CoreServices.h>
    // Does not work: #include <CarbonCore.framework/MacTypes.h>
    // Used to work on Tiger/32-Bit, but does not work now: #include <CoreServices/Frameworks/CarbonCore.framework/Headers/MacTypes.h>
    #endif

    #if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
    #include <OpenGL/OpenGL.h>
    #include <CoreText/CoreText.h>
    #endif
#endif

// C standard library headers:

// We can't include stdint.h on Windows if we build against the
// MSCRT Windows common C Runtime instead of the MSVC 2010 runtime:
#if PSYCH_SYSTEM != PSYCH_WINDOWS
#include <stdint.h>
#else
// Add defines which would be part of stdint.h on Windows:
#ifndef INT64_MAX
#define INT64_MAX	0x7fffffffffffffff
#endif
#ifndef INT32_MAX
#define INT32_MAX	0x7fffffff
#endif
#endif

#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <float.h>

//end include once
#endif