Commit graph

559 commits

Author SHA1 Message Date
William S Fulton
504c2030bb Change in default behaviour wrapping C++ bool for Python.
Only a Python True or False will now work for C++ bool parameters.
This fixes overloading bool with other types.
2014-03-08 12:04:19 +00:00
William S Fulton
4fb940d913 Further fixes when using type() when using -builtin to include module name
Using type() on a builtin type should include the package and module
name, see http://docs.python.org/2/c-api/typeobj.html
2014-03-01 23:26:27 +00:00
William S Fulton
a3a0535229 Add testcase and info on python -builtin missing argument count check 2014-03-01 16:44:01 +00:00
William S Fulton
c5911cc08d Add %$isextendmember for %rename of members added via %extend 2014-02-18 23:21:46 +00:00
William S Fulton
9cbd742b66 Fix %$ismember %rename predicate for members added via %extend
Bug reported was incorrect renaming of PHP built-in functions, such as
next. See PHPFN in phpkw.swg.

Add some tests for the %rename predicates.
2014-02-18 07:30:55 +00:00
William S Fulton
844695b674 Fix typedef_typedef test 2014-02-06 19:31:31 +00:00
William S Fulton
e531578c54 Modify typedef_typedef testcase to work for all languages
Add CHANGES note

Closes #112.
2014-01-14 07:21:40 +00:00
Yann Diorcet
2e186244d6 Add test for checking prefix resolving in typedef 2014-01-14 07:21:40 +00:00
Vadim Zeitlin
cdf1ba9120 Don't accept strings too long to fit in char[N] with trailing NUL.
It was previously possible to assign "hello" to a variable backed by char[5]
storage in C, and the array contained the correct character data but without
the trailing NUL, which was unexpected in C.

This is not allowed any more, only "helo" can fit into a char[5] now and
anything else fails the type check, just as it already happened for the longer
strings before.

Closes #122
2013-12-23 21:13:25 +00:00
Vadim Zeitlin
88a0e228a9 Change the length of strings created from fixed-size buffers.
Use the usual C rule for NUL-terminated strings instead of discarding all the
trailing NUL characters.

This was unexpected (as buffers in C code are not necessarily always padded
with NULs to their full length) and also inconsistent among languages as this
was only done for those of them using typemaps/strings.swg but not for C# or
Java, for example, which terminated the string at the first NUL even before
this change.

Notice that this patch couldn't use strlen() or wcslen() with possibly not
NUL-terminated strings, so we had to add [our own equivalents of] strnlen()
and wcsnlen() and use them instead. This required adding yet another parameter
to string typemap macros, so update the example using them accordingly too.
2013-12-23 21:12:17 +00:00
Vadim Zeitlin
ed28725a15 Add std_auto_ptr.i defining typemaps for returning std::auto_ptr<>.
These typemaps are currently defined for C#, Java and Python only and the
tests are provided only for these languages.

Also add a brief description of the new header to the documentation.
2013-12-03 23:45:20 +01:00
Vadim Zeitlin
72afb74f47 Add support for case conversion characters in regex substitutions.
Allow using Perl-like \l, \L, \u, \U and \E escape sequences in the
substitution string used with %rename("%(regex:/pattern/subst/)s").
This is useful for e.g. title casing all string after removing some prefix.

Closes #82
2013-10-15 07:17:56 +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
738cc36aab Rename all C++0x to C++11 and cpp0x to cpp11 2013-10-07 20:37:00 +01:00
William S Fulton
a91cd0bc5c Infinity is now by default an acceptable value for type 'float'.
This fix makes the handling of type 'float' and 'double' the same. The implementation requires the
C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available.
2013-09-12 07:28:12 +01:00
William S Fulton
b58dabced9 %implicitconv is improved for overloaded functions.
Like in C++, the methods with the actual types are considered before trying implicit conversions.
2013-08-28 20:30:46 +01:00
William S Fulton
1cc735df5e %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer.
Problem highlighted by Bo Peng on the swig-user mailing list. SF patch #230.
2013-08-28 20:28:15 +01:00
William S Fulton
1c44078751 Improve testing of %pythonprepend and %pythonappend 2013-07-02 20:00:17 +01:00
William S Fulton
ace8fcd972 SWIG_AsWCharPtrAndSize improper operation if cptr NULL
SF bug #1327

This doesn't have any noticeable effect with the usage of
SWIG_AsWCharPtrAndSize as shipped by SWIG, but could be a problem if a
user is using this function with cptr equal to zero and psize is non-zero
 - the length would be incorrectly set due to the call to PyUnicode_GetSize
failing.
2013-07-02 18:58:56 +01:00
Paweł Tomulik
c9295401da clean all .py files generated by python-test-suite
Closes #49
2013-06-04 22:23:53 +01:00
William S Fulton
72f2d8ac8f Fix Python test-suite makefile to show which tests have runtime tests (for Python 3). 2013-05-27 10:24:02 +01:00
William S Fulton
fd93beadf4 Fix 'make check-python-test-suite PY3=1' and -j (make jobs) 2013-05-25 22:29:18 +01:00
William S Fulton
5481270c2a Fix Python 3 inconsistency handling -ve numbers for unsigned C types.
An OverFlow error is now consistently thrown instead of a TypeError.

Fixes primitive_types testcase for Python 3
2013-05-25 10:36:14 +01:00
Artem Serebriyskiy
3e188e508d Add test case for attributes with moderately complex templates
* New test case tests that %attribute macros correctly supports passing
  template with multiple parameters as class name or attribute type name

* Some further changes were made to %attribute macros - now
  AttributeType is protected with %arg as well. This allows you
  to have attributes of type e.g. std::pair<int,int> etc

Update CHANGES file for %attribute template fixes

Closes #48
2013-05-25 00:44:36 +01:00
William S Fulton
f15eb3f5ec Fix vararg documentation for Python 3
Memory handling is different to Python 2.
2013-05-24 23:02:34 +01:00
William S Fulton
074c0039db Fix Python version checking in Python tests 2013-05-24 18:57:26 +01:00
William S Fulton
0f1e3da5de Fix the high passed to PyTuple_GetSlice in varargs wrappers.
Harmless bug as slices can take any size larger than the actual size for
the high value. Reported in SF Bug 1326.
2013-05-23 21:25:41 +01:00
William S Fulton
f68cde8bb9 Fix li_std_containers_int test case for Python < 2.6
Workaround bugs in older versions of Python
2013-05-03 19:55:42 +01:00
Jesus Lopez
9be3235988 Support $descriptor() macro in fragments
Closes #36
2013-04-18 23:04:07 +01:00
William S Fulton
5878ca5f1a Fix autodoc test for python 2.4 2013-03-29 09:20:17 +00:00
William S Fulton
b504b68a62 Fix erratically failing threads_exception python test 2013-03-26 20:57:41 +00:00
William S Fulton
8778724768 Add support for extern "C++" - no warning should be issued as was previously occurring 2013-02-08 18:55:16 +00:00
William S Fulton
e44656cfe5 Add support for extern "C" thread_local 2013-02-08 18:45:29 +00:00
William S Fulton
b725625e6f Add support for thread_local when specified with other legitimate storage class specifiers - extern and static 2013-02-08 06:36:39 +00:00
William S Fulton
d613ef42f2 Rework std::initializer_list handling to warn about usage in any method, not just constructors. A typemap is used to issue the warning and can be overridden with user defined behaviour. 2013-02-04 20:03:22 +00:00
William S Fulton
c8ff23de0c Initialization list doc updates and new tests. Fix functions with default arguments that are initializer lists 2013-02-02 20:03:10 +00:00
William S Fulton
a043b55b69 Better clarification about polymorphic wrappers for function objects - std::function 2013-02-01 19:17:21 +00:00
William S Fulton
2a90cc6a98 Remove generated output that should not be checked in2 2013-01-28 07:11:08 +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
Paweł Tomulik
da00bdb12d added python test case li_std_except_as_class for SF bug 1295 2013-01-04 15:43:44 +01:00
William S Fulton
ba575159f6 Add runtime test for %implicitconv
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13950 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-08 10:37:04 +00:00
William S Fulton
e25da884cb Fix unrestricted unions testcase and add runtime example
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13849 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-21 19:15:44 +00:00
William S Fulton
049035ff3e Add discard and add methods to std::set and std::multiset wrappers so that pyabc.i can be used ensuring MutableSet is a valid abstract base class
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13619 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-15 22:36:15 +00:00
William S Fulton
54726b9d09 Fix using declarations and templates. %template was putting the
instantiated template into the global namespace instead of the namespace
of the template definition. This fixes regression in swig-2.0.5 copying
the std::pair typemaps which occurs with a 'using std::pair'
declaration. This also fixes lots of other using declarations of
template problems (template forward declarations. combinations
using directives).

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13504 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-04 20:24:22 +00:00
William S Fulton
73b0431fbc Fix C enum forward declarations in some target languages (notably Java)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13030 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-01 18:44:22 +00:00
William S Fulton
117cb9b74a Fix a few warnings/errors in the test-suite using Solaris compiler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12993 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-15 21:56:38 +00:00
William S Fulton
f00a41093c As std_list.i is not available in many language, put this python specific test just in Python makefile
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12986 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-14 21:11:19 +00:00
William S Fulton
df4f9adf0a Diagnostics for erratically failing test case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12984 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-14 20:29:22 +00:00
William S Fulton
e8aab00b6d Remove run tests which should have been done in rev 12953 (reverting %shared_ptr fixes with typedef)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12982 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-14 17:01:39 +00:00
William S Fulton
50693941c6 Fix #3475492 - iterating through std::vector wrappers of enumerations.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12916 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-13 07:10:24 +00:00