2012-01-05 04:38:54 +01:00
|
|
|
/* Copyright (C) 2012 Wildfire Games.
|
2010-01-09 20:20:14 +01:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_SCRIPTTYPES
|
|
|
|
#define INCLUDED_SCRIPTTYPES
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
# define XP_WIN
|
2011-07-15 15:22:48 +02:00
|
|
|
# ifndef WIN32
|
|
|
|
# define WIN32 // SpiderMonkey expects this
|
|
|
|
# endif
|
2010-11-17 00:00:52 +01:00
|
|
|
|
|
|
|
// The jsval struct type causes crashes due to weird miscompilation
|
|
|
|
// issues in (at least) VC2008, so force it to be the less-type-safe
|
|
|
|
// non-struct type instead
|
|
|
|
# define JS_NO_JSVAL_JSID_STRUCT_TYPES
|
|
|
|
|
2010-11-17 04:02:04 +01:00
|
|
|
// Make JS think the int8_t etc types are defined, since wposix_types.h emulates
|
|
|
|
// the ones that are needed and this avoids conflicting definitions
|
|
|
|
# define JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES
|
|
|
|
|
2011-11-14 19:18:04 +01:00
|
|
|
#else // If not Windows, then Unix:
|
|
|
|
|
2010-01-09 20:20:14 +01:00
|
|
|
# define XP_UNIX
|
2011-11-14 19:18:04 +01:00
|
|
|
|
|
|
|
// In DEBUG mode, jsval defaults to struct types. Normally we build separate
|
|
|
|
// debug/release mode versions of the library, but when using --with-system-mozjs185
|
|
|
|
// it's always a release mode library, so we have to disable struct types for
|
|
|
|
// ABI compatibility
|
|
|
|
# if defined(DEBUG) && defined(WITH_SYSTEM_MOZJS185)
|
|
|
|
# define JS_NO_JSVAL_JSID_STRUCT_TYPES
|
|
|
|
# endif
|
|
|
|
|
2010-01-09 20:20:14 +01:00
|
|
|
#endif
|
|
|
|
// (we don't support XP_OS2 or XP_BEOS)
|
|
|
|
|
2011-11-14 19:18:04 +01:00
|
|
|
|
|
|
|
// Guess whether the library was compiled with the release-mode or debug-mode ABI
|
|
|
|
// (for JS_DumpHeap etc)
|
|
|
|
#if defined(DEBUG) && !defined(WITH_SYSTEM_MOZJS185)
|
|
|
|
# define MOZJS_DEBUG_ABI 1
|
|
|
|
#else
|
|
|
|
# define MOZJS_DEBUG_ABI 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-04-09 02:05:37 +02:00
|
|
|
#include <cstring> // required by jsutil.h
|
|
|
|
|
2011-07-15 15:22:48 +02:00
|
|
|
// SpiderMonkey wants the DEBUG flag
|
|
|
|
#ifndef NDEBUG
|
|
|
|
# ifndef DEBUG
|
|
|
|
# define DEBUG
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2011-07-17 01:24:14 +02:00
|
|
|
// Ignore some harmless warnings triggered by jsapi.h
|
|
|
|
#if GCC_VERSION >= 402 // (older GCCs don't support this pragma)
|
|
|
|
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
# pragma GCC diagnostic ignored "-Wredundant-decls"
|
|
|
|
#endif
|
|
|
|
#if MSC_VERSION
|
|
|
|
# pragma warning(push)
|
|
|
|
# pragma warning(disable:4480) // "nonstandard extension used: specifying underlying type for enum"
|
|
|
|
# pragma warning(disable:4100) // "unreferenced formal parameter"
|
|
|
|
#endif
|
|
|
|
|
2010-11-17 00:00:52 +01:00
|
|
|
#include "js/jsapi.h"
|
2010-03-20 18:00:21 +01:00
|
|
|
|
2011-07-17 01:24:14 +02:00
|
|
|
#if MSC_VERSION
|
|
|
|
# pragma warning(pop)
|
|
|
|
#endif
|
|
|
|
#if GCC_VERSION >= 402
|
|
|
|
# pragma GCC diagnostic warning "-Wunused-parameter"
|
|
|
|
# pragma GCC diagnostic warning "-Wredundant-decls"
|
|
|
|
#endif
|
|
|
|
|
2010-03-20 18:00:21 +01:00
|
|
|
#if JS_VERSION != 185
|
|
|
|
#error Your compiler is trying to use an incorrect version of the SpiderMonkey library.
|
2012-01-05 04:38:54 +01:00
|
|
|
#error The only version that works is the one in the libraries/spidermonkey/ directory,
|
2010-03-20 18:00:21 +01:00
|
|
|
#error and it will not work with a typical system-installed version.
|
|
|
|
#error Make sure you have got all the right files and include paths.
|
|
|
|
#endif
|
2010-01-09 20:20:14 +01:00
|
|
|
|
|
|
|
class ScriptInterface;
|
|
|
|
class CScriptVal;
|
2010-05-20 02:59:01 +02:00
|
|
|
class CScriptValRooted;
|
2010-01-09 20:20:14 +01:00
|
|
|
|
|
|
|
#endif // INCLUDED_SCRIPTTYPES
|