Commit Graph

311 Commits

Author SHA1 Message Date
Nihal c6cfad2aab Remove SWIG_Get_Type in magic getter and setter methods.
Use respective getter and setter methods.
2017-07-19 20:49:22 +05:30
Nihal de31666c3a Fixup: Remove TRMS Stuff (Not used in PHP7).
Remove Cmp of class_name with NULL.
Reuse code to find "_get" (getters) methods of member variables.
2017-07-19 20:48:50 +05:30
Nihal 58aff09ebe Add magic methods support (__get, __set, and __isset) inherently to the extensions.
This to to maintain compatibility and consistency.
2017-07-19 20:48:46 +05:30
Nihal 42f012b2d1 Bug Fix of double freeing. It used to create a new object for all get commands of class/struct pointers.
Now creating only if newobject is lit, or else creating a basic zend object to return to user.
2017-07-19 20:48:27 +05:30
Nihal 9addd37640 Use pre-exisiting function is_class to check a valid class/struct defenition. 2017-07-19 20:48:24 +05:30
Nihal ce04574059 Add support to access static member variables in different way.
This is to keep compatibility and consistency with the older way.
Shape::nshapes static variable's setter and getter methods can be
accessed by Shape::nshapes(10),Shape::nshapes() respectively.
2017-07-19 20:48:19 +05:30
Nihal 4de2f257f9 Using wname variable for function name generated in .cxx or .c wrapper.
This is to ensure compatibility and consistency
2017-07-19 20:48:15 +05:30
Nihal 5e001d5288 Add class constants support to access class enums and class constants.
"flat" constants changed to class constatns.
Example: Foo_IMPULSE -> Foo::IMPULSE
2017-07-19 20:48:01 +05:30
Nihal 11e2f53840 Object Structure approach Code
Takes care of simple class wrapping with pointers, enum, values, variables, and inheritance.
2017-07-19 20:47:53 +05:30
Nihal 251d25346d Fix OUTPUT Typemap not having return statement bug in PHP wrapper. 2017-06-28 09:47:33 +12:00
Olly Betts 9a0180c56c Merge pull request #970 from nihal95/master
Adds pragma version directive for php5 and php7.  Fixes #360.
2017-05-16 17:47:35 +12:00
William S Fulton ebd37155a8 Fix potential use of uninitialized variables in directors 2017-05-13 22:40:59 +01:00
Nihal eb9e72f3b2 Add new pragma to specify version to PHP5 and PHP7 extensions.
See issue #360, feature request to have version in php5 and php7 extensions.
2017-05-08 11:43:38 +05:30
Christophe Duvernois 4777a0ad3c #526 : propagate c++11 noexcept to director classes 2017-04-27 23:37:15 +02:00
Olly Betts 0aac18b2a1 [PHP] destroy_globals function is empty, so drop
We can just pass NULL instead.
2016-12-30 16:02:01 +13:00
Olly Betts 36ee653d3b Omit module functions when there's no code
MSHUTDOWN, RINIT, RSHUTDOWN and MINFO are often empty, so check and
omit them if this is the case, and set the module structure entry to
NULL instead.  Reduces code size, number of external functions on the
module, and runtime overhead a little (RINIT and RSHUTDOWN are called
on every request when used with a webserver).
2016-12-30 15:36:08 +13:00
Olly Betts cf60bb8895 [php7] Drop special code for PHP < 5.4 2016-12-30 14:56:53 +13:00
Olly Betts 4a2ede0820 [PHP7] Remove lingering generated ZTS code
ZTS is gone in PHP7 so these are dead code.
2016-12-30 12:41:19 +13:00
Olly Betts 2b4c1cdd5e Fix "set but not used" warning 2016-12-13 11:40:45 +13:00
Olly Betts 2aa2219f28 Fix reference example under PHP 7.1
PHP 7.1 no longer supports calling methods with fewer parameters
than declared, so we need to generate __construct() with default
values for all but the first parameter.
2016-12-06 11:01:55 +13:00
Olly Betts da1dd2ffd2 [PHP] Pick a default dtor which can't collide 2016-12-01 15:09:53 +13:00
Olly Betts 76a98b0b1a [PHP] Emit at most one copy of the default dtor
Can reduce the wrapper source size significantly, though at least
with recent GCC the stripped compiled size seems unchanged.
2016-12-01 14:21:29 +13:00
Olly Betts 659116a1b2 Fix memory leaks introduced by previous commit 2016-12-01 14:04:10 +13:00
Olly Betts 4993991d28 [PHP] Only emit one copy of each distinct arginfo
Previously we emitted a separate one for every wrapped function,
but typically many functions have the same number of parameters
and combinations of parameters passed by reference or not.

