Commit graph

94 commits

Author SHA1 Message Date
Olly Betts
06e5a5fb0d [PHP] Update the lists of PHP keywords with new ones from PHP 5.4
and newer (and some missing ones from 5.3).  Reserved PHP constants
names are now checked against enum values and constants, instead
of against function and method names.  Built-in PHP function names
no longer match methods added by %extend.  Functions and methods
named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
longer needlessly renamed.
2014-02-19 17:21:34 +13:00
Olly Betts
36c22b70bd Make PHP %keywordwarn message wording consistent with other languages 2014-02-19 16:51:31 +13:00
Olly Betts
fcf8180751 Whitespace tweaks 2014-02-17 16:27:39 +13:00
Olly Betts
b761131fec "if (strlen(msg))" -> "if (msg[0])" 2014-02-17 16:26:48 +13:00
Olly Betts
7af8b13ef7 Just call strcmp() rather than strlen() twice plus zend_binary_strcmp() 2014-02-17 16:25:29 +13:00
Olly Betts
052d0057c2 Only call strlen(lc_fname) if we are going to use the result 2014-02-17 16:24:04 +13:00
Marvin Greenberg
843aa7cd65 Work around differences in clang libc++ std::vector<bool>::const_reference
clang++ using -stdlib=libc++ defines const_reference as a class,
to map boolean vectors onto a bit set.  Because swig does
not "see" the type as "const &" it generates incorrect code for this case,
generating a declaration like:

  const_reference result;

When const_reference is a typedef to 'bool' as is the case with stdlibc++
this works.  When this is actually a constant reference, this is clearly
invalid since it is not initialized.  For libc++, this is a class
which cannot be default constructed, resulting in an error.  The fix
is to explicitly define the various accessor extensions as having a
bool return type for this specialization.
2014-02-04 16:00:12 -05:00
William S Fulton
cc650e692e Director exceptions now derive from std::exception 2014-01-20 19:40:52 +00:00
William S Fulton
f068be89e5 Fix PHP compilation error in ZTS mode (64 bit windows) due to TSRMLS_FETCH() expansion 2014-01-16 06:48:35 +00:00
William S Fulton
1a19451c1b Error out attempting to use directors without -c++
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
135a7cc558 Beautify director.swg files
Also some comment corrections for Perl
2013-12-23 19:50:41 +00: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
c151a0d69a Add array function PHP keywords 2013-11-11 19:12:48 +00:00
William S Fulton
7b08378145 Minor cleanup prior to merging to master 2013-10-11 21:48:45 +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
Olly Betts
abfa75b169 [PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL
if the type lookup fails.
2013-06-04 12:53:27 +12:00
Olly Betts
939fa86627 [PHP] Add missing directorin typemap for char* and char[] which
fixes director_string testcase failure.
2013-04-09 14:35:14 +12: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
d3769a1fd4 Add rvalue reference typemaps 2013-01-24 20:27:28 +00:00
William S Fulton
2c74c90430 Fix for gcc warning -Wunused-value without triggering -Wunused-parameter
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13735 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-07 06:06:00 +00:00
William S Fulton
12a9671440 std::string typemap modifications so they can be used with %apply for other string classes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13120 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-26 06:33:49 +00:00
William S Fulton
142f1e72bb Fix some language's std::map wrappers to recognise difference_type, size_type, key_type and mapped_type.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13092 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-15 19:51:06 +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
Olly Betts
fcb46fe2fa [PHP] Fix the constant typemaps for SWIGTYPE, etc - previously
these used the wrong name for renamed constants.  Add
autodoc_runme.php to the testsuite as a regression test for this.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13062 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-10 11:41:19 +00:00
William S Fulton
38f6156a93 Using C++11 enum classes with just a forward reference.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13013 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-23 22:15:37 +00:00
William S Fulton
4c898b023c The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12879 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-21 07:16:44 +00:00
Olly Betts
ee474ece0e Update keyword list to include keywords add in PHP releases up to 5.3.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12845 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-11-28 04:07:44 +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
a09225e70b Need to cast away const-ness for the PHP API.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12724 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-30 06:58:26 +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
4c64a731c8 Avoid pointless creation of a PHP string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12721 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-30 04:37:49 +00:00
Olly Betts
f38530b490 Make a char * pointer we don't modify through const.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12710 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-24 03:59:35 +00:00
Olly Betts
669bc0e001 [PHP] Fix sharing of type information between multiple SWIG-wrapped modules (SF#3202463).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12528 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-12 01:38:27 +00:00
Olly Betts
4fbb9e24d6 [PHP] Add casts to the typemaps for long long and unsigned long
long to avoid issues when they are used with shorter types via
%apply.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12520 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-07 04:06:54 +00:00
William S Fulton
28deca09be [PHP] Add missing INPUT, OUTPUT and INOUT typemaps in the typemaps.i library for primitive reference types as well as signed char * and bool *.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12480 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-19 14:53:53 +00:00
Olly Betts
3cee7b7b3e [PHP] Fix invalid erase during iteration of std::map in generated
director code.  Reported by Cory Bennett in SF#3175820.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12469 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-18 05:30:26 +00:00
William S Fulton
5f8c936569 Fix some eroneous typecheck rankings for php
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12439 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-05 22:58:32 +00:00
William S Fulton
640cce2c50 Fix typecheck typemaps for SWIGTYPE *const&
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12413 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-30 00:42:27 +00:00
William S Fulton
ef865e06d5 Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH) - Java patch is from Volker Grabsch. Elements of the primitive_types.i testcase for this moved into char_binary.i. Documentation for this enhanced.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12393 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-14 19:06:43 +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
Olly Betts
b36ae8aaf4 Attach the swig_php_init_member_ptr fragment to all the typemaps which need it.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12148 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-25 01:48:33 +00:00
William S Fulton
b946430c8a Remove potential symbol clash with wrapped code (php)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12147 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-24 19:33:21 +00:00
Olly Betts
0d7863c810 Wrapping pointer to member function types is likely to be rare, so use
%fragment to only pull in the required machinery if it is going to be
used.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12145 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-24 14:16:16 +00:00
Olly Betts
c7a6e3dad4 Fix // comments to /* */ in typemaps which should be usable from C code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12109 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-10 02:34:25 +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
1392a6e497 [PHP] When using %throws or %catches, SWIG-generated PHP5 wrappers
now throw PHP Exception objects instead of giving a PHP error of
type E_ERROR.

This change shouldn't cause incompatibility issues, since you can't
set an error handler for E_ERROR, so previously PHP would just exit
which also happens for unhandled exceptions.  The benefit is you can
now catch them if you want to.

Fixes SF#2545578 and SF#2955522.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12055 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-26 07:32:20 +00:00
Olly Betts
ed98187e3b Tidy up typemaps, combining variants with the same code.
Use const_cast to remove const-ness from const char * for stupid PHP API in
%throws typemap.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12054 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-26 00:19:08 +00:00
Olly Betts
9207a2fe37 [PHP] Add missing directorin typemap for const std::string &.
Fixes SF#3006404 reported by t-Legiaw.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12053 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-25 23:38:44 +00:00