From 5fab9c8a3857f2c0499790461160bdb4bc9d3602 Mon Sep 17 00:00:00 2001 From: Oliver Buchtala Date: Sat, 8 Sep 2012 01:04:40 +0000 Subject: [PATCH] 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 --- Tools/javascript/jsc_shell.cxx | 12 +++--------- Tools/javascript/v8_shell.cxx | 10 +++++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Tools/javascript/jsc_shell.cxx b/Tools/javascript/jsc_shell.cxx index 3fa704440..a21fb3f1a 100644 --- a/Tools/javascript/jsc_shell.cxx +++ b/Tools/javascript/jsc_shell.cxx @@ -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::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) diff --git a/Tools/javascript/v8_shell.cxx b/Tools/javascript/v8_shell.cxx index 940609ec3..e124ebd7d 100755 --- a/Tools/javascript/v8_shell.cxx +++ b/Tools/javascript/v8_shell.cxx @@ -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 : ""; -} - 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 : ""; +}