1 | /*
|
---|
2 | * Copyright (C) 2004, 2005, 2006, 2007, 2013 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 should contain only:
|
---|
22 | * 1) files to precompile 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 | /* Things that need to be defined globally should go into "config.h". */
|
---|
29 |
|
---|
30 | #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H && defined(BUILDING_WITH_CMAKE)
|
---|
31 | #include "cmakeconfig.h"
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <wtf/Platform.h>
|
---|
35 |
|
---|
36 | #if defined(__APPLE__)
|
---|
37 | #ifdef __cplusplus
|
---|
38 | #define NULL __null
|
---|
39 | #else
|
---|
40 | #define NULL ((void *)0)
|
---|
41 | #endif
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #if !OS(WINDOWS)
|
---|
45 | #include <pthread.h>
|
---|
46 | #endif // !OS(WINDOWS)
|
---|
47 |
|
---|
48 | #include <sys/types.h>
|
---|
49 | #include <fcntl.h>
|
---|
50 | #if HAVE(REGEX_H)
|
---|
51 | #include <regex.h>
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #include <setjmp.h>
|
---|
55 |
|
---|
56 | #include <signal.h>
|
---|
57 | #include <stdarg.h>
|
---|
58 | #include <stddef.h>
|
---|
59 | #include <stdio.h>
|
---|
60 | #include <stdlib.h>
|
---|
61 | #include <string.h>
|
---|
62 | #include <time.h>
|
---|
63 | #if defined(__APPLE__)
|
---|
64 | #include <unistd.h>
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #ifdef __cplusplus
|
---|
68 | #include <algorithm>
|
---|
69 | #include <cstddef>
|
---|
70 | #include <new>
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | #if defined(__APPLE__)
|
---|
74 | #include <sys/param.h>
|
---|
75 | #endif
|
---|
76 | #include <sys/stat.h>
|
---|
77 | #if defined(__APPLE__)
|
---|
78 | #include <sys/time.h>
|
---|
79 | #include <sys/resource.h>
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #if USE(CF)
|
---|
83 | #include <CoreFoundation/CoreFoundation.h>
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #if USE(CG)
|
---|
87 | #include <CoreGraphics/CoreGraphics.h>
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #if OS(WINDOWS)
|
---|
91 | #ifndef CF_IMPLICIT_BRIDGING_ENABLED
|
---|
92 | #define CF_IMPLICIT_BRIDGING_ENABLED
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | #ifndef CF_IMPLICIT_BRIDGING_DISABLED
|
---|
96 | #define CF_IMPLICIT_BRIDGING_DISABLED
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #if USE(CF)
|
---|
100 | #include <CoreFoundation/CFBase.h>
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | #ifndef CF_ENUM
|
---|
104 | #define CF_ENUM(_type, _name) _type _name; enum
|
---|
105 | #endif
|
---|
106 | #ifndef CF_OPTIONS
|
---|
107 | #define CF_OPTIONS(_type, _name) _type _name; enum
|
---|
108 | #endif
|
---|
109 | #ifndef CF_ENUM_DEPRECATED
|
---|
110 | #define CF_ENUM_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep)
|
---|
111 | #endif
|
---|
112 | #ifndef CF_ENUM_AVAILABLE
|
---|
113 | #define CF_ENUM_AVAILABLE(_mac, _ios)
|
---|
114 | #endif
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | #if PLATFORM(WIN_CAIRO)
|
---|
118 | #include <windows.h>
|
---|
119 | #else
|
---|
120 |
|
---|
121 | #if OS(WINDOWS)
|
---|
122 |
|
---|
123 | #if USE(CG)
|
---|
124 | // FIXME <rdar://problem/8208868> Remove support for obsolete ColorSync API, CoreServices header in CoreGraphics
|
---|
125 | // We can remove this once the new ColorSync APIs are available in an internal Safari SDK.
|
---|
126 | #include <ColorSync/ColorSync.h>
|
---|
127 | #ifdef __COLORSYNCDEPRECATED__
|
---|
128 | #define COREGRAPHICS_INCLUDES_CORESERVICES_HEADER
|
---|
129 | #define OBSOLETE_COLORSYNC_API
|
---|
130 | #endif
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | #if USE(CFURLCONNECTION)
|
---|
134 | #include <CFNetwork/CFNetwork.h>
|
---|
135 | // On Windows, dispatch.h needs to be included before certain CFNetwork headers.
|
---|
136 | #include <dispatch/dispatch.h>
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | #include <windows.h>
|
---|
140 | #endif // OS(WINDOWS)
|
---|
141 |
|
---|
142 | #if PLATFORM(IOS_FAMILY)
|
---|
143 | #include <MobileCoreServices/MobileCoreServices.h>
|
---|
144 | #endif
|
---|
145 |
|
---|
146 | #if PLATFORM(MAC)
|
---|
147 | #if !USE(APPLE_INTERNAL_SDK)
|
---|
148 | /* SecTrustedApplication.h declares SecTrustedApplicationCreateFromPath(...) to
|
---|
149 | * be unavailable on macOS, so do not include that header. */
|
---|
150 | #define _SECURITY_SECTRUSTEDAPPLICATION_H_
|
---|
151 | #endif
|
---|
152 | #include <CoreServices/CoreServices.h>
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | #endif
|
---|
156 |
|
---|
157 | #ifdef __OBJC__
|
---|
158 | #if PLATFORM(IOS_FAMILY)
|
---|
159 | #import <Foundation/Foundation.h>
|
---|
160 | #else
|
---|
161 | #if USE(APPKIT)
|
---|
162 | #import <Cocoa/Cocoa.h>
|
---|
163 | #endif
|
---|
164 | #endif // PLATFORM(IOS_FAMILY)
|
---|
165 | #endif
|
---|
166 |
|
---|
167 | #ifdef __cplusplus
|
---|
168 |
|
---|
169 | #if !PLATFORM(WIN)
|
---|
170 | #import <wtf/FastMalloc.h>
|
---|
171 | #import <wtf/HashMap.h>
|
---|
172 | #import <wtf/StdLibExtras.h>
|
---|
173 | #import <wtf/text/AtomString.h>
|
---|
174 | #import <wtf/text/WTFString.h>
|
---|
175 | #endif
|
---|
176 |
|
---|
177 | #define new ("if you use new/delete make sure to include config.h at the top of the file"())
|
---|
178 | #define delete ("if you use new/delete make sure to include config.h at the top of the file"())
|
---|
179 | #endif
|
---|
180 |
|
---|
181 | /* When C++ exceptions are disabled, the C++ library defines |try| and |catch|
|
---|
182 | * to allow C++ code that expects exceptions to build. These definitions
|
---|
183 | * interfere with Objective-C++ uses of Objective-C exception handlers, which
|
---|
184 | * use |@try| and |@catch|. As a workaround, undefine these macros. */
|
---|
185 | #ifdef __OBJC__
|
---|
186 | #undef try
|
---|
187 | #undef catch
|
---|
188 | #endif
|
---|