0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

stubbed v8 engine

This commit is contained in:
Aaron 2009-05-04 11:49:18 -04:00
parent 661bce250b
commit 187689b0cd
4 changed files with 67 additions and 4 deletions

View File

@ -168,8 +168,9 @@ usesm = not GetOption( "usesm" ) is None
commonFiles = Split( "stdafx.cpp buildinfo.cpp db/jsobj.cpp db/json.cpp db/commands.cpp db/lasterror.cpp db/nonce.cpp db/queryutil.cpp" )
commonFiles += [ "util/background.cpp" , "util/mmap.cpp" , "util/sock.cpp" , "util/util.cpp" , "util/message.cpp" ]
commonFiles += Glob( "util/*.c" );
commonFiles += Glob( "util/*.c" )
commonFiles += Split( "client/connpool.cpp client/dbclient.cpp client/model.cpp" )
commonFiles += [ "scripting/engine.cpp" ]
#mmap stuff
@ -189,7 +190,6 @@ coreDbFiles = []
coreServerFiles = [ "util/message_server_port.cpp" , "util/message_server_asio.cpp" ]
serverOnlyFiles = Split( "db/query.cpp db/introspect.cpp db/btree.cpp db/clientcursor.cpp db/tests.cpp db/repl.cpp db/btreecursor.cpp db/cloner.cpp db/namespace.cpp db/matcher.cpp db/dbcommands.cpp db/dbeval.cpp db/dbwebserver.cpp db/dbinfo.cpp db/dbhelpers.cpp db/instance.cpp db/pdfile.cpp db/cursor.cpp db/security_commands.cpp db/security.cpp util/miniwebserver.cpp db/storage.cpp db/reccache.cpp db/queryoptimizer.cpp" )
serverOnlyFiles += [ "scripting/engine.cpp" ]
if usesm:
serverOnlyFiles += [ "scripting/engine_spidermonkey.cpp" , "shell/mongo.cpp" ]
@ -728,7 +728,7 @@ elif not onlyServer:
shellEnv.Append( LIBS=["winmm.lib"] )
if weird:
shell32BitFiles = Glob( "shell/*.cpp" )
shell32BitFiles = Glob( "shell/*.cpp" ) + [ "scripting/engine_v8.cpp" ]
for f in allClientFiles:
shell32BitFiles.append( "32bit/" + str( f ) )
@ -742,7 +742,7 @@ elif not onlyServer:
mongo = shellEnv.Program( "mongo" , shell32BitFiles )
else:
shellEnv.Append( LIBS=[ "mongoclient"] )
mongo = shellEnv.Program( "mongo" , Glob( "shell/*.cpp" ) );
mongo = shellEnv.Program( "mongo" , Glob( "shell/*.cpp" ) + [ "scripting/engine_v8.cpp" ] );
# ---- RUNNING TESTS ----

View File

@ -174,6 +174,8 @@
93A479F70FAF2A5000E760DD /* engine_java.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = engine_java.h; sourceTree = "<group>"; };
93A479F90FAF2A5000E760DD /* engine_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engine_none.cpp; sourceTree = "<group>"; };
93A479FA0FAF2A5000E760DD /* engine_spidermonkey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engine_spidermonkey.cpp; sourceTree = "<group>"; };
93A47AA50FAF416F00E760DD /* engine_v8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engine_v8.cpp; sourceTree = "<group>"; };
93A47AA60FAF41B200E760DD /* engine_v8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = engine_v8.h; sourceTree = "<group>"; };
93A6E10C0F24CF9800DA4EBF /* lasterror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lasterror.h; sourceTree = "<group>"; };
93A6E10D0F24CFB100DA4EBF /* flushtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flushtest.cpp; sourceTree = "<group>"; };
93A6E10E0F24CFD300DA4EBF /* security.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = security.h; sourceTree = "<group>"; };
@ -551,6 +553,8 @@
93A479F20FAF2A5000E760DD /* scripting */ = {
isa = PBXGroup;
children = (
93A47AA60FAF41B200E760DD /* engine_v8.h */,
93A47AA50FAF416F00E760DD /* engine_v8.cpp */,
93A479F30FAF2A5000E760DD /* engine.cpp */,
93A479F40FAF2A5000E760DD /* engine.h */,
93A479F60FAF2A5000E760DD /* engine_java.cpp */,

11
scripting/engine_v8.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "engine_v8.h"
namespace mongo {
void ScriptEngine::setup(){
if ( !globalScriptEngine ){
globalScriptEngine = new V8ScriptEngine();
}
}
} // namespace mongo

48
scripting/engine_v8.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include "engine.h"
namespace mongo {
class V8Scope : public Scope {
public:
V8Scope() {}
virtual ~V8Scope() {}
virtual void reset() {}
virtual void init( BSONObj * data ) {}
virtual void localConnect( const char * dbName ) {}
virtual double getNumber( const char *field ) { assert( false ); return 0; }
virtual string getString( const char *field ) { assert( false ); return ""; }
virtual bool getBoolean( const char *field ) { assert( false ); return false; }
virtual BSONObj getObject( const char *field ) { assert( false ); return BSONObj(); }
virtual int type( const char *field ) { assert( false ); return 0; }
virtual void setNumber( const char *field , double val ) {}
virtual void setString( const char *field , const char * val ) {}
virtual void setObject( const char *field , const BSONObj& obj ) {}
virtual void setBoolean( const char *field , bool val ) {}
virtual void setThis( const BSONObj * obj ) {}
virtual ScriptingFunction createFunction( const char * code ) { assert( false ); return 0; }
virtual int invoke( ScriptingFunction func , const BSONObj& args ) { assert( false ); return 0; }
virtual string getError() { assert( false ); return ""; }
};
class V8ScriptEngine : public ScriptEngine {
public:
V8ScriptEngine() {}
virtual ~V8ScriptEngine() {}
virtual Scope * createScope() { return new V8Scope(); }
virtual void runTest() {}
};
extern ScriptEngine * globalScriptEngine;
}