2009-05-05 10:43:54 -04:00
|
|
|
// engine_spidermonkey.h
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "engine.h"
|
|
|
|
|
|
2009-07-24 08:26:35 -04:00
|
|
|
// START inc hacking
|
|
|
|
|
|
2009-05-11 13:10:26 -04:00
|
|
|
#if defined( MOZJS )
|
2009-05-05 10:43:54 -04:00
|
|
|
|
2009-05-29 16:26:59 -04:00
|
|
|
#define MOZILLA_1_8_BRANCH
|
|
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
#include "mozjs/jsapi.h"
|
2009-05-06 22:11:45 -04:00
|
|
|
#include "mozjs/jsdate.h"
|
2009-07-24 08:26:35 -04:00
|
|
|
#include "mozjs/jsregexp.h"
|
2009-05-11 13:10:26 -04:00
|
|
|
|
2009-06-04 17:10:21 -04:00
|
|
|
#warning if you are using an ubuntu version of spider monkey, we recommend installing spider monkey from source
|
2009-06-04 17:04:30 -04:00
|
|
|
|
2009-05-11 13:10:26 -04:00
|
|
|
#elif defined( OLDJS )
|
|
|
|
|
|
2009-05-13 14:20:20 -04:00
|
|
|
#ifdef WIN32
|
|
|
|
|
#include "jstypes.h"
|
|
|
|
|
#undef JS_PUBLIC_API
|
|
|
|
|
#undef JS_PUBLIC_DATA
|
|
|
|
|
#define JS_PUBLIC_API(t) t
|
|
|
|
|
#define JS_PUBLIC_DATA(t) t
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-05-11 13:10:26 -04:00
|
|
|
#include "jsapi.h"
|
|
|
|
|
#include "jsdate.h"
|
2009-07-24 08:26:35 -04:00
|
|
|
#include "jsregexp.h"
|
2009-05-11 13:10:26 -04:00
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
#else
|
2009-05-11 13:10:26 -04:00
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
#include "js/jsapi.h"
|
2009-10-10 16:52:46 -04:00
|
|
|
#include "js/jsobj.h"
|
2009-05-06 22:11:45 -04:00
|
|
|
#include "js/jsdate.h"
|
2009-07-24 08:26:35 -04:00
|
|
|
#include "js/jsregexp.h"
|
2009-05-11 13:10:26 -04:00
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
#endif
|
|
|
|
|
|
2009-07-24 08:26:35 -04:00
|
|
|
// END inc hacking
|
|
|
|
|
|
2009-05-28 13:54:47 -04:00
|
|
|
// -- SM 1.6 hacks ---
|
|
|
|
|
#ifndef JSCLASS_GLOBAL_FLAGS
|
|
|
|
|
|
|
|
|
|
#warning old version of spider monkey ( probably 1.6 ) you should upgrade to at least 1.7
|
|
|
|
|
|
|
|
|
|
#define JSCLASS_GLOBAL_FLAGS 0
|
|
|
|
|
|
|
|
|
|
JSBool JS_CStringsAreUTF8(){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-01 12:59:07 -04:00
|
|
|
#define SM16
|
2009-06-01 11:34:11 -04:00
|
|
|
|
2009-05-28 13:54:47 -04:00
|
|
|
#endif
|
|
|
|
|
// -- END SM 1.6 hacks ---
|
|
|
|
|
|
2009-07-24 08:26:35 -04:00
|
|
|
#ifdef JSVAL_IS_TRACEABLE
|
|
|
|
|
#define SM18
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-08-28 14:03:08 -04:00
|
|
|
#ifdef XULRUNNER
|
|
|
|
|
#define SM181
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
namespace mongo {
|
|
|
|
|
|
|
|
|
|
class SMScope;
|
2009-05-08 11:02:12 -04:00
|
|
|
class Convertor;
|
2009-05-09 22:07:36 -04:00
|
|
|
|
|
|
|
|
extern JSClass bson_class;
|
2009-05-06 12:48:19 -04:00
|
|
|
extern JSClass bson_ro_class;
|
2009-05-15 08:31:11 -04:00
|
|
|
|
2009-05-06 17:33:00 -04:00
|
|
|
extern JSClass object_id_class;
|
2009-10-02 16:38:20 -04:00
|
|
|
extern JSClass dbpointer_class;
|
2009-10-02 17:07:07 -04:00
|
|
|
extern JSClass dbref_class;
|
2009-06-05 09:54:35 -04:00
|
|
|
extern JSClass bindata_class;
|
2009-05-15 08:31:11 -04:00
|
|
|
extern JSClass timestamp_class;
|
|
|
|
|
extern JSClass minkey_class;
|
|
|
|
|
extern JSClass maxkey_class;
|
2009-05-06 12:48:19 -04:00
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
// internal things
|
|
|
|
|
void dontDeleteScope( SMScope * s ){}
|
|
|
|
|
void errorReporter( JSContext *cx, const char *message, JSErrorReport *report );
|
|
|
|
|
extern boost::thread_specific_ptr<SMScope> currentScope;
|
|
|
|
|
|
|
|
|
|
// bson
|
|
|
|
|
JSBool resolveBSONField( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mongo
|
2009-05-15 16:32:31 -04:00
|
|
|
void initMongoJS( SMScope * scope , JSContext * cx , JSObject * global , bool local );
|
2009-07-24 08:26:35 -04:00
|
|
|
bool appendSpecialDBObject( Convertor * c , BSONObjBuilder& b , const string& name , jsval val , JSObject * o );
|
2009-06-03 13:18:50 -04:00
|
|
|
|
|
|
|
|
#define JSVAL_IS_OID(v) ( JSVAL_IS_OBJECT( v ) && JS_InstanceOf( cx , JSVAL_TO_OBJECT( v ) , &object_id_class , 0 ) )
|
|
|
|
|
|
2009-07-13 12:49:29 -04:00
|
|
|
bool isDate( JSContext * cx , JSObject * o );
|
|
|
|
|
|
2009-05-05 10:43:54 -04:00
|
|
|
}
|