From 3499675cb0e4d322e8bfb6c47fa9f587c37887c1 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 11 Feb 2019 18:28:41 +1300 Subject: [PATCH 1/5] Fix hardcoded _v in PHP typecheck typemaps This should be $1, which ends up substituted with _v so this does not actually affect behaviour. --- Lib/php/php.swg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 7deda4ca7..4eba6be2a 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -471,7 +471,7 @@ %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { void *tmp; - _v = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0); + $1 = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0); } %typecheck(SWIG_TYPECHECK_POINTER) @@ -480,7 +480,7 @@ SWIGTYPE *const& { void *tmp; - _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0); + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0); } %typecheck(SWIG_TYPECHECK_POINTER) @@ -488,19 +488,19 @@ SWIGTYPE && { void *tmp; - _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0); + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0); } %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& { void *tmp; - _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0); + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0); } %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { void *tmp; - _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0); + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0); } /* Exception handling */ From 950473d77e45641325672f058d9c2ddafc6c2f70 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 12 Feb 2019 10:14:25 +1300 Subject: [PATCH 2/5] [php] Whitespace improvements in generated C/C++ code --- Lib/php/globalvar.i | 21 ++++++++++----------- Lib/php/phpinit.swg | 6 +++--- Source/Modules/php.cxx | 28 ++++++++++++++-------------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Lib/php/globalvar.i b/Lib/php/globalvar.i index a5fd779ab..6b31207a6 100644 --- a/Lib/php/globalvar.i +++ b/Lib/php/globalvar.i @@ -136,7 +136,7 @@ %typemap(varin) SWIGTYPE [] { - if($1) { + if ($1) { zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, $owner); } @@ -144,15 +144,15 @@ %typemap(varin) char [ANY] { - zval **z_var; - char *s1; + zval **z_var; + char *s1; - zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var); - s1 = Z_STRVAL_P(z_var); - if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { - if (s1) - strncpy($1, s1, $1_dim0); - } + zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var); + s1 = Z_STRVAL_P(z_var); + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { + if (s1) + strncpy($1, s1, $1_dim0); + } } %typemap(varin) SWIGTYPE @@ -166,7 +166,6 @@ } $1 = *($&1_ltype)_temp; - } %typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && @@ -245,7 +244,7 @@ (z_var)->value.str.val = 0; (z_var)->value.str.len = 0; } - } + } } %typemap(varout) SWIGTYPE diff --git a/Lib/php/phpinit.swg b/Lib/php/phpinit.swg index 6c2363393..1665f5dc4 100644 --- a/Lib/php/phpinit.swg +++ b/Lib/php/phpinit.swg @@ -1,13 +1,13 @@ /* ------------------------------------------------------------ - * The start of the PHP initialization function + * The start of the PHP initialization function * ------------------------------------------------------------ */ %insert(init) "swiginit.swg" %init %{ SWIG_php_minit { - SWIG_InitializeModule((void*)&module_number); + SWIG_InitializeModule((void*)&module_number); %} %fragment("swig_php_init_member_ptr2", "header") %{ @@ -21,5 +21,5 @@ static int swig_member_ptr = 0; %} %fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") %{ - swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number); + swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number); %} diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 2151316bd..994fbd7de 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -142,7 +142,7 @@ static void SwigPHP_emit_resource_registrations() { ki = First(zend_types); if (ki.key) - Printf(s_oinit, "\n/* Register resource destructors for pointer types */\n"); + Printf(s_oinit, "\n /* Register resource destructors for pointer types */\n"); while (ki.key) { DOH *key = ki.key; Node *class_node = ki.item; @@ -180,11 +180,11 @@ static void SwigPHP_emit_resource_registrations() { Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name); // register with php - Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex" + Printf(s_oinit, " le_swig_%s=zend_register_list_destructors_ex" "(%s, NULL, SWIGTYPE%s->name, module_number);\n", key, rsrc_dtor_name, key); // store php type in class struct - Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key); + Printf(s_oinit, " SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key); Delete(rsrc_dtor_name); @@ -272,8 +272,8 @@ public: /* subsections of the init section */ s_vinit = NewStringEmpty(); s_vdecl = NewString("/* vdecl subsection */\n"); - s_cinit = NewString("/* cinit subsection */\n"); - s_oinit = NewString("/* oinit subsection */\n"); + s_cinit = NewString(" /* cinit subsection */\n"); + s_oinit = NewString(" /* oinit subsection */\n"); pragma_phpinfo = NewStringEmpty(); s_phpclasses = NewString("/* PHP Proxy Classes */\n"); f_directors_h = NewStringEmpty(); @@ -364,7 +364,7 @@ public: /* Initialize the rest of the module */ - Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module); + Printf(s_oinit, " ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module); /* start the header section */ Printf(s_header, "ZEND_BEGIN_MODULE_GLOBALS(%s)\n", module); @@ -549,17 +549,17 @@ public: // Printv(s_init,s_resourcetypes,NIL); /* We need this after all classes written out by ::top */ - Printf(s_oinit, "CG(active_class_entry) = NULL;\n"); - Printf(s_oinit, "/* end oinit subsection */\n"); + Printf(s_oinit, " CG(active_class_entry) = NULL;\n"); + Printf(s_oinit, " /* end oinit subsection */\n"); Printf(s_init, "%s\n", s_oinit); /* Constants generated during top call */ - Printf(s_cinit, "/* end cinit subsection */\n"); + Printf(s_cinit, " /* end cinit subsection */\n"); Printf(s_init, "%s\n", s_cinit); Clear(s_cinit); Delete(s_cinit); - Printf(s_init, " return SUCCESS;\n"); + Printf(s_init, " return SUCCESS;\n"); Printf(s_init, "}\n\n"); // Now do REQUEST init which holds any user specified %rinit, and also vinit @@ -577,15 +577,15 @@ public: if (Len(s_vinit) > 0) { /* finish our init section which will have been used by class wrappers */ Printv(s_init, - "/* vinit subsection */\n", + " /* vinit subsection */\n", s_vinit, "\n" - "/* end vinit subsection */\n", + " /* end vinit subsection */\n", NIL); Clear(s_vinit); } Delete(s_vinit); - Printf(s_init, " return SUCCESS;\n"); + Printf(s_init, " return SUCCESS;\n"); Printf(s_init, "}\n\n"); } @@ -598,7 +598,7 @@ public: "/* shutdown section */\n" "{\n", s_shutdown, - " return SUCCESS;\n" + " return SUCCESS;\n" "}\n\n", NIL); } From 9db02a1e6bd17898108f5c0dac7fa87c765371c6 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 12 Feb 2019 10:27:31 +1300 Subject: [PATCH 3/5] Update PHP testsuite for vadz's new cars --- Examples/test-suite/php/ignore_parameter_runme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/test-suite/php/ignore_parameter_runme.php b/Examples/test-suite/php/ignore_parameter_runme.php index f86a61169..b9c2b777d 100644 --- a/Examples/test-suite/php/ignore_parameter_runme.php +++ b/Examples/test-suite/php/ignore_parameter_runme.php @@ -4,7 +4,7 @@ require "tests.php"; require "ignore_parameter.php"; // New functions -check::functions(array('jaguar','lotus','tvr','ferrari','sportscars_daimler','sportscars_astonmartin','sportscars_bugatti','sportscars_lamborghini')); +check::functions(array('jaguar','lotus','tvr','ferrari','fiat','sportscars_daimler','sportscars_astonmartin','sportscars_bugatti','sportscars_lamborghini','sportscars_maseratti')); // New classes check::classes(array('ignore_parameter','SportsCars','MiniCooper','MorrisMinor','FordAnglia','AustinAllegro')); // No new vars From 6d2aae47181a82c4eba7f7fb3194abb0ecc2b513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Sun, 10 Feb 2019 23:18:05 +0100 Subject: [PATCH 4/5] Fixed typo in Perl5 docs. Fixed typo in section 33.7.2 "Perl5 typemaps". There is no function set_setiv() in the perl api, the correct name is sv_setiv(). --- Doc/Manual/Perl5.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html index f3ba75572..5ce765c26 100644 --- a/Doc/Manual/Perl5.html +++ b/Doc/Manual/Perl5.html @@ -1888,7 +1888,7 @@ like this:
 %typemap(out) int {
   $result = sv_newmortal();
-  set_setiv($result, (IV) $1);
+  sv_setiv($result, (IV) $1);
   argvi++;
 }
 
From 200984f0512627ffb48cbd6bcbaf2e0604fcc172 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Fri, 8 Feb 2019 13:32:38 -0700 Subject: [PATCH 5/5] [Python] Fix some errors in the documentation for -threads The documentation for -threads was added in f0f2fd2daee085021e8b76f823332d52f1982a06 [skip ci] --- Doc/Manual/Contents.html | 2 +- Doc/Manual/Ocaml.html | 4 ++-- Doc/Manual/Python.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index fbfc7d751..d30337058 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1813,7 +1813,7 @@
  • Director Usage Example
  • Creating director objects
  • Typemaps for directors, directorin, directorout, directorargout -
  • typemap +
  • directorin typemap
  • directorout typemap
  • directorargout typemap diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 8e456b9e6..6da866157 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -47,7 +47,7 @@
  • Director Usage Example
  • Creating director objects
  • Typemaps for directors, directorin, directorout, directorargout -
  • typemap +
  • directorin typemap
  • directorout typemap
  • directorargout typemap @@ -948,7 +948,7 @@ well as a function return value in the same way you provide function arguments, and to receive arguments the same way you normally receive function returns.

    -

    38.2.5.6 typemap

    +

    38.2.5.6 directorin typemap

    diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index 9d5d2a307..20e95775f 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -7259,12 +7259,12 @@ will not be able to run any other threads, even if the wrapped C/C++ code is wai

    The threads module option in the *.i template file:

    -
    %feature("nothread") method;
    +
    %module("threads"=1)
  • You can disable thread support for a given method:

    -
    %module("threads"=1)
    +
    %feature("nothread") method;
    or
    %nothread method;