Commit graph

2,434 commits

Author SHA1 Message Date
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
12708c9241 Fix typos 2013-09-25 17:29:33 +12:00
Gavin Kinsey
43032339d0 Fixed a memory leak for java STRING_ARRAY
The allocation loop uses size, so the free loop should do the same,
not size-1.
2013-09-20 18:44:44 +01:00
William S Fulton
d0cb2b73db Remove X11 detection during configure
X11 is not used anywhere.
2013-09-18 00:40:24 +01:00
William S Fulton
0431664b18 Guile OUTPUT typemap fix
Fixes 'attempt to free a non-heap object' in some OUTPUT typemaps.
2013-09-15 10:43:49 +01:00
Sylvestre Ledru
7a88729c87 Remove trailing spaces in the generated code.
No functional changes
2013-09-13 10:02:39 +02:00
Artem Serebriyskiy
c3f3880d0c Lua static member access improvements.
1) Static members and static functions inside class can be accessed as ModuleName.ClassName.FunctionName (MemberName respectively). Old way aka ModuleName.ClassName_FunctionName still works.
2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc.
3) More 'runme' tests for lua + modifications to existing tests to test new changes.

Code is loosely based upon python implemenation of the same thing.

Patch #62.
2013-09-12 21:32:26 +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
Miles Bader
c746ae7a0f Include Lua error locus in SWIG error messages
This is standard information in Lua error messages, and makes it much
easier to find bugs.
2013-08-30 06:56:33 +01:00
Miles Bader
663c41e248 Add Lua runtime helper functions for error-handling
Add two helper functions to the Lua runtime, "SWIG_Lua_pusherrstring"
and "SWIG_Lua_pushferrstring".

These are like the standard Lua functions lua_pushstring and
lua_pushfstring respectively, except that the strings are prefixed
with the location of the innermost Lua call-point (as generated by
luaL_where).
2013-08-30 06:56:33 +01:00
Vadim Zeitlin
9efaf954c7 Add support for std::map<> comparator template argument for C#.
Allow exporting maps using non-default comparison function.

Closes #77
2013-08-29 19:08:15 +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
Kris Thielemans
a495b5a985 Remove SwigPyObject_print and SwigPyObject_str, and make the generated wrapper use the default python implementations, which will fall back to repr (for -builtin option).
Advantages:
- it avoids the swig user having to jump through hoops to get print to
  work as expected when redefining repr/str slots.
- typing the name of a variable on the python prompt now prints the
  result of a (possibly redefined) repr, without the swig user having to
do any extra work.
- when redefining repr, the swig user doesn't necessarily have to
  redefine str as it will call the redefined repr
