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#include <wtf/Platform.h>
31
32#if defined(__APPLE__)
33#ifdef __cplusplus
34#define NULL __null
35#else
36#define NULL ((void *)0)
37#endif
38#endif
39
40#if OS(WINDOWS)
41
42#ifndef _WIN32_WINNT
43#define _WIN32_WINNT 0x0502
44#endif
45
46#ifndef WINVER
47#define WINVER 0x0502
48#endif
49
50#if !USE(CURL)
51#ifndef _WINSOCKAPI_
52#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
53#endif
54#endif
55
56#else
57
58#include <pthread.h>
59
60#endif // OS(WINDOWS)
61
62#include <sys/types.h>
63#include <fcntl.h>
64#if defined(__APPLE__)
65#include <regex.h>
66#endif
67
68#include <setjmp.h>
69
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
84#include <ciso646>
85
86#if defined(_LIBCPP_VERSION)
87
88// Add work around for a bug in libc++ that caused standard heap
89// APIs to not compile <rdar://problem/10858112>.
90
91#include <type_traits>
92
93namespace WebCore {
94    class TimerHeapReference;
95}
96
97_LIBCPP_BEGIN_NAMESPACE_STD
98
99inline _LIBCPP_INLINE_VISIBILITY
100const WebCore::TimerHeapReference& move(const WebCore::TimerHeapReference& t)
101{
102    return t;
103}
104
105_LIBCPP_END_NAMESPACE_STD
106
107#endif // defined(_LIBCPP_VERSION)
108
109#include <algorithm>
110#include <cstddef>
111#include <new>
112
113#endif
114
115#if defined(__APPLE__)
116#include <sys/param.h>
117#endif
118#include <sys/stat.h>
119#if defined(__APPLE__)
120#include <sys/time.h>
121#include <sys/resource.h>
122#endif
123
124#include <CoreFoundation/CoreFoundation.h>
125#if PLATFORM(WIN_CAIRO)
126#include <ConditionalMacros.h>
127#include <windows.h>
128#else
129
130#if OS(WINDOWS)
131#if USE(CG)
132
133#if defined(_MSC_VER) && _MSC_VER <= 1600
134
135#include <WebCore/WebCoreHeaderDetection.h>
136
137#if HAVE(AVCF_LEGIBLE_OUTPUT)
138// These must be defined before including CGFloat.h
139// This can be removed once we move to VS2012 or newer
140#include <wtf/ExportMacros.h>
141#include <wtf/MathExtras.h>
142
143#define isnan _isnan
144#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
145#include <CoreGraphics/CGFloat.h>
146#endif
147#include <CoreGraphics/CoreGraphics.h>
148#include <CoreGraphics/CGFloat.h>
149#undef isnan
150#endif
151#endif
152
153// FIXME <rdar://problem/8208868> Remove support for obsolete ColorSync API, CoreServices header in CoreGraphics
154// We can remove this once the new ColorSync APIs are available in an internal Safari SDK.
155#include <ColorSync/ColorSync.h>
156#ifdef __COLORSYNCDEPRECATED__
157#define COREGRAPHICS_INCLUDES_CORESERVICES_HEADER
158#define OBSOLETE_COLORSYNC_API
159#endif
160#endif
161#if USE(CFNETWORK)
162/* Windows doesn't include CFNetwork.h via CoreServices.h, so we do
163   it explicitly here to make Windows more consistent with Mac. */
164#include <CFNetwork/CFNetwork.h>
165#endif
166#include <windows.h>
167#else
168#if !PLATFORM(IOS)
169#include <CoreServices/CoreServices.h>
170#endif // !PLATFORM(IOS)
171#endif // OS(WINDOWS)
172
173#endif
174
175#ifdef __OBJC__
176#if PLATFORM(IOS)
177#import <Foundation/Foundation.h>
178#else
179#import <Cocoa/Cocoa.h>
180#endif // PLATFORM(IOS)
181#endif
182
183#ifdef __cplusplus
184#define new ("if you use new/delete make sure to include config.h at the top of the file"())
185#define delete ("if you use new/delete make sure to include config.h at the top of the file"())
186#endif
187
188/* When C++ exceptions are disabled, the C++ library defines |try| and |catch|
189 * to allow C++ code that expects exceptions to build. These definitions
190 * interfere with Objective-C++ uses of Objective-C exception handlers, which
191 * use |@try| and |@catch|. As a workaround, undefine these macros. */
192#ifdef __OBJC__
193#undef try
194#undef catch
195#endif
196
197