C90 fixes for Javascript JSC
This commit is contained in:
parent
9e56ae10cf
commit
59ff3e6a3a
4 changed files with 9 additions and 4 deletions
|
|
@ -402,6 +402,7 @@ static JSStaticFunction $jsnspace_functions[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static JSClassDefinition $jsnspace_classDefinition;
|
static JSClassDefinition $jsnspace_classDefinition;
|
||||||
|
static JSObjectRef $jsmangledname_object;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -412,7 +413,7 @@ static JSClassDefinition $jsnspace_classDefinition;
|
||||||
%{
|
%{
|
||||||
$jsmangledname_classDefinition.staticFunctions = $jsmangledname_functions;
|
$jsmangledname_classDefinition.staticFunctions = $jsmangledname_functions;
|
||||||
$jsmangledname_classDefinition.staticValues = $jsmangledname_values;
|
$jsmangledname_classDefinition.staticValues = $jsmangledname_values;
|
||||||
JSObjectRef $jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
$jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,12 @@ SWIG_From_dec(unsigned long)(unsigned long value)
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal_dec(unsigned long)(JSValueRef obj, unsigned long *val)
|
SWIG_AsVal_dec(unsigned long)(JSValueRef obj, unsigned long *val)
|
||||||
{
|
{
|
||||||
|
long longVal;
|
||||||
if(!JSValueIsNumber(context, obj)) {
|
if(!JSValueIsNumber(context, obj)) {
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
}
|
}
|
||||||
|
|
||||||
long longVal = (long) JSValueToNumber(context, obj, NULL);
|
longVal = (long) JSValueToNumber(context, obj, NULL);
|
||||||
|
|
||||||
if(longVal < 0) {
|
if(longVal < 0) {
|
||||||
return SWIG_OverflowError;
|
return SWIG_OverflowError;
|
||||||
|
|
@ -142,11 +143,12 @@ SWIG_From_dec(unsigned long long)(unsigned long long value)
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal_dec(unsigned long long)(JSValueRef obj, unsigned long long *val)
|
SWIG_AsVal_dec(unsigned long long)(JSValueRef obj, unsigned long long *val)
|
||||||
{
|
{
|
||||||
|
long long longVal;
|
||||||
if(!JSValueIsNumber(context, obj)) {
|
if(!JSValueIsNumber(context, obj)) {
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
||||||
|
|
||||||
if(longVal < 0) {
|
if(longVal < 0) {
|
||||||
return SWIG_OverflowError;
|
return SWIG_OverflowError;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
||||||
return JSValueMakeUndefined(context);
|
return JSValueMakeUndefined(context);
|
||||||
} else {
|
} else {
|
||||||
JSStringRef jsstring;
|
JSStringRef jsstring;
|
||||||
|
JSValueRef result;
|
||||||
if(size < 2) {
|
if(size < 2) {
|
||||||
char c[2];
|
char c[2];
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -63,7 +64,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
||||||
} else {
|
} else {
|
||||||
jsstring = JSStringCreateWithUTF8CString(carray);
|
jsstring = JSStringCreateWithUTF8CString(carray);
|
||||||
}
|
}
|
||||||
JSValueRef result = JSValueMakeString(context, jsstring);
|
result = JSValueMakeString(context, jsstring);
|
||||||
JSStringRelease(jsstring);
|
JSStringRelease(jsstring);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1792,6 +1792,7 @@ int JSCEmitter::emitNamespaces() {
|
||||||
namespace_definition.replace("$jsglobalvariables", variables)
|
namespace_definition.replace("$jsglobalvariables", variables)
|
||||||
.replace("$jsglobalfunctions", functions)
|
.replace("$jsglobalfunctions", functions)
|
||||||
.replace("$jsnspace", name_mangled)
|
.replace("$jsnspace", name_mangled)
|
||||||
|
.replace("$jsmangledname", name_mangled)
|
||||||
.pretty_print(f_wrap_cpp);
|
.pretty_print(f_wrap_cpp);
|
||||||
|
|
||||||
Template t_createNamespace(getTemplate("jsc_nspace_definition"));
|
Template t_createNamespace(getTemplate("jsc_nspace_definition"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue