merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11821 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
d8a371808a
190 changed files with 5421 additions and 2036 deletions
10
ANNOUNCE
10
ANNOUNCE
|
|
@ -1,10 +1,10 @@
|
|||
*** ANNOUNCE: SWIG 1.3.40 (in progress) ***
|
||||
*** ANNOUNCE: SWIG 1.3.41 (in progress) ***
|
||||
|
||||
http://www.swig.org
|
||||
|
||||
|
||||
We're pleased to announce SWIG-1.3.40, the latest installment in the
|
||||
SWIG development effort. SWIG-1.3.40 includes a number of bug fixes
|
||||
We're pleased to announce SWIG-1.3.41, the latest installment in the
|
||||
SWIG development effort. SWIG-1.3.41 includes a number of bug fixes
|
||||
and enhancements.
|
||||
|
||||
What is SWIG?
|
||||
|
|
@ -24,11 +24,11 @@ Availability:
|
|||
-------------
|
||||
The release is available for download on Sourceforge at
|
||||
|
||||
http://prdownloads.sourceforge.net/swig/swig-1.3.40.tar.gz
|
||||
http://prdownloads.sourceforge.net/swig/swig-1.3.41.tar.gz
|
||||
|
||||
A Windows version is also available at
|
||||
|
||||
http://prdownloads.sourceforge.net/swig/swigwin-1.3.40.zip
|
||||
http://prdownloads.sourceforge.net/swig/swigwin-1.3.41.zip
|
||||
|
||||
Please report problems with this release to the swig-dev mailing list,
|
||||
details at http://www.swig.org/mail.html.
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ $(PACKAGE_NAME).1: ccache.yo
|
|||
-yodl2man -o $(PACKAGE_NAME).1 ccache.yo
|
||||
|
||||
web/ccache-man.html: ccache.yo
|
||||
mkdir -p man
|
||||
yodl2html -o web/ccache-man.html ccache.yo
|
||||
|
||||
install: $(PACKAGE_NAME)$(EXEEXT) $(PACKAGE_NAME).1
|
||||
|
|
@ -64,8 +63,11 @@ test: test.sh
|
|||
check: test
|
||||
|
||||
distclean: clean distclean-docs
|
||||
/bin/rm -f Makefile config.h config.sub config.log build-stamp config.status configure config.h
|
||||
/bin/rm -f Makefile config.h config.sub config.log build-stamp config.status config.h.in ccache_swig_config.h
|
||||
|
||||
maintainer-clean: distclean
|
||||
/bin/rm -f configure
|
||||
|
||||
# FIXME: To fix this, test.sh needs to be able to take ccache from the
|
||||
# installed prefix, not from the source dir.
|
||||
installcheck:
|
||||
|
|
|
|||
258
CHANGES
258
CHANGES
|
|
@ -2,6 +2,264 @@ SWIG (Simplified Wrapper and Interface Generator)
|
|||
|
||||
See CHANGES.current for current version.
|
||||
|
||||
Version 1.3.40 (18 August 2009)
|
||||
===============================
|
||||
|
||||
2009-08-17: olly
|
||||
[Perl] Add "#undef do_exec" to our clean up of Perl global
|
||||
namespace pollution.
|
||||
|
||||
2009-08-17: olly
|
||||
[PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217).
|
||||
|
||||
2009-08-17: wsfulton
|
||||
Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html
|
||||
is not available.
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[Octave] Caught exceptions display the type of the C++ exception instead of the
|
||||
generic "c++-side threw an exception" message.
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[Java] When %catches is used, fix so that any classes specified in the "throws"
|
||||
attribute of the "throws" typemap are generated into the Java method's throws clause.
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez.
|
||||
|
||||
2009-08-15: wsfulton
|
||||
Fix %template seg fault on some cases of overloading the templated method.
|
||||
Bug reported by Jan Kupec.
|
||||
|
||||
2009-08-15: wsfulton
|
||||
[Ruby] Add numerous missing wrapped methods for std::vector<bool> specialization
|
||||
as reported by Youssef Jones.
|
||||
|
||||
2009-08-14: wsfulton
|
||||
[Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer
|
||||
memory ownership control. shared_ptr support still to be added. Patch from
|
||||
David Fletcher.
|
||||
|
||||
2009-08-14: olly
|
||||
[PHP] PHP5 now wraps static member variables as documented.
|
||||
|
||||
2009-08-14: olly
|
||||
[PHP] Update the PHP "class" example to work with PHP5 and use
|
||||
modern wrapping features.
|
||||
|
||||
2009-08-13: wsfulton
|
||||
[PHP] std::vector wrappers overhaul. They no longer require the
|
||||
specialize_std_vector() macro. Added wrappers for capacity() and reserve().
|
||||
|
||||
2009-08-13: wsfulton
|
||||
[PHP] Add const reference typemaps. const reference primitive types are
|
||||
now passed by value rather than pointer like the other target languages.
|
||||
Fixes SF#2524029.
|
||||
|
||||
2009-08-08: wsfulton
|
||||
[Python] More user friendly AttributeError is raised when there are
|
||||
no constructors generated for the proxy class in the event that the
|
||||
class is abstract - the error message is now
|
||||
"No constructor defined - class is abstract" whereas if there are no
|
||||
public constructors for any other reason and the class is not abstract,
|
||||
the message remains
|
||||
"No constructor defined".
|
||||
[tcl] Similarly for tcl when using -itcl.
|
||||
|
||||
2009-08-04: olly
|
||||
[PHP] Fix generated code to work with PHP 5.3.
|
||||
|
||||
2009-08-04: vmiklos
|
||||
[PHP] Various mathematical functions (which would conflict
|
||||
with the built-in PHP ones) are now automatically handled by
|
||||
adding a 'c_' prefix.
|
||||
|
||||
2009-08-03: wsfulton
|
||||
[C#] The std::vector<T> implementation is improved and now uses $typemap such
|
||||
that the proxy class for T no longer has to be specified in some macros
|
||||
for correct C# compilation; the following macros are deprecated, where
|
||||
CSTYPE was the C# type for the C++ class CTYPE:
|
||||
|
||||
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE)
|
||||
usage should be removed altogether
|
||||
|
||||
SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE)
|
||||
should be replaced with:
|
||||
SWIG_STD_VECTOR_ENHANCED(CTYPE)
|
||||
|
||||
Some more details in csharp/std_vector.i
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2009-07-31: olly
|
||||
[Python] Fix indentation so that we give a useful error if the
|
||||
module can't be loaded. Patch from Gaetan Lehmann in SF#2829853.
|
||||
|
||||
2009-07-29: wsfulton
|
||||
Add $typemap(method, typelist) special variable macro. This allows
|
||||
the contents of a typemap to be inserted within another typemap.
|
||||
Fully documented in Typemaps.html.
|
||||
|
||||
2009-07-29: vmiklos
|
||||
[PHP] Static member variables are now prefixed with the
|
||||
class name. This allows static member variables with the
|
||||
same name in different classes.
|
||||
|
||||
2009-07-29: olly
|
||||
[Python] Add missing locks to std::map wrappers. Patch from
|
||||
Paul Hampson in SF#2813836.
|
||||
|
||||
2009-07-29: olly
|
||||
[PHP] Fix memory leak in PHP OUTPUT typemaps. Reported by Hitoshi
|
||||
Amano in SF#2826322.
|
||||
|
||||
2009-07-29: olly
|
||||
[PHP] Fix memory leak in PHP resource destructor for classes
|
||||
without a destructor and non-class types. Patch from Hitoshi Amano
|
||||
in SF#2825303.
|
||||
|
||||
2009-07-28: olly
|
||||
[PHP] Update warnings about clashes between identifiers and PHP
|
||||
keywords and automatic renaming to work with the PHP5 class
|
||||
wrappers. Fixes SF#1613679.
|
||||
|
||||
2009-07-28: vmiklos
|
||||
[PHP] If a member function is not public but it has a base
|
||||
which is public, then now a warning is issued and the member
|
||||
function will be public, as PHP requires this.
|
||||
|
||||
2009-07-21: vmiklos
|
||||
[PHP] Director support added.
|
||||
|
||||
2009-07-15: olly
|
||||
[Perl] Don't specify Perl prototype "()" for a constructor with a
|
||||
different name to the class, as such constructors can still take
|
||||
parameters.
|
||||
|
||||
2009-07-12: xavier98
|
||||
[Octave] Add support for Octave 3.2 API
|
||||
|
||||
2009-07-05: olly
|
||||
[PHP] Update the list of PHP keywords - "cfunction" is no longer a
|
||||
keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
|
||||
and "__NAMESPACE__".
|
||||
|
||||
2009-07-03: olly
|
||||
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
|
||||
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
|
||||
of the manual. Based on patch from SF#2810380 by Christian
|
||||
Gollwitzer.
|
||||
|
||||
2009-07-02: vmiklos
|
||||
[PHP] Added factory.i for PHP, see the li_factory testcase
|
||||
for more info on how to use it.
|
||||
|
||||
2009-07-02: wsfulton
|
||||
Fix -Wallkw option as reported by Solomon Gibbs.
|
||||
|
||||
2009-07-02: wsfulton
|
||||
Fix syntax error when a nested struct contains a comment containing a * followed
|
||||
eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs.
|
||||
|
||||
2009-07-01: vmiklos
|
||||
[PHP] Unknown properties are no longer ignored in proxy
|
||||
classes.
|
||||
|
||||
2009-07-01: vmiklos
|
||||
[PHP] Fixed %newobject behaviour, previously any method
|
||||
marked with %newobject was handled as a constructor.
|
||||
|
||||
2009-06-30: olly
|
||||
[Ruby] Undefine close and connect macros defined by Ruby API
|
||||
headers as we don't need them and they can clash with C++ methods
|
||||
being wrapped. Patch from Vit Ondruch in SF#2814430.
|
||||
|
||||
2009-06-26: olly
|
||||
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
|
||||
double parameter.
|
||||
|
||||
2009-06-24: wsfulton
|
||||
Fix wrapping methods with default arguments and the compactdefaultargs feature
|
||||
where a class is passed by value and is assigned a default value. The SwigValueWrapper
|
||||
template workaround for a missing default constructor is no longer used as the code
|
||||
generated does not call the default constructor.
|
||||
|
||||
2009-06-16: wsfulton
|
||||
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
|
||||
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
|
||||
|
||||
2009-06-02: talby
|
||||
[Perl] Resolved reference.i overload support problem
|
||||
identified by John Potowsky.
|
||||
|
||||
2009-05-26: wsfulton
|
||||
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
|
||||
now implements System.Collections.Generic.IDictionary<>.
|
||||
|
||||
These std:map wrappers have a non-backwards compatible overhaul to make them
|
||||
like a .NET IDictionary. Some method names have changed as following:
|
||||
set -> setitem (use this[] property now)
|
||||
get -> getitem (use this[] property now)
|
||||
has_key -> ContainsKey
|
||||
del -> Remove
|
||||
clear -> Clear
|
||||
|
||||
The following macros used for std::map wrappers are deprecated and will no longer work:
|
||||
specialize_std_map_on_key
|
||||
specialize_std_map_on_value
|
||||
specialize_std_map_on_both
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2009-05-20: vmiklos
|
||||
[PHP] Add the 'thisown' member to classes. The usage of it
|
||||
is the same as the Python thisown one: it's 1 by default and
|
||||
you can set it to 0 if you want to prevent freeing it. (For
|
||||
example to prevent a double free.)
|
||||
|
||||
2009-05-14: bhy
|
||||
[Python] Fix the wrong pointer value returned by SwigPyObject_repr().
|
||||
|
||||
2009-05-13: mutandiz (Mikel Bancroft)
|
||||
[allegrocl] Minor tweak when wrapping in -nocwrap mode.
|
||||
|
||||
2009-05-11: wsfulton
|
||||
[C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These
|
||||
implement IList<> instead of IEnumerable<> where possible.
|
||||
|
||||
2009-04-29: wsfulton
|
||||
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
|
||||
When this attribute is set, the typemap will not apply to classes that are derived
|
||||
from a C++ base class, eg
|
||||
%typemap(csbase, notderived="1") SWIGTYPE "CommonBase"
|
||||
|
||||
2009-04-29: olly
|
||||
[Python] Don't attempt to acquire the GIL in situations where we
|
||||
know that it will already be locked. This avoids some dead-locks
|
||||
with mod_python (due to mod_python bugs which are apparently
|
||||
unlikely to ever be fixed), and results in smaller wrappers which
|
||||
run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04,
|
||||
the stripped wrapper library was 11% smaller and ran 2.7% faster).
|
||||
|
||||
2009-04-21: wsfulton
|
||||
[C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation.
|
||||
|
||||
2009-04-09: wsfulton
|
||||
Fix #2746858 - C macro expression using floating point numbers
|
||||
|
||||
2009-03-30: olly
|
||||
[PHP] The default out typemap for char[ANY] now returns the string up to a
|
||||
zero byte, or the end of the array if there is no zero byte. This
|
||||
is the same as Python does, and seems more generally useful than
|
||||
the previous behaviour of returning the whole contents of the array
|
||||
including any zero bytes. If you want the old behaviour, you can provide
|
||||
your own typemap to do this:
|
||||
|
||||
%typemap(out) char [ANY]
|
||||
%{
|
||||
RETVAL_STRINGL($1, $1_dim0, 1);
|
||||
%}
|
||||
|
||||
Version 1.3.39 (21 March 2009)
|
||||
==============================
|
||||
|
||||
|
|
|
|||
446
CHANGES.current
446
CHANGES.current
|
|
@ -1,257 +1,295 @@
|
|||
Version 1.3.40 (in progress)
|
||||
Version 1.3.41 (in progress)
|
||||
============================
|
||||
|
||||
2009-08-17: olly
|
||||
[Perl] Add "#undef do_exec" to our clean up of Perl global
|
||||
namespace pollution.
|
||||
2010-01-11: wsfulton
|
||||
Slight change to warning, error and diagnostic reporting. The warning number is no
|
||||
longer shown within brackets. This is to help default parsing of warning messages by
|
||||
other tools, vim on Unix in particular.
|
||||
|
||||
2009-08-17: olly
|
||||
[PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217).
|
||||
Example original display using -Fstandard:
|
||||
example.i:20: Warning(401): Nothing known about base class 'B'. Ignored.
|
||||
New display:
|
||||
example.i:20: Warning 401: Nothing known about base class 'B'. Ignored.
|
||||
|
||||
2009-08-17: wsfulton
|
||||
Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html
|
||||
is not available.
|
||||
Also subtle fix to -Fmicrosoft format adding in missing space. Example original display:
|
||||
example.i(20): Warning(401): Nothing known about base class 'Base'. Ignored.
|
||||
New display:
|
||||
example.i(20) : Warning 401: Nothing known about base class 'Base'. Ignored.
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[Octave] Caught exceptions display the type of the C++ exception instead of the
|
||||
generic "c++-side threw an exception" message.
|
||||
2010-01-10: wsfulton
|
||||
Fix a few inconsistencies in reporting of file/line numberings including modifying
|
||||
the overload warnings 509, 512, 516, 474, 475 to now be two line warnings.
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[Java] When %catches is used, fix so that any classes specified in the "throws"
|
||||
attribute of the "throws" typemap are generated into the Java method's throws clause.
|
||||
2010-01-10: wsfulton
|
||||
Modify -debug-tags output to use standard file name/line reporting so that editors
|
||||
can easily navigate to the appropriate lines.
|
||||
Was typically:
|
||||
. top . include . include (/usr/share/swig/temp/trunk/Lib/swig.swg:312)
|
||||
. top . include . include . include (/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39)
|
||||
now:
|
||||
/usr/share/swig/temp/trunk/Lib/swig.swg:312: . top . include . include
|
||||
/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39: . top . include . include . include
|
||||
|
||||
2009-08-16: wsfulton
|
||||
[C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez.
|
||||
2010-01-03: wsfulton
|
||||
Fix missing file/line numbers for typemap warnings and in output from the
|
||||
-debug-tmsearch/-debug-tmused options.
|
||||
|
||||
2009-08-15: wsfulton
|
||||
Fix %template seg fault on some cases of overloading the templated method.
|
||||
Bug reported by Jan Kupec.
|
||||
2010-01-03: wsfulton
|
||||
Add typemaps used debugging option (-debug-tmused). When used each line displays
|
||||
the typemap used for each type for which code is being generated including the file
|
||||
and line number related to the type. This is effectively a condensed form of the
|
||||
-debug-tmsearch option. Documented in Typemaps.html.
|
||||
|
||||
2009-08-15: wsfulton
|
||||
[Ruby] Add numerous missing wrapped methods for std::vector<bool> specialization
|
||||
as reported by Youssef Jones.
|
||||
2009-12-23: wsfulton
|
||||
Fix for %javaexception and directors so that all the appropriate throws clauses
|
||||
are generated. Problem reported by Peter Greenwood.
|
||||
|
||||
2009-08-14: wsfulton
|
||||
[Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer
|
||||
memory ownership control. shared_ptr support still to be added. Patch from
|
||||
David Fletcher.
|
||||
2009-12-20: wsfulton
|
||||
Add -debug-tmsearch option for debugging the typemap pattern matching rules.
|
||||
Documented in Typemaps.html.
|
||||
|
||||
2009-08-14: olly
|
||||
[PHP] PHP5 now wraps static member variables as documented.
|
||||
2009-12-12: wsfulton
|
||||
[Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER
|
||||
macro provided in the octave headers for determining the api version instead.
|
||||
|
||||
2009-08-14: olly
|
||||
[PHP] Update the PHP "class" example to work with PHP5 and use
|
||||
modern wrapping features.
|
||||
2009-12-04: olly
|
||||
[Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of
|
||||
SF#2859614.
|
||||
|
||||
2009-08-13: wsfulton
|
||||
[PHP] std::vector wrappers overhaul. They no longer require the
|
||||
specialize_std_vector() macro. Added wrappers for capacity() and reserve().
|
||||
2009-12-04: olly
|
||||
Fix handling of modulo operator (%) in constant expressions
|
||||
(SF#2818562).
|
||||
|
||||
2009-08-13: wsfulton
|
||||
[PHP] Add const reference typemaps. const reference primitive types are
|
||||
now passed by value rather than pointer like the other target languages.
|
||||
Fixes SF#2524029.
|
||||
2009-12-04: olly
|
||||
[PHP] "empty" is a reserved word in PHP, so rename empty() method
|
||||
on STL classes to "is_empty()" (previously this was automatically
|
||||
renamed to "c_empty()").
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2009-08-08: wsfulton
|
||||
[Python] More user friendly AttributeError is raised when there are
|
||||
no constructors generated for the proxy class in the event that the
|
||||
class is abstract - the error message is now
|
||||
"No constructor defined - class is abstract" whereas if there are no
|
||||
public constructors for any other reason and the class is not abstract,
|
||||
the message remains
|
||||
"No constructor defined".
|
||||
[tcl] Similarly for tcl when using -itcl.
|
||||
2009-12-03: olly
|
||||
[PHP] Add typemaps for long long and unsigned long long, and for
|
||||
pointer to method.
|
||||
|
||||
2009-08-04: olly
|
||||
[PHP] Fix generated code to work with PHP 5.3.
|
||||
2009-12-02: olly
|
||||
[PHP] Fix warning and rename of reserved class name to be case
|
||||
insensitive.
|
||||
|
||||
2009-08-04: vmiklos
|
||||
[PHP] Various mathematical functions (which would conflict
|
||||
with the built-in PHP ones) are now automatically handled by
|
||||
adding a 'c_' prefix.
|
||||
2009-12-01: wsfulton
|
||||
Revert support for %extend and memberin typemaps added in swig-1.3.39. The
|
||||
memberin typemaps are ignored again for member variables within a %extend block.
|
||||
Documentation inconsistency reported by Torsten Landschoff.
|
||||
|
||||
2009-08-03: wsfulton
|
||||
[C#] The std::vector<T> implementation is improved and now uses $typemap such
|
||||
that the proxy class for T no longer has to be specified in some macros
|
||||
for correct C# compilation; the following macros are deprecated, where
|
||||
CSTYPE was the C# type for the C++ class CTYPE:
|
||||
2009-11-29: wsfulton
|
||||
[Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for
|
||||
static const char member variables.
|
||||
|
||||
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE)
|
||||
usage should be removed altogether
|
||||
%javaconst(1) A;
|
||||
%csconst(1) A;
|
||||
struct X {
|
||||
static const char A = 'A';
|
||||
};
|
||||
|
||||
SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE)
|
||||
should be replaced with:
|
||||
SWIG_STD_VECTOR_ENHANCED(CTYPE)
|
||||
2009-11-26: wsfulton
|
||||
[Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to
|
||||
use the actual constant value if it is specified, rather than the C++ code to
|
||||
access the member.
|
||||
|
||||
Some more details in csharp/std_vector.i
|
||||
%javaconst(1) EN;
|
||||
%csconst(1) EN;
|
||||
struct X {
|
||||
static const int EN = 2;
|
||||
};
|
||||
|
||||
2009-11-23: wsfulton
|
||||
C++ nested typedef classes can now be handled too, for example:
|
||||
struct Outer {
|
||||
typedef Foo { } FooTypedef1, FooTypedef2;
|
||||
};
|
||||
|
||||
2009-11-18: wsfulton
|
||||
The wrappers for C nested structs are now generated in the same order as declared
|
||||
in the parsed code.
|
||||
|
||||
2009-11-18: wsfulton
|
||||
Fix #491476 - multiple declarations of nested structs, for example:
|
||||
struct Outer {
|
||||
struct {
|
||||
int val;
|
||||
} inner1, inner2, *inner3, inner4[1];
|
||||
} outer;
|
||||
|
||||
2009-11-17: wsfulton
|
||||
Fix parsing of enum declaration and initialization, for example:
|
||||
|
||||
enum ABC {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
} A = a, *pC = &C, array[3] = {a, b, c};
|
||||
|
||||
2009-11-17: wsfulton
|
||||
Fix parsing of struct declaration and initialization, for example:
|
||||
|
||||
struct S {
|
||||
int x;
|
||||
} instance = { 10 };
|
||||
|
||||
2009-11-15: wsfulton
|
||||
Fix #1960977 - Syntax error parsing derived nested class declaration and member
|
||||
variable instance.
|
||||
|
||||
2009-11-14: wsfulton
|
||||
Fix #2310483 - function pointer typedef within extern "C" block.
|
||||
|
||||
2009-11-13: wsfulton
|
||||
Fix usage of nested template classes within templated classes so that compileable code
|
||||
is generated.
|
||||
|
||||
2009-11-13: olly
|
||||
[php] Fix place where class prefix (as specified with -prefix)
|
||||
wasn't being used. Patch from gverbruggen in SF#2892647.
|
||||
|
||||
2009-11-12: wsfulton
|
||||
Fix usage of nested template classes so that compileable code is generated - the nested
|
||||
template class is now treated like a normal nested classes, that is, as an opaque type
|
||||
unless the nestedworkaround feature is used.
|
||||
|
||||
2009-11-12: wsfulton
|
||||
Replace SWIGWARN_PARSE_NESTED_CLASS with SWIGWARN_PARSE_NAMED_NESTED_CLASS and
|
||||
SWIGWARN_PARSE_UNNAMED_NESTED_CLASS for named and unnamed nested classes respectively.
|
||||
|
||||
Named nested class ignored warnings can now be suppressed by name using %warnfilter, eg:
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::Inner;
|
||||
|
||||
but clearly unnamed nested classes cannot and the global suppression is still required, eg:
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
2009-11-11: wsfulton
|
||||
Added the nestedworkaround feature as a way to use the full functionality of a nested class
|
||||
(C++ mode only). It removes the nested class from SWIG's type information so it is as if SWIG
|
||||
had never parsed the nested class. The documented nested class workarounds using a global
|
||||
fake class stopped working when SWIG treated the nested class as an opaque pointer, and
|
||||
this feature reverts this behaviour. The documentation has been updated with details of how
|
||||
to use and implement it, see the "Nested classes" section in SWIGPlus.html.
|
||||
|
||||
2009-11-11: wsfulton
|
||||
There were a number of C++ cases where nested classes/structs/unions were being handled
|
||||
as if C code was being parsed which would oftentimes lead to uncompileable code as an
|
||||
attempt was made to wrap the nested structs like it is documented for C code. Now all
|
||||
nested structs/classes/unions are ignored in C++ mode, as was always documented. However,
|
||||
there is an improvement as usage of nested structs/classes/unions is now always treated
|
||||
as an opaque type by default, resulting in generated code that should always compile.
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2009-07-31: olly
|
||||
[Python] Fix indentation so that we give a useful error if the
|
||||
module can't be loaded. Patch from Gaetan Lehmann in SF#2829853.
|
||||
2009-11-09: drjoe
|
||||
Fix R for -fcompact and add std_map.i
|
||||
|
||||
2009-07-29: wsfulton
|
||||
Add $typemap(method, typelist) special variable macro. This allows
|
||||
the contents of a typemap to be inserted within another typemap.
|
||||
Fully documented in Typemaps.html.
|
||||
2009-11-08: wsfulton
|
||||
Fix inconsistency for nested structs/unions/classes. Uncompileable code was being
|
||||
generated when inner struct and union declarations were used as types within the
|
||||
inner struct. The inner struct/union is now treated as a forward declaration making the
|
||||
behaviour the same as an inner class. (C++ code), eg:
|
||||
|
||||
2009-07-29: vmiklos
|
||||
[PHP] Static member variables are now prefixed with the
|
||||
class name. This allows static member variables with the
|
||||
same name in different classes.
|
||||
struct Outer {
|
||||
struct InnerStruct { int x; };
|
||||
InnerStruct* getInnerStruct();
|
||||
};
|
||||
|
||||
2009-07-29: olly
|
||||
[Python] Add missing locks to std::map wrappers. Patch from
|
||||
Paul Hampson in SF#2813836.
|
||||
2009-11-08: wsfulton
|
||||
Ignored nested class/struct warnings now display the name of the ignored class/struct.
|
||||
|
||||
2009-07-29: olly
|
||||
[PHP] Fix memory leak in PHP OUTPUT typemaps. Reported by Hitoshi
|
||||
Amano in SF#2826322.
|
||||
2009-11-07: wsfulton
|
||||
Bug #1514681 - Fix nested template classes within a namespace generated uncompileable
|
||||
code and introduced strange side effects to other wrapper code especially code
|
||||
after the nested template class. Note that nested template classes are still ignored.
|
||||
|
||||
2009-07-29: olly
|
||||
[PHP] Fix memory leak in PHP resource destructor for classes
|
||||
without a destructor and non-class types. Patch from Hitoshi Amano
|
||||
in SF#2825303.
|
||||
2009-11-07: wsfulton
|
||||
Add new debug options:
|
||||
-debug-symtabs - Display symbol tables information
|
||||
-debug-symbols - Display target language symbols in the symbol tables
|
||||
-debug-csymbols - Display C symbols in the symbol tables
|
||||
|
||||
2009-07-28: olly
|
||||
[PHP] Update warnings about clashes between identifiers and PHP
|
||||
keywords and automatic renaming to work with the PHP5 class
|
||||
wrappers. Fixes SF#1613679.
|
||||
2009-11-03: wsfulton
|
||||
Fix some usage of global scope operator, for example:
|
||||
|
||||
2009-07-28: vmiklos
|
||||
[PHP] If a member function is not public but it has a base
|
||||
which is public, then now a warning is issued and the member
|
||||
function will be public, as PHP requires this.
|
||||
namespace AA { /* ... */ }
|
||||
using namespace ::AA;
|
||||
|
||||
2009-07-21: vmiklos
|
||||
[PHP] Director support added.
|
||||
and bug #1816802 - SwigValueWrapper should be used:
|
||||
|
||||
2009-07-15: olly
|
||||
[Perl] Don't specify Perl prototype "()" for a constructor with a
|
||||
different name to the class, as such constructors can still take
|
||||
parameters.
|
||||
struct CC {
|
||||
CC(int); // no default constructor
|
||||
};
|
||||
::CC x();
|
||||
|
||||
2009-07-12: xavier98
|
||||
[Octave] Add support for Octave 3.2 API
|
||||
and in template parameter specializations:
|
||||
|
||||
2009-07-05: olly
|
||||
[PHP] Update the list of PHP keywords - "cfunction" is no longer a
|
||||
keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
|
||||
and "__NAMESPACE__".
|
||||
struct S {};
|
||||
template <typename T> struct X { void a() {}; };
|
||||
template <> struct X<S> { void b() {}; };
|
||||
%template(MyTConcrete) X< ::S >;
|
||||
|
||||
2009-07-03: olly
|
||||
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
|
||||
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
|
||||
of the manual. Based on patch from SF#2810380 by Christian
|
||||
Gollwitzer.
|
||||
plus probably some other corner case usage of ::.
|
||||
|
||||
2009-07-02: vmiklos
|
||||
[PHP] Added factory.i for PHP, see the li_factory testcase
|
||||
for more info on how to use it.
|
||||
2009-11-02: olly
|
||||
[Python] Fix potential memory leak in initialisation code for the
|
||||
generated module.
|
||||
|
||||
2009-07-02: wsfulton
|
||||
Fix -Wallkw option as reported by Solomon Gibbs.
|
||||
2009-10-23: wsfulton
|
||||
Fix seg fault when using a named nested template instantiation using %template(name)
|
||||
within a class. A warning that these are not supported is now issued plus processing
|
||||
continues as if no name was given.
|
||||
|
||||
2009-07-02: wsfulton
|
||||
Fix syntax error when a nested struct contains a comment containing a * followed
|
||||
eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs.
|
||||
2009-10-20: wsfulton
|
||||
[Python] Fix std::vector<const T*>. This would previously compile, but not run correctly.
|
||||
|
||||
2009-07-01: vmiklos
|
||||
[PHP] Unknown properties are no longer ignored in proxy
|
||||
classes.
|
||||
2009-10-20: wsfulton
|
||||
Fixed previously fairly poor template partial specialization and explicit
|
||||
specialization support. Numerous bugs in this area have been fixed including:
|
||||
|
||||
2009-07-01: vmiklos
|
||||
[PHP] Fixed %newobject behaviour, previously any method
|
||||
marked with %newobject was handled as a constructor.
|
||||
- Template argument deduction implemented for template type arguments, eg this now
|
||||
works:
|
||||
template<typename T> class X {};
|
||||
template<typename T> class X<T *> {};
|
||||
%template(X1) X<const int *>; // Chooses T * specialization
|
||||
|
||||
2009-06-30: olly
|
||||
[Ruby] Undefine close and connect macros defined by Ruby API
|
||||
headers as we don't need them and they can clash with C++ methods
|
||||
being wrapped. Patch from Vit Ondruch in SF#2814430.
|
||||
and more complex cases with multiple parameters and a mix of template argument
|
||||
deduction and explicitly specialised parameters, eg:
|
||||
template <typename T1, typename T2> struct TwoParm { void a() {} };
|
||||
template <typename T1> struct TwoParm<T1 *, int *> { void e() {} };
|
||||
%template(E) TwoParm<int **, int *>;
|
||||
|
||||
2009-06-26: olly
|
||||
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
|
||||
double parameter.
|
||||
|
||||
2009-06-24: wsfulton
|
||||
Fix wrapping methods with default arguments and the compactdefaultargs feature
|
||||
where a class is passed by value and is assigned a default value. The SwigValueWrapper
|
||||
template workaround for a missing default constructor is no longer used as the code
|
||||
generated does not call the default constructor.
|
||||
|
||||
2009-06-16: wsfulton
|
||||
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
|
||||
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
|
||||
|
||||
2009-06-02: talby
|
||||
[Perl] Resolved reference.i overload support problem
|
||||
identified by John Potowsky.
|
||||
|
||||
2009-05-26: wsfulton
|
||||
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
|
||||
now implements System.Collections.Generic.IDictionary<>.
|
||||
|
||||
These std:map wrappers have a non-backwards compatible overhaul to make them
|
||||
like a .NET IDictionary. Some method names have changed as following:
|
||||
set -> setitem (use this[] property now)
|
||||
get -> getitem (use this[] property now)
|
||||
has_key -> ContainsKey
|
||||
del -> Remove
|
||||
clear -> Clear
|
||||
|
||||
The following macros used for std::map wrappers are deprecated and will no longer work:
|
||||
specialize_std_map_on_key
|
||||
specialize_std_map_on_value
|
||||
specialize_std_map_on_both
|
||||
Note that the primary template must now be in scope, like in C++, when
|
||||
an explicit or partial specialization is instantiated with %template.
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2009-05-20: vmiklos
|
||||
[PHP] Add the 'thisown' member to classes. The usage of it
|
||||
is the same as the Python thisown one: it's 1 by default and
|
||||
you can set it to 0 if you want to prevent freeing it. (For
|
||||
example to prevent a double free.)
|
||||
2009-09-14: wsfulton
|
||||
[C#] Add %csattributes for adding C# attributes to enum values, see docs for example.
|
||||
|
||||
2009-05-14: bhy
|
||||
[Python] Fix the wrong pointer value returned by SwigPyObject_repr().
|
||||
2009-09-11: wsfulton
|
||||
Fix memmove regression in cdata.i as reported by Adriaan Renting.
|
||||
|
||||
2009-05-13: mutandiz (Mikel Bancroft)
|
||||
[allegrocl] Minor tweak when wrapping in -nocwrap mode.
|
||||
2009-09-07: wsfulton
|
||||
Fix constant expressions containing <= or >=.
|
||||
|
||||
2009-05-11: wsfulton
|
||||
[C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These
|
||||
implement IList<> instead of IEnumerable<> where possible.
|
||||
2009-09-02: wsfulton
|
||||
The following operators in constant expressions now result in type bool for C++
|
||||
wrappers and remain as type int for C wrappers, as per each standard:
|
||||
|
||||
2009-04-29: wsfulton
|
||||
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
|
||||
When this attribute is set, the typemap will not apply to classes that are derived
|
||||
from a C++ base class, eg
|
||||
%typemap(csbase, notderived="1") SWIGTYPE "CommonBase"
|
||||
&& || == != < > <= >= (Actually the last 4 are still broken). For example:
|
||||
|
||||
2009-04-29: olly
|
||||
[Python] Don't attempt to acquire the GIL in situations where we
|
||||
know that it will already be locked. This avoids some dead-locks
|
||||
with mod_python (due to mod_python bugs which are apparently
|
||||
unlikely to ever be fixed), and results in smaller wrappers which
|
||||
run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04,
|
||||
the stripped wrapper library was 11% smaller and ran 2.7% faster).
|
||||
#define A 10
|
||||
#define B 10
|
||||
#define A_EQ_B A == B // now wrapped as type bool for C++
|
||||
#define A_AND_B A && B // now wrapped as type bool for C++
|
||||
|
||||
2009-04-21: wsfulton
|
||||
[C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation.
|
||||
2009-09-02: wsfulton
|
||||
Fix #2845746. true and false are now recognised keywords (only when wrapping C++).
|
||||
Constants such as the following are now wrapped (as type bool):
|
||||
#define FOO true
|
||||
#define BAR FOO && false
|
||||
|
||||
2009-04-09: wsfulton
|
||||
Fix #2746858 - C macro expression using floating point numbers
|
||||
|
||||
2009-03-30: olly
|
||||
[PHP] The default out typemap for char[ANY] now returns the string up to a
|
||||
zero byte, or the end of the array if there is no zero byte. This
|
||||
is the same as Python does, and seems more generally useful than
|
||||
the previous behaviour of returning the whole contents of the array
|
||||
including any zero bytes. If you want the old behaviour, you can provide
|
||||
your own typemap to do this:
|
||||
|
||||
%typemap(out) char [ANY]
|
||||
%{
|
||||
RETVAL_STRINGL($1, $1_dim0, 1);
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1070,31 +1070,35 @@ With each is the cast that can be used in the debugger to extract the underlying
|
|||
<p>
|
||||
<li>String *s;</li>
|
||||
<br>
|
||||
(String *)((DohBase *)s)->data
|
||||
(struct String *)((DohBase *)s)->data
|
||||
<br>
|
||||
The underlying char * string can be displayed with
|
||||
<br>
|
||||
((String *)((DohBase *)s)->data)->str
|
||||
(*(struct String *)(((DohBase *)s)->data)).str
|
||||
|
||||
<p>
|
||||
<li>SwigType *t;</li>
|
||||
<br>
|
||||
(String *)((DohBase *)t)->data
|
||||
(struct String *)((DohBase *)t)->data
|
||||
<br>
|
||||
The underlying char * string can be displayed with
|
||||
<br>
|
||||
((String *)((DohBase *)t)->data)->str
|
||||
(*(struct String *)(((DohBase *)t)->data)).str
|
||||
|
||||
<p>
|
||||
<li>String_or_char *sc;</li>
|
||||
<li>const_String_or_char_ptr sc;</li>
|
||||
Either <br>
|
||||
((String *)((DohBase *)sc)->data)->str
|
||||
(*(struct String *)(((DohBase *)sc)->data)).str
|
||||
<br> or <br>
|
||||
(char *)sc
|
||||
<br> will work depending on whether the underlying type is really a String * or char *.
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Please also read the Debugging Functions section in <a href="tree.html">SWIG Parse Tree Handling</a> for the <tt>Swig_print_node()</tt>, <tt>Swig_print_tree()</tt> and <tt>Swig_print_tags()</tt> functions for displaying node contents. It is often easier to place a few calls to these functions in code of interest and recompile than use the debugger.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
Copyright (C) 1999-2004 SWIG Development Team.
|
||||
|
||||
|
|
|
|||
|
|
@ -218,10 +218,10 @@ The following functions are used to help debug SWIG parse trees.
|
|||
<blockquote>
|
||||
Prints the tag-structure of the parse tree to standard output. <tt>node</tt> is the top-level parse tree node. <tt>prefix</tt> is
|
||||
a string prefix thats added to the start of each line. Normally, you would specify the empty string or NIL for <tt>prefix</tt>.
|
||||
This function is called by the <tt>-dump_tags</tt> option to SWIG.
|
||||
This function is called by the <tt>-debug-tags</tt> option to SWIG.
|
||||
|
||||
<pre>
|
||||
% swig -dump_tags -python example.i
|
||||
% swig -debug-tags -python example.i
|
||||
. top (:1)
|
||||
. top . include (/Users/beazley/Projects/share/swig/1.3.31/swig.swg:0)
|
||||
. top . include . include (/Users/beazley/Projects/share/swig/1.3.31/swigwarnings.swg:0)
|
||||
|
|
@ -243,7 +243,7 @@ Since many language modules include hundreds of typemaps and other information,
|
|||
|
||||
<blockquote>
|
||||
Prints the contents of a parse tree node, including all children, to standard output. The output includes all attributes
|
||||
and other details. The command line option <tt>-dump_tree</tt> produces output generated by this function.
|
||||
and other details.
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
|
|
@ -251,8 +251,8 @@ and other details. The command line option <tt>-dump_tree</tt> produces output
|
|||
|
||||
<blockquote>
|
||||
Prints the same output as <tt>Swig_print_node()</tt> except that it also processes all of the siblings of <tt>node</tt>. This can
|
||||
be used to dump the entire parse tree to standard output. Use the command line option <tt>-dump_tree</tt> to get
|
||||
the output of this function for a SWIG input file.
|
||||
be used to dump the entire parse tree to standard output. The command line options <tt>-debug-module</tt>
|
||||
and <tt>-debug-top</tt> use this function to display the parse tree for a SWIG input file.
|
||||
</blockquote>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<ul>
|
||||
<li><a href="#Allegrocl_nn2">Basics</a>
|
||||
<ul>
|
||||
<li><a href="#Allegrocl_nn3">Running Swig</a>
|
||||
<li><a href="#Allegrocl_nn3">Running SWIG</a>
|
||||
<li><a href="#Allegrocl_nn4">Command Line Options</a>
|
||||
<li><a href="#Allegrocl_nn5">Inserting user code into generated files</a>
|
||||
</ul>
|
||||
|
|
@ -138,7 +138,7 @@ to it.
|
|||
<H2><a name="Allegrocl_nn2"></a>17.1 Basics</H2>
|
||||
|
||||
|
||||
<H3><a name="Allegrocl_nn3"></a>17.1.1 Running Swig</H3>
|
||||
<H3><a name="Allegrocl_nn3"></a>17.1.1 Running SWIG</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
|
||||
|
||||
<b>Disclaimer: This chapter is under construction.</b>
|
||||
|
||||
<p>
|
||||
In Chapter 3, SWIG's treatment of basic datatypes and pointers was
|
||||
described. In particular, primitive types such as <tt>int</tt> and
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ The PInvoke interface has been chosen over Microsoft's Managed C++ interface as
|
|||
PInvoke is part of the ECMA/ISO C# specification.
|
||||
It is also better suited for robust production environments due to the Managed C++ flaw called the
|
||||
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vcconMixedDLLLoadingProblem.asp">Mixed DLL Loading Problem</a>.
|
||||
Swig C# works equally well on non-Microsoft operating systems such as Linux, Solaris and Apple Mac using
|
||||
SWIG C# works equally well on non-Microsoft operating systems such as Linux, Solaris and Apple Mac using
|
||||
<a href="http://www.mono-project.com/">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
|
||||
</p>
|
||||
|
||||
|
|
@ -249,7 +249,9 @@ public static extern IntPtr function(string jarg1);
|
|||
<p>
|
||||
Support for type attributes.
|
||||
The 'imtype' and 'cstype' typemaps can have an optional <tt>inattributes</tt> and <tt>outattributes</tt> typemap attribute.
|
||||
There are C# attributes and typemap attributes, don't get confused!!
|
||||
The 'imtype' typemap can also have an optional <tt>directorinattributes</tt> and <tt>directoroutattributes</tt>
|
||||
typemap attribute which attaches to director delegates, an implementation detail of directors, see <a href="#csharp_directors_implementation">directors implementation</a>.
|
||||
Note that there are C# attributes and typemap attributes, don't get confused between the two!!
|
||||
The C# attributes specified in these typemap attributes are generated wherever the type is used in the C# wrappers.
|
||||
These can be used to specify any C# attribute associated with a C/C++ type, but are more typically used for the C# <tt>MarshalAs</tt> attribute.
|
||||
For example:
|
||||
|
|
@ -293,11 +295,16 @@ These attributes are associated with the C/C++ parameter type or return type, wh
|
|||
the attribute features and typemaps covered next.
|
||||
Note that all these different C# attributes can be combined so that a method has more than one attribute.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>directorinattributes</tt> and <tt>directoroutattributes</tt> typemap attribute are attached to the delegates in the director class, for example, the SwigDelegateBase_0
|
||||
</p>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Support for attaching C# attributes to wrapped methods and variables.
|
||||
Support for attaching C# attributes to wrapped methods, variables and enum values.
|
||||
This is done using the <tt>%csattributes</tt> feature, see <a href="Customization.html#features">%feature directives</a>.
|
||||
Note that C# attributes are attached to proxy classes and enums using the <tt>csattributes</tt> typemap.
|
||||
For example, imagine we have a custom attribute class, <tt>ThreadSafeAttribute</tt>, for labelling thread safety.
|
||||
|
|
@ -344,6 +351,38 @@ they can be added using the 'csvarin' and 'csvarout' typemaps respectively.
|
|||
Note that the type used for the property is specified in the 'cstype' typemap.
|
||||
If the 'out' attribute exists in this typemap, then the type used is from the 'out' attribute.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An example for attaching attributes to the enum and enum values is shown below.
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%typemap(csattributes) Couleur "[System.ComponentModel.Description(\"Colours\")]"
|
||||
%csattributes Rouge "[System.ComponentModel.Description(\"Red\")]"
|
||||
%csattributes Vert "[System.ComponentModel.Description(\"Green\")]"
|
||||
%inline %{
|
||||
enum Couleur { Rouge, Orange, Vert };
|
||||
%}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
which will result in the following C# enum:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
[System.ComponentModel.Description("Colours")]
|
||||
public enum Couleur {
|
||||
[System.ComponentModel.Description("Red")]
|
||||
Rouge,
|
||||
Orange,
|
||||
[System.ComponentModel.Description("Green")]
|
||||
Vert
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
|
@ -948,7 +987,7 @@ without setting the <tt>canthrow</tt> attribute you will get a warning message s
|
|||
|
||||
<div class="code">
|
||||
<pre>
|
||||
example.i:21: Warning(845): Unmanaged code contains a call to a SWIG_CSharpSetPendingException
|
||||
example.i:21: Warning 845: Unmanaged code contains a call to a SWIG_CSharpSetPendingException
|
||||
method and C# code does not handle pending exceptions via the canthrow attribute.
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -346,10 +346,11 @@
|
|||
<li><a href="Typemaps.html#Typemaps_pattern_matching">Pattern matching rules</a>
|
||||
<ul>
|
||||
<li><a href="Typemaps.html#Typemaps_nn17">Basic matching rules</a>
|
||||
<li><a href="Typemaps.html#Typemaps_nn18">Typedef reductions</a>
|
||||
<li><a href="Typemaps.html#Typemaps_typedef_reductions">Typedef reductions</a>
|
||||
<li><a href="Typemaps.html#Typemaps_nn19">Default typemaps</a>
|
||||
<li><a href="Typemaps.html#Typemaps_mixed_default">Mixed default typemaps</a>
|
||||
<li><a href="Typemaps.html#Typemaps_nn20">Multi-arguments typemaps</a>
|
||||
<li><a href="Typemaps.html#Typemaps_debugging_search">Debugging typemap pattern matching</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#Typemaps_nn21">Code generation rules</a>
|
||||
<ul>
|
||||
|
|
@ -383,7 +384,7 @@
|
|||
<li><a href="Typemaps.html#Typemaps_nn40">Typemaps for arrays</a>
|
||||
<li><a href="Typemaps.html#Typemaps_nn41">Implementing constraints with typemaps</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#Typemaps_nn43">Typemaps for multiple languages</a>
|
||||
<li><a href="Typemaps.html#Typemaps_nn43">Typemaps for multiple target languages</a>
|
||||
<li><a href="Typemaps.html#Typemaps_optimal">Optimal code generation when returning by value</a>
|
||||
<li><a href="Typemaps.html#Typemaps_multi_argument_typemaps">Multi-argument typemaps</a>
|
||||
<li><a href="Typemaps.html#runtime_type_checker">The run-time type checker</a>
|
||||
|
|
@ -537,7 +538,7 @@
|
|||
<ul>
|
||||
<li><a href="Allegrocl.html#Allegrocl_nn2">Basics</a>
|
||||
<ul>
|
||||
<li><a href="Allegrocl.html#Allegrocl_nn3">Running Swig</a>
|
||||
<li><a href="Allegrocl.html#Allegrocl_nn3">Running SWIG</a>
|
||||
<li><a href="Allegrocl.html#Allegrocl_nn4">Command Line Options</a>
|
||||
<li><a href="Allegrocl.html#Allegrocl_nn5">Inserting user code into generated files</a>
|
||||
</ul>
|
||||
|
|
@ -1280,9 +1281,6 @@
|
|||
<li><a href="Python.html#Python_nn47">Simple pointers</a>
|
||||
<li><a href="Python.html#Python_nn48">Unbounded C Arrays</a>
|
||||
<li><a href="Python.html#Python_nn49">String handling</a>
|
||||
<li><a href="Python.html#Python_nn50">Arrays</a>
|
||||
<li><a href="Python.html#Python_nn51">String arrays</a>
|
||||
<li><a href="Python.html#Python_nn52">STL wrappers</a>
|
||||
</ul>
|
||||
<li><a href="Python.html#Python_nn53">Typemaps</a>
|
||||
<ul>
|
||||
|
|
@ -1581,7 +1579,7 @@
|
|||
<li><a href="Extending.html#Extending_nn31">Writing a Language Module</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#Extending_nn32">Execution model</a>
|
||||
<li><a href="Extending.html#Extending_nn33">Starting out</a>
|
||||
<li><a href="Extending.html#Extending_starting_out">Starting out</a>
|
||||
<li><a href="Extending.html#Extending_nn34">Command line options</a>
|
||||
<li><a href="Extending.html#Extending_nn35">Configuration and preprocessing</a>
|
||||
<li><a href="Extending.html#Extending_nn36">Entry point to code generation</a>
|
||||
|
|
@ -1590,16 +1588,18 @@
|
|||
<li><a href="Extending.html#Extending_nn39">Configuration files</a>
|
||||
<li><a href="Extending.html#Extending_nn40">Runtime support</a>
|
||||
<li><a href="Extending.html#Extending_nn41">Standard library files</a>
|
||||
<li><a href="Extending.html#Extending_nn42">Examples and test cases</a>
|
||||
<li><a href="Extending.html#Extending_nn42">User examples</a>
|
||||
<li><a href="Extending.html#Extending_test_suite">Test driven development and the test-suite</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#Extending_running_test_suite">Running the test-suite</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#Extending_nn43">Documentation</a>
|
||||
<li><a href="Extending.html#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
|
||||
<li><a href="Extending.html#Extending_coding_style_guidelines">Coding style guidelines</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#Extending_nn44">Typemaps</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#Extending_nn45">Proxy classes</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#Extending_debugging_options">Debugging Options</a>
|
||||
<li><a href="Extending.html#Extending_nn46">Guide to parse tree nodes</a>
|
||||
<li><a href="Extending.html#Extending_further_info">Further Development Information</a>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
|
|
|||
|
|
@ -53,6 +53,21 @@ The <tt>%exception</tt> directive allows you to define a general purpose excepti
|
|||
handler. For example, you can specify the following:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%exception {
|
||||
try {
|
||||
$action
|
||||
}
|
||||
catch (RangeError) {
|
||||
... handle error ...
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
How the exception is handled depends on the target language, for example, Python:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%exception {
|
||||
try {
|
||||
|
|
@ -60,7 +75,7 @@ handler. For example, you can specify the following:
|
|||
}
|
||||
catch (RangeError) {
|
||||
PyErr_SetString(PyExc_IndexError,"index out-of-bounds");
|
||||
return NULL;
|
||||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
<li><a href="#Extending_nn31">Writing a Language Module</a>
|
||||
<ul>
|
||||
<li><a href="#Extending_nn32">Execution model</a>
|
||||
<li><a href="#Extending_nn33">Starting out</a>
|
||||
<li><a href="#Extending_starting_out">Starting out</a>
|
||||
<li><a href="#Extending_nn34">Command line options</a>
|
||||
<li><a href="#Extending_nn35">Configuration and preprocessing</a>
|
||||
<li><a href="#Extending_nn36">Entry point to code generation</a>
|
||||
|
|
@ -57,16 +57,18 @@
|
|||
<li><a href="#Extending_nn39">Configuration files</a>
|
||||
<li><a href="#Extending_nn40">Runtime support</a>
|
||||
<li><a href="#Extending_nn41">Standard library files</a>
|
||||
<li><a href="#Extending_nn42">Examples and test cases</a>
|
||||
<li><a href="#Extending_nn42">User examples</a>
|
||||
<li><a href="#Extending_test_suite">Test driven development and the test-suite</a>
|
||||
<ul>
|
||||
<li><a href="#Extending_running_test_suite">Running the test-suite</a>
|
||||
</ul>
|
||||
<li><a href="#Extending_nn43">Documentation</a>
|
||||
<li><a href="#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
|
||||
<li><a href="#Extending_coding_style_guidelines">Coding style guidelines</a>
|
||||
</ul>
|
||||
<li><a href="#Extending_nn44">Typemaps</a>
|
||||
<ul>
|
||||
<li><a href="#Extending_nn45">Proxy classes</a>
|
||||
</ul>
|
||||
<li><a href="#Extending_debugging_options">Debugging Options</a>
|
||||
<li><a href="#Extending_nn46">Guide to parse tree nodes</a>
|
||||
<li><a href="#Extending_further_info">Further Development Information</a>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
|
@ -2471,7 +2473,7 @@ the parsing of command line options, all aspects of code generation are controll
|
|||
different methods of the <tt>Language</tt> that must be defined by your module.
|
||||
</p>
|
||||
|
||||
<H3><a name="Extending_nn33"></a>35.10.2 Starting out</H3>
|
||||
<H3><a name="Extending_starting_out"></a>35.10.2 Starting out</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2602,24 +2604,24 @@ void Language::main(int argc, char *argv[]) {
|
|||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if (strcmp(argv[i],"-globals") == 0) {
|
||||
if (argv[i+1]) {
|
||||
global_name = NewString(argv[i+1]);
|
||||
Swig_mark_arg(i);
|
||||
Swig_mark_arg(i+1);
|
||||
i++;
|
||||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if ( (strcmp(argv[i],"-proxy") == 0)) {
|
||||
proxy_flag = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-keyword") == 0) {
|
||||
use_kw = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
fputs(usage,stderr);
|
||||
}
|
||||
} else if (strcmp(argv[i],"-globals") == 0) {
|
||||
if (argv[i+1]) {
|
||||
global_name = NewString(argv[i+1]);
|
||||
Swig_mark_arg(i);
|
||||
Swig_mark_arg(i+1);
|
||||
i++;
|
||||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if ( (strcmp(argv[i],"-proxy") == 0)) {
|
||||
proxy_flag = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-keyword") == 0) {
|
||||
use_kw = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-help") == 0) {
|
||||
fputs(usage,stderr);
|
||||
}
|
||||
...
|
||||
}
|
||||
}
|
||||
|
|
@ -3053,7 +3055,7 @@ but without the typemaps, there is still work to do.
|
|||
<!-- please report bugs in this section to ttn -->
|
||||
|
||||
<p>
|
||||
At the time of this writing, SWIG supports nearly a dozen languages,
|
||||
At the time of this writing, SWIG supports nearly twenty languages,
|
||||
which means that for continued sanity in maintaining the configuration
|
||||
files, the language modules need to follow some conventions. These are
|
||||
outlined here along with the admission that, yes it is ok to violate
|
||||
|
|
@ -3225,7 +3227,7 @@ The following are the minimum that are usually supported:
|
|||
Please copy these and modify for any new language.
|
||||
</p>
|
||||
|
||||
<H3><a name="Extending_nn42"></a>35.10.11 Examples and test cases</H3>
|
||||
<H3><a name="Extending_nn42"></a>35.10.11 User examples</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -3254,7 +3256,226 @@ during this process, see the section on <a href="#n37a">configuration
|
|||
files</a>.
|
||||
</p>
|
||||
|
||||
<H3><a name="Extending_nn43"></a>35.10.12 Documentation</H3>
|
||||
<H3><a name="Extending_test_suite"></a>35.10.12 Test driven development and the test-suite</H3>
|
||||
|
||||
|
||||
<p>
|
||||
A test driven development approach is central to the improvement and development of SWIG.
|
||||
Most modifications to SWIG are accompanied by additional regression tests and checking all
|
||||
tests to ensure that no regressions have been introduced.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The regression testing is carried out by the SWIG <i>test-suite</i>.
|
||||
The test-suite consists of numerous testcase interface files in the <tt>Examples/test-suite</tt> directory
|
||||
as well as target language specific runtime tests in the <tt>Examples/test-suite/[lang]</tt> directory.
|
||||
When a testcase is run, it will execute the following steps for each testcase:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>Execute SWIG passing it the testcase interface file.</li>
|
||||
<li>Compile the resulting generated C/C++ code with either the C or C++ compiler into object files.</li>
|
||||
<li>Link the object files into a dynamic library (dll/shared object).</li>
|
||||
<li>Compile any generated and any runtime test target language code with the target language compiler, if the target language supports compilation. This step thus does not apply to the interpreted languages.</li>
|
||||
<li>Execute a runtime test if one exists.</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
For example, the <i>ret_by_value</i> testcase consists of two components.
|
||||
The first component is the <tt>Examples/test-suite/ret_by_value.i</tt> interface file.
|
||||
The name of the SWIG module <b>must</b> always be the name of the testcase, so the <tt>ret_by_value.i</tt> interface file thus begins with:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%module ret_by_value
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The testcase code will then follow the module declaration,
|
||||
usually within a <tt>%inline %{ ... %}</tt> section for the majority of the tests.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The second component is the optional runtime tests.
|
||||
Any runtime tests are named using the following convention: <tt>[testcase]_runme.[ext]</tt>,
|
||||
where <tt>[testcase]</tt> is the testcase name and <tt>[ext]</tt> is the normal extension for the target language file.
|
||||
In this case, the Java and Python target languages implement a runtime test, so their files are respectively,
|
||||
<tt>Examples/test-suite/java/ret_by_value_runme.java</tt> and
|
||||
<tt>Examples/test-suite/python/ret_by_value_runme.py</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The goal of the test-suite is to test as much as possible in a <b>silent</b> manner.
|
||||
This way any SWIG or compiler errors or warnings are easily visible.
|
||||
Should there be any warnings, changes must be made to either fix them (preferably) or suppress them.
|
||||
Compilation or runtime errors result in a testcase failure and will be immediately visible.
|
||||
It is therefore essential that the runtime tests are written in a manner that displays nothing to stdout/stderr on success
|
||||
but error/exception out with an error message on stderr on failure.
|
||||
</p>
|
||||
|
||||
<H4><a name="Extending_running_test_suite"></a>35.10.12.1 Running the test-suite</H4>
|
||||
|
||||
|
||||
<p>
|
||||
In order for the test-suite to work for a particular target language, the language must be correctly detected
|
||||
and configured during the configure stage so that the correct Makefiles are generated.
|
||||
Most development occurs on Linux, so usually it is a matter of installing the development packages for the target language
|
||||
and simply configuring as outlined <a href="#Extending_starting_out">earlier</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If when running the test-suite commands that follow, you get a message that the test was skipped, it indicates that the
|
||||
configure stage is missing information in order to compile and run everything for that language.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The test-suite can be run in a number of ways.
|
||||
The first group of commands are for running multiple testcases in one run and should be executed in the top level directory.
|
||||
To run the entire test-suite (can take a long time):
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make -k check-test-suite
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
To run the test-suite just for target language [lang], replace [lang] with one of csharp, java, perl5, python, ruby, tcl etc:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make check-[lang]-test-suite
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
Note that if a runtime test is available, a message "(with run test)" is displayed when run. For example:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
$ make check-python-test-suite
|
||||
checking python test-suite
|
||||
checking testcase argcargvtest (with run test) under python
|
||||
checking testcase python_autodoc under python
|
||||
checking testcase python_append (with run test) under python
|
||||
checking testcase callback (with run test) under python
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
The files generated on a previous run can be deleted using the clean targets, either the whole test-suite or for a particular language:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make clean-test-suite
|
||||
make clean-[lang]-test-suite
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
The test-suite can be run in a <i>partialcheck</i> mode where just SWIG is executed, that is, the compile,
|
||||
link and running of the testcases is not performed.
|
||||
Note that the partialcheck does not require the target language to be correctly configured and detected and unlike the other test-suite make targets, is never skipped. Once again, either all the languages can be executed or just a chosen language:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make partialcheck-test-suite
|
||||
make partialcheck-[lang]-test-suite
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
If your computer has more than one CPU, you are strongly advised to use parallel make to speed up the execution speed.
|
||||
This can be done with any of the make targets that execute more than one testcase.
|
||||
For example, a dual core processor can efficiently use 2 parallel jobs:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make -j2 check-test-suite
|
||||
make -j2 check-python-test-suite
|
||||
make -j2 partialcheck-java-test-suite
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
The second group of commands are for running individual testcases and should be executed in the appropriate
|
||||
target language directory, <tt>Examples/test-suite/[lang]</tt>.
|
||||
Testcases can contain either C or C++ code and when one is written, a decision must be made as to which of these input
|
||||
languages is to be used.
|
||||
Replace <tt>[testcase]</tt> in the commands below with the name of the testcase.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For a C language testcase, add the testcase under the C_TEST_CASES list in <tt>Examples/test-suite/common.mk</tt> and
|
||||
execute individually as:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make -s [testcase].ctest
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
For a C++ language testcase, add the testcase under the CPP_TEST_CASES list in <tt>Examples/test-suite/common.mk</tt> and
|
||||
execute individually as:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make -s [testcase].cpptest
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
A third category of tests are C++ language testcases testing multiple modules (the %import directive).
|
||||
These require more than one shared library (dll/shared object) to be built and so are separated out from the normal C++ testcases.
|
||||
Add the testcase under the MULTI_CPP_TEST_CASES list in <tt>Examples/test-suite/common.mk</tt> and
|
||||
execute individually as:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make -s [testcase].multicpptest
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
To delete the generated files, execute:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make -s [testcase].clean
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
If you would like to see the exact commands being executed, drop the -s option:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make [testcase].ctest
|
||||
make [testcase].cpptest
|
||||
make [testcase].multicpptest
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
Some real examples of each:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
make -s ret_by_value.clean
|
||||
make -s ret_by_value.ctest
|
||||
make -s bools.cpptest
|
||||
make -s imports.multicpptest
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
Advanced usage of the test-suite facilitates running tools on some of the five stages.
|
||||
The make variables <tt>SWIGTOOL</tt> and <tt>RUNTOOL</tt> are used to specify a tool to respectively, invoke SWIG
|
||||
and the execution of the runtime test.
|
||||
You are advised to view the <tt>Examples/test-suite/common.mk</tt> file for details but for a short summary,
|
||||
the classic usage is to use <a href="http://valgrind.org/">Valgrind</a> for memory checking.
|
||||
For example, checking for memory leaks when running the runtime test in the target language interpreter:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make ret_by_value.ctest RUNTOOL="valgrind --leak-check=full"
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
This will probably make more sense if you look at the output of the above as it will show the exact commands being executed.
|
||||
SWIG can be analyzed for bad memory accesses using:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
make ret_by_value.ctest SWIGTOOL="valgrind --tool=memcheck --trace-children=yes"
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Extending_nn43"></a>35.10.13 Documentation</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -3286,7 +3507,7 @@ Some topics that you'll want to be sure to address include:
|
|||
if available.
|
||||
</ul>
|
||||
|
||||
<H3><a name="Extending_prerequisites"></a>35.10.13 Prerequisites for adding a new language module to the SWIG distribution</H3>
|
||||
<H3><a name="Extending_prerequisites"></a>35.10.14 Prerequisites for adding a new language module to the SWIG distribution</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -3343,7 +3564,7 @@ should be added should there be an area not already covered by
|
|||
the existing tests.
|
||||
</p>
|
||||
|
||||
<H3><a name="Extending_coding_style_guidelines"></a>35.10.14 Coding style guidelines</H3>
|
||||
<H3><a name="Extending_coding_style_guidelines"></a>35.10.15 Coding style guidelines</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -3367,11 +3588,29 @@ The generated C/C++ code should also follow this style as close as possible. How
|
|||
should be avoided as unlike the SWIG developers, users will never have consistent tab settings.
|
||||
</p>
|
||||
|
||||
<H2><a name="Extending_nn44"></a>35.11 Typemaps</H2>
|
||||
<H2><a name="Extending_debugging_options"></a>35.11 Debugging Options</H2>
|
||||
|
||||
|
||||
<H3><a name="Extending_nn45"></a>35.11.1 Proxy classes</H3>
|
||||
<p>
|
||||
There are various command line options which can aid debugging a SWIG interface as well as debugging the development of a language module. These are as follows:
|
||||
</p>
|
||||
|
||||
<div class="shell"><pre>
|
||||
-debug-classes - Display information about the classes found in the interface
|
||||
-debug-module <n> - Display module parse tree at stages 1-4, <n> is a csv list of stages
|
||||
-debug-symtabs - Display symbol tables information
|
||||
-debug-symbols - Display target language symbols in the symbol tables
|
||||
-debug-csymbols - Display C symbols in the symbol tables
|
||||
-debug-tags - Display information about the tags found in the interface
|
||||
-debug-template - Display information for debugging templates
|
||||
-debug-top <n> - Display entire parse tree at stages 1-4, <n> is a csv list of stages
|
||||
-debug-typedef - Display information about the types and typedefs in the interface
|
||||
-debug-typemap - Display information for debugging typemaps
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
The complete list of command line options for SWIG are available by running <tt>swig -help</tt>.
|
||||
</p>
|
||||
|
||||
<H2><a name="Extending_nn46"></a>35.12 Guide to parse tree nodes</H2>
|
||||
|
||||
|
|
@ -3781,6 +4020,13 @@ extern "X" { ... } declaration.
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<H2><a name="Extending_further_info"></a>35.13 Further Development Information</H2>
|
||||
|
||||
|
||||
<p>
|
||||
There is further documentation available on the internals of SWIG, API documentation and debugging information.
|
||||
This is shipped with SWIG in the <tt>Doc/Devel</tt> directory.
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ Produces the following code at the top of the generated GOOPS guile-module
|
|||
<code>Module-primitive.scm</code> (with <i>primitive</i> replaced with whatever is given with the <code>-primsuffix</code>
|
||||
argument. The code to load the <code>.so</code> library should be located in the <code>%scheme</code> directive,
|
||||
which will then be added to the scmstub file.
|
||||
Swig will automatically generate the line <code>(use-modules (<i>Package</i> <i>Module-primitive</i>))</code>
|
||||
SWIG will automatically generate the line <code>(use-modules (<i>Package</i> <i>Module-primitive</i>))</code>
|
||||
into the GOOPS guile-module. So if <i>Module-primitive.scm</i> is on the autoload path for guile, the
|
||||
<code>%goops</code> directive can be empty. Otherwise, the <code>%goops</code> directive should contain
|
||||
whatever code is needed to load the <i>Module-primitive.scm</i> file into guile.</p>
|
||||
|
|
@ -848,7 +848,7 @@ Produces the following code at the top of the generated GOOPS guile-module
|
|||
</li>
|
||||
|
||||
<li><p><b>Module Linkage</b>: This is very similar to passive linkage with a scmstub file.
|
||||
Swig will also automatically generate the line <code>(use-modules
|
||||
SWIG will also automatically generate the line <code>(use-modules
|
||||
(<i>Package</i> <i>Module-primitive</i>))</code> into the GOOPS guile-module. Again the <code>%goops</code>
|
||||
directive should contain whatever code is needed to get that module loaded into guile.</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ major features include:
|
|||
|
||||
<p>
|
||||
Currently, the only major C++ feature not supported is nested classes--a limitation
|
||||
that will be removed in a future release.
|
||||
that should be removed in a future release, but has some workarounds for the moment.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1772,7 +1772,7 @@ If declarations such as these appear, you will get a warning message like this:
|
|||
|
||||
<div class="code">
|
||||
<pre>
|
||||
example.i:12: Warning(515): Overloaded method spam(unsigned short) ignored.
|
||||
example.i:12: Warning 515: Overloaded method spam(unsigned short) ignored.
|
||||
Method spam(int) at example.i:11 used.
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ in order for this to work.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b><tt>char *cdata(void *ptr, int nbytes)</tt></b>
|
||||
<b><tt>const char *cdata(void *ptr, size_t nbytes)</tt></b>
|
||||
</p>
|
||||
|
||||
<div class="indent"><p>
|
||||
|
|
@ -676,7 +676,7 @@ pointer.
|
|||
</p></div>
|
||||
|
||||
<p>
|
||||
<b><tt>void memmove(void *ptr, char *s)</tt></b>
|
||||
<b><tt>void memmove(void *ptr, const char *s)</tt></b>
|
||||
</p>
|
||||
|
||||
<div class="indent"><p>
|
||||
|
|
@ -890,7 +890,10 @@ char *foo();
|
|||
</div>
|
||||
|
||||
<p>
|
||||
This will release the result.
|
||||
This will release the result if the appropriate target language support is available.
|
||||
SWIG provides the appropriate "newfree" typemap for <tt>char *</tt> so that the memory is released,
|
||||
however, you may need to provide your own "newfree" typemap for other types.
|
||||
See <a href="Customization.html#ownership">Object ownership and %newobject</a> for more details.
|
||||
</p>
|
||||
|
||||
<H3><a name="Library_nn12"></a>8.3.4 cstring.i</H3>
|
||||
|
|
|
|||
|
|
@ -684,8 +684,8 @@ void foo(Bar &b);
|
|||
If declarations such as these appear, you will get a warning message like this:
|
||||
</p>
|
||||
<div class="shell"><pre>
|
||||
example.i:12: Warning(509): Overloaded spam(short) is shadowed by spam(int)
|
||||
at example.i:11.
|
||||
example.i:12: Warning 509: Overloaded method spam(short) effectively ignored,
|
||||
example.i:11: Warning 509: as it is shadowed by spam(int).
|
||||
</pre></div>
|
||||
<p>
|
||||
To fix this, you either need to ignore or rename one of the methods. For example:
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ base class's methods. Typically you will get a warning when the module name is m
|
|||
</p>
|
||||
|
||||
<div class="shell"> <pre>
|
||||
derived_module.i:8: Warning(401): Base class 'base' ignored - unknown module name for base. Either import
|
||||
derived_module.i:8: Warning 401: Base class 'base' ignored - unknown module name for base. Either import
|
||||
the appropriate module interface file or specify the name of the module in the %import directive.
|
||||
</pre></div>
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ options are found near the end of the chapter.
|
|||
|
||||
|
||||
<p>
|
||||
To build a Perl5 module, run Swig using the <tt>-perl</tt> option as
|
||||
To build a Perl5 module, run SWIG using the <tt>-perl</tt> option as
|
||||
follows :
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@
|
|||
|
||||
|
||||
|
||||
<p>
|
||||
<b>Caution: This chapter (and module!) is still under construction</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG supports generating wrappers for PHP5. Support for PHP4 has been removed
|
||||
as of SWIG 1.3.37. The PHP developers are no longer making new PHP4 releases,
|
||||
|
|
@ -105,7 +101,7 @@ also contain PHP5 class wrappers.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
Swig can generate PHP extensions from C++ libraries as well when
|
||||
SWIG can generate PHP extensions from C++ libraries as well when
|
||||
given the <tt>-c++</tt> option. The support for C++ is discussed in
|
||||
more detail in <a href="#Php_nn2_6">section 27.2.6</a>.
|
||||
</p>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue