|
1 /* |
|
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Library General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 * Library General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Library General Public License |
|
15 * along with this library; see the file COPYING.LIB. If not, write to |
|
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
17 * Boston, MA 02110-1301, USA. |
|
18 * |
|
19 */ |
|
20 |
|
21 /* This prefix file is for use on Mac OS X and Windows only. It should contain only: |
|
22 * 1) files to precompile on Mac OS X and Windows for faster builds |
|
23 * 2) in one case at least: OS-X-specific performance bug workarounds |
|
24 * 3) the special trick to catch us using new or delete without including "config.h" |
|
25 * The project should be able to build without this header, although we rarely test that. |
|
26 */ |
|
27 |
|
28 |
|
29 /* Things that need to be defined globally should go into "config.h". */ |
|
30 |
|
31 #if defined(__APPLE__) |
|
32 #ifdef __cplusplus |
|
33 #define NULL __null |
|
34 #else |
|
35 #define NULL ((void *)0) |
|
36 #endif |
|
37 #endif |
|
38 |
|
39 #if defined(WIN32) || defined(_WIN32) |
|
40 |
|
41 #ifndef _WIN32_WINNT |
|
42 #define _WIN32_WINNT 0x0500 |
|
43 #endif |
|
44 |
|
45 #ifndef WINVER |
|
46 #define WINVER 0x0500 |
|
47 #endif |
|
48 |
|
49 #ifndef _WINSOCKAPI_ |
|
50 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h |
|
51 #endif |
|
52 |
|
53 // If we don't define these, they get defined in windef.h. |
|
54 // We want to use std::min and std::max |
|
55 #ifdef __cplusplus |
|
56 #define max max |
|
57 #define min min |
|
58 #endif |
|
59 |
|
60 #endif // defined(WIN32) || defined(_WIN32) |
|
61 |
|
62 #include <ctype.h> |
|
63 #include <sys/types.h> |
|
64 #include <fcntl.h> |
|
65 #include <pthread.h> |
|
66 #if defined(__APPLE__) |
|
67 #include <regex.h> |
|
68 #endif |
|
69 #include <setjmp.h> |
|
70 #include <signal.h> |
|
71 #include <stdarg.h> |
|
72 #include <stddef.h> |
|
73 #include <stdio.h> |
|
74 #include <stdlib.h> |
|
75 #include <string.h> |
|
76 #include <time.h> |
|
77 #if defined(__APPLE__) |
|
78 #include <unistd.h> |
|
79 #endif |
|
80 |
|
81 #ifdef __cplusplus |
|
82 |
|
83 #include <algorithm> |
|
84 #include <cstddef> |
|
85 #include <new> |
|
86 |
|
87 /* Work around bug 3553309 by re-including <ctype.h>. */ |
|
88 #include <cctype> |
|
89 #if defined(__APPLE__) |
|
90 #define isalnum(c) __istype((c), (_CTYPE_A|_CTYPE_D)) |
|
91 #define isalpha(c) __istype((c), _CTYPE_A) |
|
92 #define iscntrl(c) __istype((c), _CTYPE_C) |
|
93 #define isdigit(c) __isctype((c), _CTYPE_D) /* ANSI -- locale independent */ |
|
94 #define isgraph(c) __istype((c), _CTYPE_G) |
|
95 #define islower(c) __istype((c), _CTYPE_L) |
|
96 #define isprint(c) __istype((c), _CTYPE_R) |
|
97 #define ispunct(c) __istype((c), _CTYPE_P) |
|
98 #define isspace(c) __istype((c), _CTYPE_S) |
|
99 #define isupper(c) __istype((c), _CTYPE_U) |
|
100 #define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ |
|
101 #define tolower(c) __tolower(c) |
|
102 #define toupper(c) __toupper(c) |
|
103 #endif |
|
104 |
|
105 #endif |
|
106 |
|
107 #include <sys/types.h> |
|
108 #if defined(__APPLE__) |
|
109 #include <sys/param.h> |
|
110 #endif |
|
111 #include <sys/stat.h> |
|
112 #if defined(__APPLE__) |
|
113 #include <sys/time.h> |
|
114 #include <sys/resource.h> |
|
115 #endif |
|
116 |
|
117 #include <time.h> |
|
118 |
|
119 #include <CoreFoundation/CoreFoundation.h> |
|
120 #include <CoreServices/CoreServices.h> |
|
121 |
|
122 #include <AvailabilityMacros.h> |
|
123 |
|
124 #if defined(__APPLE__) |
|
125 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 |
|
126 #define BUILDING_ON_TIGER 1 |
|
127 #endif |
|
128 #endif |
|
129 |
|
130 #ifdef __OBJC__ |
|
131 #import <Cocoa/Cocoa.h> |
|
132 #endif |
|
133 |
|
134 #ifdef __cplusplus |
|
135 #define new ("if you use new/delete make sure to include config.h at the top of the file"()) |
|
136 #define delete ("if you use new/delete make sure to include config.h at the top of the file"()) |
|
137 #endif |
|
138 |
|
139 /* Work around bug with C++ library that screws up Objective-C++ when exception support is disabled. */ |
|
140 #if defined(__APPLE__) |
|
141 #undef try |
|
142 #undef catch |
|
143 #endif |