Merge latest master into doxygen branch again.
Update Doxygen-specific Python unit tests to work with the new indentation. Update one of Doxygen-specific Java tests to still build with the new handling of srcdir.
This commit is contained in:
commit
6cce652762
557 changed files with 4998 additions and 4138 deletions
|
|
@ -27,8 +27,7 @@ scm_module_variable (SCM module, SCM sym)
|
|||
#endif
|
||||
|
||||
#if SCM_MAJOR_VERSION >= 2
|
||||
// scm_c_define_gsubr takes a different parameter type
|
||||
// depending on the guile version
|
||||
/* scm_c_define_gsubr takes a different parameter type depending on the guile version */
|
||||
|
||||
typedef scm_t_subr swig_guile_proc;
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -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,11 +105,16 @@ 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);
|
||||
if(t) free(t);
|
||||
if(t) {
|
||||
if (t->swigCMemOwn) {
|
||||
free (($jstype)t->swigCObject);
|
||||
}
|
||||
JSObjectSetPrivate(thisObject, NULL);
|
||||
free(t);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -121,14 +126,18 @@ 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) {
|
||||
$jstype arg1 = ($jstype)t->swigCObject;
|
||||
${destructor_action}
|
||||
if(t) {
|
||||
if (t->swigCMemOwn) {
|
||||
$jstype arg1 = ($jstype)t->swigCObject;
|
||||
${destructor_action}
|
||||
}
|
||||
/* remove the private data to make sure that it isn't accessed elsewhere */
|
||||
JSObjectSetPrivate(thisObject, NULL);
|
||||
free(t);
|
||||
}
|
||||
if(t) free(t);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -140,7 +149,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;
|
||||
|
|
@ -150,7 +159,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef
|
|||
|
||||
goto fail;
|
||||
fail:
|
||||
return NULL;
|
||||
return JSValueMakeUndefined(context);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -162,7 +171,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 +192,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;
|
||||
|
|
@ -195,7 +204,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
|
|||
|
||||
goto fail;
|
||||
fail:
|
||||
return NULL;
|
||||
return JSValueMakeUndefined(context);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -208,7 +217,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;
|
||||
|
|
@ -220,7 +229,7 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
|
|||
|
||||
goto fail;
|
||||
fail:
|
||||
return NULL;
|
||||
return JSValueMakeUndefined(context);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -232,7 +241,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 +300,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 +317,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 }
|
||||
};
|
||||
|
|
@ -341,7 +350,7 @@ JSStaticFunction $jsmangledname_functions[] = {
|
|||
$jsmangledname_classDefinition.staticFunctions = $jsmangledname_staticFunctions;
|
||||
$jsmangledname_classDefinition.staticValues = $jsmangledname_staticValues;
|
||||
$jsmangledname_classDefinition.callAsConstructor = $jsctor;
|
||||
$jsmangledname_classDefinition.finalize = $jsdtor;
|
||||
$jsmangledname_objectDefinition.finalize = $jsdtor;
|
||||
$jsmangledname_objectDefinition.staticValues = $jsmangledname_values;
|
||||
$jsmangledname_objectDefinition.staticFunctions = $jsmangledname_functions;
|
||||
$jsclass_inheritance
|
||||
|
|
@ -382,17 +391,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;
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -7,13 +7,28 @@
|
|||
#define SWIG_exception(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
||||
#define SWIG_fail goto fail
|
||||
|
||||
void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
|
||||
JSStringRef message = JSStringCreateWithUTF8CString(type);
|
||||
*exception = JSValueMakeString(context, message);
|
||||
JSStringRelease(message);
|
||||
SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
|
||||
JSStringRef message = JSStringCreateWithUTF8CString(type);
|
||||
JSValueRef error_arguments[1];
|
||||
JSObjectRef exception_object;
|
||||
JSValueRef exception_value;
|
||||
exception_value = JSValueMakeString(context, message);
|
||||
/* Converting the result to an object will let JavascriptCore add
|
||||
"sourceURL" (file) and "line" (number) and "message" to the exception,
|
||||
instead of just returning a raw string. This is extremely important for debugging your errors.
|
||||
Using JSObjectMakeError is better than JSValueToObject because the latter only populates
|
||||
"sourceURL" and "line", but not "message" or any others I don't know about.
|
||||
*/
|
||||
error_arguments[0] = exception_value;
|
||||
exception_object = JSObjectMakeError(context, 1, error_arguments, NULL);
|
||||
|
||||
/* Return the exception_object */
|
||||
*exception = exception_object;
|
||||
|
||||
JSStringRelease(message);
|
||||
}
|
||||
|
||||
void SWIG_JSC_exception(JSContextRef context, JSValueRef *exception, int code, const char* msg) {
|
||||
SWIGRUNTIME void SWIG_JSC_exception(JSContextRef context, JSValueRef *exception, int code, const char* msg) {
|
||||
SWIG_Javascript_Raise(context, exception, msg);
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +43,7 @@ typedef struct {
|
|||
swig_type_info *info;
|
||||
} SwigPrivData;
|
||||
|
||||
JSValueRef _wrap_SwigObject_disown(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
SWIGRUNTIME JSValueRef _wrap_SwigObject_disown(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
{
|
||||
JSValueRef jsresult;
|
||||
|
||||
|
|
@ -41,7 +56,7 @@ JSValueRef _wrap_SwigObject_disown(JSContextRef context, JSObjectRef function, J
|
|||
return jsresult;
|
||||
}
|
||||
|
||||
JSValueRef _wrap_SwigObject_getCPtr(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
SWIGRUNTIME JSValueRef _wrap_SwigObject_getCPtr(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
{
|
||||
JSValueRef jsresult;
|
||||
long result;
|
||||
|
|
@ -55,7 +70,7 @@ JSValueRef _wrap_SwigObject_getCPtr(JSContextRef context, JSObjectRef function,
|
|||
return jsresult;
|
||||
}
|
||||
|
||||
JSValueRef _wrap_SwigObject_equals(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
SWIGRUNTIME JSValueRef _wrap_SwigObject_equals(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
{
|
||||
JSValueRef jsresult;
|
||||
bool result;
|
||||
|
|
@ -72,13 +87,13 @@ JSValueRef _wrap_SwigObject_equals(JSContextRef context, JSObjectRef function, J
|
|||
return jsresult;
|
||||
}
|
||||
|
||||
JSStaticValue _SwigObject_values[] = {
|
||||
SWIGRUNTIME JSStaticValue _SwigObject_values[] = {
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
JSStaticFunction _SwigObject_functions[] = {
|
||||
SWIGRUNTIME JSStaticFunction _SwigObject_functions[] = {
|
||||
{
|
||||
"disown",_wrap_SwigObject_disown, kJSPropertyAttributeNone
|
||||
},
|
||||
|
|
@ -93,13 +108,15 @@ JSStaticFunction _SwigObject_functions[] = {
|
|||
}
|
||||
};
|
||||
|
||||
JSClassDefinition _SwigObject_objectDefinition;
|
||||
SWIGRUNTIME JSClassDefinition _SwigObject_objectDefinition;
|
||||
|
||||
JSClassRef _SwigObject_classRef;
|
||||
SWIGRUNTIME JSClassRef _SwigObject_classRef;
|
||||
|
||||
|
||||
int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef objRef, void** ptr, swig_type_info *info, int flags) {
|
||||
SwigPrivData *cdata = (SwigPrivData *) JSObjectGetPrivate(objRef);
|
||||
SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef objRef, void** ptr, swig_type_info *info, int flags) {
|
||||
SwigPrivData *cdata;
|
||||
|
||||
cdata = (SwigPrivData *) JSObjectGetPrivate(objRef);
|
||||
if(cdata == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
@ -127,12 +144,20 @@ int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef objRef, void**
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, void** ptr, swig_type_info *info, int flags) {
|
||||
SWIGRUNTIME int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, void** ptr, swig_type_info *info, int flags) {
|
||||
JSObjectRef objRef;
|
||||
|
||||
/* special case: JavaScript null => C NULL pointer */
|
||||
if(JSValueIsNull(context, valRef)) {
|
||||
*ptr=0;
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
if(!JSValueIsObject(context, valRef)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
JSObjectRef objRef = JSValueToObject(context, valRef, NULL);
|
||||
objRef = JSValueToObject(context, valRef, NULL);
|
||||
if(objRef == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
@ -140,18 +165,28 @@ int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, void** ptr, swi
|
|||
return SWIG_JSC_ConvertInstancePtr(context, objRef, ptr, info, flags);
|
||||
}
|
||||
|
||||
JSObjectRef SWIG_JSC_NewPointerObj(JSContextRef context, void *ptr, swig_type_info *info, int flags) {
|
||||
|
||||
SWIGRUNTIME JSObjectRef SWIG_JSC_NewPointerObj(JSContextRef context, void *ptr, swig_type_info *info, int flags) {
|
||||
JSClassRef classRef;
|
||||
JSObjectRef result;
|
||||
SwigPrivData *cdata;
|
||||
|
||||
if (ptr == NULL) {
|
||||
// HACK: it is not possible to use JSValueToObject (causing seg-fault)
|
||||
// This static cast turned out to be a workaround
|
||||
// In future, we should change the interface of this method
|
||||
// to return JSValueRef instead of JSObjectRef.
|
||||
return (JSObjectRef) JSValueMakeNull(context);
|
||||
}
|
||||
|
||||
if(info->clientdata == NULL) {
|
||||
classRef = _SwigObject_classRef;
|
||||
} else {
|
||||
classRef = (JSClassRef) info->clientdata;
|
||||
}
|
||||
|
||||
JSObjectRef result = JSObjectMake(context, classRef, NULL);
|
||||
result = JSObjectMake(context, classRef, NULL);
|
||||
|
||||
SwigPrivData* cdata = (SwigPrivData*) malloc(sizeof(SwigPrivData));
|
||||
cdata = (SwigPrivData*) malloc(sizeof(SwigPrivData));
|
||||
cdata->swigCObject = ptr;
|
||||
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
|
||||
cdata->info = info;
|
||||
|
|
@ -181,18 +216,18 @@ typedef struct {
|
|||
swig_type_info *type;
|
||||
} SwigPackedData;
|
||||
|
||||
JSStaticValue _SwigPackedData_values[] = {
|
||||
SWIGRUNTIME JSStaticValue _SwigPackedData_values[] = {
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
JSStaticFunction _SwigPackedData_functions[] = {
|
||||
SWIGRUNTIME JSStaticFunction _SwigPackedData_functions[] = {
|
||||
{
|
||||
0, 0, 0
|
||||
}
|
||||
};
|
||||
JSClassDefinition _SwigPackedData_objectDefinition;
|
||||
JSClassRef _SwigPackedData_classRef;
|
||||
SWIGRUNTIME JSClassDefinition _SwigPackedData_objectDefinition;
|
||||
SWIGRUNTIME JSClassRef _SwigPackedData_classRef;
|
||||
|
||||
SWIGRUNTIMEINLINE
|
||||
int SwigJSCPacked_Check(JSContextRef context, JSValueRef valRef) {
|
||||
|
|
@ -243,7 +278,7 @@ JSValueRef SWIG_JSC_NewPackedObj(JSContextRef context, void *data, size_t size,
|
|||
}
|
||||
|
||||
/* SwigPackedData wrappers */
|
||||
|
||||
SWIGRUNTIME
|
||||
void _wrap_SwigPackedData_delete(JSObjectRef obj)
|
||||
{
|
||||
SwigPackedData* cdata = (SwigPackedData*) JSObjectGetPrivate(obj);
|
||||
|
|
@ -262,7 +297,7 @@ void _wrap_SwigPackedData_delete(JSObjectRef obj)
|
|||
* Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg)
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
SWIGRUNTIME
|
||||
unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) {
|
||||
static JSStringRef LENGTH = 0;
|
||||
JSValueRef exception = NULL;
|
||||
|
|
@ -295,4 +330,5 @@ JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueR
|
|||
|
||||
length = SWIGJSC_ArrayLength(context, arr);
|
||||
JSObjectSetPropertyAtIndex(context, arr, length, obj, 0);
|
||||
return arr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ SWIG_JSC_AsCharPtrAndSize(JSContextRef context, JSValueRef valRef, char** cptr,
|
|||
if(JSValueIsString(context, valRef)) {
|
||||
JSStringRef js_str = JSValueToStringCopy(context, valRef, NULL);
|
||||
size_t len = JSStringGetMaximumUTF8CStringSize(js_str);
|
||||
char* cstr = (char*) malloc(len * sizeof(char));
|
||||
char* cstr = (char*) %new_array(len, char);
|
||||
/* JSStringGetUTF8CString returns the length including 0-terminator */
|
||||
len = JSStringGetUTF8CString(js_str, cstr, len);
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
|||
} else {
|
||||
JSStringRef jsstring;
|
||||
if(size < 2) {
|
||||
char c[size+1];
|
||||
char c[2];
|
||||
int i;
|
||||
for(i=0;i<size;++i) {
|
||||
c[i] = carray[i];
|
||||
|
|
|
|||
|
|
@ -1,69 +1 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_string.i
|
||||
*
|
||||
* Typemaps for const std::string&.
|
||||
* To use non-const std::string references use the following %apply:
|
||||
* %apply const std::string & {std::string &};
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
std::string SWIGJSC_valueToString(JSContextRef context, JSValueRef value) {
|
||||
JSStringRef jsstring = JSValueToStringCopy(context, value, /* JSValueRef *exception */ 0);
|
||||
unsigned int length = JSStringGetLength(jsstring);
|
||||
char *cstr = new char[length + 1];
|
||||
JSStringGetUTF8CString(jsstring, cstr, length + 1);
|
||||
|
||||
// create a copy
|
||||
std::string result(cstr);
|
||||
|
||||
JSStringRelease(jsstring);
|
||||
delete[] cstr;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValueRef SWIGJSC_stringToValue(JSContextRef context, const std::string& s)
|
||||
{
|
||||
JSValueRef result;
|
||||
JSStringRef jsstring = JSStringCreateWithUTF8CString(s.c_str());
|
||||
result = JSValueMakeString(context, jsstring);
|
||||
JSStringRelease(jsstring);
|
||||
return result;
|
||||
}
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
%naturalvar string;
|
||||
|
||||
class string;
|
||||
|
||||
|
||||
%typemap(in) string
|
||||
%{
|
||||
$1 = SWIGJSC_valueToString(context, $input);
|
||||
%}
|
||||
|
||||
%typemap(in) const string &
|
||||
%{
|
||||
$1 = new std::string(SWIGJSC_valueToString(context, $input));
|
||||
%}
|
||||
|
||||
%typemap(freearg) const string &
|
||||
%{
|
||||
delete $1;
|
||||
%}
|
||||
|
||||
%typemap(out) string
|
||||
%{
|
||||
$result = SWIGJSC_stringToValue(context, $1);
|
||||
%}
|
||||
|
||||
%typemap(out) const string &
|
||||
%{
|
||||
$result = SWIGJSC_stringToValue(context, *$1);
|
||||
%}
|
||||
|
||||
}
|
||||
%include <typemaps/std_string.swg>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -113,6 +113,6 @@ void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*modul
|
|||
}
|
||||
|
||||
#if defined(BUILDING_NODE_EXTENSION)
|
||||
NODE_MODULE($jsname, $jsname_initialize);
|
||||
NODE_MODULE($jsname, $jsname_initialize)
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,11 @@ void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void* ptr, swig_type_info
|
|||
|
||||
int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info *info, int flags) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
/* special case: JavaScript null => C NULL pointer */
|
||||
if(valRef->IsNull()) {
|
||||
*ptr=0;
|
||||
return SWIG_OK;
|
||||
}
|
||||
if(!valRef->IsObject()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
|
@ -228,10 +232,14 @@ int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info
|
|||
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
|
||||
}
|
||||
|
||||
v8::Handle<v8::Object> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
v8::HandleScope scope;
|
||||
v8::Handle<v8::FunctionTemplate> class_templ;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return scope.Close(v8::Null());
|
||||
}
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x031900)
|
||||
if(info->clientdata != 0) {
|
||||
class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
|
||||
|
|
|
|||
|
|
@ -1,79 +1 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_string.i
|
||||
*
|
||||
* Typemaps for std::string and const std::string&.
|
||||
*
|
||||
* To use non-const std::string references use the following %apply:
|
||||
* %apply const std::string & {std::string &};
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%fragment("SWIGV8_valueToString", "header", fragment="SWIG_AsCharPtrAndSize") {
|
||||
std::string* SWIGV8_valueToStringPtr(v8::Handle<v8::Value> val) {
|
||||
|
||||
if (!val->IsString()) return 0;
|
||||
|
||||
int alloc;
|
||||
size_t size;
|
||||
char* chars;
|
||||
int res = SWIG_AsCharPtrAndSize(val, &chars, &size, &alloc);
|
||||
|
||||
if(res != SWIG_OK) {
|
||||
v8::ThrowException(v8::Exception::TypeError(v8::String::New("Could not convert to string.")));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// copies the data (again)
|
||||
std::string *str = new std::string(chars);
|
||||
|
||||
if (alloc) delete[] chars;
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SWIGV8_stringToValue", "header", fragment="SWIG_FromCharPtrAndSize") {
|
||||
v8::Handle<v8::Value> SWIGV8_stringToValue(const std::string &str) {
|
||||
return SWIG_FromCharPtrAndSize(str.c_str(), str.length());
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
%naturalvar string;
|
||||
|
||||
class string;
|
||||
|
||||
%typemap(in, fragment="SWIGV8_valueToString") string (std::string* tmp)
|
||||
%{
|
||||
tmp = SWIGV8_valueToStringPtr($input);
|
||||
$1 = *tmp;
|
||||
if (tmp == 0) { v8::ThrowException(v8::Exception::TypeError(v8::String::New("Null pointer."))); goto fail; }
|
||||
if (tmp) delete tmp;
|
||||
%}
|
||||
|
||||
%typemap(in, fragment="SWIGV8_valueToString") const string &
|
||||
%{
|
||||
$1 = SWIGV8_valueToStringPtr($input);
|
||||
if ($1 == 0) { v8::ThrowException(v8::Exception::TypeError(v8::String::New("Null pointer."))); goto fail; }
|
||||
%}
|
||||
|
||||
%typemap(freearg) const string &
|
||||
%{
|
||||
if ($1) delete $1;
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="SWIGV8_stringToValue") string
|
||||
%{
|
||||
$result = SWIGV8_stringToValue($1);
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="SWIGV8_stringToValue") const string &
|
||||
%{
|
||||
$result = SWIGV8_stringToValue(*$1);
|
||||
%}
|
||||
|
||||
}
|
||||
%include <typemaps/std_string.swg>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ void swiglua_ref_clear(SWIGLUA_REF* pref){
|
|||
}
|
||||
|
||||
void swiglua_ref_set(SWIGLUA_REF* pref,lua_State* L,int idx){
|
||||
// swiglua_ref_clear(pref); /* just in case */
|
||||
pref->L=L;
|
||||
lua_pushvalue(L,idx); /* copy obj to top */
|
||||
pref->ref=luaL_ref(L,LUA_REGISTRYINDEX); /* remove obj from top & put into registry */
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ typedef struct swig_lua_class {
|
|||
swig_lua_method *methods;
|
||||
swig_lua_attribute *attributes;
|
||||
swig_lua_namespace *cls_static;
|
||||
swig_lua_method *metatable; // 0 for -eluac
|
||||
swig_lua_method *metatable; /* 0 for -eluac */
|
||||
struct swig_lua_class **bases;
|
||||
const char **base_names;
|
||||
} swig_lua_class;
|
||||
|
|
@ -392,8 +392,9 @@ static int swig_lua_elua_emulate_unique_key;
|
|||
/* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
|
||||
SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
|
||||
{
|
||||
int i, table_parsed, parsed_tables_array, target_table;
|
||||
assert(lua_istable(L,-1));
|
||||
int target_table = lua_gettop(L);
|
||||
target_table = lua_gettop(L);
|
||||
/* Get the registry where we put all parsed tables to avoid loops */
|
||||
lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
|
||||
if(lua_isnil(L,-1)) {
|
||||
|
|
@ -402,11 +403,10 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
|
|||
lua_pushvalue(L,-1);
|
||||
lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key));
|
||||
}
|
||||
int parsed_tables_array = lua_gettop(L);
|
||||
parsed_tables_array = lua_gettop(L);
|
||||
lua_pushvalue(L,target_table);
|
||||
lua_rawsetp(L, parsed_tables_array, table);
|
||||
int i;
|
||||
int table_parsed = 0;
|
||||
table_parsed = 0;
|
||||
const int SWIGUNUSED pairs_start = lua_gettop(L);
|
||||
for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
|
||||
{
|
||||
|
|
@ -606,7 +606,7 @@ SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
|
|||
/* helper function - register namespace methods and attributes into namespace */
|
||||
SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
|
||||
{
|
||||
int i = 0;
|
||||
int i;
|
||||
/* There must be namespace table (not metatable) at the top of the stack */
|
||||
assert(lua_istable(L,-1));
|
||||
SWIG_Lua_InstallConstants(L, ns->ns_constants);
|
||||
|
|
@ -630,10 +630,12 @@ SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *
|
|||
/* Register all classes in the namespace */
|
||||
SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
|
||||
{
|
||||
swig_lua_class **classes;
|
||||
|
||||
/* There must be a module/namespace table at the top of the stack */
|
||||
assert(lua_istable(L,-1));
|
||||
|
||||
swig_lua_class **classes = ns->ns_classes;
|
||||
classes = ns->ns_classes;
|
||||
|
||||
if( classes != 0 ) {
|
||||
while(*classes != 0) {
|
||||
|
|
@ -650,6 +652,7 @@ SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace
|
|||
*/
|
||||
SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
|
||||
{
|
||||
swig_lua_namespace **sub_namespace;
|
||||
/* 1 argument - table on the top of the stack */
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */
|
||||
|
|
@ -681,7 +684,7 @@ SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns
|
|||
/* Register classes */
|
||||
SWIG_Lua_add_namespace_classes(L,ns);
|
||||
|
||||
swig_lua_namespace **sub_namespace = ns->ns_namespaces;
|
||||
sub_namespace = ns->ns_namespaces;
|
||||
if( sub_namespace != 0) {
|
||||
while(*sub_namespace != 0) {
|
||||
SWIG_Lua_namespace_register(L, *sub_namespace, 1);
|
||||
|
|
@ -705,46 +708,6 @@ SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns
|
|||
|
||||
SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
|
||||
|
||||
/* Macros for iteration among class bases */
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
||||
#define SWIG_LUA_INIT_BASE_SEARCH(bases_count)\
|
||||
(void)swig_type;\
|
||||
SWIG_Lua_get_table(L,".bases");\
|
||||
assert(lua_istable(L,-1));\
|
||||
bases_count = lua_rawlen(L,-1);\
|
||||
const int bases_table = lua_gettop(L);
|
||||
#define SWIG_LUA_GET_BASE_METATABLE(i,base_swig_type, valid)\
|
||||
lua_rawgeti(L,bases_table,i+1);\
|
||||
base_swig_type = 0;\
|
||||
if(lua_isnil(L,-1)) {\
|
||||
valid = 0;\
|
||||
lua_pop(L,1);\
|
||||
} else\
|
||||
valid = 1;
|
||||
|
||||
#else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
|
||||
|
||||
#define SWIG_LUA_INIT_BASE_SEARCH(bases_count)\
|
||||
assert(swig_type!=0);\
|
||||
swig_module_info *module=SWIG_GetModule(L);\
|
||||
swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;\
|
||||
const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;\
|
||||
bases_count = 0;\
|
||||
for(;base_names[bases_count];bases_count++);/* get length of bases */
|
||||
|
||||
#define SWIG_LUA_GET_BASE_METATABLE(i,base_swig_type, valid)\
|
||||
swig_lua_class *base_class = bases[i];\
|
||||
if(!base_class)\
|
||||
valid = 0;\
|
||||
else {\
|
||||
valid = 1;\
|
||||
SWIG_Lua_get_class_metatable(L,base_class->fqname);\
|
||||
base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);\
|
||||
assert(base_swig_type != 0);\
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
|
||||
|
||||
SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
|
||||
|
|
@ -753,27 +716,70 @@ SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED
|
|||
/* first_arg - position of the object in stack. Everything that is above are arguments
|
||||
* and is passed to every evocation of the func */
|
||||
int last_arg = lua_gettop(L);/* position of last argument */
|
||||
lua_getmetatable(L,first_arg);
|
||||
int original_metatable = last_arg + 1;
|
||||
size_t bases_count;
|
||||
SWIG_LUA_INIT_BASE_SEARCH(bases_count);
|
||||
int result = SWIG_ERROR;
|
||||
int bases_table;
|
||||
(void)swig_type;
|
||||
lua_getmetatable(L,first_arg);
|
||||
|
||||
/* initialise base search */
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
||||
SWIG_Lua_get_table(L,".bases");
|
||||
assert(lua_istable(L,-1));
|
||||
bases_count = lua_rawlen(L,-1);
|
||||
bases_table = lua_gettop(L);
|
||||
#else
|
||||
/* In elua .bases table doesn't exist. Use table from swig_lua_class */
|
||||
(void)bases_table;
|
||||
assert(swig_type!=0);
|
||||
swig_module_info *module=SWIG_GetModule(L);
|
||||
swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;
|
||||
const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;
|
||||
bases_count = 0;
|
||||
for(;base_names[bases_count];
|
||||
bases_count++);/* get length of bases */
|
||||
#endif
|
||||
|
||||
if(ret)
|
||||
*ret = 0;
|
||||
if(bases_count>0)
|
||||
{
|
||||
int to_remove;
|
||||
size_t i;
|
||||
int j;
|
||||
int subcall_last_arg;
|
||||
int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */
|
||||
int valid = 1;
|
||||
swig_type_info *base_swig_type = 0;
|
||||
for(j=first_arg;j<=last_arg;j++)
|
||||
lua_pushvalue(L,j);
|
||||
int subcall_last_arg = lua_gettop(L);
|
||||
swig_type_info *base_swig_type = 0;
|
||||
subcall_last_arg = lua_gettop(L);
|
||||
|
||||
/* Trick: temporarily replacing original metatable with metatable for base class and call getter */
|
||||
for(i=0;i<bases_count;i++) {
|
||||
SWIG_LUA_GET_BASE_METATABLE(i,base_swig_type,valid);
|
||||
/* Iteration through class bases */
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
||||
lua_rawgeti(L,bases_table,i+1);
|
||||
base_swig_type = 0;
|
||||
if(lua_isnil(L,-1)) {
|
||||
valid = 0;
|
||||
lua_pop(L,1);
|
||||
} else {
|
||||
valid = 1;
|
||||
}
|
||||
#else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
|
||||
swig_lua_class *base_class = bases[i];
|
||||
if(!base_class) {
|
||||
valid = 0;
|
||||
} else {
|
||||
valid = 1;
|
||||
SWIG_Lua_get_class_metatable(L,base_class->fqname);
|
||||
base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);
|
||||
assert(base_swig_type != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!valid)
|
||||
continue;
|
||||
assert(lua_isuserdata(L, subcall_first_arg));
|
||||
|
|
@ -789,7 +795,7 @@ SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED
|
|||
lua_pushvalue(L,original_metatable);
|
||||
lua_setmetatable(L,first_arg);
|
||||
/* Clear - remove everything between last_arg and subcall_last_arg including */
|
||||
const int to_remove = subcall_last_arg - last_arg;
|
||||
to_remove = subcall_last_arg - last_arg;
|
||||
for(j=0;j<to_remove;j++)
|
||||
lua_remove(L,last_arg+1);
|
||||
} else {
|
||||
|
|
@ -810,6 +816,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
|
|||
(1) userdata (not the meta table)
|
||||
(2) string name of the attribute
|
||||
*/
|
||||
int bases_search_result;
|
||||
int substack_start = lua_gettop(L)-2;
|
||||
assert(first_arg == substack_start+1);
|
||||
lua_checkstack(L,5);
|
||||
|
|
@ -862,8 +869,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
|
|||
/* Remove the metatable */
|
||||
lua_pop(L,1);
|
||||
/* Search in base classes */
|
||||
|
||||
int bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
|
||||
bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
|
||||
return bases_search_result; /* sorry not known */
|
||||
}
|
||||
|
||||
|
|
@ -875,11 +881,14 @@ SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
|
|||
(1) userdata (not the meta table)
|
||||
(2) string name of the attribute
|
||||
*/
|
||||
assert(lua_isuserdata(L,1));
|
||||
swig_lua_userdata *usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
swig_type_info *type = usr->type;
|
||||
int result;
|
||||
swig_lua_userdata *usr;
|
||||
swig_type_info *type;
|
||||
int ret = 0;
|
||||
int result = SWIG_Lua_class_do_get(L,type,1,&ret);
|
||||
assert(lua_isuserdata(L,1));
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
type = usr->type;
|
||||
result = SWIG_Lua_class_do_get(L,type,1,&ret);
|
||||
if(result == SWIG_OK)
|
||||
return ret;
|
||||
|
||||
|
|
@ -897,6 +906,7 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
|
|||
(3) any for the new value
|
||||
*/
|
||||
|
||||
int bases_search_result;
|
||||
int substack_start = lua_gettop(L) - 3;
|
||||
lua_checkstack(L,5);
|
||||
assert(lua_isuserdata(L,substack_start+1)); /* just in case */
|
||||
|
|
@ -940,7 +950,7 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
|
|||
|
||||
lua_pop(L,1); /* remove metatable */
|
||||
/* Search among bases */
|
||||
int bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
|
||||
bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
|
||||
if(ret)
|
||||
assert(*ret == 0);
|
||||
assert(lua_gettop(L) == substack_start + 3);
|
||||
|
|
@ -957,11 +967,14 @@ SWIGINTERN int SWIG_Lua_class_set(lua_State *L)
|
|||
(2) string name of the attribute
|
||||
(3) any for the new value
|
||||
*/
|
||||
assert(lua_isuserdata(L,1));
|
||||
swig_lua_userdata *usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
swig_type_info *type = usr->type;
|
||||
int ret = 0;
|
||||
int result = SWIG_Lua_class_do_set(L,type,1,&ret);
|
||||
int result;
|
||||
swig_lua_userdata *usr;
|
||||
swig_type_info *type;
|
||||
assert(lua_isuserdata(L,1));
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
type = usr->type;
|
||||
result = SWIG_Lua_class_do_set(L,type,1,&ret);
|
||||
if(result != SWIG_OK) {
|
||||
SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method.");
|
||||
lua_error(L);
|
||||
|
|
@ -997,13 +1010,15 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
|
|||
{
|
||||
/* there should be 1 param passed in
|
||||
(1) userdata (not the metatable) */
|
||||
const char *className;
|
||||
void* userData;
|
||||
assert(lua_isuserdata(L,1)); /* just in case */
|
||||
void* userData = lua_touserdata(L,1); /* get the userdata address for later */
|
||||
userData = lua_touserdata(L,1); /* get the userdata address for later */
|
||||
lua_getmetatable(L,1); /* get the meta table */
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
|
||||
lua_getfield(L, -1, ".type");
|
||||
const char *className = lua_tostring(L, -1);
|
||||
className = lua_tostring(L, -1);
|
||||
|
||||
lua_pushfstring(L, "<%s userdata: %p>", className, userData);
|
||||
return 1;
|
||||
|
|
@ -1022,6 +1037,23 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* lua callable function to compare userdata's value
|
||||
the issue is that two userdata may point to the same thing
|
||||
but to lua, they are different objects */
|
||||
SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
|
||||
{
|
||||
int result;
|
||||
swig_lua_userdata *usr1,*usr2;
|
||||
if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
|
||||
return 0; /* nil reply */
|
||||
usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
|
||||
/*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
|
||||
result=(usr1->ptr==usr2->ptr);
|
||||
lua_pushboolean(L,result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* populate table at the top of the stack with metamethods that ought to be inherited */
|
||||
SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
|
||||
{
|
||||
|
|
@ -1231,10 +1263,10 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
|
|||
SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int i;
|
||||
size_t bases_count = 0;
|
||||
/* Add bases to .bases table */
|
||||
SWIG_Lua_get_table(L,".bases");
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
size_t bases_count = 0;
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
|
||||
|
|
@ -1289,7 +1321,7 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration
|
|||
|
||||
/* The real function that resolves a metamethod.
|
||||
* Function searches given class and all it's bases(recursively) for first instance of something that is
|
||||
* not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actuall metamethod implementation
|
||||
* not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation
|
||||
* and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
|
||||
* answer.
|
||||
* Returns 1 if found, 0 otherwise.
|
||||
|
|
@ -1303,6 +1335,9 @@ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class
|
|||
int skip_check)
|
||||
{
|
||||
/* This function is called recursively */
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
if (!skip_check) {
|
||||
SWIG_Lua_get_class_metatable(L, clss->fqname);
|
||||
lua_pushvalue(L, metamethod_name_idx);
|
||||
|
|
@ -1319,8 +1354,6 @@ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class
|
|||
}
|
||||
|
||||
/* Forwarding calls to bases */
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
|
||||
|
|
@ -1335,21 +1368,26 @@ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class
|
|||
* and calls it */
|
||||
SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
|
||||
{
|
||||
int numargs;
|
||||
int metamethod_name_idx;
|
||||
const swig_lua_class* clss;
|
||||
int result;
|
||||
|
||||
lua_checkstack(L,5);
|
||||
const int numargs = lua_gettop(L); /* number of arguments to pass to actuall metamethod */
|
||||
numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
|
||||
|
||||
/* Get upvalues from closure */
|
||||
lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
|
||||
const int metamethod_name_idx = lua_gettop(L);
|
||||
metamethod_name_idx = lua_gettop(L);
|
||||
|
||||
lua_pushvalue(L, lua_upvalueindex(2));
|
||||
const swig_lua_class* clss = (const swig_lua_class*)(lua_touserdata(L,-1));
|
||||
clss = (const swig_lua_class*)(lua_touserdata(L,-1));
|
||||
lua_pop(L,1); /* remove lightuserdata with clss from stack */
|
||||
|
||||
/* Actuall work */
|
||||
const int result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
|
||||
/* Actual work */
|
||||
result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
|
||||
if (!result) {
|
||||
SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actuall metamethod. Memory corruption is most likely explanation.");
|
||||
SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation.");
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1367,10 +1405,14 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
|
|||
*/
|
||||
SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
|
||||
{
|
||||
int key_index;
|
||||
int success = 0;
|
||||
int i = 0;
|
||||
|
||||
/* metamethod name - on the top of the stack */
|
||||
assert(lua_isstring(L,-1));
|
||||
|
||||
const int key_index = lua_gettop(L);
|
||||
key_index = lua_gettop(L);
|
||||
|
||||
/* Check whether method is already defined in metatable */
|
||||
lua_pushvalue(L,key_index); /* copy of the key */
|
||||
|
|
@ -1382,8 +1424,6 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
lua_pop(L,1);
|
||||
|
||||
/* Iterating over immediate bases */
|
||||
int success = 0;
|
||||
int i = 0;
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
const swig_lua_class *base = clss->bases[i];
|
||||
|
|
@ -1413,11 +1453,16 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
|
||||
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int metatable_index;
|
||||
int metamethods_info_index;
|
||||
int tostring_undefined;
|
||||
int eq_undefined = 0;
|
||||
|
||||
SWIG_Lua_get_class_metatable(L, clss->fqname);
|
||||
const int metatable_index = lua_gettop(L);
|
||||
metatable_index = lua_gettop(L);
|
||||
SWIG_Lua_get_inheritable_metamethods(L);
|
||||
assert(lua_istable(L,-1));
|
||||
const int metamethods_info_index = lua_gettop(L);
|
||||
metamethods_info_index = lua_gettop(L);
|
||||
lua_pushnil(L); /* first key */
|
||||
while(lua_next(L, metamethods_info_index) != 0 ) {
|
||||
/* key at index -2, value at index -1 */
|
||||
|
|
@ -1435,7 +1480,7 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
|
|||
lua_pushstring(L, "__tostring");
|
||||
lua_pushvalue(L,-1);
|
||||
lua_rawget(L,metatable_index);
|
||||
const int tostring_undefined = lua_isnil(L,-1);
|
||||
tostring_undefined = lua_isnil(L,-1);
|
||||
lua_pop(L,1);
|
||||
if( tostring_undefined ) {
|
||||
lua_pushcfunction(L, SWIG_Lua_class_tostring);
|
||||
|
|
@ -1444,6 +1489,18 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
|
|||
lua_pop(L,1); /* remove copy of the key */
|
||||
}
|
||||
|
||||
/* Special handling for __eq method */
|
||||
lua_pushstring(L, "__eq");
|
||||
lua_pushvalue(L,-1);
|
||||
lua_rawget(L,metatable_index);
|
||||
eq_undefined = lua_isnil(L,-1);
|
||||
lua_pop(L,1);
|
||||
if( eq_undefined ) {
|
||||
lua_pushcfunction(L, SWIG_Lua_class_equal);
|
||||
lua_rawset(L, metatable_index);
|
||||
} else {
|
||||
lua_pop(L,1); /* remove copy of the key */
|
||||
}
|
||||
/* Warning: __index and __newindex are SWIG-defined. For user-defined operator[]
|
||||
* a __getitem/__setitem method should be defined
|
||||
*/
|
||||
|
|
@ -1488,6 +1545,7 @@ SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *cls
|
|||
SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
|
||||
{
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
int i;
|
||||
/* if name already there (class is already registered) then do nothing */
|
||||
SWIG_Lua_get_class_registry(L); /* get the registry */
|
||||
lua_pushstring(L,clss->fqname); /* get the name */
|
||||
|
|
@ -1499,7 +1557,6 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *c
|
|||
}
|
||||
lua_pop(L,2); /* tidy stack */
|
||||
/* Recursively initialize all bases */
|
||||
int i = 0;
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_class_register_instance(L,clss->bases[i]);
|
||||
|
|
@ -1513,13 +1570,16 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *c
|
|||
* It would get us all special methods: __getitem, __add etc.
|
||||
* This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away
|
||||
*/
|
||||
const int new_metatable_index = lua_absindex(L,-1);
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
|
||||
const int base_metatable = lua_absindex(L,-1);
|
||||
SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
|
||||
lua_pop(L,1);
|
||||
int new_metatable_index = lua_absindex(L,-1);
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
int base_metatable;
|
||||
SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
|
||||
base_metatable = lua_absindex(L,-1);
|
||||
SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
|
||||
lua_pop(L,1);
|
||||
}
|
||||
}
|
||||
/* And now we will overwrite all incorrectly set data */
|
||||
#endif
|
||||
|
|
@ -1566,6 +1626,7 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *c
|
|||
|
||||
SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
|
||||
{
|
||||
int SWIGUNUSED begin;
|
||||
assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
|
||||
SWIG_Lua_class_register_instance(L,clss);
|
||||
SWIG_Lua_class_register_static(L,clss);
|
||||
|
|
@ -1580,7 +1641,7 @@ SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
|
|||
* | ".set" --> ....
|
||||
* |=============================== ".instance"
|
||||
*/
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
begin = lua_gettop(L);
|
||||
lua_pushstring(L,clss->cls_static->name);
|
||||
lua_rawget(L,-2); /* get class static table */
|
||||
assert(lua_istable(L,-1));
|
||||
|
|
@ -1604,6 +1665,7 @@ SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
|
|||
SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
int i;
|
||||
/* if name already there (class is already registered) then do nothing */
|
||||
SWIG_Lua_get_class_registry(L); /* get the registry */
|
||||
lua_pushstring(L,clss->fqname); /* get the name */
|
||||
|
|
@ -1615,7 +1677,6 @@ SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_cla
|
|||
}
|
||||
lua_pop(L,2); /* tidy stack */
|
||||
/* Recursively initialize all bases */
|
||||
int i = 0;
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
|
||||
|
|
@ -1629,7 +1690,7 @@ SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_cla
|
|||
lua_pop(L,1);
|
||||
assert(lua_gettop(L) == begin);
|
||||
}
|
||||
#endif // elua && eluac
|
||||
#endif /* elua && eluac */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Class/structure conversion fns
|
||||
|
|
@ -1757,23 +1818,6 @@ SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* lua callable function to compare userdata's value
|
||||
the issue is that two userdata may point to the same thing
|
||||
but to lua, they are different objects */
|
||||
SWIGRUNTIME int SWIG_Lua_equal(lua_State *L)
|
||||
{
|
||||
int result;
|
||||
swig_lua_userdata *usr1,*usr2;
|
||||
if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
|
||||
return 0; /* nil reply */
|
||||
usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
||||
usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
|
||||
/*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
|
||||
result=(usr1->ptr==usr2->ptr);
|
||||
lua_pushboolean(L,result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* global variable support code: class/struct typemap functions
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -1831,8 +1875,8 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
|
|||
#endif
|
||||
/* Executes a C string in Lua which is a really simple way of calling lua from C
|
||||
Unfortunately lua keeps changing its APIs, so we need a conditional compile
|
||||
In lua 5.0.X its lua_dostring()
|
||||
In lua 5.1.X its luaL_dostring()
|
||||
In lua 5.0.X it's lua_dostring()
|
||||
In lua 5.1.X it's luaL_dostring()
|
||||
*/
|
||||
SWIGINTERN int
|
||||
SWIG_Lua_dostring(lua_State *L, const char *str) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|||
{
|
||||
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
|
||||
int i;
|
||||
int globalRegister = 0;
|
||||
/* start with global table */
|
||||
lua_pushglobaltable (L);
|
||||
/* SWIG's internal initialisation */
|
||||
|
|
@ -39,7 +40,7 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|||
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
|
||||
/* add a global fn */
|
||||
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
||||
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
||||
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal);
|
||||
#endif
|
||||
|
||||
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
||||
|
|
@ -49,7 +50,6 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|||
SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
||||
}
|
||||
}
|
||||
int globalRegister = 0;
|
||||
#ifdef SWIG_LUA_MODULE_GLOBAL
|
||||
globalRegister = 1;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ This is one giant macro to define the typemaps & the helpers
|
|||
for array handling
|
||||
*/
|
||||
%define SWIG_TYPEMAP_NUM_ARR(NAME,TYPE)
|
||||
%{SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE);%}
|
||||
%{SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE)%}
|
||||
|
||||
// fixed size array's
|
||||
%typemap(in) TYPE INPUT[ANY]
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
%include <pycontainer.swg>
|
||||
|
||||
/*
|
||||
%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class T, size_t S>
|
||||
struct traits_asptr<std::carray<T, S> > {
|
||||
static int asptr(PyObject *obj, std::carray<T, S> **array) {
|
||||
return traits_asptr_stdseq<std::carray<T, S> >::asptr(obj, array);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[];
|
||||
|
||||
%extend std::carray {
|
||||
%fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header",
|
||||
fragment="SwigPyIterator_T",
|
||||
fragment=SWIG_Traits_frag(_Type),
|
||||
fragment="StdCarrayTraits") {
|
||||
namespace swig {
|
||||
template <> struct traits<std::carray<_Type, _Size > > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() {
|
||||
return "std::carray<" #_Type "," #_Size " >";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr,
|
||||
SWIG_Traits_frag(std::carray<_Type, _Size >),
|
||||
std::carray<_Type, _Size >);
|
||||
|
||||
%typemap(out,noblock=1) iterator, const_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
inline size_t __len__() const { return self->size(); }
|
||||
|
||||
inline const _Type& __getitem__(size_t i) const { return (*self)[i]; }
|
||||
|
||||
inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; }
|
||||
|
||||
|
||||
swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
%include <std/std_carray.swg>
|
||||
*/
|
||||
|
||||
|
|
@ -34,12 +34,12 @@
|
|||
SWIGTYPE &&,
|
||||
SWIGTYPE [] {
|
||||
zval *z_var;
|
||||
zend_constant c;
|
||||
size_t len = sizeof("$symname") - 1;
|
||||
MAKE_STD_ZVAL(z_var);
|
||||
SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0);
|
||||
zend_constant c;
|
||||
c.value = *z_var;
|
||||
zval_copy_ctor(&c.value);
|
||||
size_t len = sizeof("$symname") - 1;
|
||||
c.name = zend_strndup("$symname", len);
|
||||
c.name_len = len+1;
|
||||
c.flags = CONST_CS | CONST_PERSISTENT;
|
||||
|
|
|
|||
|
|
@ -625,6 +625,28 @@ PHPBN2(MYSQLI_SERVER_PUBLIC_KEY);
|
|||
/* Added in PHP 5.6 */
|
||||
PHPBN2(LDAP_ESCAPE_DN);
|
||||
PHPBN2(LDAP_ESCAPE_FILTER);
|
||||
PHPBN2(OPENSSL_DEFAULT_STREAM_CIPHERS);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_ANY_CLIENT);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_ANY_SERVER);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_SERVER);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_SERVER);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
|
||||
PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_SERVER);
|
||||
PHPBN2(PGSQL_CONNECT_ASYNC);
|
||||
PHPBN2(PGSQL_CONNECTION_AUTH_OK);
|
||||
PHPBN2(PGSQL_CONNECTION_AWAITING_RESPONSE);
|
||||
PHPBN2(PGSQL_CONNECTION_MADE);
|
||||
PHPBN2(PGSQL_CONNECTION_SETENV);
|
||||
PHPBN2(PGSQL_CONNECTION_SSL_STARTUP);
|
||||
PHPBN2(PGSQL_CONNECTION_STARTED);
|
||||
PHPBN2(PGSQL_DML_ESCAPE);
|
||||
PHPBN2(PGSQL_POLLING_ACTIVE);
|
||||
PHPBN2(PGSQL_POLLING_FAILED);
|
||||
PHPBN2(PGSQL_POLLING_OK);
|
||||
PHPBN2(PGSQL_POLLING_READING);
|
||||
PHPBN2(PGSQL_POLLING_WRITING);
|
||||
|
||||
/* Class names reserved by PHP (case insensitive) */
|
||||
PHPCN(directory);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
%fragment("t_output_helper","header") %{
|
||||
static void
|
||||
t_output_helper(zval **target, zval *o TSRMLS_DC) {
|
||||
zval *tmp;
|
||||
if ( (*target)->type == IS_ARRAY ) {
|
||||
/* it's already an array, just append */
|
||||
add_next_index_zval( *target, o );
|
||||
|
|
@ -102,7 +103,6 @@ t_output_helper(zval **target, zval *o TSRMLS_DC) {
|
|||
FREE_ZVAL(o);
|
||||
return;
|
||||
}
|
||||
zval *tmp;
|
||||
ALLOC_INIT_ZVAL(tmp);
|
||||
*tmp = **target;
|
||||
zval_copy_ctor(tmp);
|
||||
|
|
|
|||
|
|
@ -710,7 +710,8 @@ namespace swig
|
|||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "tp_iter", functype="getiterfunc") iterator;
|
||||
#else
|
||||
%pythoncode {def __iter__(self): return self.iterator()}
|
||||
%pythoncode {def __iter__(self):
|
||||
return self.iterator()}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,8 @@ namespace swig
|
|||
%feature("python:slot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__;
|
||||
#else
|
||||
%extend SwigPyIterator {
|
||||
%pythoncode {def __iter__(self): return self}
|
||||
%pythoncode {def __iter__(self):
|
||||
return self}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
|||
SWIG_InternalNewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void();
|
||||
} else {
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
%#if PY_VERSION_HEX >= 0x03010000
|
||||
return PyUnicode_DecodeUTF8(carray, %numeric_cast(size,int), "surrogateescape");
|
||||
%#else
|
||||
return PyUnicode_FromStringAndSize(carray, %numeric_cast(size,int));
|
||||
%#endif
|
||||
%#else
|
||||
return PyString_FromStringAndSize(carray, %numeric_cast(size,int));
|
||||
%#endif
|
||||
|
|
|
|||
|
|
@ -176,10 +176,14 @@
|
|||
|
||||
#else
|
||||
%extend {
|
||||
%pythoncode {def __iter__(self): return self.key_iterator()}
|
||||
%pythoncode {def iterkeys(self): return self.key_iterator()}
|
||||
%pythoncode {def itervalues(self): return self.value_iterator()}
|
||||
%pythoncode {def iteritems(self): return self.iterator()}
|
||||
%pythoncode {def __iter__(self):
|
||||
return self.key_iterator()}
|
||||
%pythoncode {def iterkeys(self):
|
||||
return self.key_iterator()}
|
||||
%pythoncode {def itervalues(self):
|
||||
return self.value_iterator()}
|
||||
%pythoncode {def iteritems(self):
|
||||
return self.iterator()}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -176,18 +176,20 @@ SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
|
|||
%define %swig_pair_methods(pair...)
|
||||
#if !defined(SWIGPYTHON_BUILTIN)
|
||||
%extend {
|
||||
%pythoncode {def __len__(self): return 2
|
||||
def __repr__(self): return str((self.first, self.second))
|
||||
%pythoncode {def __len__(self):
|
||||
return 2
|
||||
def __repr__(self):
|
||||
return str((self.first, self.second))
|
||||
def __getitem__(self, index):
|
||||
if not (index % 2):
|
||||
return self.first
|
||||
else:
|
||||
return self.second
|
||||
if not (index % 2):
|
||||
return self.first
|
||||
else:
|
||||
return self.second
|
||||
def __setitem__(self, index, val):
|
||||
if not (index % 2):
|
||||
self.first = val
|
||||
else:
|
||||
self.second = val}
|
||||
if not (index % 2):
|
||||
self.first = val
|
||||
else:
|
||||
self.second = val}
|
||||
}
|
||||
#endif
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -231,10 +231,14 @@
|
|||
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%pythoncode {def __iter__(self): return self.key_iterator()}
|
||||
%pythoncode {def iterkeys(self): return self.key_iterator()}
|
||||
%pythoncode {def itervalues(self): return self.value_iterator()}
|
||||
%pythoncode {def iteritems(self): return self.iterator()}
|
||||
%pythoncode {def __iter__(self):
|
||||
return self.key_iterator()}
|
||||
%pythoncode {def iterkeys(self):
|
||||
return self.key_iterator()}
|
||||
%pythoncode {def itervalues(self):
|
||||
return self.value_iterator()}
|
||||
%pythoncode {def iteritems(self):
|
||||
return self.iterator()}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Ruby 1.9 changed the file name of this header
|
||||
/* Ruby 1.9 changed the file name of this header */
|
||||
#ifdef HAVE_RUBY_IO_H
|
||||
#include "ruby/io.h"
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue