Commit graph

54 commits

Author SHA1 Message Date
William S Fulton
3efea1f4ab Fix typecheck typemaps for non-pointers and NULL
The typecheck typemaps succeed for non pointers (SWIGTYPE, SWIGTYPE&,
SWIGTYPE&&) when the equivalent to C NULL is passed from the target
language. This commit implements a fix for Python to not accept a Python
None for non-pointer types.

Issue #1202
2018-12-29 11:45:46 +00:00
William S Fulton
ebce018542 Fix constant function pointer typemaps
The function pointer typemaps were not being used when the function
pointer is const, like ADD_BY_VALUE_C in the funcptr_cpp.i testcase:

  %constant int (* const ADD_BY_VALUE_C)(const int &, int) = addByValue;

Problem affecting Javascript and observable when running test-suite with -cppcast.
2018-11-13 07:35:44 +00:00
William S Fulton
e86c881a70 Fix directorout typemaps which were causing undefined behaviour when returning pointers by reference.
Closes #1167
2017-12-14 07:00:42 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton
98a31ff633 Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.
Closes #434
2016-05-14 21:32:24 +01:00
Paweł Tomulik
350d43d988 handle const pointers to functions 2016-03-24 10:59:23 +01:00
William S Fulton
b0b5552c14 Fix casts for array setters broken when fixing nested C classes (c++out mode for Octave)
Introduced in 703d5b96fe
Fixes compilation errors with Visual Studio
2014-03-15 12:39:39 +00:00
William S Fulton
e95ac82651 Nested C class setters restored in c++out mode for Octave
Suitable casts are required so that assignment of instances of nested classes
work as the nested class is duplicated in the global namespace, eg:

struct Outer {
  struct Nested {
    int bar;
  } bar_instance;
};

Outer.bar_instance can now be assigned to.
2013-12-12 09:00:16 +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
William S Fulton
ac74c90fb0 Add rvalue reference typemaps 2013-01-24 20:27:29 +00:00
William S Fulton
4c898b023c The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12879 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-21 07:16:44 +00:00
William S Fulton
aac2b5d2e1 Remove VARARGS_SENTINEL typemaps further to revision 12666. Note that the idea of having a named typemap for sentinels is flawed unless the named typemap is provided for every single type in the typemap library.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12668 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-14 23:54:09 +00:00
William S Fulton
640cce2c50 Fix typecheck typemaps for SWIGTYPE *const&
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12413 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-30 00:42:27 +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
6d03b7ce6a update old syntax to new _dim0
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11124 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-02-08 22:54:58 +00:00
William S Fulton
30c4214ece Fix #1904537 Swig causes a Perl warning 'x used only once' in Perl 5.10 reported by Ari Jolma
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10286 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-29 23:42:52 +00:00
Gonzalo Garramuno
5eb47b0da5 Reverted the static_cast fix as it is incorrect due
to swig going thru a void* in-between.
The problem is still present, but will require a much
more elaborate fix.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9947 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-09-20 00:19:57 +00:00
Gonzalo Garramuno
7a3c9a08a2 Changed swigtype.swg to use static_cast's instead of
reinterpret_cast's.
This fixes a potentially subtle problem with director
classes using reinterpret casts in their casts
and when casting class that have multiple inheritance. 
The code currently generated by swig actually works
find under most compilers but was, afaik, not truly 
C++ conformant.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9942 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-09-19 09:00:59 +00:00
Marcelo Matus
e28dacf28d use better names to avoid clashing with directors, as reported by Eric Blossom
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9038 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-27 21:20:46 +00:00
Marcelo Matus
245ec68c4d add minor and missing noblock attributes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8755 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-02-08 23:56:59 +00:00
Marcelo Matus
4f4e31460f fix extra &
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8707 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-02-04 09:46:40 +00:00
Marcelo Matus
22ed3ee374 solve unused var warning
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8508 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-22 00:02:20 +00:00
Marcelo Matus
7065472c88 silence warnings with -O1 -Wall
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8499 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-21 01:03:37 +00:00
Marcelo Matus
4d3b731ca5 remove noblock=1 in the varin typemaps since Tcl could add some code before the variable declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-20 00:59:29 +00:00
Marcelo Matus
507a8184cc use internal SWIG_exception_fail, let SWIG_exception as in 1.3.27
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8434 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-14 21:23:36 +00:00
Marcelo Matus
5251d6157c better throws(...) typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8377 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-11 23:12:34 +00:00
Marcelo Matus
e676d2f8bd rename %throws to %catchs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8351 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-10 18:47:51 +00:00
Marcelo Matus
1ee069a150 allow the result code to be passed to the error routine
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8323 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-09 19:12:51 +00:00
Marcelo Matus
f1f9068a62 unsigned/signed casts
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8268 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-07 00:59:30 +00:00
Marcelo Matus
3cae8e09ba more test cases, less cast operations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8267 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-07 00:58:14 +00:00
Marcelo Matus
a29cb3bb02 more test cases, less cast operations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8266 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-07 00:57:44 +00:00
Marcelo Matus
76c06cc3bb more test cases, less cast operations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8265 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-07 00:28:51 +00:00
Marcelo Matus
a9cc475443 avoid signed/unsigned warns
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8264 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-06 23:13:12 +00:00
Marcelo Matus
b279ccbb03 avoid extra casting since they conflict with 'const', reported by James Bigler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8263 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-06 23:08:06 +00:00
Marcelo Matus
89e7497ac6 add support for named warning codes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8249 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-06 11:42:24 +00:00
Marcelo Matus
4048f282c9 add to %argument_fail
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8185 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-02 17:37:53 +00:00
Marcelo Matus
7223672e09 securing the call to SWIG_IsOK, which is a macro
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8131 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-30 01:14:24 +00:00
Marcelo Matus
381596b0f3 add the copyctor feature/directive to enable automatic copy constructors. In the way, fix how default ctor/dtor are added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8129 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-30 00:04:00 +00:00
Marcelo Matus
7dbaf9630c cosmetics and remove extra freearg typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8114 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-28 22:38:49 +00:00
Marcelo Matus
88e6edcac3 fix for the typemap match option
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-28 07:52:55 +00:00
Marcelo Matus
0e4b388ec9 add implicitconv support and cosmetics for cast rank
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8095 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-27 22:06:26 +00:00
Marcelo Matus
255296362f can't use as_voidptrptr with fcnptrs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7896 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-28 17:31:34 +00:00
Marcelo Matus
f3c24eff33 fixes for directors + pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7860 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-21 21:01:35 +00:00
Marcelo Matus
c529327196 add missing typecheck typemap for function ptrs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7779 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-03 10:00:51 +00:00
Marcelo Matus
9c5b888299 add missing directors typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7761 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-31 09:45:51 +00:00
Marcelo Matus
a8fe5247e2 added methods for size_t and more freearg typemaps around, just in case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7743 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-27 11:30:14 +00:00
Marcelo Matus
05c529eedc be sure we use #if defined(...) instead of the fragil #ifdef everywhere, fix missing director typemaps and cosmetics
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7742 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-27 10:35:38 +00:00
Marcelo Matus
3c5c038e86 fix ifdefs for directors
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7738 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-26 14:09:58 +00:00
Marcelo Matus
3c65cea431 Perl added to the Unified typemap library, cleaner way to use the library, and 'normalized' macro names
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7707 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-24 14:59:05 +00:00