Commit graph

42 commits

Author SHA1 Message Date
Olly Betts
c8a7322a4d Use %{ %} instead of { } after %pythoncode
Simpler and safer change to address PR#357.
2015-03-20 13:45:19 +13:00
Julien Schueller
f4fffbf668 Fixed another E701 2014-06-06 15:13:23 +02:00
William S Fulton
80f8d1d922 Fix for missing C++ code in std::multimap wrappers.
%template for a std::multimap generated uncompilable code unless a
%template for a std::map of the same template types was also coded up.

This patch is needed in conjunction with previous commit - 5f1fff1849

Closes #64
Closes #65
2013-08-06 07:02:49 +01:00
Stefan Zager
e167400a29 Fixed issue from swig-user 6/27/11.
Support code in std_map.i needs all the template parameters that std::map takes,
even the default ones (Compare, Allocator).



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-07-15 18:49:32 +00:00
Stefan Zager
a52612f845 Fixed PyGetSetDescr for python3.2.
Fixed memory management in special_variable_macros test.

Don't define asdict() for multimap.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12659 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-08 06:54:21 +00:00
Stefan Zager
6bd724dbf9 Added asdict() method to convert std::map to a python dict.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12646 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-29 23:26:55 +00:00
Stefan Zager
e629b192e2 Fixed the argument counts passed to SWIG_Python_UnpackTuple for varargs.
Removed obsolete methods from std_map.i and pyiterators.swg.

Added builtin-check target to python test suite Makefile.

Fixed using_namespace_loop.i so that the generated wrappers will compile.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12644 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-29 18:25:16 +00:00
Stefan Zager
4b9ef9bc99 Bug 1498929: Access to member fields of map elements.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12643 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-04-25 21:12:33 +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
William S Fulton
908c37cef8 Coding style fixes for Python builtin changes added on the szager-builtin branch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-03 19:34:18 +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
dd465f9588 Finished std::pair and std::map support.
li_std_pair_extra test fails, because the _runme.py uses the
secret 'this' member variable, which doesn't exist when the
-builtin option is used.  Seems like a flaw in the test.

Test suite now fails on li_std_string_extra, because static
member variables are not fully implemented.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12351 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-15 23:04:20 +00:00
Olly Betts
0d539c8048 [Python] Add missing locks to std::map wrappers. Patch from
Paul Hampson in SF#2813836.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11465 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-29 03:34:22 +00:00
Olly Betts
734dafd405 Fix grammar in comment and error message.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11352 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-03 11:58:37 +00:00
Haoyu Bai
8f84447860 Commited SF#2158938: change all SWIG symbols start with Py to a new name.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10961 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-03 18:43:44 +00:00
Haoyu Bai
3d8ddfc442 Merged the Python 3.0 support branch. The merging progress is not so smooth, so hope this commit won't make anything broken.
This is the (incomplemete) log produced by svnmerge.py:

Merged revisions 10405-10409,10420-10422,10426,10438,10445,10451,10454-10465,10467,10473-10475,10485,10488-10489,10493-10495,10497,10509-10510,10513-10514,10517,10520,10525,10528-10529,10533-10535,10554-10557,10570,10573,10593,10614,10666-10669,10673,10678,10687,10690,10704-10706,10731,10744,10750-10752,10755,10759,10770,10775-10776,10813,10819 via svnmerge from 
https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10834 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-11 17:18:07 +00:00
William S Fulton
521059242c gcc-4.2 warning fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10186 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-12-09 22:27:38 +00:00
William S Fulton
79eea19382 string handling mods to keep gcc-4.2 happy
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10088 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-04 20:35:59 +00:00
Marcelo Matus
b319720cf1 fix bug #1480074
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9085 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-05-04 05:48:55 +00:00
Marcelo Matus
a66fa50a8c cosmetic for generated python code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8850 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-02-20 07:33:18 +00:00
Marcelo Matus
2bde7c2c3b map iterators now use the native PySwigIterator, which is very very good for large maps, since no more temporals key/value tuples are needed
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8311 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-09 00:40:44 +00:00
Marcelo Matus
68521b1c74 add value iterator
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8295 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-08 09:30:53 +00:00
Marcelo Matus
e8d67c80f3 fix to avoid copies when the wrapper class exists, and to accept std::map pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8292 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-08 07:04:45 +00:00
Marcelo Matus
0fd2fe23cf add thread support based in proposal #398495 by Joseph Winston
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7929 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-06 06:39:24 +00:00
Marcelo Matus
af0aab45d7 fix memory leaking
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-21 20:58:31 +00:00
Marcelo Matus
a3424e36e1 add 'iterator'(sequences) and 'key_iterator'(maps). The first returns allways the C++ iterator. In sequences __iter__ returns 'iterator()', in maps, __iter__ returns 'key_iterator()'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7775 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-02 15:58:58 +00:00
Marcelo Matus
cda225ea32 add iterator support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7766 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-31 09:56:13 +00:00
William S Fulton
03a67698a9 use exception specification instead of %exception to handle STL error checking
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7352 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-07-27 20:09:42 +00:00
William S Fulton
4fea1d827a Various fixes for Visual C++ 7.1 and Sun Studio 10
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7255 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-06-03 20:52:16 +00:00
Marcelo Matus
a2f5af9ddd fix #1188207 and uniform the error/null/none handling
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7225 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-05-26 20:43:33 +00:00
Marcelo Matus
5b74ab97a7 more fixes for security and warnings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7009 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-02-26 20:25:10 +00:00
Marcelo Matus
9537f69323 fix empty map bug
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6980 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-02-22 19:52:43 +00:00
Marcelo Matus
dc4409a1f1 isolate language independent STD/STL/C++ code + more documentation + cleaning
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6382 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-10 06:42:15 +00:00
Marcelo Matus
349e6bc6ee using <> when including lib files, fix char{ANY], add char FIXSIZE[ANY], fix pyfragments.swg, fixing *.swg and *.i names
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6250 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-09-17 06:17:35 +00:00
Marcelo Matus
e0e8157d0b suppress compiler warns and more cosmetics
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5830 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-05 20:20:36 +00:00
Marcelo Matus
ab44291de8 we better disable the comparison method generation by default.
reasons:

- before they were not generated, so, nobody will miss them,
  and still they can be activated back using SWIG_STD_EXTEND_COMPARISON,

- the performance penalty is quite visible, and the solution is not
  general, ie, for user types, still they need to be generated by hand.


Marcelo


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5822 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-02 02:34:19 +00:00
Marcelo Matus
b85f90a6ed fix pair for ptrs, and add SWIG_STD_NOEXTEND_COMPARISON to reduce swig times
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5820 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-01 18:51:30 +00:00
Marcelo Matus
29a30e2dcc - better support for classes with no default constructor, equal or
comparison methods.

  you will be able to do

    struct Foo {
     Foo(int) {}
    };

    %std_nodefconst_type(Foo); // Says Foo has no def. constructor

    %template(vector_Foo) std::vector<Foo>;

  and the conflicting vector/list/deque methods will not be generated.


more cosmetic, and a note about the relation between std::map and
std::pair.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5810 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-31 11:27:53 +00:00
Marcelo Matus
7afe6bc139 normalizing the inout typemaps and other cosmetic fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5782 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-21 23:26:18 +00:00
Marcelo Matus
1d5529bcfc better STL support, see CHANGES.current
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5755 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 09:41:19 +00:00
Luigi Ballabio
03658fcb4c std::map ready for prime time (hopefully)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4510 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-03-11 15:38:02 +00:00
Luigi Ballabio
9d50216d9c Support for std::map (thanks, Dave)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4414 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-02-27 10:05:55 +00:00