This change significantly reduces both the size of the generated
wrapper, and of the compiled PHP extension module (e.g. by ~6% for
the stripped extension module for Xapian's PHP7 bindings).
2016-12-01 13:05:41 +13:00
Olly Betts 75a00cd15e [PHP7] Make default C++ extension .cxx
This is SWIG's default for every language except PHP, and now is a
good time to make this change so that once we drop PHP5 support, we'll
have the same default everywhere.  It's easy to override the default
with -cppext cxx to get the PHP5 behaviour.
2016-11-30 13:27:13 +13:00
Olly Betts 1169874f59 [PHP] Add support for PHP7.
PHP5's C extension API has changed substantially so you need to use
-php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
2016-11-30 13:05:59 +13:00
Olly Betts 1adfe2f537 [PHP] Fix code generated for feature("director:except")
Previously the return value of call_user_function() was ignored and we
checked an uninitialised value instead.  Fixes #627.  Based on patch
from Sergey Seroshtan.
2016-09-25 14:42:04 +13:00
Olly Betts 26bbc96d58 Arrange to return after calling zend_throw_exception()
Fixes github issue#240.
2016-09-16 17:54:02 +12:00
William S Fulton ac495d5c66 Merge branch 'char-escaping'
* char-escaping:
  Add missing string_constant.i testcase
  changes file update for char wrappers
  C# char wrappers fixes for enum values, static const member char values and %csconst
  D testing added for %dmanifestconst and char constants
  Fix wrapping D constants using %dmanifestconst
  Php fix for enum value of '\0'
  Fix static const char member variables wrappers with %javaconst(1).
  Expand char testing in enums and %constant
  Java char changes file update
  Java enum and static member variable escaping fix for chars
  Add tests for enum values and static const member variables chars containing escape sequences
  Minor documentation tweak

Conflicts:
	CHANGES.current
2016-03-12 23:27:51 +00:00
William S Fulton 539aca58a5 Php fix for enum value of '\0' 2016-03-12 00:26:49 +00:00
William S Fulton 21ee09fc19 Multiple inheritance warning wording tweak 2016-03-06 10:45:39 +00:00
Petre Eftime 0a07cd4c30 Prevent redefinition warnings when compiling with SWIG<module> defined
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
2015-12-22 14:33:21 +02:00
William S Fulton 6a61f8271f Php fix for -Wmissing-field-initializers warning
Use ZEND_FE_END (introduced sometime around 5.2) to obtain the correct
number of arguments for zend_function_entry. Fallback to the original
3 argument initializer if not defined, however, this will not fix the
initializer warning though for some older versions of PHP.
2015-12-19 16:21:23 +00:00
William S Fulton edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
Nils Gladitz 925cec3a82 Add a space between literal and string macro
In C++11 a space between a literal and string macro is required.
2015-07-03 20:59:23 +01:00
Olly Betts 7ba0652677 Create director_common.swg for language-indep code
Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for
all languages with director support, not just Python and PHP.
2015-03-12 19:51:11 +13:00
Olly Betts b3003f1f9f [PHP] When wrapping a returned resource as an object, check if all
cases wrap it in the same class, and if so eliminate the pointless
switch statement wrapper we previously generated.
2015-01-23 13:56:13 +13:00
Olly Betts 0dd685bad2 Fix PHP crash in director_finalizer 2015-01-14 15:38:55 +13:00
Olly Betts ea5be4e508 Fix PHP backend for default_args testcase 2015-01-14 10:44:54 +13:00
Olly Betts 682b4dd843 [PHP] Fix segfault in director upcall check
Manifest only when using PHP built with ZTS enabled.
2015-01-12 13:53:01 +13:00
William S Fulton 06e361dbf2 Fix linux gcc warnings and strtol corrections 2015-01-11 17:30:25 +00:00
Olly Betts cd16059c66 Provide -cppext as a general command line option
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend).  Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
2015-01-08 10:54:37 +13:00
Olly Betts 1a99212c2c [PHP] Add support for specifying any PHP interfaces a wrapped class
implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator";
2014-09-12 12:48:37 -03:00
Olly Betts 14c2cf3407 PHP: Fix memory leak if a director method is passed Null for self 2014-08-29 16:28:00 -03:00
Olly Betts 73bb909bae [PHP] The generated __isset() method now returns true for read-only properties. 2014-05-01 14:37:58 +12:00
Olly Betts 36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12:00
Olly Betts f563069e7b [PHP] Fix wrapping director constructors with default parameters with a ZTS-enabled build of PHP. 2014-04-03 10:38:19 +13:00
Olly Betts 2a3981289d [PHP] Pass the ZTS context we already have to avoid needing to
call TSRMLS_FETCH, which is relatively expensive.
2014-04-02 23:35:59 +13:00
Miklos Vajna 227192f80a Fix Examples/php/pointer to work with PHP 5.5
With this, all examples work with PHP 5.5 for me.
2013-12-12 15:52:51 +13:00
Olly Betts cecd89f66f [PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages.  The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).

