Commit graph

4,352 commits

Author SHA1 Message Date
Vadim Zeitlin
c79dd9d420 Make std::vector<> wrappers conform to List interface in Java
Derive the class wrapping std::vector<> in Java from java.util.AbstractList<>.
This makes it possible to use it with various algorithms working with Java
collections and, maybe even more importantly, makes it possible to iterate
over the wrapped vectors using for-each loops.

This commit is based on the original patch by Volker Diels-Grabsch from
https://sourceforge.net/p/swig/patches/278/
2016-11-29 17:46:38 +01:00
William S Fulton
7268f58c4c Fix %rename override of wildcard %rename for templates
%rename(GlobalIntOperator) *::operator bool; // wildcard %rename
%rename(XIntOperator) X::operator bool; // fix now overrides first %rename above
OR
%rename(XIntOperator) X<int>::operator bool; // fix now overrides first %rename above

template<typename T> struct X {
  operator bool();
  ...
};
%template(Xint) X<int>;
2016-11-28 22:50:52 +00:00
Joseph C Wang
bff182d556 fix #697 - miscounting comma in member lists
fix method for counting comma in member list
2016-11-12 00:23:41 +08:00
William S Fulton
bdda0a0829 Python - fix compilation error when using -extranative and -builtin.
Closes #816
2016-11-02 22:00:54 +00:00
William S Fulton
c74397bfd0 Merge branch 'liorgold-alias-template'
* liorgold-alias-template:
  Warning header cosmetics
  Fix decl attribute in C++11 alias templates
  Add C++11 alias templates
2016-11-02 09:10:59 +00:00
William S Fulton
eda0779e76 C# std::array changes file addition
Fix C# warnings in test-case too.
2016-10-30 22:35:59 +00:00
William S Fulton
d48b1712a8 Merge branch 'myd7349-master'
* myd7349-master:
  Convert the Java runtime testcase cpp11_li_std_array_runme to C#
  Add C++11 std::array interface file for C#
  SWIG_STD_VECTOR_ENHANCED for std::wstring
2016-10-30 22:27:47 +00:00
William S Fulton
ed3bc81dca Compiler warning fixes in testcase 2016-10-30 13:54:33 +00:00
William S Fulton
96015de0dd Update documentation for using SWIG_ConvertPtr example usage
Add a test case to test the example documentation typemaps
2016-10-23 20:16:35 +01:00
William S Fulton
129ef8ea8f Correct docs and examples to call SWIG_fail after setting a Python error
Although 'return NULL' works, it may miss out on some cleanup and NULL
is the wrong value to return in generated code for overloaded functions.
2016-10-23 20:16:35 +01:00
William S Fulton
e9e6a99f0f Add missing VOID_INT_PTR director typemaps 2016-10-23 16:18:05 +01:00
William S Fulton
f89b8836dd Merge branch 'jiulongw-master'
* jiulongw-master:
  Fix go wrapper compilation error
  Fix missing semicolon in golang wrapper
  Fix extra quote escape in golang
  Fix #define error when value contains char in compound expression
  Add more test case for char const expression in enum
  Revert "Add enum test cases with const char in compound expression"
  Add runtime tests for char in compound expression patch
  Add enum test cases with const char in compound expression
  Fix enum error when value contains char in compound expression
2016-10-23 10:32:48 +01:00
William S Fulton
5df10e380e Fix some test-suite warnings 2016-10-16 19:10:35 +01:00
William S Fulton
58461c1ffd php run test fixes for new functions in testcase 2016-10-15 17:58:21 +01:00
William S Fulton
f9ba371ee4 Remove li_boost_array testcase
Too many problems, this attempt to use std::array typemaps for boost::array
isn't really working. Latest problem is clang compile failures on OSX.
2016-10-15 17:58:17 +01:00
William S Fulton
4b4540056d Turn off Python pickle test for old style classes 2016-10-14 19:48:37 +01:00
William S Fulton
d2cb98c134 Pickle test additions
These are not working yet for all combinations of builtin and PY3
The goal is to have a sensible default error that states that
pickling is not supported.
2016-10-14 07:30:44 +01:00
William S Fulton
96fae38be2 Fix Python pickling and metaclass for builtin wrappers
The metaclass (SwigPyObjectType) for SWIG objects was not defined in
a way that let importlib successfully import the Python wrappers.
The pickle module failed because it couldn't determine what module the
SWIG wrapped objects are in.

I've changed the definition of SwigPyObjectType using more normal
builtin type definitions. There are still some open questions:
- None of the builtin types, like swig_static_var_getset_descriptor and
  SwigPyObject are added into any module. No call to PyModule_AddObject
  is made, so isinstance cannot be used for any wrapped type, all of
  which are derived from SwigPyObject.

Closes #808
2016-10-14 07:30:44 +01:00
William S Fulton
9135ad72e2 Additional static member variable testing for Python 2016-10-14 07:30:44 +01:00
Jiulong Wang
256e283fc3 Fix #define error when value contains char in compound expression 2016-10-02 13:01:16 -07:00
William S Fulton
08688d7d9d Add support for "ret" typemap where missing and improve documentation on it. 2016-09-29 08:07:26 +01:00
Li Shengqiu
bac85d5b1a [Go] Fix argument names in inherited functions #795 (#797)
* [Go] Fix argument names in inherited functions #795

This commit fixes a wrong argument name replacement in the inherited functions as well as a memory leak.

* Add testcase for #795

* Move variable_replacement testcase into common

