From a25ccbf58b5d45a5916cf81821659c1730f0e793 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 8 Sep 2010 02:40:56 +0000 Subject: [PHP] Fix handling of OUTPUT typemaps (Patch from Ryan in SF#3058394). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12208 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/php.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/Modules/php.cxx') diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 365fcd370..89204d7bf 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -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"); @@ -1663,7 +1665,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)) { -- cgit v1.2.1 From 9eaf5ba1be143ea16eb7bfc096122be3c7bead19 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 14 Oct 2010 05:13:09 +0000 Subject: [PHP] Allow compilation on non-conforming Microsoft C++ compilers which don't accept: return function_returning_void(); Reported by Frank Vanden Berghen on the SWIG mailing list. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12265 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/php.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Modules/php.cxx') diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 89204d7bf..05f2082c2 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -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 */ -- cgit v1.2.1 From 004643ff30118e7a61484f329bfeebebfb202053 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 25 Nov 2010 20:39:11 +0000 Subject: Fix mangling of PHP constructor wrapper when types use global scope or typedefs git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12309 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/php.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Modules/php.cxx') diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 05f2082c2..b95eaa7cd 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -1601,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"); -- cgit v1.2.1 From 1adc50e73032eb80e2f77cac15205112e422cdf5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 15 Dec 2010 21:55:08 +0000 Subject: constify SwigType * in many places git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12349 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/php.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Modules/php.cxx') diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index b95eaa7cd..43eee9ae6 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() { @@ -2710,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(); -- cgit v1.2.1 From 74883f1dd7b22fdca609787300460f5550aec095 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 4 Feb 2011 20:25:59 +0000 Subject: [PHP] SF #3166423 Recent PHP versions no longer define zend_error_noreturn - calls to this have been replaced with zend_error. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12430 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/php.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Modules/php.cxx') diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 43eee9ae6..554e40bb8 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -976,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"); @@ -2290,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); @@ -2665,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 -- cgit v1.2.1