Minor cleanup in javascript shell implementation.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13785 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Oliver Buchtala 2012-09-08 01:04:40 +00:00
commit 5fab9c8a38
2 changed files with 8 additions and 14 deletions

View file

@ -12,10 +12,6 @@
#error "implement dll loading"
#endif
JSValueRef JSCShell_Print(JSContextRef context, JSObjectRef object,
JSObjectRef globalobj, size_t argc,
const JSValueRef args[], JSValueRef* ex);
class JSCShell: public JSShell {
typedef int (*JSCIntializer)(JSGlobalContextRef context);
@ -38,7 +34,7 @@ protected:
private:
//static JSValueRef Print(JSContextRef context,JSObjectRef object, JSObjectRef globalobj, size_t argc, const JSValueRef args[], JSValueRef* ex);
static JSValueRef Print(JSContextRef context,JSObjectRef object, JSObjectRef globalobj, size_t argc, const JSValueRef args[], JSValueRef* ex);
static bool RegisterFunction(JSGlobalContextRef context, JSObjectRef object, const char* functionName, JSObjectCallAsFunctionCallback cbFunction);
@ -51,8 +47,6 @@ private:
JSGlobalContextRef context;
};
using namespace std;
JSCShell::~JSCShell() {
if(context != 0) {
JSGlobalContextRelease(context);
@ -79,7 +73,7 @@ bool JSCShell::InitializeEngine() {
context = JSGlobalContextCreate(NULL);
if(context == 0) return false;
JSObjectRef globalObject = JSContextGetGlobalObject(context);
JSCShell::RegisterFunction(context, globalObject, "print", JSCShell_Print);
JSCShell::RegisterFunction(context, globalObject, "print", JSCShell::Print);
// Call module initializers
for(std::vector<JSCIntializer>::iterator it = module_initializers.begin();
it != module_initializers.end(); ++it) {
@ -110,7 +104,7 @@ bool JSCShell::DisposeEngine() {
return true;
}
JSValueRef JSCShell_Print(JSContextRef context, JSObjectRef object,
JSValueRef JSCShell::Print(JSContextRef context, JSObjectRef object,
JSObjectRef globalobj, size_t argc,
const JSValueRef args[], JSValueRef* ex) {
if (argc > 0)

View file

@ -57,11 +57,6 @@ protected:
#error "implement dll loading"
#endif
// Extracts a C string from a V8 Utf8Value.
const char* V8Shell::ToCString(const v8::String::Utf8Value& value) {
return *value ? *value : "<string conversion failed>";
}
V8Shell::V8Shell()
{
}
@ -220,3 +215,8 @@ void V8Shell::ReportException(v8::TryCatch* try_catch) {
}
}
}
// Extracts a C string from a V8 Utf8Value.
const char* V8Shell::ToCString(const v8::String::Utf8Value& value) {
return *value ? *value : "<string conversion failed>";
}