- the behaviour is exactly the same as without the -builtin option while
  requiring no extra work by the user (aside from adding the
%feature("python:slot...) statements of course)
- the patch simplifies pyrun.swg a tiny bit.

Disadvantage:
- default str() will give different (but clearer?) output on swigged
  classes compared to unpatched swig

SF Bug #326
2013-08-07 20:22:03 +01: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
Andrew Simmons
5f1fff1849 Copied std::pair<> fragment from Lib/std/std_map.i into Lib/std/std_multimap.i. This fixes an error when a std::multimap template is wrapped by itself. 2013-07-25 18:23:45 +01:00
joequant
93b63969f9 change to allow file SEXP return values 2013-07-14 20:28:17 +08:00
William S Fulton
d0af4f50d3 Add %pythonbegin directive.
For adding code at the beginning of the generated .py file.
2013-07-05 06:30:16 +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
Olly Betts
c8a879303c Fix comment typo (interpeters) 2013-07-02 12:29:28 +12:00
William S Fulton
7491be12e5 Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr when using -builtin.
SF patch #340
2013-07-01 20:09:31 +01:00
William S Fulton
0058eea3ad Add SF patch #342 fix some director classes crashing on object deletion when using -builtin.
Fixes SF bug #1301 and python test cases director_basic and
director_classic seg faulting when used with -builtin.

Patch from Christian Delbaere.
2013-07-01 19:25:34 +01:00
Karl Wette
d72e3dd899 Octave: add SWIGRUNTIMEINLINE to SWIG_Octave_SetConstant() 2013-06-13 17:46:47 +02:00
William S Fulton
7f95c7bb3e Use a less confusing macro name, SWIG_PYTHON_NO_DEBUG => SWIG_PYTHON_INTERPRETER_NO_DEBUG 2013-06-11 19:15:57 +01:00
William S Fulton
5cdfc503e1 Add SWIG_PYTHON_NO_DEBUG macro for building Debug wrappers against the Python Debug dll 2013-06-11 00:22:21 -07:00
William S Fulton
3834036e13 Fix Ruby regression with missing rb_complex_new function.
Affects Ruby versions prior to 1.9 using std::complex wrappers if just using std::complex
as an output type. Also fix the Complex helper functions external visibility (to static by default).

Closes #52
2013-06-07 19:56:38 +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
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
Artem Serebriyskiy
c956c4c87f Fix %arg in Lib/attribute.i 2013-05-25 00:37:57 +01:00
Artem Serebriyskiy
3357ee85cd Fix all attributes macroses 2013-05-25 00:37:57 +01:00
William S Fulton
04b9037c70 Simplify and improve Guile FILE * in typemap
Fix incorrect special variable $name and remove unnecessary temporary
variable.
2013-05-16 19:21:59 +01:00
William S Fulton
ea2e615cec Fix some typos in directive names 2013-05-12 19:14:59 +01:00
Karl Wette
93650b2911 Octave: install functions only once, when creating module
- once installed, Octave functions can never really be uninstalled
  (clear -f doesn't prevent the function being called again), so
  it makes no sense to install functions more than once
- this can lead to a significant speed-up of module loading times,
  up to a factor of 10 for a large module loaded multiple times
2013-05-12 17:32:09 +01:00
Karl Wette
ef160ec072 Octave: remove allocation of new octave_value in SWIG_Octave_SetGlobalValue()
- this introduces a memory leak, which becomes significant for large
  modules (many global variables) and many module re-loadings (e.g.
  during a long-running script)
- the original motivation was to prevent double-frees on exit, but this
  problem appears to have been fixed by the _Exit() hack in later commits,
  and in any case is an issue only for Octave ~3.2, so it should be safe to
  remove; tested by running Octave examples/test suite with Debian 3.2.4 and
  built-from-source 3.2.4, 3.4.3, and 3.6.3
2013-05-12 17:32:08 +01:00
Geert Janssens
9110d47ea6 Use freearg instead of argout to free temp variable 2013-04-28 22:06:25 +02:00
William S Fulton
6a60efffd1 Some C++ experience needed
On 19/04/13 18:41, Geert Janssens wrote:
> Hi,
>
> I'm working through the failing testcases for guile. One testcase fails
> with a compilation error in some generated code based on std_map and
> std_pair. I know exactly where this generated code comes from, but my
> C++ knowledge is insufficient to understand the error, let alone remedy
> it. I gather some kind of const violation, but that's all I can read
> from it :( My hope is that someone used to working with stl will more
> easily understand it.
>
> So, if someone can help me understand the error and what the fix would
> be in C++, I can fix the corresponding .i file.
>
> This is the code snippet the causes the error:
>

<snip>

>
> /usr/lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_pair.h:88:12:
> error: non-static const member ‘const std::pair<int, A*> std::pair<int,
> const std::pair<int, A*> >::second’, can’t use default assignment operator

This is the main problem - it is saying there is no default assignment
operator (because one of the members in pair is const). The solution is
to avoid assignment. I've attached a patch to do this plus some error
message corrections.

William
2013-04-28 22:06:25 +02:00
Geert Janssens
140829a826 guile: fix std_map.i "$1 not found" error 2013-04-28 22:06:25 +02:00
Geert Janssens
d689d9a860 Fix deprecation warnings for test suite under guile 2.0 2013-04-28 22:06:24 +02:00
Geert Janssens
b819d2a91e Drop guilegh interface
All of guile's interface files now use the scm interface.
This should not affect any users. Swig generated code
using the scm interface can be mixed with gh interface
using user code.
It does simplify maintenance of the guile swig code though.
2013-04-28 22:06:24 +02:00
Geert Janssens
3c47730803 Drop support for guile 1.6 and older 2013-04-28 22:06:22 +02:00
Geert Janssens
2c23a5d2cd Add support for guile 2.0: update swg and interface files
Note: only the scm interface is considered.
2013-04-28 22:06:22 +02:00
William S Fulton
62638bfd15 Pike - a few updates to get Pike 7.8 running most of the examples 2013-04-20 02:28:48 +01:00
William S Fulton
1f4bd0bfa5 Minor extraneous makefiles tidy up 2013-04-19 22:47:29 +01:00
Marvin Greenberg
d0202cbdac Fix typecheck OUTPUT typemaps for Java 2013-04-10 18:37:26 +01: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
Nishant Rodrigues
5fd059d80f Patch fixing warning 322 in rubycontainer_extended
'rubycontainer_extended.swg' generates warnings:

 Warning 322: Redundant redeclaration of 'map_bang',
 Warning 322: previous declaration of 'map_bang'.

The fix is to remove a redundant call to swig_container_extend for
swig::GC_VALUE.

Thanks

========================================================
2013-04-08 18:58:01 +01:00
William S Fulton
5ae6ff404d Cosmetic - use C comments instead of C++ comments for recent Ruby change 2013-04-08 07:58:09 +01:00
William S Fulton
bb3fe8c906 Rewrite Ruby's GC_VALUE without use of macros for easier debugging 2013-04-06 02:20:56 +01:00
William S Fulton
8484c2de9b More rb_protect rewrite to use rb_rescue for Ruby 1.9 2013-04-06 00:30:50 +01:00
William S Fulton
5d529d5a76 Ruby 1.9 fixes.
SF Bug#1292 - Runtime fixes for Proc changes in ruby-1.9 when using STL wrappers that override the default predicate, such as:

  %template(Map) std::map<swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ, swig::BinaryPredicate<> >;

Fixes li_std_functors testcases for Ruby 1.9.

Also rb_respond_to return values have changed subtely in 1.9 and return should be treated as a flag instead of checking for Qtrue, see SF Bug #1159.

Also fix li_std_map, li_std_set silently failing - rb_protect behaviour seems to have changed when an exception is thrown, so code has been changed to use rb_rescue. A call to 'rb_set_errinfo(Qnil)' could have solved this after the rb_protect call, but it is only available in 1.9+ and Ruby API changes are not easily and transparently detectable.
2013-04-05 23:41:59 +01:00