diff --git a/source/i18n/ScriptInterface.cpp b/source/i18n/ScriptInterface.cpp index 28ab882830..d80971c733 100755 --- a/source/i18n/ScriptInterface.cpp +++ b/source/i18n/ScriptInterface.cpp @@ -3,15 +3,7 @@ #include "ScriptInterface.h" #include "CLocale.h" #include "StringConvert.h" - -#include - -// Make JS debugging a little easier by automatically naming GC roots -#ifndef NDEBUG -// Don't simply #define NAME_ALL_GC_ROOTS, because jsapi.h is horridly broken -# define JS_AddRoot(cx, rp) JS_AddNamedRoot((cx), (rp), __FILE__) -#endif - +#include "scripting/SpiderMonkey.h" #include "ps/CLogger.h" #define LOG_CATEGORY "i18n" diff --git a/source/ps/Singleton.h b/source/ps/Singleton.h index 01ba14c63c..66f6786303 100755 --- a/source/ps/Singleton.h +++ b/source/ps/Singleton.h @@ -19,10 +19,6 @@ #ifndef _TEMPLATE_SINGLETON #define _TEMPLATE_SINGLETON -#include -#include "lib.h" - - template class Singleton { @@ -31,7 +27,7 @@ class Singleton public: Singleton() { - assert( !ms_singleton ); + assert2( !ms_singleton ); //use a cunning trick to get the singleton pointing to the start of //the whole, rather than the start of the Singleton part of the object diff --git a/source/ps/StringConvert.cpp b/source/ps/StringConvert.cpp index 69418c1fed..d277462f2d 100755 --- a/source/ps/StringConvert.cpp +++ b/source/ps/StringConvert.cpp @@ -5,7 +5,7 @@ #include -#include +#include "scripting/SpiderMonkey.h" #if SDL_BYTE_ORDER == SDL_BIG_ENDIAN #define ucs2le_to_wchart(ptr) (wchar_t)( (u16) ((u8*)ptr)[0] | (u16) ( ((u8*)ptr)[1] << 8) ) diff --git a/source/scripting/ScriptableComplex.h b/source/scripting/ScriptableComplex.h index f509e5985a..20baa37fae 100644 --- a/source/scripting/ScriptableComplex.h +++ b/source/scripting/ScriptableComplex.h @@ -6,7 +6,7 @@ #include "scripting/ScriptingHost.h" #include "JSConversions.h" -#include +#include "scripting/SpiderMonkey.h" #include diff --git a/source/scripting/ScriptingHost.h b/source/scripting/ScriptingHost.h index 082fdf4f83..9295f48e99 100755 --- a/source/scripting/ScriptingHost.h +++ b/source/scripting/ScriptingHost.h @@ -26,17 +26,7 @@ ERROR_SUBGROUP(Scripting, DefineType); ERROR_TYPE(Scripting_DefineType, AlreadyExists); ERROR_TYPE(Scripting_DefineType, CreationFailed); -#include - -#ifndef NDEBUG -#include -#endif - -// Make JS debugging a little easier by automatically naming GC roots -#ifndef NDEBUG -// Don't simply #define NAME_ALL_GC_ROOTS, because jsapi.h is horridly broken -# define JS_AddRoot(cx, rp) JS_AddNamedRoot((cx), (rp), __FILE__ ) -#endif +#include "scripting/SpiderMonkey.h" #include #include diff --git a/source/scripting/SpiderMonkey.h b/source/scripting/SpiderMonkey.h new file mode 100644 index 0000000000..187b2e74db --- /dev/null +++ b/source/scripting/SpiderMonkey.h @@ -0,0 +1,35 @@ +// master header for the SpiderMonkey Javascript library. + +// include this instead of accessing any headers directly. +// rationale: these headers require an OS macro to be set (XP_*). +// since this is specific to SpiderMonkey, we don't want to hide the fact in +// some obscure header that's pulled in via PCH (would make reuse harder). +// we take care of it below. + +// jstypes.h (included via jsapi.h) requires we define +// "one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN or XP_UNIX". +#include "config.h" +#if defined(OS_WIN) +# define XP_WIN +#elif defined(OS_MAC) +# define XP_MAC +#elif defined(OS_BEOS) +# define XP_BEOS +#else +# define XP_UNIX +#endif + +#include +#include +#ifndef NDEBUG +# include +#endif + +// include any further required headers here + + +// Make JS debugging a little easier by automatically naming GC roots +// Don't simply #define NAME_ALL_GC_ROOTS, because jsapi.h is horridly broken +#ifndef NDEBUG +# define JS_AddRoot(cx, rp) JS_AddNamedRoot((cx), (rp), __FILE__ ) +#endif