JavaScript: Added missing static modifiers to avoid duplicate symbol problems with multiple SWIG modules.

This commit is contained in:
Eric Wing 2014-05-18 01:29:45 -07:00 committed by Oliver Buchtala
commit aa55154ccf
3 changed files with 32 additions and 32 deletions

View file

@ -8,7 +8,7 @@
* ----------------------------------------------------------------------------- */
%fragment ("js_ctor", "templates")
%{
JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
@ -28,7 +28,7 @@ JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc
* ----------------------------------------------------------------------------- */
%fragment ("js_veto_ctor", "templates")
%{
JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
@ -44,7 +44,7 @@ JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
* ----------------------------------------------------------------------------- */
%fragment ("js_ctor_dispatcher", "templates")
%{
JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
JSObjectRef thisObject = NULL;
@ -70,7 +70,7 @@ JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
* ----------------------------------------------------------------------------- */
%fragment ("js_overloaded_ctor", "templates")
%{
JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
$jscode
@ -105,7 +105,7 @@ JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc
* ----------------------------------------------------------------------------- */
%fragment ("js_dtor", "templates")
%{
void $jswrapper(JSObjectRef thisObject)
static void $jswrapper(JSObjectRef thisObject)
{
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
if(t && t->swigCMemOwn) free (($jstype)t->swigCObject);
@ -121,7 +121,7 @@ void $jswrapper(JSObjectRef thisObject)
* ----------------------------------------------------------------------------- */
%fragment ("js_dtoroverride", "templates")
%{
void $jswrapper(JSObjectRef thisObject)
static void $jswrapper(JSObjectRef thisObject)
{
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
if(t && t->swigCMemOwn) {
@ -140,7 +140,7 @@ void $jswrapper(JSObjectRef thisObject)
* ----------------------------------------------------------------------------- */
%fragment ("js_getter", "templates")
%{
JSValueRef $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
static JSValueRef $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
$jslocals
JSValueRef jsresult;
@ -162,7 +162,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef
* ----------------------------------------------------------------------------- */
%fragment ("js_setter", "templates")
%{
bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
static bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
$jslocals
$jscode
@ -183,7 +183,7 @@ bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef proper
* ----------------------------------------------------------------------------- */
%fragment ("js_function", "templates")
%{
JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
JSValueRef jsresult;
@ -208,7 +208,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
* ----------------------------------------------------------------------------- */
%fragment ("js_function_dispatcher", "templates")
%{
JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
JSValueRef jsresult;
@ -232,7 +232,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
* ----------------------------------------------------------------------------- */
%fragment ("js_overloaded_function", "templates")
%{
int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result)
static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result)
{
$jslocals
JSValueRef jsresult;
@ -291,11 +291,11 @@ int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObjec
* ----------------------------------------------------------------------------- */
%fragment ("jsc_class_declaration", "templates")
%{
JSClassDefinition $jsmangledname_classDefinition;
static JSClassDefinition $jsmangledname_classDefinition;
JSClassDefinition $jsmangledname_objectDefinition;
static JSClassDefinition $jsmangledname_objectDefinition;
JSClassRef $jsmangledname_classRef;
static JSClassRef $jsmangledname_classRef;
%}
/* -----------------------------------------------------------------------------
@ -308,22 +308,22 @@ JSClassRef $jsmangledname_classRef;
* ----------------------------------------------------------------------------- */
%fragment ("jsc_class_tables", "templates")
%{
JSStaticValue $jsmangledname_staticValues[] = {
static JSStaticValue $jsmangledname_staticValues[] = {
$jsstaticclassvariables
{ 0, 0, 0, 0 }
};
JSStaticFunction $jsmangledname_staticFunctions[] = {
static JSStaticFunction $jsmangledname_staticFunctions[] = {
$jsstaticclassfunctions
{ 0, 0, 0 }
};
JSStaticValue $jsmangledname_values[] = {
static JSStaticValue $jsmangledname_values[] = {
$jsclassvariables
{ 0, 0, 0, 0 }
};
JSStaticFunction $jsmangledname_functions[] = {
static JSStaticFunction $jsmangledname_functions[] = {
$jsclassfunctions
{ 0, 0, 0 }
};
@ -382,17 +382,17 @@ JSStaticFunction $jsmangledname_functions[] = {
* ----------------------------------------------------------------------------- */
%fragment ("jsc_nspace_declaration", "templates")
%{
JSStaticValue $jsnspace_values[] = {
static JSStaticValue $jsnspace_values[] = {
$jsglobalvariables
{ 0, 0, 0, 0 }
};
JSStaticFunction $jsnspace_functions[] = {
static JSStaticFunction $jsnspace_functions[] = {
$jsglobalfunctions
{ 0, 0, 0 }
};
JSClassDefinition $jsnspace_classDefinition;
static JSClassDefinition $jsnspace_classDefinition;
%}
/* -----------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
%insert(wrapper) %{
bool JS_registerClass(JSGlobalContextRef context, JSObjectRef parentObject,
SWIGINTERN bool JS_registerClass(JSGlobalContextRef context, JSObjectRef parentObject,
const char* className,
JSClassDefinition* definition) {
@ -14,7 +14,7 @@ bool JS_registerClass(JSGlobalContextRef context, JSObjectRef parentObject,
return true;
}
bool JS_registerNamespace(JSGlobalContextRef context,
SWIGINTERN bool JS_registerNamespace(JSGlobalContextRef context,
JSObjectRef namespaceObj, JSObjectRef parentNamespace,
const char* name)
{
@ -28,7 +28,7 @@ bool JS_registerNamespace(JSGlobalContextRef context,
}
bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object,
SWIGINTERN bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object,
const char* functionName, JSObjectCallAsFunctionCallback callback)
{
JSStringRef js_functionName = JSStringCreateWithUTF8CString(functionName);
@ -39,7 +39,7 @@ bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object,
return true;
}
bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
char buffer[256];
char msg[512];
@ -57,7 +57,7 @@ bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSString
return false;
}
JSValueRef JS_CharPtrToJSValue(JSContextRef context, char* cstr) {
SWIGINTERN JSValueRef JS_CharPtrToJSValue(JSContextRef context, char* cstr) {
JSValueRef val;
JSStringRef jsstring = JSStringCreateWithUTF8CString((char*) cstr);

View file

@ -16,7 +16,7 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
/**
* Creates a class template for a class with specified initialization function.
*/
v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
v8::HandleScope scope;
v8::Local<v8::FunctionTemplate> class_templ = v8::FunctionTemplate::New();
class_templ->SetClassName(v8::String::NewSymbol(symbol));
@ -36,7 +36,7 @@ v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol)
/**
* Registers a class method with given name for a given class template.
*/
void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8FunctionCallback _func) {
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
proto_templ->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func));
@ -45,7 +45,7 @@ void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, cons
/**
* Registers a class property with given name for a given class template.
*/
void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
@ -54,7 +54,7 @@ void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, cons
/**
* Registers a class method with given name for a given object.
*/
void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) {
obj->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func)->GetFunction());
}
@ -62,12 +62,12 @@ void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
/**
* Registers a class method with given name for a given object.
*/
void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
obj->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
}
void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
const SwigV8PropertyCallbackInfoVoid& info)
{
char buffer[256];