William S Fulton
46f7501d94
Cleanup SWIG_VERSION definition
...
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.
Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this
Closes #1050
2022-10-13 19:47:43 +01:00
Olly Betts
4ac3c87a29
Sort out predefined SWIG-specific macros
...
Ensure that SWIG_VERSION is defined both at SWIG-time and in the
generated C/C++ wrapper code (it was only defined in the wrapper
for some target languages previously).
SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
to match behaviour for all other target languages.
Stop defining SWIGVERSION in the wrapper. This only happened as a
side-effect of how SWIG_VERSION was defined but was never documented and
is redundant.
The new testcase also checks that SWIG is defined at SWIG-time but not
in the generated wrapper, and that exactly one of a list of
target-language specific macros is defined.
Fixes #1050
2022-10-05 12:40:15 +13:00
William S Fulton
e139a36511
SWIGTYPE && input typemaps now assume object has been moved
...
Replicated Java implementation.
Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)
PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
2022-08-31 19:40:14 +01:00
William S Fulton
c737bd5713
Add C# support std::unique_ptr inputs
...
Based on Java implementation.
2022-07-17 15:20:13 +01:00
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
bf36bf7d8a
Movable and move-only types supported in "out" typemaps.
...
Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.
Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.
The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation alsoand required modifying SwigValueWrapper to
change a cast operator from:
SwigValueWrapper::operator T&() const;
to
#if __cplusplus >=201103L
SwigValueWrapper::operator T&&() const;
#else
SwigValueWrapper::operator T&() const;
#endif
This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:
1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
__cplusplus macro if all versions of C++ need to be supported.
Issue #999
Closes #1044
More about the commit:
Added some missing "varout" typemaps for Ocaml which was falling back to
use "out" typemaps as they were missing.
Ruby std::set fix for SwigValueWrapper C++11 changes.
2022-06-30 17:26:48 +01:00
William S Fulton
c1b004f4fa
Add access modifier support for interface feature
...
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.
For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.
For example:
%typemap(csinterfacemodifiers) X "internal interface"
Closes #1874
2020-09-25 18:54:25 +01:00
William S Fulton
bfddc50a6a
Add C# support for void *VOID_INT_PTR member variables
...
Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
2020-08-13 16:06:48 +01:00
William S Fulton
06462acdf9
Fix C# CA1063 warning by implementing the recommended Dispose methods.
...
Previously just the Dispose() method was generated.
Now the Dispose() and Dispose(bool disposing) methods are generated.
Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
typemaps are being used. Details in #421 on Github. SWIG will error out if one of
the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
error message:
foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.
Closes #421
2019-04-08 19:20:45 +01: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
3d2e57b0f2
Add %proxycode directive for adding code into proxy classes for C#, D and Java
2017-01-13 20:43:50 +00:00
William S Fulton
e9e6a99f0f
Add missing VOID_INT_PTR director typemaps
2016-10-23 16:18:05 +01: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
William S Fulton
236822b488
Warning fixes in generated C# code for 64bit Visual C++ on Windows.
2015-07-03 20:59:24 +01:00
Curtis Dunham
fe91d6449f
Remove register storage class declarations
...
They're unnecessary, anacronistic, deprecated in modern
standards, generally ignored, useless, and (most importantly)
clang complains about them.
2014-02-19 11:58:27 -06:00
Brant K. Kyser
5f53503b7d
Correct spelling of compatibility.
2013-10-22 14:08:47 -05:00
Brant K. Kyser
3720b48847
Add support for SWIG2_CSHARP macro to create SWIG 2 backwards compatability mode.
2013-10-21 13:13:47 -05:00
Brant K. Kyser
adb93980f2
Remove using directives from the generated C# code and fully qualify the use of all .NET framework types in order to minimize potential name collisions from input files defining types, namespace, etc with the same name as .NET framework members.
2013-10-17 15:44:24 -05:00
Brant K. Kyser
3235570619
Globablly qualify the use of types from the .NET framework's System namespace in the C# module and library.
2013-10-17 13:27:48 -05: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
1386b73545
More rvalue reference typemaps
2013-01-24 20:26:02 +00:00
William S Fulton
5e507b82f1
Apply patch #3571029 which adds missing director support for const unsigned long long &.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13952 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-09 20:49:28 +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
6a74028e65
Fix inconsistencies in Java and C# getCPtr() and pointer constructor visibility - change to protected/internal from public. Add SWIG_JAVABODY_PROXY, SWIG_JAVABODY_TYPEWRAPPER and SWIG_CSBODY_PROXY, SWIG_CSBODY_TYPEWRAPPER for users to easily change when using multiple modules.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12843 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-11-25 20:56:56 +00:00
William S Fulton
25ff4e4927
merge revisions 11877-12162 from trunk to gsoc2009-matevz
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12164 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-20 23:35:40 +00:00
William S Fulton
d8cc75946b
Improved C++0x rvalue reference implementation differentiating lvalue and rvalue references. The previous implementation treated rvalue references as lvalue references which leads to a number of different wrapping issues.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12160 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-18 00:19:22 +00:00
William S Fulton
d25121a0ed
Fix SWIG_STD_VECTOR_ENHANCED macro used in C# std::vector to work with commas
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12081 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-01 23:10:22 +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
96f9879511
Fixes for nspace and derived classes
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-09 21:15:34 +00:00
William S Fulton
7f53260203
merge revisions 11872:11876 from trunk to gsoc2009-matevz branch - license changes
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11905 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-06 00:51:54 +00:00
William S Fulton
4308dd03cf
SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:26:02 +00:00
William S Fulton
30335a0198
std::map improvements based on patch from Yuval Baror
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11230 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-05-22 06:10:52 +00:00
William S Fulton
be73d28ad7
don't unnecessarily set swigCPtr to zero again if Dispose/delete called multiple times
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11179 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-31 12:23:47 +00:00
William S Fulton
4887e7be7c
Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-14 21:09:23 +00:00
William S Fulton
336b50b43d
Add the optimal attribute to the out typemap for more optimal code generation when returning objects by value
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10450 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-14 22:12:31 +00:00
William S Fulton
2cf3cb3dc9
char *& typemaps added
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10295 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-04 21:35:22 +00:00
William S Fulton
ed2bc825bd
minor member pointer fixes for last commit
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10077 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-30 22:21:19 +00:00
William S Fulton
3acd5c2d94
Fix member pointers on 64 bit platforms
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10073 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-29 23:07:01 +00:00
William S Fulton
62b2401d09
member function typemap fix for VC++
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10028 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-23 21:56:24 +00:00
William S Fulton
6e4d5b4b3a
Fix member pointer typemaps (32bit fix only though)
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9890 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-08-10 11:16:59 +00:00
William S Fulton
a4eb259f31
member pointer fixes
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9868 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-07-18 21:07:48 +00:00
William S Fulton
24af2d1b11
consistent directout typemaps for all languages - $result used instead of $1 in C# and Java now
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9467 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-20 22:54:14 +00:00
William S Fulton
cff71a3716
Fixes for %apply char *, char[], char[ANY] to other types, like unsigned char
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9462 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-19 21:35:19 +00:00
William S Fulton
ff75eef478
const size_t& typemaps added
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9457 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-17 21:43:40 +00:00
William S Fulton
1be9e42787
Avoid potential race conditions on the Dispose() method
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9444 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-12 23:10:18 +00:00
William S Fulton
5723482a49
Add warning for directorout typemaps
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9147 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-06-05 21:03:57 +00:00
William S Fulton
35e80864f4
Fix char* %apply for directors
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9109 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-05-14 18:50:06 +00:00
William S Fulton
c60b129351
Director support added
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9096 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-05-13 23:15:37 +00:00