2005-01-31 00:09:51 +01:00
|
|
|
// precompiled header. must be the first non-comment part of every source
|
|
|
|
// file (VC6/7 requirement).
|
|
|
|
//
|
|
|
|
// if the compiler supports PCH (i.e. HAVE_PCH is defined), this
|
|
|
|
// tries to include all headers that may be needed. otherwise, all source
|
|
|
|
// files will still need to include this (for various global fixes and the
|
|
|
|
// memory trackers), but additionally include all required headers.
|
|
|
|
//
|
|
|
|
// this policy yields the best compile performance with or without PCH.
|
2004-06-04 14:41:53 +02:00
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
// must come before warning disables.
|
|
|
|
#include "lib/config.h"
|
|
|
|
|
|
|
|
// disable some common and annoying warnings
|
|
|
|
// (done as soon as possible so that headers below are covered)
|
|
|
|
#if MSC_VERSION
|
|
|
|
// .. temporarily disabled W4 (unimportant but ought to be fixed)
|
|
|
|
# pragma warning(disable:4201) // nameless struct (Matrix3D)
|
|
|
|
# pragma warning(disable:4244) // conversion from uintN to uint8
|
|
|
|
// .. permanently disabled W4
|
|
|
|
# pragma warning(disable:4127) // conditional expression is constant; rationale: see STMT in lib.h.
|
2005-07-03 02:50:49 +02:00
|
|
|
# pragma warning(disable:4996) // function is deprecated
|
|
|
|
# pragma warning(disable:4786) // identifier truncated to 255 chars
|
2005-08-14 04:07:12 +02:00
|
|
|
// .. disabled only for the precompiled headers
|
|
|
|
# pragma warning(disable:4702) // unreachable code (frequent in STL)
|
2005-08-09 18:23:19 +02:00
|
|
|
// .. VS2005 code analysis (very frequent ones)
|
|
|
|
# if MSC_VERSION >= 1400
|
2005-07-03 02:50:49 +02:00
|
|
|
# pragma warning(disable:6011) // dereferencing NULL pointer
|
|
|
|
# pragma warning(disable:6246) // local declaration hides declaration of the same name in outer scope
|
|
|
|
# endif
|
2004-06-04 14:41:53 +02:00
|
|
|
#endif
|
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
//
|
|
|
|
// headers made available everywhere for convenience
|
|
|
|
//
|
|
|
|
|
2005-06-22 05:23:22 +02:00
|
|
|
#include "lib/types.h"
|
|
|
|
#include "lib/string_s.h" // CRT secure string
|
|
|
|
#include "lib/debug.h"
|
|
|
|
#include "ps/Pyrogenesis.h" // MICROLOG and old error system
|
2005-09-13 01:37:52 +02:00
|
|
|
#include <assert.h> // assert()
|
2005-02-28 16:50:35 +01:00
|
|
|
|
2005-01-31 00:09:51 +01:00
|
|
|
//
|
|
|
|
// memory headers
|
|
|
|
//
|
2004-05-08 03:18:15 +02:00
|
|
|
|
2005-01-31 00:09:51 +01:00
|
|
|
// these are all system headers that contain "new", "malloc" etc.; they must
|
|
|
|
// come before the memory tracker headers to avoid conflicts with their
|
|
|
|
// macros. therefore, they are always included, even if !HAVE_PCH.
|
2004-05-08 03:18:15 +02:00
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
#if OS_WIN
|
|
|
|
# include <malloc.h>
|
2005-01-31 00:09:51 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <new>
|
|
|
|
#include <memory>
|
2005-08-09 18:23:19 +02:00
|
|
|
#include <valarray> // free() member function
|
2005-01-31 00:09:51 +01:00
|
|
|
|
2005-02-28 16:50:35 +01:00
|
|
|
|
2005-01-31 00:09:51 +01:00
|
|
|
//
|
|
|
|
// headers to be precompiled
|
|
|
|
//
|
|
|
|
|
|
|
|
// candidates are all system headers we may possibly need or large/rarely
|
|
|
|
// changed project headers; everything placed in here will not need to be
|
|
|
|
// compiled every time. however, if they change, the project will have to be
|
|
|
|
// completely rebuilt. (slow!)
|
|
|
|
//
|
|
|
|
// if the compiler doesn't support precompiled headers (i.e. !HAVE_PCH),
|
|
|
|
// including anything here would actually slow things down, because we might
|
|
|
|
// not otherwise need some of these headers. therefore, do nothing and rely
|
|
|
|
// on all source files (additionally) including everything they need.
|
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
#if HAVE_PCH
|
2005-01-31 00:09:51 +01:00
|
|
|
|
2005-06-25 09:43:13 +02:00
|
|
|
// all new-form C library headers
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <cassert>
|
|
|
|
#include <cctype>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <cerrno>
|
|
|
|
#include <cfloat>
|
|
|
|
//#include <ciso646>
|
|
|
|
// defines e.g. "and" to "&". unnecessary and causes trouble with asm.
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <climits>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <clocale>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <cmath>
|
|
|
|
#include <csetjmp>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <csignal>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <cstring>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <ctime>
|
|
|
|
#include <cwchar>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <cwctype>
|
2005-01-31 00:09:51 +01:00
|
|
|
|
2005-06-25 09:43:13 +02:00
|
|
|
// all C++98 STL headers
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <algorithm>
|
2004-06-01 19:34:12 +02:00
|
|
|
#include <deque>
|
2004-05-08 03:18:15 +02:00
|
|
|
#include <functional>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <iterator>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <list>
|
|
|
|
#include <map>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <memory>
|
2004-05-08 03:18:15 +02:00
|
|
|
#include <numeric>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <queue>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <set>
|
|
|
|
#include <stack>
|
2005-06-25 09:43:13 +02:00
|
|
|
#include <utility>
|
2005-01-31 00:09:51 +01:00
|
|
|
#include <vector>
|
2004-05-24 22:25:48 +02:00
|
|
|
|
2005-06-25 09:43:13 +02:00
|
|
|
// all other C++98 headers
|
|
|
|
#include <bitset>
|
|
|
|
#include <complex>
|
|
|
|
#include <exception>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <ios>
|
|
|
|
#include <iosfwd>
|
|
|
|
#include <iostream>
|
|
|
|
#include <istream>
|
|
|
|
#include <limits>
|
|
|
|
#include <locale>
|
|
|
|
#include <new>
|
|
|
|
#include <ostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <streambuf>
|
|
|
|
#include <string>
|
|
|
|
#include <strstream>
|
|
|
|
#include <typeinfo>
|
|
|
|
#include <valarray>
|
|
|
|
|
|
|
|
// STL extensions
|
2005-08-09 18:23:19 +02:00
|
|
|
#if GCC_VERSION
|
2005-06-01 22:12:45 +02:00
|
|
|
# include <ext/hash_map>
|
|
|
|
# include <ext/hash_set>
|
|
|
|
#else
|
|
|
|
# include <hash_map>
|
|
|
|
# include <hash_set>
|
|
|
|
#endif
|
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
// some other external libraries that are used in several places:
|
|
|
|
// .. CStr is included very frequently, so a reasonable amount of time is
|
|
|
|
// saved by including it here. (~10% in a full rebuild, as of r2365)
|
2005-06-01 22:12:45 +02:00
|
|
|
#include "ps/CStr.h"
|
2005-06-22 05:23:22 +02:00
|
|
|
#include "scripting/SpiderMonkey.h"
|
2005-06-01 22:12:45 +02:00
|
|
|
#include "boost/shared_ptr.hpp"
|
|
|
|
#include "boost/weak_ptr.hpp"
|
|
|
|
|
2005-01-31 00:09:51 +01:00
|
|
|
// (further headers to be precompiled go here)
|
2004-06-30 18:06:05 +02:00
|
|
|
|
2005-08-09 18:23:19 +02:00
|
|
|
#endif // #if HAVE_PCH
|
2005-01-23 19:23:29 +01:00
|
|
|
|
2005-08-14 04:07:12 +02:00
|
|
|
// restore temporarily-disabled warnings
|
|
|
|
#if MSC_VERSION
|
|
|
|
# pragma warning(default:4702)
|
|
|
|
#endif
|
|
|
|
|
2005-01-31 00:09:51 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// memory trackers
|
|
|
|
//
|
|
|
|
|
|
|
|
// these must be included from every file to make sure all allocations
|
|
|
|
// are hooked. placing in the precompiled header is more convenient than
|
|
|
|
// manually #including from every file, but requires that all system
|
|
|
|
// headers containing "new", "malloc" etc. come before this (see above).
|
2005-08-09 18:23:19 +02:00
|
|
|
//
|
|
|
|
// note: mmgr.h activates mmgr or the VC debug heap or nothing depending
|
|
|
|
// on CONFIG_USE_MMGR and HAVE_VC_DEBUG_ALLOC settings.
|
2005-06-22 05:23:22 +02:00
|
|
|
# include "mmgr.h"
|