* Move variable_replacement testcase into common
2016-09-27 15:08:47 +13:00
William S Fulton
848628ae91 More flexible python builtin slots
The closure names used for builtin slots are mangled with their functype so
 that overloaded C++ method names can be used for multiple slots.
For example:
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
will generate closures:
  SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
  SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
2016-09-25 14:15:38 +01:00
William S Fulton
5b8e8fa107 Merge pull request #793 from q-p/bad_cast
Add std::bad_cast to std_except.i
2016-09-25 14:12:01 +01: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
William S Fulton
0769e9b727 Fix iterators for containers of NULL pointers (or Python None) when using -builtin.
Previously iteration would stop at the first element that had a NULL pointer value.
2016-09-17 17:53:48 +01:00
Daniel Vollmer
2dc87d7485 Add std::bad_cast to std_except.i
This exception occurs when dynamic_cast<T&> fails.

Fixes #783.
2016-09-17 10:26:54 +02:00
Olly Betts
b138f054e5 [Javascript] Fix SWIG_exception() macro (#792)
Fix SWIG_exception() macro to return from the current function.
Fixes #789, reported by Julien Dutriaux.
2016-09-17 17:29:42 +12:00
Olly Betts
26bbc96d58 Arrange to return after calling zend_throw_exception()
Fixes github issue#240.
2016-09-16 17:54:02 +12:00
Jiulong Wang
9e53432aef Add more test case for char const expression in enum 2016-09-14 22:41:02 -07:00
Jiulong Wang
822ff096ef Revert "Add enum test cases with const char in compound expression"
This reverts commit b2bf0b3ef7.
2016-09-09 09:19:05 -07:00
Jiulong Wang
b5358ffeba Add runtime tests for char in compound expression patch 2016-09-08 17:59:22 -07:00
Jiulong Wang
b2bf0b3ef7 Add enum test cases with const char in compound expression 2016-09-08 17:27:12 -07:00
Olly Betts
a4015acaca [PHP] Fix out typemap for member function pointers
The existing typemap was just broken - it correctly created the resource
and then did nothing with it, and instead tried to register the member
pointer as a normal pointer, which is never going to work as it's larger
than a normal pointer.

Add cpp_basic_runme.php as a regression test for this.
2016-09-02 09:51:18 +12:00
Olly Betts
888e9c6fec Use preg_match() in PHP test harness code
ereg() and eregi() were deprecated in PHP 5.3.0 and removed in PHP 7.0.0,
and preg_match() has been available since PHP4.
2016-09-02 09:09:24 +12:00
William S Fulton
5b7c08c214 Make Python builtin types hashable by default
Default hash is the underlying C/C++ pointer.
This matches up with testing for equivalence (Py_EQ in SwigPyObject_richcompare)
which compares the pointers.
2016-08-23 19:06:36 +01:00
William S Fulton
4f777b181c Correct notes on customising Python builtin comparison operators
Also add example for python:compare feature
2016-08-22 07:22:40 +01:00
William S Fulton
4c0c802aa0 Add Python builtin tp_dealloc override test 2016-08-19 18:35:51 +01:00
William S Fulton
f778ee19df Python builtin hashfunc closure fix
If the wrong return type in the hash function was used, an error:
  SystemError: error return without exception set
was raised

Add some tests for testing builtin slots
2016-08-18 07:10:54 +01:00
William S Fulton
4ab3af90cb Merge branch 'stl-vector-ptrs'
* stl-vector-ptrs:
  Test case warning fixes for nodejs
  Fix testcase causing nodejs test failure
  UTL STL container descriptor checks
  Fix std::vector of pointers which failed if a pointer to a pointer of the container element type existed (Python)
  Remove unused traits.swg
2016-08-01 06:55:01 +01:00
William S Fulton
56ab717ff3 Test case warning fixes for nodejs
nodejs 4.2.1 on Ubuntu Xenial Xerus
2016-07-30 21:23:57 +01:00
William S Fulton
0177937f7e Fix testcase causing nodejs test failure 2016-07-30 15:00:55 +01:00
Simon Marchetto
95a5def328 scilab: fix issue #755 2016-07-29 11:52:26 +02:00
William S Fulton
6e9184b6f8 Fix std::vector of pointers which failed if a pointer to a pointer of the container element type existed (Python)
Closes SF Bug 2359417 created after commit 93f0390322 (svn rev 10958)
2016-07-28 22:51:22 +01:00
William S Fulton
9c3f608ef7 Remove unused traits.swg
This file has code that looks like it was migrated to Lib/std/std_common.i
2016-07-27 18:46:23 +01:00
Lior Goldberg
d0fc5b7b5b Add C++11 alias templates 2016-07-06 00:31:04 +03:00
myd7349
407b987f4c Convert the Java runtime testcase cpp11_li_std_array_runme to C# 2016-07-05 10:44:36 +08:00
William S Fulton
b24e970a28 Merge branch 'wkalinin-nested-ignore-fix'
* wkalinin-nested-ignore-fix:
  renamed test module, in accordance with other tests
  function body fixed
  added foo() definition to satisfy some test linking fails
  func() renamed to foo() for 'go'
  fixed test-suite/nested_ignore.i
  test for #662
  fix for nested ignored types

Closes #662
2016-06-26 00:33:19 +01:00
Lior Goldberg
c363a93d69 Added support for type alias 2016-06-22 23:13:28 +03:00
William S Fulton
86fd5c9858 Fix autodoc testcase for python -fastproxy
Also fixes -O.
This is a minimal change avoiding the differences in the function names
when -fastproxy is used until autodoc code is improved with doxygen
changes.

Closes #721.
2016-06-22 00:15:05 +01:00