Commit graph

33 commits

Author SHA1 Message Date
William S Fulton
71cd6a38fe Performance optimisation for directors for classes passed by value
The directorin typemaps in the director methods now use std::move on the
input parameter when copying the object from the stack to the heap prior
to the callback into the target language, thereby taking advantage of
move semantics if available.
2022-07-04 11:19:29 +01:00
William S Fulton
088d7c7773 Add some missing doctype tyemaps 2018-06-05 18:52:30 +01:00
Vadim Zeitlin
b7f78dd5a7 Merge branch 'master' into doxygen 2018-03-19 21:54:46 +01:00
William S Fulton
3f8b8fe734 Enhancements for directorin typemaps
The directorin typemaps will now generate a temporary variable
(specified after the type), such as:
%typemap(directorin) MyType (MyType *temp) { ... use temp ... }

The shared_ptr director typemaps have been fixed for use in functions
that take more than one parameter.
2017-10-16 19:28:27 +01:00
William S Fulton
6470fe8c36 Director shared_ptr typemaps for scripting languages
Modify the Python and Ruby director shared_ptr typemaps to be language neutral.
Port the director modifications to other scripting languages that
have shared_ptr support - Octave, R and Scilab. Scilab shared_ptr
support is not fully working and needs work though.
2017-10-13 07:34:38 +01:00
William S Fulton
000e63e0f8 Remove duplicate director shared_ptr pointer reference typemaps 2017-10-11 07:08:46 +01:00
Stephen Sinclair
52ca39b5ab For shared_ptr directorin, make copy of shared_ptr in all cases. 2017-09-27 18:10:59 -03:00
Stephen Sinclair
bda750ee15 Add directorin typemap for Python and Ruby shared_ptr. 2017-09-27 11:22:30 -03:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
Vadim Zeitlin
db65ae5aea Merge branch 'master' into doxygen
Fix the usual conflicts in autodoc unit test due to fixing the
divergences in autodoc generation between builtin and default cases in
this branch.
2017-09-19 14:02:53 +02:00
William S Fulton
ab1e9f5bd9 Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemaps
[skip ci]
2017-04-20 19:21:47 +01:00
Vadim Zeitlin
e668c47b70 Merge branch 'master' into doxygen
The way Python docstrings are indented has changed on master, so use the
standard inspect module in Python autodoc unit test to ignore the differences
in their indentation level between -builtin and non-builtin cases to make the
test still pass with the branch version, which avoids the use of different
(but almost identical) values in the test itself.
2016-12-12 01:24:17 +01:00
William S Fulton
fcb383b46b shared_ptr typemap error message fix for global variables
$argnum was not being expanded in the generated code
Correct to use the error message from the standard typemaps
2015-09-25 22:57:59 +01:00
Vadim Zeitlin
dd4c680a02 Use Python-ish, not C++, parameter types in Python documentation.
Using C++ types in documentation for Python users is more harmful than
useless, so use Python types whenever possible and allow defining "doctype"
typemap to customize this for the user-defined types.
2014-08-22 17:45:22 +02:00
William S Fulton
5f6389ab31 Cosmetic Python changes and replace DOH types
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12608 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-04 20:13:14 +00:00
Stefan Zager
3d444101d1 A slew of changes based on William Fulton's code review.
- Fixed naming conventions; SwigPyBuiltin is used a lot
- Removed use of std::vector
- builtin.swg isn't included if -builtin isn't specified
- Changed many feature names to use a "python:" prefix
- Eliminated static vars in std_pair.i
- Eliminated C++-style comments (//)
- Enabled autodoc and docstring with -builtin
- Fixed non-ansi generated C code
- Detect and complain if two incompatible swig modules are loaded
- Removed argcargvtest_runme3.py, and fixed argcargvtest_runme.py
  so that 2to3 handles it better
- Removed anonymous namespaces
- Eliminated builtin_init typemaps; consolidated functionality into
  SWIG_Python_NewPointerObj
- Eliminate printf warnings from %U conversion character by switching
  to %S, which works just as well
- Fixed li_std_set_runme.py for python3, which returns set members in
  a different order from python2





git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-29 06:57:02 +00:00
Stefan Zager
97802ab8c4 Changed a bunch of methods from SWIGRUNTIME to SWIGINTERN. Removed a snarky comment.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12513 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 04:18:58 +00:00
Stefan Zager
288c37f5bf Regressions pass! With a few tweaks for unsupported features, primarily:
- Throwing wrapped types as exceptions is unsupported.
- Reverse comparison operators (e.g., __radd__) aren't supported.

Rationalized destructors.

Finished std::map implementation.  Required fixes to typecheck for
SWIGTYPE* const&.

Need a little special handling of the swig_type_info for SwigPyObject
when multiple modules are loaded.

Fall back to SwigPyObject_richcompare if there's no operator overload.

"memberget" and "memberset" attrs are applied strangely; work around
them.

Added 'this' attribute.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12415 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-30 03:17:28 +00:00
Stefan Zager
d4b8048e9a Stopped using template class SwigPyBuiltin, because it caused problems
when two typedef-equivalent types are wrapped as separate classes.

Now failing on refcount.cpptest.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-12 00:43:01 +00:00
Stefan Zager
8ac54d1d5e Director issues should be mostly clean now.
Refactored some type initialization out of SWIG_init.

Use __all__ attribute of module to define public interface.
This is necessary to make available symbols starting with '_'.

Now dying on li_boost_shared_ptr.  Looks like it's gonna be ugly.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12373 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-06 00:09:25 +00:00
William S Fulton
3dfac02269 shared_ptr improvements so the proxy class does not need to be specified - SWIG_SHARED_PTR macro deprecated and replaced by %shared_ptr
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12037 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-22 23:57:19 +00:00
William S Fulton
12cfc251e4 Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an inheritance hierarchy. No special treatment is needed for derived classes, the SWIG_SHARED_PTR_DERIVED macro is deprecated.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12036 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-22 22:49:47 +00:00
William S Fulton
bdb136d611 Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-01 18:26:37 +00:00
William S Fulton
1de9c8b27f Add a few comments about the smart pointer implementation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11828 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-01-23 15:30:42 +00:00
William S Fulton
f630911352 remove debug comment
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11158 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-19 00:04:28 +00:00
William S Fulton
51a723aa85 Add possibility of using when using shared_ptr and wrapping pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11157 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-18 23:54:09 +00:00
William S Fulton
69d6ce4f33 Fix shared_ptr typemaps for use with %pythonnondynamic
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10344 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-04-04 23:29:59 +00:00
William S Fulton
8c24e2ca74 Fix shared_ptr typemaps where the pointer type is a templated type with with more than one parameter.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10327 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-27 20:29:01 +00:00
William S Fulton
77cd446a53 remove debugging info from shared_ptr typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10302 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-12 16:48:37 +00:00
William S Fulton
1a560e3866 global variables test and shared_ptr varin/varout typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-29 23:23:35 +00:00
William S Fulton
9b7042280c Add member variable support for shared_ptr
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10260 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-14 22:53:11 +00:00
William S Fulton
444f643c4e Add shared_ptr typecheck typemaps for Python and add overloaded method tests for shared_ptr
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10251 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-13 23:10:58 +00:00
William S Fulton
3d1356dead Complete the Python support for shared_ptr mainly for derived classes. This includes the smartptr feature for overriding the class registration function and shared_ptr typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10237 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-09 12:26:21 +00:00