*** POTENTIAL INCOMPATIBILITY  ***
2013-12-12 15:40:15 +13:00
William S Fulton d15220cba4 Remove a couple of unused variable warnings in generated code 2013-10-18 19:10:42 +01:00
William S Fulton bcb7aee022 Merge branch 'master' into gsoc2009-matevz
Conflicts:
	Examples/Makefile.in
	Examples/guile/Makefile.in
	Lib/php/php.swg
	Makefile.in
	Source/CParse/parser.y
	configure.ac
2013-10-10 07:26:09 +01:00
William S Fulton c4d40c7b64 PHP directors - generate call_user_function on one line 2013-10-01 22:13:57 +01:00
Olly Betts 24ff00690f Use ZVAL_STRINGL instead of ZVAL_STRING to set funcname as we know the length at swig-time 2013-04-14 08:03:46 +12:00
Olly Betts a16dc29046 Removed unused Printf parameter 2013-04-14 06:14:47 +12:00
Sylvestre Ledru e0b14786d6 Fix some useless code detected by scan-build (LLVM/Clang) 2013-03-08 20:53:18 +00:00
William S Fulton e805d5f925 Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
2013-01-28 07:01:37 +00:00
William S Fulton 7841a0d097 Remove cvs/svn Id strings 2013-01-12 01:21:16 +00:00
Olly Betts 0dd11cdd8d Fix to work with a ZTS build of PHP (broken in 2.0.7) 2013-01-08 18:33:47 +13:00
William S Fulton 8a8c8e377b gcc-4.6 warning fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-15 18:33:02 +00:00
William S Fulton 89052f3b0a Fix Strcmp - it didn't have consistent null pointer handling - revert to what it used to be - a lightweight wrapper around strcmp which means functions once again must not pass in null to it.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13943 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-02 13:36:13 +00:00
William S Fulton d93dc0f8e2 Distinguish between an "abstract" attribute on a class containing a list of abstract members and an "abstract" flag on pure virtual methods - renamed former to "abstracts"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13935 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-24 14:13:58 +00:00
William S Fulton 0d2c459046 Remove some unused code and pointless variable assignments
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13932 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-23 07:38:00 +00:00
William S Fulton d918bddfc0 Fix segfaults when using filename paths greater than 1024 characters in length - use String * and heap instead of fixed size static char array buffers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13904 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-18 00:45:18 +00:00
William S Fulton 46d2486115 Resource leak fixes (or hiding them from Coverity static analysis tool by using String instead of char *)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13886 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-14 22:16:54 +00:00
William S Fulton 5a1e82a2f4 Remove DohClose (Close) and replace with calls to DohDelete (Delete) to fix some minor memory leaks in most uses of NewFile.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13885 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-14 22:16:07 +00:00
William S Fulton b1ee062d2a Cosmetic variable renaming for consistency across language modules
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-27 17:38:05 +00:00
William S Fulton f6229d4b73 Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Implemented by ensuring the 'type' attribute in the Node is set up correctly and using the usual Swig_typemap_lookup on the Node.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13873 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-27 17:37:34 +00:00
William S Fulton ecac2d2a68 Improve nullptr constant wrapping
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13842 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-20 19:09:38 +00:00
Olly Betts 7196e556a5 Fix SF#3528035, a regression introduced by the fix for SF#3428833.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13105 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-23 02:58:24 +00:00
Olly Betts de9d01dbcd [PHP] Fix getters for template members. (SF#3428833)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13096 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-18 02:43:52 +00:00
Olly Betts a2a42c7038 Add back 'NIL', dropped by mistake in change before last.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13082 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-14 05:11:02 +00:00
Olly Betts e4763231be Remove some commented out code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13081 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-14 04:58:08 +00:00
Olly Betts 4f11fd51ab Drop check for "ZEND_MODULE_API_NO > 20010900". We only support PHP5
now, and 5.0.0 was released in 2004.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13080 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-14 03:31:04 +00:00
Olly Betts d81770dd93 [PHP] Fix memory leak in code generated for a callback. Patch from
SF bug #3510806.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13079 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-12 13:52:00 +00:00
Olly Betts d96db667f7 [PHP] Avoid using zend_error_noreturn() as it doesn't work with all
builds of PHP (SF bug #3166423).  Instead we now wrap it in a
SWIG_FAIL() function which we annotate as "noreturn" for GCC to
avoids warnings.  This also reduces the size of the compiled
wrapper (e.g. the stripped size is 6% for Xapian's PHP bindings).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13077 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-12 13:26:16 +00:00
William S Fulton 468ca084fc Correct special variables in 'directorargout' typemap. This change will break any 'directorargout' typemaps you may have written. Please change: to and to \n Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't previously compile and add in , etc expansion.\n [C#, Go, Java, D] Add support for the 'directorargout' typemap.\n [Java] Add (char *STRING, size_t LENGTH) director typemaps.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-20 20:50:36 +00:00
William S Fulton 24133bacd7 Remove numerous hard coded 'result' variable name in generated c/c++ wrappers. The variable name is now defined in just one place, making it possible to change the name easily if a target language so wishes - see cwrap.c.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12830 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-10-30 21:51:50 +00:00
William S Fulton 44c202d048 Add in $symname expansion for director methods
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12772 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-08-04 19:45:19 +00:00
Olly Betts 210266cd70 [PHP] Don't generate "return $r;" in cases where $r hasn't been set.
This was basically harmless, except it generated a PHP E_NOTICE if
the calling code had enabled them.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12767 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-07-29 10:51:02 +00:00
Olly Betts 688ea24560 [PHP] Fix director code to work when PHP is built with ZTS enabled,
which is the standard configuration on Microsoft Windows.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12749 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-06-23 16:04:42 +00:00
Olly Betts 29190559f8 SWIG_ZTS_SetPointerZval() now interprets bit 1 in newobject as meaning (wrap
in a PHP class wrapper), rather than taking newobject==2 as meaning this,
so we can wrap new and existing objects in this way.

Handle wrapping classes in a C++ namespace being returned by director methods.

No need to force classname to lowercase as zend_lookup_class() does that
internally.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12723 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-30 06:47:47 +00:00
Olly Betts dce3b5bacf [PHP] Fix handling of directors when -prefix is used.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12722 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-30 04:49:29 +00:00
Olly Betts 1d7f309a8a [PHP] Fix handling of methods of classes with a virtual base class (SF#3124665).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12711 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-24 14:51:59 +00:00
Olly Betts 72fc8be46c [PHP] Fix handling of overloaded methods/functions where some
return void and others don't - whether this worked or not depended 
on the order they were encountered in (SF#3208299).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12539 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-14 12:33:56 +00:00
William S Fulton a63d456f8a Remove redundant code highlighted by warnings in gcc-4.6
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12536 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-14 07:22:08 +00:00
William S Fulton b69b793d8e Better consistency in usage display
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12524 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-09 21:42:38 +00:00
Olly Betts 24053d7789 [PHP] Don't use zend_error_noreturn() for cases where the function
returns void - now this issue can only matter if you have a function
or method which is directed and returns non-void.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12523 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-07 23:05:01 +00:00
Olly Betts 630e438c6a [PHP] Address bug in PHP on some platforms/architectures which
results in zend_error_noreturn() not being available using
SWIG_ZEND_ERROR_NORETURN which defaults to zend_error_noreturn but
can be overridden when building the module by passing
-DSWIG_ZEND_ERROR_NORETURN=zend_error to the compiler.  This may
result in compiler warnings, but should at least allow a module
to be built on those platforms/architectures (SF#3166423).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12479 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-19 13:28:43 +00:00
Olly Betts bf7c9e9a42 [PHP] An overloaded method which can return an object or a
primitive type no longer causes SWIG to segfault.  Reported by Paul
Colby in SF#3168531.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12471 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-18 06:39:51 +00:00
William S Fulton 74883f1dd7 [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
2011-02-04 20:25:59 +00:00
William S Fulton 1adc50e730 constify SwigType * in many places
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12349 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-15 21:55:08 +00:00
William S Fulton 004643ff30 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
2010-11-25 20:39:11 +00:00
Olly Betts 9eaf5ba1be [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
2010-10-14 05:13:09 +00:00
Olly Betts a25ccbf58b [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
2010-09-08 02:40:56 +00:00
William S Fulton 25ff4e4927 merge revisions 11877-12162 from trunk to gsoc2009-matevz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12164 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-20 23:35:40 +00:00
William S Fulton ab1cd03979 merge revisions 11243-11872 from trunk to gsoc2009-matevz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-20 21:58:41 +00:00
William S Fulton d8cc75946b Improved C++0x rvalue reference implementation differentiating lvalue and rvalue references. The previous implementation treated rvalue references as lvalue references which leads to a number of different wrapping issues.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12160 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-18 00:19:22 +00:00
Olly Betts d0d40db326 Use SWIG_PTR rather than literal "_cPtr".
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12149 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-25 02:41:27 +00:00
Olly Betts ae40eff993 The default visibility for methods is public, so don't specify that explicitly
to keep the wrapper size down.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12146 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-24 14:44:06 +00:00
William S Fulton 95a3eb5a7d code style: fix inconsistent NULL pointer comparisons
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12137 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-17 23:49:12 +00:00
Olly Betts f67c0fa12c [PHP] Fix directors to correctly call a method with has a
different name in PHP to C++ (we were always using the C++ name
in this case).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12110 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-10 04:41:11 +00:00
William S Fulton bb41eeb343 Fix potential name clashes with symbols in the Director class
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12062 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-27 20:55:24 +00:00
Olly Betts e512093358 [PHP] Stop generating a bogus line of code in certain constructors.
This was mostly harmless, but caused a PHP notice to be issued, if
enabled (SF#2985684).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12033 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-21 07:07:15 +00:00
Olly Betts 227f2e2e0a [PHP] Fix wrapping of global variables which was producing
uncompilable code in some cases.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12027 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-14 08:22:28 +00:00
William S Fulton e81bfb86c0 Correct file and line number display for some error messages, these now also result in exiting with an error.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11945 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-13 23:08:02 +00:00
William S Fulton 7f53260203 merge revisions 11872:11876 from trunk to gsoc2009-matevz branch - license changes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11905 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-06 00:51:54 +00:00
William S Fulton cb64f65bae SWIG license change - Source moves to GPLv3
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11876 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:53:33 +00:00
William S Fulton 83bd820285 Add typemaps used debugging option (-debug-tmused). Fix missing file/line numbers for typemap warnings and in the output from the -debug-tmsearch/-debug-tmused options
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11802 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-01-04 19:33:52 +00:00
Olly Betts bfb09161f7 Eliminate "int error;" declaration from generated PHP director support code
if it isn't used.  No change in behaviour, and the compiler will just optimise
away the unused variable, but it can cause an "unused variable" warning.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11776 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-12-10 11:52:29 +00:00
Olly Betts bcda9644f1 Remove two commented out lines of code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11773 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-12-04 04:56:10 +00:00
Olly Betts dd5714ea28 [php] Fix place where class prefix (as specified with -prefix)
wasn't being used.  Patch from gverbruggen in SF#2892647.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11736 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-11-13 07:15:08 +00:00
Miklos Vajna fc52ca3b80 PHP: handle -prefix when checking if a class has been subclassed or not
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11637 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-18 16:23:23 +00:00
Olly Betts 4540717c39 [PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11619 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-17 08:47:30 +00:00
Olly Betts 47e404ba5b Only have an array for properties in the base class, not in derived classes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11611 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-17 05:24:17 +00:00
Olly Betts c4f5f22f67 Remove some superfluous "else"s in generated PHP code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11610 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-17 03:19:14 +00:00
Miklos Vajna 8da18d336e PHP: Optimize the previous commit a bit.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11594 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-16 21:47:24 +00:00
Miklos Vajna b5c49c20fd PHP: fix for the valuewrapper_base testcase
The problem is the following: before director support, the return class
type of a function was hardwired. That was bad, as factory functions
wanted to instantiate abstract classes, so we switched to detecting the
class type based on the PHP resource type. That was good, but broke the
case when for example

%template(make_Interface_BP) make<Interface_<BinaryPolarization> >;

was used, as the cheap parser had no idea how to turn
'Interface_T_oss__BinaryPolarization_t' to 'make_Interface_BP'.

This patch still uses the resource type detection, but in case that
would result in a non-existing class, we just use the hardwired name.

NOTE: This still does not fix the case when abstract classes are used
with templates.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11593 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-16 21:44:05 +00:00
Olly Betts f3d0ebbf18 Refactor the recent support for wrapping static member variables for PHP5 so it
works for static members which are themselves classes.  With this and the previous
patch, li_std_string now passes and all other tests pass/fail as before.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11578 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-15 05:33:05 +00:00
Olly Betts ba29cea2b5 Minor cleanups.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11571 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-14 17:01:20 +00:00
Olly Betts 57017bd6bc [PHP] PHP5 now wraps static member variables as documented.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11570 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-14 16:22:15 +00:00
Olly Betts f4e3444ae3 Use module name instead of hardcoded "example" in __get().
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11567 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-14 09:44:15 +00:00
Olly Betts e125ce326d If $c would be used as a parameter name, rename it to $c_ to avoid issues
if call-time pass-by-reference is enabled and used.
Use $c instead of $class to keep down the number of "reserved" parameter
names.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11564 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-14 08:04:21 +00:00
Olly Betts e068305125 If there's no prefix, special case to avoid prepending an empty string.
Don't calculate $class in the stdClass case when we don't need it.
Eliminate an unnecessary else.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11563 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-14 07:53:38 +00:00
Miklos Vajna 889b156afd PHP: fix for the extend_template testcase
The fix is not to handle a %template as a rename by reading the class'
sym:name attribute instead of the ctor's name attribute.

This has been broken in r11510.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11539 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-12 11:18:58 +00:00
Olly Betts 741b90763b Fix to work for classes which aren't called "Foo"...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11531 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-11 14:42:03 +00:00
Olly Betts 37b9370344 Eliminate space before "function" when there's no access specifier (just a
cosmetic tweak).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11530 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-11 14:40:51 +00:00
Miklos Vajna b61f9da6e6 PHP: fix for the template_ref_type testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11528 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-11 10:19:04 +00:00
Miklos Vajna 486419b271 PHP: Skip the Foo:: prefix when detecting ctor renames
This fixes a few testcases (like the mixed_types one) I broke in the
previous commit.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11512 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-06 13:16:50 +00:00
Miklos Vajna 09b20003fb PHP: fix for the overload_rename testcase
Previously we just had two __construct function which resulted in a
parse error. Now we create a new factory method for the renamed ctor.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11510 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-06 12:27:03 +00:00
Miklos Vajna 76a90e6606 PHP: define our own ZEND_MODULE_BUILD_ID macro for PHP <= 5.3
This silences the warning, but causes no breakage for future releases.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11504 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-05 11:37:45 +00:00
Miklos Vajna 9444f2cebe PHP: fix for the import_nomodule testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-03 13:52:25 +00:00
Miklos Vajna ad0428538d PHP: fix for the cpp_namespace testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11480 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 14:01:27 +00:00
Miklos Vajna 7e4b1a086d PHP: Cleanups.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11479 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 12:16:50 +00:00
Olly Betts 19c4162047 Remove dead code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11477 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 08:50:56 +00:00
Olly Betts 7c84046a36 Make SwigPHP_emit_resource_registrations() static.
Remove "NEW Destructor style" comment as it's no longer meaningful.
Undo indent damage.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11476 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 08:39:27 +00:00
William S Fulton 028fcff0a5 remove redundant method
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11474 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 06:08:36 +00:00
William S Fulton 7f0e632ddd typemap method name: use consistent terminology in code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11473 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-30 06:06:49 +00:00
Miklos Vajna ae606df4df PHP: fix for the allowexcept testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11469 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-29 16:17:04 +00:00
Miklos Vajna 22351914fe PHP: Avoid calling is_resource() twice with no good reason
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11466 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-29 11:03:22 +00:00
Olly Betts 4b7478ac15 [PHP] Fix memory leak in PHP resource destructor for classes
without a destructor and non-class types.  Patch from Hitoshi Amano
in SF#2825303.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11463 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-29 02:06:18 +00:00
Olly Betts c321421bc5 [PHP] Update warnings about clashes between identifiers and PHP
keywords and automatic renaming to work with the PHP5 class 
wrappers.  Fixes SF#1613679.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11460 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-28 13:12:06 +00:00
Miklos Vajna 0fa227ea83 PHP: fix for the director_using testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11459 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-28 11:47:36 +00:00
Miklos Vajna 0249eea389 Merge https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-vmiklos/
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11434 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-22 11:08:29 +00:00
Olly Betts dc4474c95d Use single quotes for string literals since we don't need or want substitutions
to work.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11361 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-05 03:47:26 +00:00
William S Fulton efa11dee52 add new %begin directive for inserting code at top of wrapper file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11133 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-20 07:52:24 +00:00
Haoyu Bai 6d2aef67d9 Replaced all [const] String_or_char * to const_String_or_char_ptr, by the following command:
sed -i "s/\(const \)\?String_or_char \*/const_String_or_char_ptr /g" CParse/* Include/* Modules/* Preprocessor/* Swig/*

This is a preparation for moving to new DOH, since for strong typed objects we need the const_String_or_char_ptr class to implicit convert to and from String * or const char *.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11080 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-24 13:15:51 +00:00
Olly Betts 79f7900968 Mark SWIGPERL5, SWIGPHP5, and SWIGTCL8 as deprecated in the source
code and remove documentation of them.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11030 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-05 22:40:07 +00:00
William S Fulton 5ec2d8c166 All languages now define a macro in the generated C/C++ wrapper file indicating which language is being wrapped, eg #define SWIGJAVA
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11018 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-30 00:38:34 +00:00
William S Fulton da0b517a7f accept unix directory separators on windows for input file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11001 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-24 14:50:26 +00:00
Olly Betts 0a101fba3b [PHP] Fix warnings when compiling generated wrapper with GCC 4.3.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10970 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-07 00:38:14 +00:00
William S Fulton 06b2eca75e remove last vestiges of php4 and encourage use of -php rather than -php5
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10969 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-06 23:15:20 +00:00
William S Fulton 5d65e1ca92 gcc-4.3 warning fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10939 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-11-23 19:44:29 +00:00
William S Fulton 6fb0f48935 customised ccache support: read the CCACHE_OUTFILES env variable and if exists, the names of all generated files are written to the filename specified in the env variable
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10898 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-11-03 12:51:45 +00:00
Olly Betts 1a0632b35d Clean out more PHP4 stuff.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-19 06:40:39 +00:00
Olly Betts 6029bc8b2d [PHP5] Fix extra code added to proxy class constructors in the case
where the only constructor takes no arguments.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10863 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-18 13:01:52 +00:00
Olly Betts e9485c0f60 [PHP5] Fix wrapping of a renamed enumerated value of an enum class member
(SF#2095273).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10862 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-18 09:54:18 +00:00
Olly Betts 70ff1c3005 [PHP] The deprecated command line option "-make" has been removed.
Searches on Google codesearch suggest that nobody is using it now
anyway.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10649 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-04 01:02:22 +00:00
Olly Betts 7893f114a4 [PHP] The deprecated command line option "-phpfull" has been
removed.  We recommend building your extension as a dynamically
loadable module.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10637 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-03 02:32:11 +00:00
Olly Betts 3d3bc01a2f Rename php4*.swg to php*.swg.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10635 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-03 00:37:38 +00:00
Olly Betts 7dfd9aae31 WARN_* constants are user visible, so keep existing WARN_PHP4_* for
backward compatibility, but add preferred forms WARN_PHP_* and use
these ourselves.

Rename Lib/php4 to Lib/php, Source/Modules/php4.cxx to Source/Modules/php.cxx.
 
Add typemaps for const reference so Examples/test-suite/apply_signed_char.i
works.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10633 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-03 00:09:56 +00:00