Refactored custom javascript engines to support primitive 'require' statements.

This commit is contained in:
Oliver Buchtala 2013-09-06 00:38:07 +03:00
commit 4794fa1884
5 changed files with 203 additions and 131 deletions

View file

@ -5,6 +5,7 @@
#include <string>
typedef void* HANDLE;
typedef void* MODULE;
class JSShell {
@ -22,7 +23,7 @@ public:
static JSShell* Create(Engine engine = JSC);
bool ImportModule(const std::string& name);
std::string LoadModule(const std::string& name, HANDLE* library);
virtual bool RunScript(const std::string& scriptPath);
@ -30,11 +31,9 @@ public:
protected:
virtual bool RegisterModule(HANDLE library, const std::string& module_name) = 0;
virtual bool InitializeEngine() = 0;
virtual bool ExecuteScript(const std::string& source, const std::string& name) = 0;
virtual bool ExecuteScript(const std::string& source, const std::string& scriptPath) = 0;
virtual bool DisposeEngine() = 0;