diff options
Diffstat (limited to 'Source/Modules/php.cxx')
-rw-r--r-- | Source/Modules/php.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 365fcd370..554e40bb8 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -126,7 +126,7 @@ static enum { } wrapperType = standard; extern "C" { - static void (*r_prevtracefunc) (SwigType *t, String *mangled, String *clientdata) = 0; + static void (*r_prevtracefunc) (const SwigType *t, String *mangled, String *clientdata) = 0; } static void SwigPHP_emit_resource_registrations() { @@ -666,7 +666,7 @@ public: /* We have an extra 'this' parameter. */ SetFlag(n, "wrap:this"); } - String *dispatch = Swig_overload_dispatch(n, "return %s(INTERNAL_FUNCTION_PARAM_PASSTHRU);", &maxargs); + String *dispatch = Swig_overload_dispatch(n, "%s(INTERNAL_FUNCTION_PARAM_PASSTHRU); return;", &maxargs); /* Generate a dispatch wrapper for all overloaded functions */ @@ -915,8 +915,10 @@ public: } /* Insert argument output code */ + bool hasargout = false; for (i = 0, p = l; p; i++) { if ((tm = Getattr(p, "tmap:argout"))) { + hasargout = true; Replaceall(tm, "$source", Getattr(p, "lname")); // Replaceall(tm,"$input",Getattr(p,"lname")); Replaceall(tm, "$target", "return_value"); @@ -974,7 +976,7 @@ public: /* Error handling code */ Printf(f->code, "fail:\n"); Printv(f->code, cleanup, NIL); - Printv(f->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL); + Printv(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());", NIL); Printf(f->code, "}\n"); @@ -1599,10 +1601,9 @@ public: Delete(args); args = NewString("$res=null"); } - SwigType *t = Getattr(current_class, "classtype"); - String *mangled_type = SwigType_manglestr(SwigType_ltype(t)); + String *mangled_type = SwigType_manglestr(Getattr(n, "type")); Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args); - Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '_p%s') {\n", arg0, arg0, mangled_type); + Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '%s') {\n", arg0, arg0, mangled_type); Printf(output, "\t\t\t$this->%s=$%s;\n", SWIG_PTR, arg0); Printf(output, "\t\t\treturn;\n"); Printf(output, "\t\t}\n"); @@ -1663,7 +1664,7 @@ public: } } Printf(output, "%s", prepare); - } else if (Cmp(d, "void") == 0) { + } else if (Cmp(d, "void") == 0 && !hasargout) { if (Cmp(invoke, "$r") != 0) Printf(output, "\t\t%s;\n", invoke); } else if (is_class(d)) { @@ -2289,7 +2290,7 @@ done: Append(f->code, "return;\n"); Append(f->code, "fail:\n"); - Append(f->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); + Append(f->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); Printf(f->code, "}\n"); Wrapper_print(f, s_wrappers); @@ -2664,7 +2665,7 @@ done: } Append(w->code, "fail:\n"); - Append(w->code, "zend_error_noreturn(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); + Append(w->code, "zend_error(SWIG_ErrorCode(),\"%s\",SWIG_ErrorMsg());\n"); Append(w->code, "}\n"); // We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method @@ -2709,7 +2710,7 @@ static PHP *maininstance = 0; // We use this function to be able to write out zend_register_list_destructor_ex // lines for most things in the type table // NOTE: it's a function NOT A PHP::METHOD -extern "C" void typetrace(SwigType *ty, String *mangled, String *clientdata) { +extern "C" void typetrace(const SwigType *ty, String *mangled, String *clientdata) { Node *class_node; if (!zend_types) { zend_types = NewHash(); |