fixed build error - ISO C90 forbids mixed declarations and code for jsc
This commit is contained in:
parent
c851e672bd
commit
15e197c807
1 changed files with 34 additions and 15 deletions
|
|
@ -1,15 +1,26 @@
|
||||||
%insert(init) %{
|
%insert(init) %{
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SWIG_JSC_SetModule(void *clientdata, swig_module_info *swig_module) {
|
SWIG_JSC_SetModule(void *clientdata, swig_module_info *swig_module) {
|
||||||
JSGlobalContextRef context = (JSGlobalContextRef)clientdata;
|
JSGlobalContextRef context;
|
||||||
|
JSObjectRef globalObject;
|
||||||
|
JSStringRef moduleName;
|
||||||
|
JSClassDefinition classDef;
|
||||||
|
JSClassRef classRef;
|
||||||
|
JSObjectRef object;
|
||||||
|
|
||||||
JSObjectRef globalObject = JSContextGetGlobalObject(context);
|
if(clientdata == 0){
|
||||||
JSStringRef moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
JSClassDefinition classDef = kJSClassDefinitionEmpty;
|
context = (JSGlobalContextRef)clientdata;
|
||||||
JSClassRef classRef = JSClassCreate(&classDef);
|
|
||||||
|
|
||||||
JSObjectRef object = JSObjectMake(context, classRef, NULL);
|
globalObject = JSContextGetGlobalObject(context);
|
||||||
|
moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
||||||
|
|
||||||
|
classDef = kJSClassDefinitionEmpty;
|
||||||
|
classRef = JSClassCreate(&classDef);
|
||||||
|
|
||||||
|
object = JSObjectMake(context, classRef, NULL);
|
||||||
JSObjectSetPrivate(object, (void*)swig_module);
|
JSObjectSetPrivate(object, (void*)swig_module);
|
||||||
|
|
||||||
JSObjectSetProperty(context, globalObject, moduleName, object, kJSPropertyAttributeNone, NULL);
|
JSObjectSetProperty(context, globalObject, moduleName, object, kJSPropertyAttributeNone, NULL);
|
||||||
|
|
@ -19,23 +30,31 @@ SWIG_JSC_SetModule(void *clientdata, swig_module_info *swig_module) {
|
||||||
}
|
}
|
||||||
SWIGRUNTIME swig_module_info *
|
SWIGRUNTIME swig_module_info *
|
||||||
SWIG_JSC_GetModule(void *clientdata) {
|
SWIG_JSC_GetModule(void *clientdata) {
|
||||||
JSGlobalContextRef context = (JSGlobalContextRef)clientdata;
|
JSGlobalContextRef context;
|
||||||
|
JSObjectRef globalObject;
|
||||||
|
JSStringRef moduleName;
|
||||||
|
JSValueRef value;
|
||||||
|
JSObjectRef object;
|
||||||
|
|
||||||
JSObjectRef globalObject = JSContextGetGlobalObject(context);
|
if(clientdata == 0){
|
||||||
JSStringRef moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
context = (JSGlobalContextRef)clientdata;
|
||||||
|
|
||||||
|
globalObject = JSContextGetGlobalObject(context);
|
||||||
|
moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
||||||
|
|
||||||
if(JSObjectHasProperty(context, globalObject, moduleName) == false) {
|
if(JSObjectHasProperty(context, globalObject, moduleName) == false) {
|
||||||
JSStringRelease(moduleName);
|
JSStringRelease(moduleName);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSValueRef value = JSObjectGetProperty(context, globalObject, moduleName, NULL);
|
value = JSObjectGetProperty(context, globalObject, moduleName, NULL);
|
||||||
|
object = JSValueToObject(context, value, NULL);
|
||||||
JSObjectRef object = JSValueToObject(context, value, NULL);
|
|
||||||
swig_module_info *swig_module = (swig_module_info*)JSObjectGetPrivate(object);
|
|
||||||
|
|
||||||
JSStringRelease(moduleName);
|
JSStringRelease(moduleName);
|
||||||
return swig_module;
|
|
||||||
|
return (swig_module_info*)JSObjectGetPrivate(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule(clientdata)
|
#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule(clientdata)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue