diff options
author | Olly Betts <olly@survex.com> | 2021-05-04 14:14:56 +1200 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2021-05-04 14:14:56 +1200 |
commit | 32283991c5d831840e4625007a9e15399d1ff1de (patch) | |
tree | 996a398bf3a2b4e3b05c7f41c52a881654218b77 | |
parent | 6e6d720d8866e4f5d4b3b0f9ea12777f440be453 (diff) | |
download | swig-32283991c5d831840e4625007a9e15399d1ff1de.tar.gz |
Don't generate a .php wrapper file by default
It's now only generated if something to put in it is specified via:
%pragma(php) include=...
or
%pragma(php) code=...
101 files changed, 46 insertions, 176 deletions
diff --git a/.gitignore b/.gitignore index 0006e6ef6..b51da0fdf 100644 --- a/.gitignore +++ b/.gitignore @@ -184,11 +184,8 @@ Examples/perl5/*/*.pm # PHP Examples/test-suite/php/php_*.h -Examples/test-suite/php/*.php -!Examples/test-suite/php/*runme.php -!Examples/test-suite/php/skel.php Examples/php/*/php_*.h -Examples/php/*/example.php +Examples/php/pragmas/example.php # Python # Based on https://github.com/github/gitignore/blob/master/Python.gitignore diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index e31802c02..254f05c52 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -84,16 +84,21 @@ swig -php7 example.i </pre></div> <p> -This will produce 3 files example_wrap.c, php_example.h and -example.php. The first file, <tt>example_wrap.c</tt> contains all of +This will produce 2 files: example_wrap.c and php_example.h. +The first file, <tt>example_wrap.c</tt> contains all of the C code needed to build a PHP extension. The second file, <tt>php_example.h</tt> contains the header information needed if you wish to statically link the extension into the php interpreter. -The third file, -<tt>example.php</tt> can be included by PHP scripts. It attempts to -dynamically load the extension and contains extra php code specified -in the interface file. If wrapping C++ code with PHP classes, it will -also contain PHP class wrappers. +</p> + +<p> +If the interface file uses <tt>%pragma(php) include=</tt>... or +<tt>%pragma(php) code=</tt>... then SWIG will also generate a third file, +<tt>example.php</tt> to contain what these specify. In SWIG < 4.1.0, +this third file was always generated as it defined the PHP classes, etc +(but this is now done via C code in <tt>example_wrap.c</tt>) and also +contained code to dynamically load the extension (but this used the +PHP <tt>dl()</tt> function, which isn't recommended nowadays). </p> <p> @@ -178,15 +183,6 @@ better to instead use <tt>extension</tt> in <tt>php.ini</tt> as described above. </p> -<p> -SWIG also generates a PHP module which defines PHP classes for the wrapped -API, which you'll need to load, for example: -</p> - -<div class="code"><pre> - include("example.php"); -</pre></div> - <H2><a name="Php_nn2">32.2 Basic PHP interface</a></H2> @@ -224,12 +220,8 @@ you can access the constants in your PHP script like this, </p> <div class="code"><pre> -include("example.php"); - echo "PI = " . PI . "\n"; - echo "E = " . E . "\n"; - </pre> </div> @@ -261,8 +253,6 @@ accessed incorrectly in PHP, <div class="code"> <pre> -include("example.php"); - if(EASY_TO_MISPEL) { ... } else { @@ -303,7 +293,6 @@ is accessed as follows: </p> <div class="code"><pre> -include("example.php"); print seki_get(); seki_set( seki_get() * 2); # The C variable is now 4. print seki_get(); @@ -349,7 +338,6 @@ Will be accessed in PHP like this : </p> <div class="code"><pre> -include("example.php"); $a = foo(2); $b = bar(3.5, -1.5); $c = bar(3.5); # Use default argument for 2nd parameter @@ -474,8 +462,6 @@ This will result in the following usage in PHP: <div class="code"><pre> <?php -include("example.php"); - $in1=copy_intp(3); $in2=copy_intp(5); $result=new_intp(); @@ -507,8 +493,6 @@ This will result in the following usage in PHP: <div class="code"><pre> <?php -include("example.php"); - $in1 = 3; $in2 = 5; $result= add($in1, $in2); # Note using variables for the input is unnecessary. @@ -544,8 +528,6 @@ This will result in the following usage in PHP: <div class="code"><pre> <?php -include("example.php"); - $in1 = 3; $in2 = 5; $result = 0; @@ -609,7 +591,6 @@ Would be used in the following way from PHP: <div class="code"><pre> <?php - require "vector.php"; $v = new Vector(); $v->x = 3; @@ -724,8 +705,6 @@ would be accessed in PHP as, </p> <div class="code"><pre> -include("example.php"); - echo "There have now been " . Ko::threats() . " threats\n"; </pre></div> @@ -759,7 +738,6 @@ class Ko { would be executed in PHP as, <div class="code"><pre> -include("example.php"); Ko::threats(); </pre></div> @@ -786,9 +764,8 @@ If there are multiple interfaces, just list them separated by commas. <p> -To place PHP code in the generated "example.php" file one can use the -<b>code</b> pragma. The code is inserted after loading the shared -object. +You can get SWIG to generate an "example.php" file by specifying +the code to put in it using the <b>code</b> pragma. </p> <div class="code"><pre> @@ -992,8 +969,6 @@ then at the PHP side you can define <div class="targetlang"> <pre> -require("mymodule.php"); - class MyFoo extends Foo { function one() { print "one from php\n"; diff --git a/Examples/php/callback/runme.php b/Examples/php/callback/runme.php index fe4cd8b95..e7093209c 100644 --- a/Examples/php/callback/runme.php +++ b/Examples/php/callback/runme.php @@ -2,8 +2,6 @@ # This file illustrates the cross language polymorphism using directors. -require("example.php"); - # Class, which overwrites Callback::run(). class PhpCallback extends Callback { diff --git a/Examples/php/class/runme.php b/Examples/php/class/runme.php index 88b4cfc79..0f667695b 100644 --- a/Examples/php/class/runme.php +++ b/Examples/php/class/runme.php @@ -2,8 +2,6 @@ # This example illustrates how member variables are wrapped. -require("example.php"); - # ----- Object creation ----- print "Creating some objects:\n"; diff --git a/Examples/php/constants/runme.php b/Examples/php/constants/runme.php index ef923829d..e561626d8 100644 --- a/Examples/php/constants/runme.php +++ b/Examples/php/constants/runme.php @@ -1,7 +1,5 @@ <?php -require "example.php"; - print "ICONST = " . ICONST . " (should be 42)\n"; print "FCONST = " . FCONST . " (should be 2.1828)\n"; print "CCONST = " . CCONST . " (should be 'x')\n"; diff --git a/Examples/php/cpointer/runme.php b/Examples/php/cpointer/runme.php index 3a0f19ec2..f552ed78a 100644 --- a/Examples/php/cpointer/runme.php +++ b/Examples/php/cpointer/runme.php @@ -1,7 +1,5 @@ <?php - require "example.php"; - # First create some objects using the pointer library. print "Testing the pointer library\n"; diff --git a/Examples/php/disown/runme.php b/Examples/php/disown/runme.php index 9bdaecb3f..e847dc71d 100644 --- a/Examples/php/disown/runme.php +++ b/Examples/php/disown/runme.php @@ -4,8 +4,6 @@ # created by SWIG. In this case, all of our C++ classes # get converted into function calls. -require("example.php"); - # ----- Object creation ----- print "Creating some objects:\n"; diff --git a/Examples/php/enum/runme.php b/Examples/php/enum/runme.php index 23d4fbc10..bf5ba881f 100644 --- a/Examples/php/enum/runme.php +++ b/Examples/php/enum/runme.php @@ -1,7 +1,5 @@ <?php -require "example.php"; - # ----- Object creation ----- # Print out the value of some enums diff --git a/Examples/php/extend/runme.php b/Examples/php/extend/runme.php index 94a59e69e..93eedee99 100644 --- a/Examples/php/extend/runme.php +++ b/Examples/php/extend/runme.php @@ -2,8 +2,6 @@ # This file illustrates the cross language polymorphism using directors. -require("example.php"); - # CEO class, which overrides Employee::getPosition(). class CEO extends Manager { diff --git a/Examples/php/funcptr/runme.php b/Examples/php/funcptr/runme.php index 4590a5cbb..d76a19bc7 100644 --- a/Examples/php/funcptr/runme.php +++ b/Examples/php/funcptr/runme.php @@ -1,7 +1,5 @@ <?php -require "example.php"; - $a = 37; $b = 42; diff --git a/Examples/php/overloading/runme.php b/Examples/php/overloading/runme.php index ffa7e1167..d4df899f0 100644 --- a/Examples/php/overloading/runme.php +++ b/Examples/php/overloading/runme.php @@ -4,8 +4,6 @@ # created by SWIG. In this case, all of our C++ classes # get converted into function calls. -include("example.php"); - # ----- Object creation ----- print "Creating some objects:\n"; diff --git a/Examples/php/pointer/runme.php b/Examples/php/pointer/runme.php index e0ed35b02..8dc3ab887 100644 --- a/Examples/php/pointer/runme.php +++ b/Examples/php/pointer/runme.php @@ -1,7 +1,5 @@ <?php - require "example.php"; - # First create some objects using the pointer library. print "Testing the pointer library\n"; diff --git a/Examples/php/proxy/runme.php b/Examples/php/proxy/runme.php index 8a2926517..0f156b6ad 100644 --- a/Examples/php/proxy/runme.php +++ b/Examples/php/proxy/runme.php @@ -4,8 +4,6 @@ # created by SWIG. In this case, all of our C++ classes # get converted into function calls. -include("example.php"); - # ----- Object creation ----- print "Creating some objects:\n"; diff --git a/Examples/php/reference/runme.php b/Examples/php/reference/runme.php index 722acdb60..5c7fc9a88 100644 --- a/Examples/php/reference/runme.php +++ b/Examples/php/reference/runme.php @@ -2,8 +2,6 @@ # This file illustrates the manipulation of C++ references in PHP. -require "example.php"; - # ----- Object creation ----- print "Creating some objects:\n"; diff --git a/Examples/php/simple/runme.php b/Examples/php/simple/runme.php index 7cb84dc0b..2795f32a0 100644 --- a/Examples/php/simple/runme.php +++ b/Examples/php/simple/runme.php @@ -1,7 +1,5 @@ <?php -require "example.php"; - # Call our gcd() function $x = "42 aaa"; diff --git a/Examples/php/sync/runme.php b/Examples/php/sync/runme.php index 597b2fc88..f01a9b3f6 100644 --- a/Examples/php/sync/runme.php +++ b/Examples/php/sync/runme.php @@ -1,7 +1,5 @@ <? -include("example.php"); - echo "PHP reading globals: string is '", s_get(), "' and value is ", x_get(), "\n"; $o = new Sync(); diff --git a/Examples/php/value/runme.php b/Examples/php/value/runme.php index 977b99cc8..112fbc874 100644 --- a/Examples/php/value/runme.php +++ b/Examples/php/value/runme.php @@ -1,8 +1,5 @@ <?php - require "example.php"; - - $v = new Vector(); $v->x = 1.0; $v->y = 2.0; diff --git a/Examples/php/variables/runme.php b/Examples/php/variables/runme.php index 126b54216..a14fede72 100644 --- a/Examples/php/variables/runme.php +++ b/Examples/php/variables/runme.php @@ -1,6 +1,5 @@ <?php - require "example.php"; echo "\nVariables (values printed from C)\n"; print_vars(); diff --git a/Examples/test-suite/php/abstract_inherit_ok_runme.php b/Examples/test-suite/php/abstract_inherit_ok_runme.php index e5000e071..6cfea2341 100644 --- a/Examples/test-suite/php/abstract_inherit_ok_runme.php +++ b/Examples/test-suite/php/abstract_inherit_ok_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "abstract_inherit_ok.php"; check::classes(array('Foo','Spam')); $spam=new Spam(); diff --git a/Examples/test-suite/php/abstract_inherit_runme.php b/Examples/test-suite/php/abstract_inherit_runme.php index a5ecfbc46..6a0180d78 100644 --- a/Examples/test-suite/php/abstract_inherit_runme.php +++ b/Examples/test-suite/php/abstract_inherit_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "abstract_inherit.php"; check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i')); // This constructor attempt should fail as there isn't one diff --git a/Examples/test-suite/php/add_link_runme.php b/Examples/test-suite/php/add_link_runme.php index 5fe585b63..073dee36d 100644 --- a/Examples/test-suite/php/add_link_runme.php +++ b/Examples/test-suite/php/add_link_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "add_link.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/argout_runme.php b/Examples/test-suite/php/argout_runme.php index 81fc01c1c..d233cf0f6 100644 --- a/Examples/test-suite/php/argout_runme.php +++ b/Examples/test-suite/php/argout_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "argout.php"; check::functions(array('incp','incr','inctr','new_intp','copy_intp','delete_intp','intp_assign','intp_value','voidhandle','handle')); diff --git a/Examples/test-suite/php/arrays_global_runme.php b/Examples/test-suite/php/arrays_global_runme.php index af892a718..8f28919b4 100644 --- a/Examples/test-suite/php/arrays_global_runme.php +++ b/Examples/test-suite/php/arrays_global_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "arrays_global.php"; check::functions(array('test_a','test_b')); check::classes(array('arrays_global','SimpleStruct','Material')); diff --git a/Examples/test-suite/php/arrays_global_twodim_runme.php b/Examples/test-suite/php/arrays_global_twodim_runme.php index c36ebff25..ca166fe17 100644 --- a/Examples/test-suite/php/arrays_global_twodim_runme.php +++ b/Examples/test-suite/php/arrays_global_twodim_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "arrays_global_twodim.php"; check::functions(array('fn_taking_arrays','get_2d_array',)); check::classes(array('arrays_global_twodim','SimpleStruct','Material')); diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php index 4119555ce..eb06fbfd8 100644 --- a/Examples/test-suite/php/arrays_runme.php +++ b/Examples/test-suite/php/arrays_runme.php @@ -1,6 +1,6 @@ <?php + require "tests.php"; -require "arrays.php"; check::functions(array('fn_taking_arrays','newintpointer','setintfrompointer','getintfrompointer','array_pointer_func')); check::classes(array('arrays','SimpleStruct','ArrayStruct','CartPoseData_t')); diff --git a/Examples/test-suite/php/arrays_scope_runme.php b/Examples/test-suite/php/arrays_scope_runme.php index 7e0da611e..f18037ca7 100644 --- a/Examples/test-suite/php/arrays_scope_runme.php +++ b/Examples/test-suite/php/arrays_scope_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "arrays_scope.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/callback_runme.php b/Examples/test-suite/php/callback_runme.php index a0dc69fb3..717185649 100644 --- a/Examples/test-suite/php/callback_runme.php +++ b/Examples/test-suite/php/callback_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "callback.php"; // In 2.0.6 and earlier, the constant was misnamed. check::equal(gettype(callback::FOO_I_Cb_Ptr), 'object', "callback::FOO_I_Cb_Ptr not an object"); diff --git a/Examples/test-suite/php/casts_runme.php b/Examples/test-suite/php/casts_runme.php index 748e72cbf..6234f0fab 100644 --- a/Examples/test-suite/php/casts_runme.php +++ b/Examples/test-suite/php/casts_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "casts.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/char_strings_runme.php b/Examples/test-suite/php/char_strings_runme.php index 58e444a3a..7dc8fe74d 100644 --- a/Examples/test-suite/php/char_strings_runme.php +++ b/Examples/test-suite/php/char_strings_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "char_strings.php"; $CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; $OTHERLAND_MSG_10 = "Little message from the safe world.10"; diff --git a/Examples/test-suite/php/class_ignore_runme.php b/Examples/test-suite/php/class_ignore_runme.php index 5f33374cc..f52bc1a13 100644 --- a/Examples/test-suite/php/class_ignore_runme.php +++ b/Examples/test-suite/php/class_ignore_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "class_ignore.php"; check::functions(array('do_blah')); check::classes(array('class_ignore','Bar','Boo','Far','Hoo')); diff --git a/Examples/test-suite/php/conversion_namespace_runme.php b/Examples/test-suite/php/conversion_namespace_runme.php index 60c2885fc..858bf89d9 100644 --- a/Examples/test-suite/php/conversion_namespace_runme.php +++ b/Examples/test-suite/php/conversion_namespace_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "conversion_namespace.php"; check::classes(array("Foo","Bar")); $bar=new Bar; diff --git a/Examples/test-suite/php/conversion_ns_template_runme.php b/Examples/test-suite/php/conversion_ns_template_runme.php index bfdfd9fc4..4157b106a 100644 --- a/Examples/test-suite/php/conversion_ns_template_runme.php +++ b/Examples/test-suite/php/conversion_ns_template_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "conversion_ns_template.php"; check::classes(array("conversion_ns_template","Foo_One","Bar_One","Hi")); // this is too hard, I'm not sure what to test for, diff --git a/Examples/test-suite/php/conversion_runme.php b/Examples/test-suite/php/conversion_runme.php index 6658c9d01..858bf89d9 100644 --- a/Examples/test-suite/php/conversion_runme.php +++ b/Examples/test-suite/php/conversion_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "conversion.php"; check::classes(array("Foo","Bar")); $bar=new Bar; diff --git a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php index df4dd9989..82296deb7 100644 --- a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php +++ b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "cpp11_strongly_typed_enumerations.php"; function enumCheck($actual, $expected) { check::equal($actual, $expected, "Enum value mismatch"); diff --git a/Examples/test-suite/php/cpp_basic_runme.php b/Examples/test-suite/php/cpp_basic_runme.php index 2f96c6437..fb34bc936 100644 --- a/Examples/test-suite/php/cpp_basic_runme.php +++ b/Examples/test-suite/php/cpp_basic_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "cpp_basic.php"; // New functions check::functions(array('get_func1_ptr','get_func2_ptr','test_func_ptr')); diff --git a/Examples/test-suite/php/cpp_static_runme.php b/Examples/test-suite/php/cpp_static_runme.php index 419417e1d..a1fd85c2e 100644 --- a/Examples/test-suite/php/cpp_static_runme.php +++ b/Examples/test-suite/php/cpp_static_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "cpp_static.php"; // New functions check::functions(array('is_python_builtin')); diff --git a/Examples/test-suite/php/director_abstract_runme.php b/Examples/test-suite/php/director_abstract_runme.php index 65ae6674c..bb424f9ea 100644 --- a/Examples/test-suite/php/director_abstract_runme.php +++ b/Examples/test-suite/php/director_abstract_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_abstract.php"; // New functions check::functions(array('g')); diff --git a/Examples/test-suite/php/director_basic_runme.php b/Examples/test-suite/php/director_basic_runme.php index 2174cf491..db7adefc1 100644 --- a/Examples/test-suite/php/director_basic_runme.php +++ b/Examples/test-suite/php/director_basic_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_basic.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_classic_runme.php b/Examples/test-suite/php/director_classic_runme.php index aa4ed59b0..e2ac1f7a7 100644 --- a/Examples/test-suite/php/director_classic_runme.php +++ b/Examples/test-suite/php/director_classic_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_classic.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_default_runme.php b/Examples/test-suite/php/director_default_runme.php index 41b15d38b..92e415041 100644 --- a/Examples/test-suite/php/director_default_runme.php +++ b/Examples/test-suite/php/director_default_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_default.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_detect_runme.php b/Examples/test-suite/php/director_detect_runme.php index fcceff9ab..ae92f7a0c 100644 --- a/Examples/test-suite/php/director_detect_runme.php +++ b/Examples/test-suite/php/director_detect_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_detect.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_enum_runme.php b/Examples/test-suite/php/director_enum_runme.php index 9b185e91c..21e07a57b 100644 --- a/Examples/test-suite/php/director_enum_runme.php +++ b/Examples/test-suite/php/director_enum_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_enum.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php index d7f22ea7a..e49c12da6 100644 --- a/Examples/test-suite/php/director_exception_runme.php +++ b/Examples/test-suite/php/director_exception_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_exception.php"; // New functions check::functions(array('launder','is_python_builtin')); diff --git a/Examples/test-suite/php/director_extend_runme.php b/Examples/test-suite/php/director_extend_runme.php index 5555ccc6f..418985476 100644 --- a/Examples/test-suite/php/director_extend_runme.php +++ b/Examples/test-suite/php/director_extend_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_extend.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_finalizer_runme.php b/Examples/test-suite/php/director_finalizer_runme.php index c149fd318..ad00bf5f0 100644 --- a/Examples/test-suite/php/director_finalizer_runme.php +++ b/Examples/test-suite/php/director_finalizer_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_finalizer.php"; // New functions check::functions(array('deletefoo','getstatus','launder','resetstatus')); diff --git a/Examples/test-suite/php/director_frob_runme.php b/Examples/test-suite/php/director_frob_runme.php index c93c39517..732b9d500 100644 --- a/Examples/test-suite/php/director_frob_runme.php +++ b/Examples/test-suite/php/director_frob_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_frob.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_nested_runme.php b/Examples/test-suite/php/director_nested_runme.php index 8d673791e..adf9f6206 100644 --- a/Examples/test-suite/php/director_nested_runme.php +++ b/Examples/test-suite/php/director_nested_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_nested.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_overload_runme.php b/Examples/test-suite/php/director_overload_runme.php index 45ea6d591..07b485d95 100644 --- a/Examples/test-suite/php/director_overload_runme.php +++ b/Examples/test-suite/php/director_overload_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_overload.php"; check::functions(array()); check::classes(array('OverloadedClass','OverloadedPointers','OverloadedGetSet')); diff --git a/Examples/test-suite/php/director_pass_by_value_runme.php b/Examples/test-suite/php/director_pass_by_value_runme.php index e8a5324d0..d3763292f 100644 --- a/Examples/test-suite/php/director_pass_by_value_runme.php +++ b/Examples/test-suite/php/director_pass_by_value_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_pass_by_value.php"; $passByVal = null; diff --git a/Examples/test-suite/php/director_profile_runme.php b/Examples/test-suite/php/director_profile_runme.php index 1aa055696..219ec815a 100644 --- a/Examples/test-suite/php/director_profile_runme.php +++ b/Examples/test-suite/php/director_profile_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_profile.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_protected_runme.php b/Examples/test-suite/php/director_protected_runme.php index 4f6cd3061..b73c8f872 100644 --- a/Examples/test-suite/php/director_protected_runme.php +++ b/Examples/test-suite/php/director_protected_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_protected.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_stl_runme.php b/Examples/test-suite/php/director_stl_runme.php index 71881fd93..654251a30 100644 --- a/Examples/test-suite/php/director_stl_runme.php +++ b/Examples/test-suite/php/director_stl_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_stl.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_string_runme.php b/Examples/test-suite/php/director_string_runme.php index 748e2892f..3127f13fb 100644 --- a/Examples/test-suite/php/director_string_runme.php +++ b/Examples/test-suite/php/director_string_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_string.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/director_thread_runme.php b/Examples/test-suite/php/director_thread_runme.php index dd1233d54..190dbad71 100644 --- a/Examples/test-suite/php/director_thread_runme.php +++ b/Examples/test-suite/php/director_thread_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_thread.php"; # Fails in a ZTS-build of PHP5 - see: https://github.com/swig/swig/pull/155 # FIXME: Does this still fail in a threaded build of PHP7? diff --git a/Examples/test-suite/php/director_unroll_runme.php b/Examples/test-suite/php/director_unroll_runme.php index 11cd68db4..7f94753f5 100644 --- a/Examples/test-suite/php/director_unroll_runme.php +++ b/Examples/test-suite/php/director_unroll_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "director_unroll.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/enum_scope_template_runme.php b/Examples/test-suite/php/enum_scope_template_runme.php index 571dc6a35..d5aed62f7 100644 --- a/Examples/test-suite/php/enum_scope_template_runme.php +++ b/Examples/test-suite/php/enum_scope_template_runme.php @@ -1,6 +1,5 @@ <?php require "tests.php"; -require "enum_scope_template.php"; check::functions(array("chops")); check::classes(array("enum_scope_template", "TreeInt")); diff --git a/Examples/test-suite/php/evil_diamond_ns_runme.php b/Examples/test-suite/php/evil_diamond_ns_runme.php index bcf5aafd4..f2115bf36 100644 --- a/Examples/test-suite/php/evil_diamond_ns_runme.php +++ b/Examples/test-suite/php/evil_diamond_ns_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "evil_diamond_ns.php"; check::classes(array("evil_diamond_ns","foo","bar","baz","spam")); check::functions("test"); diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php index 221cf277d..611f17d6a 100644 --- a/Examples/test-suite/php/evil_diamond_prop_runme.php +++ b/Examples/test-suite/php/evil_diamond_prop_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "evil_diamond_prop.php"; check::classes(array("evil_diamond_prop","foo","bar","baz","spam")); check::functions("test"); diff --git a/Examples/test-suite/php/evil_diamond_runme.php b/Examples/test-suite/php/evil_diamond_runme.php index d298eeb57..7d01c98ec 100644 --- a/Examples/test-suite/php/evil_diamond_runme.php +++ b/Examples/test-suite/php/evil_diamond_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "evil_diamond.php"; check::classes(array("evil_diamond","foo","bar","baz","spam")); check::functions("test"); diff --git a/Examples/test-suite/php/exception_order_runme.php b/Examples/test-suite/php/exception_order_runme.php index 0f8139f88..9a2c9118b 100644 --- a/Examples/test-suite/php/exception_order_runme.php +++ b/Examples/test-suite/php/exception_order_runme.php @@ -1,6 +1,5 @@ <? require "tests.php"; -require "exception_order.php"; check::functions(array('is_python_builtin')); check::classes(array('A','E1','E2','E3','exception_order','ET_i','ET_d')); diff --git a/Examples/test-suite/php/extend_template_ns_runme.php b/Examples/test-suite/php/extend_template_ns_runme.php index 47661249f..46158672b 100644 --- a/Examples/test-suite/php/extend_template_ns_runme.php +++ b/Examples/test-suite/php/extend_template_ns_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "extend_template_ns.php"; check::classes(array("extend_template_ns","Foo_One")); $foo=new Foo_One(); diff --git a/Examples/test-suite/php/extend_template_runme.php b/Examples/test-suite/php/extend_template_runme.php index 58e3f6f98..a6579dce9 100644 --- a/Examples/test-suite/php/extend_template_runme.php +++ b/Examples/test-suite/php/extend_template_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "extend_template.php"; check::classes(array("Foo_0")); $foo=new Foo_0(); diff --git a/Examples/test-suite/php/global_vars_runme.php b/Examples/test-suite/php/global_vars_runme.php index 77fdec859..c3fe7d8aa 100644 --- a/Examples/test-suite/php/global_vars_runme.php +++ b/Examples/test-suite/php/global_vars_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "global_vars.php"; check::functions(array('init','read_b','read_x')); check::classes(array('A','global_vars')); diff --git a/Examples/test-suite/php/grouping_runme.php b/Examples/test-suite/php/grouping_runme.php index 4b425e119..d2b849d1c 100644 --- a/Examples/test-suite/php/grouping_runme.php +++ b/Examples/test-suite/php/grouping_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "grouping.php"; check::functions(array("test1","test2","do_unary","negate")); check::equal(5,test1(5),"5==test1(5)"); diff --git a/Examples/test-suite/php/ignore_parameter_runme.php b/Examples/test-suite/php/ignore_parameter_runme.php index 7db71fa20..d9db2d795 100644 --- a/Examples/test-suite/php/ignore_parameter_runme.php +++ b/Examples/test-suite/php/ignore_parameter_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "ignore_parameter.php"; // New functions check::functions(array('jaguar','lotus','tvr','ferrari','fiat')); diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php index c9a6fb49e..e639c781d 100644 --- a/Examples/test-suite/php/import_nomodule_runme.php +++ b/Examples/test-suite/php/import_nomodule_runme.php @@ -1,6 +1,6 @@ <?php + require "tests.php"; -require "import_nomodule.php"; check::functions(array('is_python_builtin')); check::classes(array('import_nomodule')); diff --git a/Examples/test-suite/php/li_carrays_cpp_runme.php b/Examples/test-suite/php/li_carrays_cpp_runme.php index 597011ee8..aab454319 100644 --- a/Examples/test-suite/php/li_carrays_cpp_runme.php +++ b/Examples/test-suite/php/li_carrays_cpp_runme.php @@ -1,6 +1,6 @@ <?php + require "tests.php"; -require "li_carrays_cpp.php"; // Check functions. check::functions(array('new_intarray','delete_intarray','intarray_getitem','intarray_setitem','new_abarray','delete_abarray','abarray_getitem','abarray_setitem','sum_array')); diff --git a/Examples/test-suite/php/li_carrays_runme.php b/Examples/test-suite/php/li_carrays_runme.php index 27e97b3c3..9af74c05a 100644 --- a/Examples/test-suite/php/li_carrays_runme.php +++ b/Examples/test-suite/php/li_carrays_runme.php @@ -1,6 +1,6 @@ <?php + require "tests.php"; -require "li_carrays.php"; // Check functions. check::functions(array('new_intarray','delete_intarray','intarray_getitem','intarray_setitem','new_abarray','delete_abarray','abarray_getitem','abarray_setitem','sum_array')); diff --git a/Examples/test-suite/php/li_factory_runme.php b/Examples/test-suite/php/li_factory_runme.php index c4f3253cc..3ccdd035f 100644 --- a/Examples/test-suite/php/li_factory_runme.php +++ b/Examples/test-suite/php/li_factory_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "li_factory.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/li_std_string_runme.php b/Examples/test-suite/php/li_std_string_runme.php index f1229ba79..680b7ce98 100644 --- a/Examples/test-suite/php/li_std_string_runme.php +++ b/Examples/test-suite/php/li_std_string_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "li_std_string.php"; # Checking expected use of %typemap(in) std::string {} li_std_string::test_value("Fee"); diff --git a/Examples/test-suite/php/li_std_vector_member_var_runme.php b/Examples/test-suite/php/li_std_vector_member_var_runme.php index f463efb50..32ce484fc 100644 --- a/Examples/test-suite/php/li_std_vector_member_var_runme.php +++ b/Examples/test-suite/php/li_std_vector_member_var_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "li_std_vector_member_var.php"; $t = new Test(); diff --git a/Examples/test-suite/php/multivalue_runme.php b/Examples/test-suite/php/multivalue_runme.php index 2a5188de4..77e1e1a82 100644 --- a/Examples/test-suite/php/multivalue_runme.php +++ b/Examples/test-suite/php/multivalue_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "multivalue.php"; // New functions check::functions(array('divide_l','divide_v','divide_mv')); diff --git a/Examples/test-suite/php/newobject1_runme.php b/Examples/test-suite/php/newobject1_runme.php index 6912104c9..a495ab15d 100644 --- a/Examples/test-suite/php/newobject1_runme.php +++ b/Examples/test-suite/php/newobject1_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "newobject1.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/newobject3_runme.php b/Examples/test-suite/php/newobject3_runme.php index 9b7e14340..8efa9891d 100644 --- a/Examples/test-suite/php/newobject3_runme.php +++ b/Examples/test-suite/php/newobject3_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "newobject3.php"; $factory = new factory(); diff --git a/Examples/test-suite/php/overload_null_runme.php b/Examples/test-suite/php/overload_null_runme.php index 03932dc16..b4b28e44f 100644 --- a/Examples/test-suite/php/overload_null_runme.php +++ b/Examples/test-suite/php/overload_null_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "overload_null.php"; $o = new Overload(); $x = new X(); diff --git a/Examples/test-suite/php/overload_polymorphic_runme.php b/Examples/test-suite/php/overload_polymorphic_runme.php index 6c20374bb..908988291 100644 --- a/Examples/test-suite/php/overload_polymorphic_runme.php +++ b/Examples/test-suite/php/overload_polymorphic_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "overload_polymorphic.php"; $t = new Derived(); diff --git a/Examples/test-suite/php/overload_rename_runme.php b/Examples/test-suite/php/overload_rename_runme.php index 83259ba6d..c2df99034 100644 --- a/Examples/test-suite/php/overload_rename_runme.php +++ b/Examples/test-suite/php/overload_rename_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "overload_rename.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/overload_return_type_runme.php b/Examples/test-suite/php/overload_return_type_runme.php index 2fadb7a7d..5f01bbe19 100644 --- a/Examples/test-suite/php/overload_return_type_runme.php +++ b/Examples/test-suite/php/overload_return_type_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "overload_return_type.php"; $b = new B; check::equal($b->foo(1), 0, ""); diff --git a/Examples/test-suite/php/php_iterator_runme.php b/Examples/test-suite/php/php_iterator_runme.php index edaaf2bdc..76b4757fc 100644 --- a/Examples/test-suite/php/php_iterator_runme.php +++ b/Examples/test-suite/php/php_iterator_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "php_iterator.php"; // No new functions. check::functions(array()); diff --git a/Examples/test-suite/php/php_pragma_runme.php b/Examples/test-suite/php/php_pragma_runme.php index 76359dc54..e70f2ceda 100644 --- a/Examples/test-suite/php/php_pragma_runme.php +++ b/Examples/test-suite/php/php_pragma_runme.php @@ -1,8 +1,6 @@ <?php require "tests.php"; -require "php_pragma.php"; - check::equal('1.5',(new ReflectionExtension('php_pragma'))->getVersion(),"1.5==version(php_pragma)"); diff --git a/Examples/test-suite/php/pointer_reference_runme.php b/Examples/test-suite/php/pointer_reference_runme.php index 3fa3c6a85..a8a511271 100644 --- a/Examples/test-suite/php/pointer_reference_runme.php +++ b/Examples/test-suite/php/pointer_reference_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "pointer_reference.php"; $s = pointer_reference::get(); check::equal($s->value, 10, "pointer_reference::get() failed"); diff --git a/Examples/test-suite/php/prefix_runme.php b/Examples/test-suite/php/prefix_runme.php index eaabcf32e..0f56b041d 100644 --- a/Examples/test-suite/php/prefix_runme.php +++ b/Examples/test-suite/php/prefix_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "prefix.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php index 5f520167a..a26892b42 100644 --- a/Examples/test-suite/php/preproc_constants_c_runme.php +++ b/Examples/test-suite/php/preproc_constants_c_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "preproc_constants_c.php"; // Same as preproc_constants.i testcase, but bool types are int instead check::equal(gettype(preproc_constants_c::CONST_INT1), "integer", "preproc_constants.CONST_INT1 has unexpected type"); diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php index 476eba811..7f45a1bae 100644 --- a/Examples/test-suite/php/preproc_constants_runme.php +++ b/Examples/test-suite/php/preproc_constants_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "preproc_constants.php"; check::equal(gettype(preproc_constants::CONST_INT1), "integer", "preproc_constants.CONST_INT1 has unexpected type"); check::equal(gettype(preproc_constants::CONST_INT2), "integer", "preproc_constants.CONST_INT2 has unexpected type"); diff --git a/Examples/test-suite/php/primitive_ref_runme.php b/Examples/test-suite/php/primitive_ref_runme.php index efa9c526a..9b281cf50 100644 --- a/Examples/test-suite/php/primitive_ref_runme.php +++ b/Examples/test-suite/php/primitive_ref_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "primitive_ref.php"; # A large long long number is too big, so PHP makes treats it as a double, but SWIG opts to return it as a string. # The conversion to double can lose precision so this isn't an exact comparison. diff --git a/Examples/test-suite/php/rename_scope_runme.php b/Examples/test-suite/php/rename_scope_runme.php index 1fd85f829..e1db4f59c 100644 --- a/Examples/test-suite/php/rename_scope_runme.php +++ b/Examples/test-suite/php/rename_scope_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "rename_scope.php"; check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket")); diff --git a/Examples/test-suite/php/skel.php b/Examples/test-suite/php/skel.php index 53a717c8b..7fdebc7d6 100644 --- a/Examples/test-suite/php/skel.php +++ b/Examples/test-suite/php/skel.php @@ -2,7 +2,6 @@ // Sample test file require "tests.php"; -require "____.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/smart_pointer_rename_runme.php b/Examples/test-suite/php/smart_pointer_rename_runme.php index 8cc47dc5f..094860386 100644 --- a/Examples/test-suite/php/smart_pointer_rename_runme.php +++ b/Examples/test-suite/php/smart_pointer_rename_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "smart_pointer_rename.php"; check::classes(array("Foo","Bar")); check::classmethods("foo",array("ftest1","ftest2","__set","__isset","__get","__construct")); diff --git a/Examples/test-suite/php/swig_exception_runme.php b/Examples/test-suite/php/swig_exception_runme.php index 66758ed29..37a7a59ee 100644 --- a/Examples/test-suite/php/swig_exception_runme.php +++ b/Examples/test-suite/php/swig_exception_runme.php @@ -1,6 +1,5 @@ <?php -require("swig_exception.php"); require("tests.php"); $c = new Circle(10); diff --git a/Examples/test-suite/php/sym_runme.php b/Examples/test-suite/php/sym_runme.php index 21d71df4c..7e8f914c1 100644 --- a/Examples/test-suite/php/sym_runme.php +++ b/Examples/test-suite/php/sym_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "sym.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/template_arg_typename_runme.php b/Examples/test-suite/php/template_arg_typename_runme.php index fd1d5e5ac..c7fcbbd9d 100644 --- a/Examples/test-suite/php/template_arg_typename_runme.php +++ b/Examples/test-suite/php/template_arg_typename_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "template_arg_typename.php"; // No new functions check::functions(array()); diff --git a/Examples/test-suite/php/template_construct_runme.php b/Examples/test-suite/php/template_construct_runme.php index a8e554bb9..d09bc4d37 100644 --- a/Examples/test-suite/php/template_construct_runme.php +++ b/Examples/test-suite/php/template_construct_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "template_construct.php"; check::classes(array('Foo_int')); $foo_int=new foo_int(3); diff --git a/Examples/test-suite/php/threads_exception_runme.php b/Examples/test-suite/php/threads_exception_runme.php index 42573897f..38873dffd 100644 --- a/Examples/test-suite/php/threads_exception_runme.php +++ b/Examples/test-suite/php/threads_exception_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "threads_exception.php"; // Check functions check::functions(array('is_python_builtin')); diff --git a/Examples/test-suite/php/typedef_reference_runme.php b/Examples/test-suite/php/typedef_reference_runme.php index ee6cf488a..8309c3c6f 100644 --- a/Examples/test-suite/php/typedef_reference_runme.php +++ b/Examples/test-suite/php/typedef_reference_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "typedef_reference.php"; check::functions(array('somefunc','otherfunc','new_intp','copy_intp','delete_intp','intp_assign','intp_value')); $int2=copy_intp(2); diff --git a/Examples/test-suite/php/typemap_ns_using_runme.php b/Examples/test-suite/php/typemap_ns_using_runme.php index d679af936..e15427856 100644 --- a/Examples/test-suite/php/typemap_ns_using_runme.php +++ b/Examples/test-suite/php/typemap_ns_using_runme.php @@ -1,7 +1,7 @@ <?php require "tests.php"; -require "typemap_ns_using.php"; + if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); if (! 3==spam(3)) die("spam function not working right\n"); diff --git a/Examples/test-suite/php/using1_runme.php b/Examples/test-suite/php/using1_runme.php index 0f3c9155e..e15427856 100644 --- a/Examples/test-suite/php/using1_runme.php +++ b/Examples/test-suite/php/using1_runme.php @@ -1,7 +1,7 @@ <?php require "tests.php"; -require "using1.php"; + if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); if (! 3==spam(3)) die("spam function not working right\n"); diff --git a/Examples/test-suite/php/using2_runme.php b/Examples/test-suite/php/using2_runme.php index fa79cb256..e15427856 100644 --- a/Examples/test-suite/php/using2_runme.php +++ b/Examples/test-suite/php/using2_runme.php @@ -1,7 +1,7 @@ <?php require "tests.php"; -require "using2.php"; + if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); if (! 3==spam(3)) die("spam function not working right\n"); diff --git a/Examples/test-suite/php/valuewrapper_base_runme.php b/Examples/test-suite/php/valuewrapper_base_runme.php index d20df4ecf..29aade445 100644 --- a/Examples/test-suite/php/valuewrapper_base_runme.php +++ b/Examples/test-suite/php/valuewrapper_base_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "valuewrapper_base.php"; check::classes(array("valuewrapper_base","Base","Interface_BP")); check::functions("make_interface_bp"); diff --git a/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php b/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php index d83210e9a..abfb4d307 100644 --- a/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php +++ b/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php @@ -1,7 +1,6 @@ <? require "tests.php"; -require "virtual_vs_nonvirtual_base.php"; $fail = new SimpleClassFail(); $work = new SimpleClassWork(); diff --git a/Examples/test-suite/php/wrapmacro_runme.php b/Examples/test-suite/php/wrapmacro_runme.php index f79ddf975..cd4f916a1 100644 --- a/Examples/test-suite/php/wrapmacro_runme.php +++ b/Examples/test-suite/php/wrapmacro_runme.php @@ -1,7 +1,6 @@ <?php require "tests.php"; -require "wrapmacro.php"; check::functions(array('guint16_swap_le_be_constant', 'maximum')); diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index ab79eb04b..e85dd690d 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -40,7 +40,6 @@ static File *f_begin = 0; static File *f_runtime = 0; static File *f_runtime_h = 0; static File *f_h = 0; -static File *f_phpcode = 0; static File *f_directors = 0; static File *f_directors_h = 0; @@ -353,22 +352,6 @@ public: Delete(filename); } - /* PHP module file */ - filen = NewStringEmpty(); - Printv(filen, SWIG_output_directory(), module, ".php", NIL); - - f_phpcode = NewFile(filen, "w", SWIG_output_files()); - if (!f_phpcode) { - FileErrorDisplay(filen); - SWIG_exit(EXIT_FAILURE); - } - - Printf(f_phpcode, "<?php\n\n"); - - Swig_banner(f_phpcode); - - Printf(f_phpcode, "\n"); - /* sub-sections of the php file */ pragma_code = NewStringEmpty(); pragma_incl = NewStringEmpty(); @@ -635,7 +618,30 @@ public: Delete(f_begin); Delete(arginfo_used); - Printf(f_phpcode, "%s\n%s\n", pragma_incl, pragma_code); + if (Len(pragma_incl) > 0 || Len(pragma_code) > 0) { + /* PHP module file */ + String *php_filename = NewStringEmpty(); + Printv(php_filename, SWIG_output_directory(), module, ".php", NIL); + + File *f_phpcode = NewFile(php_filename, "w", SWIG_output_files()); + if (!f_phpcode) { + FileErrorDisplay(php_filename); + SWIG_exit(EXIT_FAILURE); + } + + Printf(f_phpcode, "<?php\n\n"); + + if (Len(pragma_incl) > 0) { + Printv(f_phpcode, pragma_incl, "\n", NIL); + } + + if (Len(pragma_code) > 0) { + Printv(f_phpcode, pragma_code, "\n", NIL); + } + + Delete(f_phpcode); + Delete(php_filename); + } return SWIG_OK; } |