merge from trunk

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12002 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2010-04-30 03:03:24 +00:00
commit 07cb6351f1
181 changed files with 4467 additions and 6779 deletions

View file

@ -40,8 +40,11 @@ web/ccache-man.html: ccache.yo
yodl2html -o web/ccache-man.html ccache.yo
install: $(PACKAGE_NAME)$(EXEEXT) $(PACKAGE_NAME).1
@echo "Installing $(PACKAGE_NAME)"
@echo "Installing $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)"
${INSTALLCMD} -d $(DESTDIR)${bindir}
${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
@echo "Installing $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1"
${INSTALLCMD} -d $(DESTDIR)${mandir}/man1
${INSTALLCMD} -m 644 ${srcdir}/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
@ -52,9 +55,6 @@ uninstall: $(PACKAGE_NAME)$(EXEEXT) $(PACKAGE_NAME).1
clean:
/bin/rm -f $(OBJS) *~ $(PACKAGE_NAME)$(EXEEXT)
distclean-docs:
rm -f $(PACKAGE_NAME).1 web/ccache-man.html
check : test
test: test.sh
@ -62,11 +62,13 @@ test: test.sh
check: test
distclean: clean distclean-docs
/bin/rm -f Makefile config.h config.sub config.log build-stamp config.status config.h.in ccache_swig_config.h
distclean: clean
/bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h
/bin/rm -rf autom4te.cache
maintainer-clean: distclean
/bin/rm -f configure
/bin/rm -f $(PACKAGE_NAME).1 web/ccache-man.html
# FIXME: To fix this, test.sh needs to be able to take ccache from the
# installed prefix, not from the source dir.

View file

@ -1,6 +1,234 @@
Version 1.3.41 (in progress)
Version 2.0.0 (in progress)
============================
2010-04-25: bhy
[Python] Fix #2985655 - broken constructor renaming.
2010-04-14: wsfulton
Typemap fragments are now official and documented in Typemaps.html.
2010-04-09: wsfulton
[Ruby] Fix #2048064 and #2408020.
Apply Ubuntu patch to fix Ruby and std::vector wrappers with -minherit.
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/522874
2010-04-09: wsfulton
[Mzscheme] Apply Ubuntu patch to fix std::map wrappers:
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/203876
2010-04-09: wsfulton
[Python] Apply patch #2952374 - fix directors and the -nortti option.
2010-04-09: wsfulton
[Lua] Fix #2887254 and #2946032 - SWIG_Lua_typename using wrong stack index.
2010-04-03: wsfulton
[Python] Fix exceptions being thrown with the -threads option based on patch from Arto Vuori.
Fixes bug #2818499.
2010-04-03: wsfulton
Fix Makefile targets: distclean and maintainer-clean
2010-04-02: wsfulton
[Lua] Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a
valid value. Bug reported by Gedalia Pasternak.
2010-04-01: wsfulton
Numerous subtle typemap matching rule fixes when using the default type. The typemap
matching rules are to take a type and find the best default typemap (SWIGTYPE, SWIGTYPE* etc),
then look for the next best match by reducing the chosen default type. The type deduction
now follows C++ template partial specialization matching rules.
Below are the set of changes made showing the default type deduction
along with the old reduced type and the new version of the reduced type:
SWIGTYPE const &[ANY]
new: SWIGTYPE const &[]
old: SWIGTYPE (&)[ANY]
SWIGTYPE *const [ANY]
new: SWIGTYPE const [ANY]
old: SWIGTYPE *[ANY]
SWIGTYPE const *const [ANY]
new: SWIGTYPE *const [ANY]
old: SWIGTYPE const *[ANY]
SWIGTYPE const *const &
new: SWIGTYPE *const &
old: SWIGTYPE const *&
SWIGTYPE *const *
new: SWIGTYPE const *
old: SWIGTYPE **
SWIGTYPE *const &
new: SWIGTYPE const &
old: SWIGTYPE *&
Additionally, a const SWIGTYPE lookup is used now for any constant type. Some examples, where
T is some reduced type, eg int, struct Foo:
T const
new: SWIGTYPE const
old: SWIGTYPE
T *const
new: SWIGTYPE *const
old: SWIGTYPE *
T const[]
new: SWIGTYPE const[]
old: SWIGTYPE[]
enum T const
new: enum SWIGTYPE const
old: enum SWIGTYPE
T (*const )[]
new: SWIGTYPE (*const )[]
old: SWIGTYPE (*)[]
Reminder: the typemap matching rules can now be seen for any types being wrapped by using
either the -debug-tmsearch or -debug-tmused options.
In practice this leads to some subtle matching rule changes and the majority of users
won't notice any changes, except in the prime area of motivation for this change: Improve
STL containers of const pointers and passing const pointers by reference. This is fixed
because many of the STL containers use a type 'T const&' as parameters and when T is
a const pointer, for example, 'K const*', then the full type is 'K const*const&'. This
means that the 'SWIGTYPE *const&' typemaps now match when T is either a non-const or
const pointer. Furthermore, some target languages incorrectly had 'SWIGTYPE *&' typemaps
when these should have been 'SWIGTYPE *const&'. These have been corrected (Java, C#, Lua, PHP).
*** POTENTIAL INCOMPATIBILITY ***
2010-03-13: wsfulton
[Java] Some very old deprecated pragma warnings are now errors.
2010-03-13: wsfulton
Improve handling of file names and directories containing double/multiple path separators.
2010-03-10: mutandiz (Mikel Bancroft)
[allegrocl] Use fully qualified symbol name of cl::identity in emit_defun().
2010-03-06: wsfulton
[Java] The intermediary JNI class modifiers are now public by default meaning these
intermediary low level functions are now accessible by default from outside any package
used. The proxy class pointer constructor and getCPtr() methods are also now public.
These are needed in order for the nspace option to work without any other mods.
The previous default of protected access can be restored using:
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
%pragma(java) jniclassclassmodifiers = "class"
2010-03-06: wsfulton
[C#] Added the nspace feature for C#. Documentation for the nspace feature is now available.
2010-03-04: wsfulton
Added the nspace feature. This adds some improved namespace support. Currently only Java
is supported for target languages, where C++ namespaces are automatically translated into
Java packages. The feature only applies to classes,struct,unions and enums declared within
a namespace. Methods and variables declared in namespaces still effectively have their
namespaces flattened. Example usage:
%feature(nspace) Outer::Inner1::Color;
%feature(nspace) Outer::Inner2::Color;
namespace Outer {
namespace Inner1 {
struct Color {
...
};
}
namespace Inner2 {
struct Color {
...
};
}
}
For Java, the -package option is also required when using the nspace feature. Say
we use -package com.myco, the two classes can then be accessed as follows from Java:
com.myco.Outer.Inner1.Color and com.myco.Outer.Inner2.Color.
2010-02-27: wsfulton
[Python] Remove -dirvtable from the optimizations included by -O as it this option
currently leads to memory leaks as reported by Johan Blake.
2010-02-13: wsfulton
[Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'.
2010-02-13: wsfulton
[Ruby] Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x
used in various STL wrappers.
2010-02-13: wsfulton
[C#, Java] Fix incorrect multiply defined symbol name error when an enum item
and class name have the same name, as reported by Nathan Krieger. Example:
class Vector {};
namespace Text {
enum Preference { Vector };
}
This also fixes other incorrect corner case target language symbol name clashes.
2010-02-11: wsfulton
Add the -debug-lsymbols option for displaying the target language layer symbols.
2010-02-09: wsfulton
Fix -MM and -MMD options on Windows. They were not omitting files in the SWIG library as
they should be.
2010-02-08: wsfulton
Fix #1807329 - When Makefile dependencies are being generated using the -M family of options
on Windows, the file paths have been corrected to use single backslashes rather than double
backslashes as path separators.
2010-02-06: wsfulton
Fix #2918902 - language specific files not being generated in correct directory on
Windows when using forward slashes for -o, for example:
swig -python -c++ -o subdirectory/theinterface_wrap.cpp subdirectory/theinterface.i
2010-02-05: wsfulton
Fix #2894405 - assertion when using -xmlout.
2010-01-28: wsfulton
Fix typemap matching bug when a templated type has a typemap both specialized and not
specialized. For example:
template<typename T> struct XX { ... };
%typemap(in) const XX & "..."
%typemap(in) const XX< int > & "..."
resulted in the 2nd typemap being applied for all T in XX< T >.
2010-01-22: wsfulton
Fix #2933129 - typemaps not being found when the unary scope operator (::) is used to denote
global scope, the typemap is now used in situations like this:
struct X {};
%typemap(in) const X & "..."
void m(const ::X &);
and this:
struct X {};
%typemap(in) const ::X & "..."
void m(const X &);
2010-01-20: wsfulton
Fix some unary scope operator (::) denoting global scope problems in the types generated
into the C++ layer. Previously the unary scope operator was dropped in the generated code
if the type had any sort of qualifier, for example when using pointers, references, like
::foo*, ::foo&, bar< ::foo* >.
2010-01-13: olly
[PHP] Add datetime to the list of PHP predefined classes (patch
from David Fletcher in SF#2931042).
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
@ -213,7 +441,7 @@ Version 1.3.41 (in progress)
-debug-csymbols - Display C symbols in the symbol tables
2009-11-03: wsfulton
Fix some usage of global scope operator, for example:
Fix some usage of unary scope operator (::) denoting global scope, for example:
namespace AA { /* ... */ }
using namespace ::AA;

View file

@ -29,7 +29,7 @@ Past SWIG developers and major contributors include:
Charlie Savage (cfis@interserv.com) (Ruby)
Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
Richard Palmer (richard@magicality.org) (PHP)
Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP)
Sam Liddicott - Ananova Ltd (saml@liddicott.com) (PHP)
Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP)
Kevin Ruland (PHP)
Shibukawa Yoshiki (Japanese Translation)

View file

@ -119,22 +119,25 @@ are case-insensitive on Windows so this convention will prevent you from inadver
creating two files that differ in case-only.
<p>
Each file should include a short abstract, author information, copyright information, and
Each file should include a short abstract, license information and
a SVN revision tag like this:
<blockquote>
<pre>
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
* This file is part of SWIG, which is licensed as a whole under version 3
* (or any later version) of the GNU General Public License. Some additional
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
* included with the SWIG source code as distributed by the SWIG developers
* and at http://www.swig.org/legal.html.
*
* cwrap.c
* xxx.c
*
* This file defines a variety of wrapping rules for C/C++ handling including
* the naming of local variables, calling conventions, and so forth.
* This file defines ...
* ----------------------------------------------------------------------------- */
char cvsroot_cwrap_c[] = "$Id$";
static char cvs[] = "&#36Id&#36";
#include "swig.h"

View file

@ -76,9 +76,8 @@ to code).
<tr><td>Examples</td>
<td>This subdir tree contains examples of using SWIG w/ different
scripting languages, including makefiles. Typically, there are the
"simple" and "matrix" examples, w/ some languages offering additional
examples. The GIFPlot example has its own set of per-language
subdirectories. See the README more index.html file in each directory
"simple" and "class" examples, w/ some languages offering additional
examples. See the README more index.html file in each directory
for more info. [FIXME: Ref SWIG user manual.]</td>
</tr>

View file

@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
<H1><a name="Allegrocl_nn1"></a>17 SWIG and Allegro Common Lisp</H1>
<H1><a name="Allegrocl"></a>17 SWIG and Allegro Common Lisp</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>

View file

@ -9,35 +9,35 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#csharp_introduction">Introduction</a>
<li><a href="#csharp_differences_java">Differences to the Java module</a>
<li><a href="#CSharp_introduction">Introduction</a>
<li><a href="#CSharp_differences_java">Differences to the Java module</a>
<li><a href="#CSharp_arrays">C# Arrays</a>
<ul>
<li><a href="#CSharp_arrays_swig_library">The SWIG C arrays library</a>
<li><a href="#CSharp_arrays_pinvoke_default_array_marshalling">Managed arrays using P/Invoke default array marshalling</a>
<li><a href="#CSharp_arrays_pinning">Managed arrays using pinning</a>
</ul>
<li><a href="#csharp_exceptions">C# Exceptions</a>
<li><a href="#CSharp_exceptions">C# Exceptions</a>
<ul>
<li><a href="#csharp_exception_example_check_typemap">C# exception example using "check" typemap</a>
<li><a href="#csharp_exception_example_percent_exception">C# exception example using %exception</a>
<li><a href="#csharp_exception_example_exception_specifications">C# exception example using exception specifications</a>
<li><a href="#csharp_custom_application_exception">Custom C# ApplicationException example</a>
<li><a href="#CSharp_exception_example_check_typemap">C# exception example using "check" typemap</a>
<li><a href="#CSharp_exception_example_percent_exception">C# exception example using %exception</a>
<li><a href="#CSharp_exception_example_exception_specifications">C# exception example using exception specifications</a>
<li><a href="#CSharp_custom_application_exception">Custom C# ApplicationException example</a>
</ul>
<li><a href="#csharp_directors">C# Directors</a>
<li><a href="#CSharp_directors">C# Directors</a>
<ul>
<li><a href="#csharp_directors_example">Directors example</a>
<li><a href="#csharp_directors_implementation">Directors implementation</a>
<li><a href="#csharp_director_caveats">Director caveats</a>
<li><a href="#CSharp_directors_example">Directors example</a>
<li><a href="#CSharp_directors_implementation">Directors implementation</a>
<li><a href="#CSharp_director_caveats">Director caveats</a>
</ul>
<li><a href="#csharp_typemap_examples">C# Typemap examples</a>
<li><a href="#CSharp_typemap_examples">C# Typemap examples</a>
<ul>
<li><a href="#csharp_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="#csharp_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="#csharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="#csharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="#csharp_partial_classes">Turning wrapped classes into partial classes</a>
<li><a href="#csharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
<li><a href="#CSharp_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="#CSharp_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="#CSharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="#CSharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="#CSharp_partial_classes">Turning wrapped classes into partial classes</a>
<li><a href="#CSharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
</ul>
</ul>
</div>
@ -45,7 +45,7 @@
<H2><a name="csharp_introduction"></a>18.1 Introduction</H2>
<H2><a name="CSharp_introduction"></a>18.1 Introduction</H2>
<p>
@ -54,7 +54,7 @@ The wrapper code implementation uses C# and the Platform Invoke (PInvoke) interf
The PInvoke interface has been chosen over Microsoft's Managed C++ interface as it is portable to both Microsoft Windows and non-Microsoft platforms.
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>.
<a href="http://msdn.microsoft.com/en-us/library/aa290048(VS.71).aspx">Mixed DLL Loading Problem</a>.
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>
@ -65,7 +65,7 @@ The <a href="http://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> h
Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/Interop_with_Native_Libraries">Interop with native libraries</a>.
</p>
<H2><a name="csharp_differences_java"></a>18.2 Differences to the Java module</H2>
<H2><a name="CSharp_differences_java"></a>18.2 Differences to the Java module</H2>
<p>
@ -102,6 +102,11 @@ namespace com.bloggs.widget {
Note that by default, the generated C# classes have no namespace and the module name is unrelated to namespaces. The module name is just like in Java and is merely used to name some of the generated classes.
</li>
<li>
The <a href="SWIGPlus.html#SWIGPlus_nspace">nspace feature</a> is also supported as described in this general section with a C# example.
Unlike Java which requires the use of the -package option when using the <tt>nspace</tt> feature, the -namespace option is not mandatory for C#.
</li>
<li>
The <tt>-dllimport &lt;name&gt;</tt> commandline option specifies the name of the DLL for the <tt>DllImport</tt> attribute for every PInvoke method. If this commandline option is not given, the <tt>DllImport</tt> DLL name is the same as the module name. This option is useful for when one wants to invoke SWIG multiple times on different modules, yet compile all the resulting code into a single DLL.
</li>
@ -132,7 +137,7 @@ If it was used, it would generate an illegal runtime initialisation via a PInvok
C# doesn't support the notion of throws clauses.
Therefore there is no 'throws' typemap attribute support for adding exception classes to a throws clause.
Likewise there is no need for an equivalent to <tt>%javaexception</tt>.
In fact, throwing C# exceptions works quite differently, see <a href="CSharp.html#csharp_exceptions">C# Exceptions</a> below.
In fact, throwing C# exceptions works quite differently, see <a href="CSharp.html#CSharp_exceptions">C# Exceptions</a> below.
</li>
<li>
@ -201,6 +206,7 @@ jniclassinterfaces -&gt; imclassinterfaces
$javaclassname -&gt; $csclassname
$&amp;javaclassname -&gt; $&amp;csclassname
$*javaclassname -&gt; $*csclassname
$javaclazzname -&gt; $csclazzname
$javainput -&gt; $csinput
$jnicall -&gt; $imcall
</pre></div>
@ -210,10 +216,10 @@ $jnicall -&gt; $imcall
<p>
Unlike the "javain" typemap, the "csin" typemap does not support the 'pgcpp' attribute as the C# module does not have a premature garbage collection prevention parameter.
The "csin" typemap supports additional optional attributes called 'cshin' and 'terminator'.
The 'cshin' attribute should contain the parameter type and name whenever a <a href="Java.html#java_constructor_helper_function">constructor helper function</a> is generated due to the 'pre' or 'post' attributes.
The 'cshin' attribute should contain the parameter type and name whenever a <a href="Java.html#Java_constructor_helper_function">constructor helper function</a> is generated due to the 'pre' or 'post' attributes.
The 'terminator' attribute normally just contains a closing brace for when the 'pre' attribute contains an opening brace, such as when a C# <tt>using</tt> or <tt>fixed</tt> block is started.
Note that 'pre', 'post', 'terminator' and 'cshin' attributes are not used for marshalling the property set.
Please see the <a href="#csharp_date_marshalling">Date marshalling example</a> and <a href="#csharp_date_properties">Date marshalling of properties example</a> for further understanding of these "csin" applicable attributes.
Please see the <a href="#CSharp_date_marshalling">Date marshalling example</a> and <a href="#CSharp_date_properties">Date marshalling of properties example</a> for further understanding of these "csin" applicable attributes.
</p>
</li>
@ -250,7 +256,7 @@ public static extern IntPtr function(string jarg1);
Support for type attributes.
The 'imtype' and 'cstype' typemaps can have an optional <tt>inattributes</tt> and <tt>outattributes</tt> typemap attribute.
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>.
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.
@ -305,7 +311,7 @@ The <tt>directorinattributes</tt> and <tt>directoroutattributes</tt> typemap att
<li>
<p>
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>.
This is done using the <tt>%csattributes</tt> feature, see <a href="Customization.html#Customization_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.
The following SWIG code shows how to attach this C# attribute to some methods and the class declaration itself:
@ -401,7 +407,7 @@ This feature is useful for some obscure cases where SWIG might get the <tt>virtu
</li>
<li>
<a name="csharp_module_directive"></a>
<a name="CSharp_module_directive"></a>
<p>
The name of the intermediary class can be changed from its default, that is, the module name with PINVOKE appended after it.
The module directive attribute <tt>imclassname</tt> is used to achieve this:
@ -436,7 +442,7 @@ if specified, otherwise it is equivalent to the <b>$module</b> special variable.
<p>
<b><tt>$imclassname</tt></b><br>
This special variable expands to the intermediary class name. For C# this is usually the same as '$modulePINVOKE' ('$moduleJNI' for Java),
unless the imclassname attribute is specified in the <a href="CSharp.html#csharp_module_directive">%module directive</a>.
unless the imclassname attribute is specified in the <a href="CSharp.html#CSharp_module_directive">%module directive</a>.
</p>
<p>
@ -716,7 +722,7 @@ public static extern void myArrayCopy(IntPtr jarg1, IntPtr jarg2, int jarg3);
<H2><a name="csharp_exceptions"></a>18.4 C# Exceptions</H2>
<H2><a name="CSharp_exceptions"></a>18.4 C# Exceptions</H2>
<p>
@ -724,7 +730,7 @@ It is possible to throw a C# Exception from C/C++ code.
SWIG already provides the framework for throwing C# exceptions if it is able to detect that a C++ exception could be thrown.
Automatically detecting that a C++ exception could be thrown is only possible when a C++ exception specification is used,
see <a href="SWIGPlus.html#SWIGPlus_exception_specifications">Exception specifications</a>.
The <a href="Customization.html#exception">Exception handling with %exception</a> section details the <tt>%exception</tt> feature.
The <a href="Customization.html#Customization_exception">Exception handling with %exception</a> section details the <tt>%exception</tt> feature.
Customised code for handling exceptions with or without a C++ exception specification is possible and the details follow.
However anyone wishing to do this should be familiar with the contents of the sections referred to above.
</p>
@ -813,7 +819,7 @@ set so should only be used when a C# exception is not created.
</p>
<H3><a name="csharp_exception_example_check_typemap"></a>18.4.1 C# exception example using "check" typemap</H3>
<H3><a name="CSharp_exception_example_check_typemap"></a>18.4.1 C# exception example using "check" typemap</H3>
<p>
@ -995,12 +1001,12 @@ method and C# code does not handle pending exceptions via the canthrow attribute
Actually it will issue this warning for any function beginning with <tt>SWIG_CSharpSetPendingException</tt>.
</P>
<H3><a name="csharp_exception_example_percent_exception"></a>18.4.2 C# exception example using %exception</H3>
<H3><a name="CSharp_exception_example_percent_exception"></a>18.4.2 C# exception example using %exception</H3>
<p>
Let's consider a similar, but more common example that throws a C++ exception from within a wrapped function.
We can use <tt>%exception</tt> as mentioned in <a href="Customization.html#exception">Exception handling with %exception</a>.
We can use <tt>%exception</tt> as mentioned in <a href="Customization.html#Customization_exception">Exception handling with %exception</a>.
</p>
<div class="code">
@ -1060,7 +1066,7 @@ The managed code generated does check for the pending exception as mentioned ear
</pre>
</div>
<H3><a name="csharp_exception_example_exception_specifications"></a>18.4.3 C# exception example using exception specifications</H3>
<H3><a name="CSharp_exception_example_exception_specifications"></a>18.4.3 C# exception example using exception specifications</H3>
<p>
@ -1117,7 +1123,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) {
Multiple catch handlers are generated should there be more than one exception specifications declared.
</p>
<H3><a name="csharp_custom_application_exception"></a>18.4.4 Custom C# ApplicationException example</H3>
<H3><a name="CSharp_custom_application_exception"></a>18.4.4 Custom C# ApplicationException example</H3>
<p>
@ -1251,7 +1257,7 @@ try {
</pre>
</div>
<H2><a name="csharp_directors"></a>18.5 C# Directors</H2>
<H2><a name="CSharp_directors"></a>18.5 C# Directors</H2>
<p>
@ -1261,10 +1267,10 @@ Essentially, it enables unmanaged C++ code to call back into managed code for vi
<p>
The following sections provide information on the C# director implementation and contain most of the information required to use the C# directors.
However, the <a href="Java.html#java_directors">Java directors</a> section should also be read in order to gain more insight into directors.
However, the <a href="Java.html#Java_directors">Java directors</a> section should also be read in order to gain more insight into directors.
</p>
<H3><a name="csharp_directors_example"></a>18.5.1 Directors example</H3>
<H3><a name="CSharp_directors_example"></a>18.5.1 Directors example</H3>
<p>
@ -1385,7 +1391,7 @@ CSharpDerived - UIntMethod(123)
</pre>
</div>
<H3><a name="csharp_directors_implementation"></a>18.5.2 Directors implementation</H3>
<H3><a name="CSharp_directors_implementation"></a>18.5.2 Directors implementation</H3>
<p>
@ -1571,7 +1577,7 @@ void SwigDirector_Base::BaseBoolMethod(Base const &amp;b, bool flag) {
</pre>
</div>
<H3><a name="csharp_director_caveats"></a>18.5.3 Director caveats</H3>
<H3><a name="CSharp_director_caveats"></a>18.5.3 Director caveats</H3>
<p>
@ -1619,7 +1625,7 @@ However, a call from C# to <tt>CSharpDefaults.DefaultMethod()</tt> will of cours
should pass the call on to <tt>CSharpDefaults.DefaultMethod(int)</tt>using the C++ default value, as shown above.
</p>
<H2><a name="csharp_typemap_examples"></a>18.6 C# Typemap examples</H2>
<H2><a name="CSharp_typemap_examples"></a>18.6 C# Typemap examples</H2>
This section includes a few examples of typemaps. For more examples, you
@ -1627,12 +1633,12 @@ might look at the files "<tt>csharp.swg</tt>" and "<tt>typemaps.i</tt>" in
the SWIG library.
<H3><a name="csharp_memory_management_member_variables"></a>18.6.1 Memory management when returning references to member variables</H3>
<H3><a name="CSharp_memory_management_member_variables"></a>18.6.1 Memory management when returning references to member variables</H3>
<p>
This example shows how to prevent premature garbage collection of objects when the underlying C++ class returns a pointer or reference to a member variable.
The example is a direct equivalent to this <a href="Java.html#java_memory_management_objects">Java equivalent</a>.
The example is a direct equivalent to this <a href="Java.html#Java_memory_management_objects">Java equivalent</a>.
</p>
<p>
@ -1751,11 +1757,11 @@ public class Bike : IDisposable {
Note the <tt>addReference</tt> call.
</p>
<H3><a name="csharp_memory_management_objects"></a>18.6.2 Memory management for objects passed to the C++ layer</H3>
<H3><a name="CSharp_memory_management_objects"></a>18.6.2 Memory management for objects passed to the C++ layer</H3>
<p>
The example is a direct equivalent to this <a href="Java.html#java_memory_management_objects">Java equivalent</a>.
The example is a direct equivalent to this <a href="Java.html#Java_memory_management_objects">Java equivalent</a>.
Managing memory can be tricky when using C++ and C# proxy classes.
The previous example shows one such case and this example looks at memory management for a class passed to a C++ method which expects the object to remain in scope
after the function has returned. Consider the following two C++ classes:
@ -1870,14 +1876,14 @@ The 'cscode' typemap simply adds in the specified code into the C# proxy class.
</div>
<H3><a name="csharp_date_marshalling"></a>18.6.3 Date marshalling using the csin typemap and associated attributes</H3>
<H3><a name="CSharp_date_marshalling"></a>18.6.3 Date marshalling using the csin typemap and associated attributes</H3>
<p>
The <a href="Java.html#nan_exception_typemap">NaN Exception example</a> is a simple example of the "javain" typemap and its 'pre' attribute.
The <a href="Java.html#Java_nan_exception_typemap">NaN Exception example</a> is a simple example of the "javain" typemap and its 'pre' attribute.
This example demonstrates how a C++ date class, say <tt>CDate</tt>, can be mapped onto the standard .NET date class,
<tt>System.DateTime</tt> by using the 'pre', 'post' and 'pgcppname' attributes of the "csin" typemap (the C# equivalent to the "javain" typemap).
The example is an equivalent to the <a href="Java.html#java_date_marshalling">Java Date marshalling example</a>.
The example is an equivalent to the <a href="Java.html#Java_date_marshalling">Java Date marshalling example</a>.
The idea is that the <tt>System.DateTime</tt> is used wherever the C++ API uses a <tt>CDate</tt>.
Let's assume the code being wrapped is as follows:
</p>
@ -2154,7 +2160,7 @@ public class example {
</pre>
</div>
<H3><a name="csharp_date_properties"></a>18.6.4 A date example demonstrating marshalling of C# properties</H3>
<H3><a name="CSharp_date_properties"></a>18.6.4 A date example demonstrating marshalling of C# properties</H3>
<p>
@ -2255,7 +2261,7 @@ Some points to note:
</ul>
<H3><a name="csharp_partial_classes"></a>18.6.5 Turning wrapped classes into partial classes</H3>
<H3><a name="CSharp_partial_classes"></a>18.6.5 Turning wrapped classes into partial classes</H3>
<p>
@ -2355,7 +2361,7 @@ demonstrating that the class contains methods calling both unmanaged code - <tt>
The following example is an alternative approach to adding managed code to the generated proxy class.
</p>
<H3><a name="csharp_extending_proxy_class"></a>18.6.6 Extending proxy classes with additional C# code</H3>
<H3><a name="CSharp_extending_proxy_class"></a>18.6.6 Extending proxy classes with additional C# code</H3>
<p>

View file

@ -35,7 +35,7 @@
<li><a href="#Chicken_nn16">Typemaps</a>
<li><a href="#Chicken_nn17">Pointers</a>
<ul>
<li><a href="#collection">Garbage collection</a>
<li><a href="#Chicken_collection">Garbage collection</a>
</ul>
<li><a href="#Chicken_nn18">Unsupported features and known problems</a>
<ul>
@ -80,14 +80,13 @@
relies on some recent additions to CHICKEN, which are only
present in releases of CHICKEN with version number
<strong>greater than or equal to 1.89</strong>.
To use a chicken version between 1.40 and 1.89, see the <a href="#collection">Garbage collection</a>
To use a chicken version between 1.40 and 1.89, see the <a href="#Chicken_collection">Garbage collection</a>
section below.
</p>
<p>
You may want to look at any of the examples in Examples/chicken/
or Examples/GIFPlot/Chicken for the basic steps to run SWIG
CHICKEN.
directory for the basic steps to run SWIG CHICKEN.
</p>
<H3><a name="Chicken_nn3"></a>19.1.1 Running SWIG in C mode</H3>
@ -226,7 +225,7 @@
a function that must be called, the constant will appear as a
scheme variable. This causes the generated .scm file to just contain the code
<tt>(set! MYCONSTANT1 (MYCONSTANT1))</tt>. See
<a href="Customization.html#features">Features and the %feature directive</a>
<a href="Customization.html#Customization_features">Features and the %feature directive</a>
for info on how to apply the %feature.
</p>
@ -254,7 +253,7 @@
<p>The SWIG chicken module has support for exceptions thrown from
C or C++ code to be caught in scheme.
See <a href="Customization.html#exception">Exception handling with %exception</a>
See <a href="Customization.html#Customization_exception">Exception handling with %exception</a>
for more information about declaring exceptions in the interface file.
</p>
@ -263,7 +262,7 @@
inside the %exception blocks. <code>SWIG_exception</code> will throw a list consisting of the code
(as an integer) and the message. Both of these will throw an exception using <code>(abort)</code>,
which can be handled by <code>(handle-exceptions)</code>. See
<a href="http://www.call-with-current-continuation.org/manual/Exceptions.html#Exceptions">Chicken manual on Exceptions</a>
the Chicken manual on Exceptions
and <a href="http://srfi.schemers.org/srfi-12/srfi-12.html">SFRI-12</a>. Since the exception values are thrown
directly, if <code>(condition-case)</code> is used to catch an exception the exception will come through in the <code>val ()</code> case.
</p>
@ -417,8 +416,8 @@ $ csc -sv modname.scm modname_wrap.c modname_impl.c -o modname.so
</div>
<p>This library can then be loaded by scheme code with the <code>(require 'modname)</code> function.
See <a href="http://www.call-with-current-continuation.org/manual/Loading-extension-libraries.html">
Loading-extension-libraries</a> in the eval unit inside the CHICKEN manual for more information.</p>
See the
Loading-extension-libraries in the eval unit inside the CHICKEN manual for more information.</p>
<p>Another alternative is to run SWIG normally and create a scheme file that contains <code>(declare (uses <i>modname</i>))</code>
and then compile that file into the shared library as well. For example, inside the <tt>mod_load.scm</tt> file,</p>
@ -520,7 +519,7 @@ all the modules.</p>
type. flags is either zero or SWIG_POINTER_DISOWN (see below).
</p>
<H3><a name="collection"></a>19.6.1 Garbage collection</H3>
<H3><a name="Chicken_collection"></a>19.6.1 Garbage collection</H3>
<p>If the owner flag passed to <code>SWIG_NewPointerObj</code> is 1, <code>NewPointerObj</code> will add a
@ -531,12 +530,12 @@ all the modules.</p>
be garbage collected, SWIG will automatically set the owner flag to 1. For other functions,
the <code>%newobject</code> directive must be specified for functions whose return values
should be garbage collected. See
<a href="Customization.html#ownership">Object ownership and %newobject</a> for more information.
<a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for more information.
</p>
<p>In situations where a C or C++ function will assume ownership of a pointer, and thus
chicken should no longer garbage collect it, SWIG provides the <code>DISOWN</code> input typemap.
After applying this typemap (see the <a href="Typemaps.html">Typemaps chapter</a> for more information on how to apply typemaps),
After applying this typemap (see the <a href="Typemaps.html#Typemaps">Typemaps chapter</a> for more information on how to apply typemaps),
any pointer that gets passed in will no longer be garbage collected.
An object is disowned by passing the <code>SWIG_POINTER_DISOWN</code> flag to <code>SWIG_ConvertPtr</code>.
<b>Warning:</b> Since the lifetime of the object is now controlled by the underlying code, the object might

View file

@ -122,7 +122,7 @@
<li><a href="SWIG.html#SWIG_nn2">Running SWIG</a>
<ul>
<li><a href="SWIG.html#SWIG_nn3">Input format</a>
<li><a href="SWIG.html#output">SWIG Output</a>
<li><a href="SWIG.html#SWIG_output">SWIG Output</a>
<li><a href="SWIG.html#SWIG_nn5">Comments</a>
<li><a href="SWIG.html#SWIG_nn6">C Preprocessor</a>
<li><a href="SWIG.html#SWIG_nn7">SWIG Directives</a>
@ -223,13 +223,16 @@
<ul>
<li><a href="SWIGPlus.html#SWIGPlus_nn24">Dispatch function generation</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn25">Ambiguity in Overloading</a>
<li><a href="SWIGPlus.html#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
<li><a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn27">Comments on overloading</a>
</ul>
<li><a href="SWIGPlus.html#SWIGPlus_nn28">Wrapping overloaded operators</a>
<li><a href="SWIGPlus.html#SWIGPlus_class_extension">Class extension</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn30">Templates</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn31">Namespaces</a>
<li><a href="SWIGPlus.html#SWIGPlus_namespaces">Namespaces</a>
<ul>
<li><a href="SWIGPlus.html#SWIGPlus_nspace">The nspace feature for namespaces</a>
</ul>
<li><a href="SWIGPlus.html#SWIGPlus_renaming_templated_types_namespaces">Renaming templated types in namespaces</a>
<li><a href="SWIGPlus.html#SWIGPlus_exception_specifications">Exception specifications</a>
<li><a href="SWIGPlus.html#SWIGPlus_catches">Exception handling with %catches</a>
@ -237,7 +240,7 @@
<li><a href="SWIGPlus.html#SWIGPlus_nn34">Smart pointers and operator-&gt;()</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn35">Using declarations and inheritance</a>
<li><a href="SWIGPlus.html#SWIGPlus_nested_classes">Nested classes</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn37">A brief rant about const-correctness</a>
<li><a href="SWIGPlus.html#SWIGPlus_const">A brief rant about const-correctness</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn42">Where to go for more information</a>
</ul>
</div>
@ -346,10 +349,9 @@
<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_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_typedef_reductions">Typedef reductions matching</a>
<li><a href="Typemaps.html#Typemaps_nn19">Default typemap matching rules</a>
<li><a href="Typemaps.html#Typemaps_multi_argument_typemaps_patterns">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>
@ -387,14 +389,18 @@
<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>
<li><a href="Typemaps.html#Typemaps_fragments">Typemap fragments</a>
<ul>
<li><a href="Typemaps.html#Typemaps_fragment_type_specialization">Fragment type specialization</a>
<li><a href="Typemaps.html#Typemaps_automatic_specialization">Fragments and automatic typemap specialization</a>
</ul>
<li><a href="Typemaps.html#Typemaps_runtime_type_checker">The run-time type checker</a>
<ul>
<li><a href="Typemaps.html#Typemaps_nn45">Implementation</a>
<li><a href="Typemaps.html#Typemaps_runtime_type_checker_usage">Usage</a>
</ul>
<li><a href="Typemaps.html#Typemaps_overloading">Typemaps and overloading</a>
<li><a href="Typemaps.html#Typemaps_nn48">More about <tt>%apply</tt> and <tt>%clear</tt></a>
<li><a href="Typemaps.html#Typemaps_nn49">Reducing wrapper code size</a>
<li><a href="Typemaps.html#Typemaps_nn47">Passing data between typemaps</a>
<li><a href="Typemaps.html#Typemaps_nn52">C++ "this" pointer</a>
<li><a href="Typemaps.html#Typemaps_nn51">Where to go for more information?</a>
@ -407,7 +413,7 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="Customization.html#exception">Exception handling with %exception</a>
<li><a href="Customization.html#Customization_exception">Exception handling with %exception</a>
<ul>
<li><a href="Customization.html#Customization_nn3">Handling exceptions in C code</a>
<li><a href="Customization.html#Customization_nn4">Exception handling with longjmp()</a>
@ -417,14 +423,14 @@
<li><a href="Customization.html#Customization_exception_special_variables">Special variables for %exception</a>
<li><a href="Customization.html#Customization_nn7">Using The SWIG exception library</a>
</ul>
<li><a href="Customization.html#ownership">Object ownership and %newobject</a>
<li><a href="Customization.html#features">Features and the %feature directive</a>
<li><a href="Customization.html#Customization_ownership">Object ownership and %newobject</a>
<li><a href="Customization.html#Customization_features">Features and the %feature directive</a>
<ul>
<li><a href="Customization.html#Customization_feature_attributes">Feature attributes</a>
<li><a href="Customization.html#Customization_feature_flags">Feature flags</a>
<li><a href="Customization.html#Customization_clearing_features">Clearing features</a>
<li><a href="Customization.html#Customization_features_default_args">Features and default arguments</a>
<li><a href="Customization.html#features_example">Feature example</a>
<li><a href="Customization.html#Customization_features_example">Feature example</a>
</ul>
</ul>
</div>
@ -497,7 +503,7 @@
<li><a href="Modules.html#Modules_introduction">Modules Introduction</a>
<li><a href="Modules.html#Modules_nn1">Basics</a>
<li><a href="Modules.html#Modules_nn2">The SWIG runtime code</a>
<li><a href="Modules.html#external_run_time">External access to the runtime</a>
<li><a href="Modules.html#Modules_external_run_time">External access to the runtime</a>
<li><a href="Modules.html#Modules_nn4">A word of caution about static libraries</a>
<li><a href="Modules.html#Modules_nn5">References</a>
<li><a href="Modules.html#Modules_nn6">Reducing the wrapper file size</a>
@ -620,35 +626,35 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="CSharp.html#csharp_introduction">Introduction</a>
<li><a href="CSharp.html#csharp_differences_java">Differences to the Java module</a>
<li><a href="CSharp.html#CSharp_introduction">Introduction</a>
<li><a href="CSharp.html#CSharp_differences_java">Differences to the Java module</a>
<li><a href="CSharp.html#CSharp_arrays">C# Arrays</a>
<ul>
<li><a href="CSharp.html#CSharp_arrays_swig_library">The SWIG C arrays library</a>
<li><a href="CSharp.html#CSharp_arrays_pinvoke_default_array_marshalling">Managed arrays using P/Invoke default array marshalling</a>
<li><a href="CSharp.html#CSharp_arrays_pinning">Managed arrays using pinning</a>
</ul>
<li><a href="CSharp.html#csharp_exceptions">C# Exceptions</a>
<li><a href="CSharp.html#CSharp_exceptions">C# Exceptions</a>
<ul>
<li><a href="CSharp.html#csharp_exception_example_check_typemap">C# exception example using "check" typemap</a>
<li><a href="CSharp.html#csharp_exception_example_percent_exception">C# exception example using %exception</a>
<li><a href="CSharp.html#csharp_exception_example_exception_specifications">C# exception example using exception specifications</a>
<li><a href="CSharp.html#csharp_custom_application_exception">Custom C# ApplicationException example</a>
<li><a href="CSharp.html#CSharp_exception_example_check_typemap">C# exception example using "check" typemap</a>
<li><a href="CSharp.html#CSharp_exception_example_percent_exception">C# exception example using %exception</a>
<li><a href="CSharp.html#CSharp_exception_example_exception_specifications">C# exception example using exception specifications</a>
<li><a href="CSharp.html#CSharp_custom_application_exception">Custom C# ApplicationException example</a>
</ul>
<li><a href="CSharp.html#csharp_directors">C# Directors</a>
<li><a href="CSharp.html#CSharp_directors">C# Directors</a>
<ul>
<li><a href="CSharp.html#csharp_directors_example">Directors example</a>
<li><a href="CSharp.html#csharp_directors_implementation">Directors implementation</a>
<li><a href="CSharp.html#csharp_director_caveats">Director caveats</a>
<li><a href="CSharp.html#CSharp_directors_example">Directors example</a>
<li><a href="CSharp.html#CSharp_directors_implementation">Directors implementation</a>
<li><a href="CSharp.html#CSharp_director_caveats">Director caveats</a>
</ul>
<li><a href="CSharp.html#csharp_typemap_examples">C# Typemap examples</a>
<li><a href="CSharp.html#CSharp_typemap_examples">C# Typemap examples</a>
<ul>
<li><a href="CSharp.html#csharp_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="CSharp.html#csharp_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="CSharp.html#csharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="CSharp.html#csharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="CSharp.html#csharp_partial_classes">Turning wrapped classes into partial classes</a>
<li><a href="CSharp.html#csharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
<li><a href="CSharp.html#CSharp_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="CSharp.html#CSharp_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="CSharp.html#CSharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="CSharp.html#CSharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="CSharp.html#CSharp_partial_classes">Turning wrapped classes into partial classes</a>
<li><a href="CSharp.html#CSharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
</ul>
</ul>
</div>
@ -682,7 +688,7 @@
<li><a href="Chicken.html#Chicken_nn16">Typemaps</a>
<li><a href="Chicken.html#Chicken_nn17">Pointers</a>
<ul>
<li><a href="Chicken.html#collection">Garbage collection</a>
<li><a href="Chicken.html#Chicken_collection">Garbage collection</a>
</ul>
<li><a href="Chicken.html#Chicken_nn18">Unsupported features and known problems</a>
<ul>
@ -732,139 +738,139 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="Java.html#java_overview">Overview</a>
<li><a href="Java.html#java_preliminaries">Preliminaries</a>
<li><a href="Java.html#Java_overview">Overview</a>
<li><a href="Java.html#Java_preliminaries">Preliminaries</a>
<ul>
<li><a href="Java.html#running_swig">Running SWIG</a>
<li><a href="Java.html#java_commandline">Additional Commandline Options</a>
<li><a href="Java.html#getting_right_headers">Getting the right header files</a>
<li><a href="Java.html#compiling_dynamic">Compiling a dynamic module</a>
<li><a href="Java.html#using_module">Using your module</a>
<li><a href="Java.html#dynamic_linking_problems">Dynamic linking problems</a>
<li><a href="Java.html#compilation_problems_cpp">Compilation problems and compiling with C++</a>
<li><a href="Java.html#building_windows">Building on Windows</a>
<li><a href="Java.html#Java_running_swig">Running SWIG</a>
<li><a href="Java.html#Java_commandline">Additional Commandline Options</a>
<li><a href="Java.html#Java_getting_right_headers">Getting the right header files</a>
<li><a href="Java.html#Java_compiling_dynamic">Compiling a dynamic module</a>
<li><a href="Java.html#Java_using_module">Using your module</a>
<li><a href="Java.html#Java_dynamic_linking_problems">Dynamic linking problems</a>
<li><a href="Java.html#Java_compilation_problems_cpp">Compilation problems and compiling with C++</a>
<li><a href="Java.html#Java_building_windows">Building on Windows</a>
<ul>
<li><a href="Java.html#visual_studio">Running SWIG from Visual Studio</a>
<li><a href="Java.html#nmake">Using NMAKE</a>
<li><a href="Java.html#Java_visual_studio">Running SWIG from Visual Studio</a>
<li><a href="Java.html#Java_nmake">Using NMAKE</a>
</ul>
</ul>
<li><a href="Java.html#java_basic_tour">A tour of basic C/C++ wrapping</a>
<li><a href="Java.html#Java_basic_tour">A tour of basic C/C++ wrapping</a>
<ul>
<li><a href="Java.html#module_packages_classes">Modules, packages and generated Java classes</a>
<li><a href="Java.html#functions">Functions</a>
<li><a href="Java.html#global_variables">Global variables</a>
<li><a href="Java.html#constants">Constants</a>
<li><a href="Java.html#enumerations">Enumerations</a>
<li><a href="Java.html#Java_module_packages_classes">Modules, packages and generated Java classes</a>
<li><a href="Java.html#Java_functions">Functions</a>
<li><a href="Java.html#Java_global_variables">Global variables</a>
<li><a href="Java.html#Java_constants">Constants</a>
<li><a href="Java.html#Java_enumerations">Enumerations</a>
<ul>
<li><a href="Java.html#anonymous_enums">Anonymous enums</a>
<li><a href="Java.html#typesafe_enums">Typesafe enums</a>
<li><a href="Java.html#proper_enums">Proper Java enums</a>
<li><a href="Java.html#typeunsafe_enums">Type unsafe enums</a>
<li><a href="Java.html#simple_enums">Simple enums</a>
<li><a href="Java.html#Java_anonymous_enums">Anonymous enums</a>
<li><a href="Java.html#Java_typesafe_enums">Typesafe enums</a>
<li><a href="Java.html#Java_proper_enums">Proper Java enums</a>
<li><a href="Java.html#Java_typeunsafe_enums">Type unsafe enums</a>
<li><a href="Java.html#Java_simple_enums">Simple enums</a>
</ul>
<li><a href="Java.html#pointers">Pointers</a>
<li><a href="Java.html#structures">Structures</a>
<li><a href="Java.html#classes">C++ classes</a>
<li><a href="Java.html#inheritance">C++ inheritance</a>
<li><a href="Java.html#pointers_refs_arrays">Pointers, references, arrays and pass by value</a>
<li><a href="Java.html#Java_pointers">Pointers</a>
<li><a href="Java.html#Java_structures">Structures</a>
<li><a href="Java.html#Java_classes">C++ classes</a>
<li><a href="Java.html#Java_inheritance">C++ inheritance</a>
<li><a href="Java.html#Java_pointers_refs_arrays">Pointers, references, arrays and pass by value</a>
<ul>
<li><a href="Java.html#null_pointers">Null pointers</a>
<li><a href="Java.html#Java_null_pointers">Null pointers</a>
</ul>
<li><a href="Java.html#overloaded_functions">C++ overloaded functions</a>
<li><a href="Java.html#java_default_arguments">C++ default arguments</a>
<li><a href="Java.html#namespaces">C++ namespaces</a>
<li><a href="Java.html#templates">C++ templates</a>
<li><a href="Java.html#smart_pointers">C++ Smart Pointers</a>
<li><a href="Java.html#Java_overloaded_functions">C++ overloaded functions</a>
<li><a href="Java.html#Java_default_arguments">C++ default arguments</a>
<li><a href="Java.html#Java_namespaces">C++ namespaces</a>
<li><a href="Java.html#Java_templates">C++ templates</a>
<li><a href="Java.html#Java_smart_pointers">C++ Smart Pointers</a>
</ul>
<li><a href="Java.html#further_details">Further details on the generated Java classes</a>
<li><a href="Java.html#Java_further_details">Further details on the generated Java classes</a>
<ul>
<li><a href="Java.html#imclass">The intermediary JNI class</a>
<li><a href="Java.html#Java_imclass">The intermediary JNI class</a>
<ul>
<li><a href="Java.html#imclass_pragmas">The intermediary JNI class pragmas</a>
<li><a href="Java.html#Java_imclass_pragmas">The intermediary JNI class pragmas</a>
</ul>
<li><a href="Java.html#java_module_class">The Java module class</a>
<li><a href="Java.html#Java_module_class">The Java module class</a>
<ul>
<li><a href="Java.html#module_class_pragmas">The Java module class pragmas</a>
<li><a href="Java.html#Java_module_class_pragmas">The Java module class pragmas</a>
</ul>
<li><a href="Java.html#java_proxy_classes">Java proxy classes</a>
<li><a href="Java.html#Java_proxy_classes">Java proxy classes</a>
<ul>
<li><a href="Java.html#memory_management">Memory management</a>
<li><a href="Java.html#inheritance_mirroring">Inheritance</a>
<li><a href="Java.html#proxy_classes_gc">Proxy classes and garbage collection</a>
<li><a href="Java.html#java_pgcpp">The premature garbage collection prevention parameter for proxy class marshalling</a>
<li><a href="Java.html#java_multithread_libraries">Single threaded applications and thread safety</a>
<li><a href="Java.html#Java_memory_management">Memory management</a>
<li><a href="Java.html#Java_inheritance_mirroring">Inheritance</a>
<li><a href="Java.html#Java_proxy_classes_gc">Proxy classes and garbage collection</a>
<li><a href="Java.html#Java_pgcpp">The premature garbage collection prevention parameter for proxy class marshalling</a>
<li><a href="Java.html#Java_multithread_libraries">Single threaded applications and thread safety</a>
</ul>
<li><a href="Java.html#type_wrapper_classes">Type wrapper classes</a>
<li><a href="Java.html#enum_classes">Enum classes</a>
<li><a href="Java.html#Java_type_wrapper_classes">Type wrapper classes</a>
<li><a href="Java.html#Java_enum_classes">Enum classes</a>
<ul>
<li><a href="Java.html#typesafe_enums_classes">Typesafe enum classes</a>
<li><a href="Java.html#proper_enums_classes">Proper Java enum classes</a>
<li><a href="Java.html#typeunsafe_enums_classes">Type unsafe enum classes</a>
<li><a href="Java.html#Java_typesafe_enums_classes">Typesafe enum classes</a>
<li><a href="Java.html#Java_proper_enums_classes">Proper Java enum classes</a>
<li><a href="Java.html#Java_typeunsafe_enums_classes">Type unsafe enum classes</a>
</ul>
</ul>
<li><a href="Java.html#java_directors">Cross language polymorphism using directors</a>
<li><a href="Java.html#Java_directors">Cross language polymorphism using directors</a>
<ul>
<li><a href="Java.html#java_enabling_directors">Enabling directors</a>
<li><a href="Java.html#java_directors_classes">Director classes</a>
<li><a href="Java.html#java_directors_overhead">Overhead and code bloat</a>
<li><a href="Java.html#java_directors_example">Simple directors example</a>
<li><a href="Java.html#java_directors_threading">Director threading issues</a>
<li><a href="Java.html#Java_enabling_directors">Enabling directors</a>
<li><a href="Java.html#Java_directors_classes">Director classes</a>
<li><a href="Java.html#Java_directors_overhead">Overhead and code bloat</a>
<li><a href="Java.html#Java_directors_example">Simple directors example</a>
<li><a href="Java.html#Java_directors_threading">Director threading issues</a>
</ul>
<li><a href="Java.html#java_allprotected">Accessing protected members</a>
<li><a href="Java.html#common_customization">Common customization features</a>
<li><a href="Java.html#Java_allprotected">Accessing protected members</a>
<li><a href="Java.html#Java_common_customization">Common customization features</a>
<ul>
<li><a href="Java.html#helper_functions">C/C++ helper functions</a>
<li><a href="Java.html#class_extension">Class extension with %extend</a>
<li><a href="Java.html#exception_handling">Exception handling with %exception and %javaexception</a>
<li><a href="Java.html#method_access">Method access with %javamethodmodifiers</a>
<li><a href="Java.html#Java_helper_functions">C/C++ helper functions</a>
<li><a href="Java.html#Java_class_extension">Class extension with %extend</a>
<li><a href="Java.html#Java_exception_handling">Exception handling with %exception and %javaexception</a>
<li><a href="Java.html#Java_method_access">Method access with %javamethodmodifiers</a>
</ul>
<li><a href="Java.html#tips_techniques">Tips and techniques</a>
<li><a href="Java.html#Java_tips_techniques">Tips and techniques</a>
<ul>
<li><a href="Java.html#input_output_parameters">Input and output parameters using primitive pointers and references</a>
<li><a href="Java.html#simple_pointers">Simple pointers</a>
<li><a href="Java.html#c_arrays">Wrapping C arrays with Java arrays</a>
<li><a href="Java.html#unbounded_c_arrays">Unbounded C Arrays</a>
<li><a href="Java.html#java_heap_allocations">Overriding new and delete to allocate from Java heap</a>
<li><a href="Java.html#Java_input_output_parameters">Input and output parameters using primitive pointers and references</a>
<li><a href="Java.html#Java_simple_pointers">Simple pointers</a>
<li><a href="Java.html#Java_c_arrays">Wrapping C arrays with Java arrays</a>
<li><a href="Java.html#Java_unbounded_c_arrays">Unbounded C Arrays</a>
<li><a href="Java.html#Java_heap_allocations">Overriding new and delete to allocate from Java heap</a>
</ul>
<li><a href="Java.html#java_typemaps">Java typemaps</a>
<li><a href="Java.html#Java_typemaps">Java typemaps</a>
<ul>
<li><a href="Java.html#default_primitive_type_mappings">Default primitive type mappings</a>
<li><a href="Java.html#Java_default_primitive_type_mappings">Default primitive type mappings</a>
<li><a href="Java.html#Java_default_non_primitive_typemaps">Default typemaps for non-primitive types</a>
<li><a href="Java.html#jvm64">Sixty four bit JVMs</a>
<li><a href="Java.html#what_is_typemap">What is a typemap?</a>
<li><a href="Java.html#typemaps_c_to_java_types">Typemaps for mapping C/C++ types to Java types</a>
<li><a href="Java.html#typemap_attributes">Java typemap attributes</a>
<li><a href="Java.html#special_variables">Java special variables</a>
<li><a href="Java.html#typemaps_for_c_and_cpp">Typemaps for both C and C++ compilation</a>
<li><a href="Java.html#java_code_typemaps">Java code typemaps</a>
<li><a href="Java.html#java_directors_typemaps">Director specific typemaps</a>
<li><a href="Java.html#Java_jvm64">Sixty four bit JVMs</a>
<li><a href="Java.html#Java_what_is_typemap">What is a typemap?</a>
<li><a href="Java.html#Java_typemaps_c_to_java_types">Typemaps for mapping C/C++ types to Java types</a>
<li><a href="Java.html#Java_typemap_attributes">Java typemap attributes</a>
<li><a href="Java.html#Java_special_variables">Java special variables</a>
<li><a href="Java.html#Java_typemaps_for_c_and_cpp">Typemaps for both C and C++ compilation</a>
<li><a href="Java.html#Java_code_typemaps">Java code typemaps</a>
<li><a href="Java.html#Java_directors_typemaps">Director specific typemaps</a>
</ul>
<li><a href="Java.html#typemap_examples">Typemap Examples</a>
<li><a href="Java.html#Java_typemap_examples">Typemap Examples</a>
<ul>
<li><a href="Java.html#simpler_enum_classes">Simpler Java enums for enums without initializers</a>
<li><a href="Java.html#exception_typemap">Handling C++ exception specifications as Java exceptions</a>
<li><a href="Java.html#nan_exception_typemap">NaN Exception - exception handling for a particular type</a>
<li><a href="Java.html#converting_java_string_arrays">Converting Java String arrays to char ** </a>
<li><a href="Java.html#expanding_java_object">Expanding a Java object to multiple arguments</a>
<li><a href="Java.html#using_typemaps_return_arguments">Using typemaps to return arguments</a>
<li><a href="Java.html#adding_downcasts">Adding Java downcasts to polymorphic return types</a>
<li><a href="Java.html#adding_equals_method">Adding an equals method to the Java classes</a>
<li><a href="Java.html#void_pointers">Void pointers and a common Java base class</a>
<li><a href="Java.html#struct_pointer_pointer">Struct pointer to pointer</a>
<li><a href="Java.html#java_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="Java.html#java_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="Java.html#java_date_marshalling">Date marshalling using the javain typemap and associated attributes</a>
<li><a href="Java.html#Java_simpler_enum_classes">Simpler Java enums for enums without initializers</a>
<li><a href="Java.html#Java_exception_typemap">Handling C++ exception specifications as Java exceptions</a>
<li><a href="Java.html#Java_nan_exception_typemap">NaN Exception - exception handling for a particular type</a>
<li><a href="Java.html#Java_converting_java_string_arrays">Converting Java String arrays to char ** </a>
<li><a href="Java.html#Java_expanding_java_object">Expanding a Java object to multiple arguments</a>
<li><a href="Java.html#Java_using_typemaps_return_arguments">Using typemaps to return arguments</a>
<li><a href="Java.html#Java_adding_downcasts">Adding Java downcasts to polymorphic return types</a>
<li><a href="Java.html#Java_adding_equals_method">Adding an equals method to the Java classes</a>
<li><a href="Java.html#Java_void_pointers">Void pointers and a common Java base class</a>
<li><a href="Java.html#Java_struct_pointer_pointer">Struct pointer to pointer</a>
<li><a href="Java.html#Java_memory_management_member_variables">Memory management when returning references to member variables</a>
<li><a href="Java.html#Java_memory_management_objects">Memory management for objects passed to the C++ layer</a>
<li><a href="Java.html#Java_date_marshalling">Date marshalling using the javain typemap and associated attributes</a>
</ul>
<li><a href="Java.html#java_directors_faq">Living with Java Directors</a>
<li><a href="Java.html#odds_ends">Odds and ends</a>
<li><a href="Java.html#Java_directors_faq">Living with Java Directors</a>
<li><a href="Java.html#Java_odds_ends">Odds and ends</a>
<ul>
<li><a href="Java.html#javadoc_comments">JavaDoc comments</a>
<li><a href="Java.html#functional_interface">Functional interface without proxy classes</a>
<li><a href="Java.html#using_own_jni_functions">Using your own JNI functions</a>
<li><a href="Java.html#performance">Performance concerns and hints</a>
<li><a href="Java.html#java_debugging">Debugging</a>
<li><a href="Java.html#Java_javadoc_comments">JavaDoc comments</a>
<li><a href="Java.html#Java_functional_interface">Functional interface without proxy classes</a>
<li><a href="Java.html#Java_using_own_jni_functions">Using your own JNI functions</a>
<li><a href="Java.html#Java_performance">Performance concerns and hints</a>
<li><a href="Java.html#Java_debugging">Debugging</a>
</ul>
<li><a href="Java.html#java_examples">Examples</a>
<li><a href="Java.html#Java_examples">Examples</a>
</ul>
</div>
<!-- INDEX -->
@ -954,38 +960,38 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="Modula3.html#modula3_overview">Overview</a>
<li><a href="Modula3.html#Modula3_modula3_overview">Overview</a>
<ul>
<li><a href="Modula3.html#whyscripting">Why not scripting ?</a>
<li><a href="Modula3.html#whymodula3">Why Modula-3 ?</a>
<li><a href="Modula3.html#whycpp">Why C / C++ ?</a>
<li><a href="Modula3.html#whyswig">Why SWIG ?</a>
<li><a href="Modula3.html#Modula3_whyscripting">Why not scripting ?</a>
<li><a href="Modula3.html#Modula3_whymodula3">Why Modula-3 ?</a>
<li><a href="Modula3.html#Modula3_whycpp">Why C / C++ ?</a>
<li><a href="Modula3.html#Modula3_whyswig">Why SWIG ?</a>
</ul>
<li><a href="Modula3.html#conception">Conception</a>
<li><a href="Modula3.html#Modula3_conception">Conception</a>
<ul>
<li><a href="Modula3.html#cinterface">Interfaces to C libraries</a>
<li><a href="Modula3.html#cppinterface">Interfaces to C++ libraries</a>
<li><a href="Modula3.html#Modula3_cinterface">Interfaces to C libraries</a>
<li><a href="Modula3.html#Modula3_cppinterface">Interfaces to C++ libraries</a>
</ul>
<li><a href="Modula3.html#preliminaries">Preliminaries</a>
<li><a href="Modula3.html#Modula3_preliminaries">Preliminaries</a>
<ul>
<li><a href="Modula3.html#compilers">Compilers</a>
<li><a href="Modula3.html#commandline">Additional Commandline Options</a>
<li><a href="Modula3.html#Modula3_compilers">Compilers</a>
<li><a href="Modula3.html#Modula3_commandline">Additional Commandline Options</a>
</ul>
<li><a href="Modula3.html#modula3_typemaps">Modula-3 typemaps</a>
<li><a href="Modula3.html#Modula3_typemaps">Modula-3 typemaps</a>
<ul>
<li><a href="Modula3.html#inoutparam">Inputs and outputs</a>
<li><a href="Modula3.html#ordinals">Subranges, Enumerations, Sets</a>
<li><a href="Modula3.html#class">Objects</a>
<li><a href="Modula3.html#imports">Imports</a>
<li><a href="Modula3.html#exceptions">Exceptions</a>
<li><a href="Modula3.html#typemap_example">Example</a>
<li><a href="Modula3.html#Modula3_inoutparam">Inputs and outputs</a>
<li><a href="Modula3.html#Modula3_ordinals">Subranges, Enumerations, Sets</a>
<li><a href="Modula3.html#Modula3_class">Objects</a>
<li><a href="Modula3.html#Modula3_imports">Imports</a>
<li><a href="Modula3.html#Modula3_exceptions">Exceptions</a>
<li><a href="Modula3.html#Modula3_typemap_example">Example</a>
</ul>
<li><a href="Modula3.html#hints">More hints to the generator</a>
<li><a href="Modula3.html#Modula3_hints">More hints to the generator</a>
<ul>
<li><a href="Modula3.html#features">Features</a>
<li><a href="Modula3.html#pragmas">Pragmas</a>
<li><a href="Modula3.html#Modula3_features">Features</a>
<li><a href="Modula3.html#Modula3_pragmas">Pragmas</a>
</ul>
<li><a href="Modula3.html#remarks">Remarks</a>
<li><a href="Modula3.html#Modula3_remarks">Remarks</a>
</ul>
</div>
<!-- INDEX -->
@ -1353,7 +1359,7 @@
<li><a href="Ruby.html#Ruby_nn22">C++ namespaces</a>
<li><a href="Ruby.html#Ruby_nn23">C++ templates</a>
<li><a href="Ruby.html#Ruby_nn23_1">C++ Standard Template Library (STL)</a>
<li><a href="Ruby.html#C_STL_Functors">C++ STL Functors</a>
<li><a href="Ruby.html#Ruby_C_STL_Functors">C++ STL Functors</a>
<li><a href="Ruby.html#Ruby_C_Iterators">C++ STL Iterators</a>
<li><a href="Ruby.html#Ruby_nn24">C++ Smart Pointers</a>
<li><a href="Ruby.html#Ruby_nn25">Cross-Language Polymorphism</a>
@ -1437,7 +1443,7 @@
</ul>
<li><a href="Ruby.html#Ruby_nn53">Advanced Topics</a>
<ul>
<li><a href="Ruby.html#Ruby_nn54">Operator overloading</a>
<li><a href="Ruby.html#Ruby_operator_overloading">Operator overloading</a>
<li><a href="Ruby.html#Ruby_nn55">Creating Multi-Module Packages</a>
<li><a href="Ruby.html#Ruby_nn56">Specifying Mixin Modules</a>
</ul>
@ -1585,7 +1591,7 @@
<li><a href="Extending.html#Extending_nn36">Entry point to code generation</a>
<li><a href="Extending.html#Extending_nn37">Module I/O and wrapper skeleton</a>
<li><a href="Extending.html#Extending_nn38">Low-level code generators</a>
<li><a href="Extending.html#Extending_nn39">Configuration files</a>
<li><a href="Extending.html#Extending_configuration_files">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">User examples</a>

View file

@ -10,7 +10,7 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#exception">Exception handling with %exception</a>
<li><a href="#Customization_exception">Exception handling with %exception</a>
<ul>
<li><a href="#Customization_nn3">Handling exceptions in C code</a>
<li><a href="#Customization_nn4">Exception handling with longjmp()</a>
@ -20,14 +20,14 @@
<li><a href="#Customization_exception_special_variables">Special variables for %exception</a>
<li><a href="#Customization_nn7">Using The SWIG exception library</a>
</ul>
<li><a href="#ownership">Object ownership and %newobject</a>
<li><a href="#features">Features and the %feature directive</a>
<li><a href="#Customization_ownership">Object ownership and %newobject</a>
<li><a href="#Customization_features">Features and the %feature directive</a>
<ul>
<li><a href="#Customization_feature_attributes">Feature attributes</a>
<li><a href="#Customization_feature_flags">Feature flags</a>
<li><a href="#Customization_clearing_features">Clearing features</a>
<li><a href="#Customization_features_default_args">Features and default arguments</a>
<li><a href="#features_example">Feature example</a>
<li><a href="#Customization_features_example">Feature example</a>
</ul>
</ul>
</div>
@ -45,7 +45,7 @@ of exception handling is presented. Then, a more general-purpose
customization mechanism known as "features" is described.
</p>
<H2><a name="exception"></a>11.1 Exception handling with %exception</H2>
<H2><a name="Customization_exception"></a>11.1 Exception handling with %exception</H2>
<p>
@ -351,7 +351,7 @@ In this case, the exception handler is only attached to declarations
named "allocate". This would include both global and member
functions. The names supplied to <tt>%exception</tt> follow the same
rules as for <tt>%rename</tt> described in the section on
<a href="SWIGPlus.html#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>.
<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>.
For example, if you wanted to define
an exception handler for a specific class, you might write this:
</p>
@ -582,7 +582,7 @@ it can be used elsewhere in SWIG. This includes typemaps and helper
functions.
</p>
<H2><a name="ownership"></a>11.2 Object ownership and %newobject</H2>
<H2><a name="Customization_ownership"></a>11.2 Object ownership and %newobject</H2>
<p>
@ -734,7 +734,7 @@ char *strdup(const char *s);
The results might not be what you expect.
</p>
<H2><a name="features"></a>11.3 Features and the %feature directive</H2>
<H2><a name="Customization_features"></a>11.3 Features and the %feature directive</H2>
<p>
@ -773,7 +773,7 @@ involving <tt>%feature</tt>:
</div>
<p>
The name matching rules outlined in the <a href="SWIGPlus.html#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
The name matching rules outlined in the <a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
section applies to all <tt>%feature</tt> directives.
In fact the the <tt>%rename</tt> directive is just a special form of <tt>%feature</tt>.
The matching rules mean that features are very flexible and can be applied with
@ -854,7 +854,7 @@ In the following example, <tt>MyExceptionClass</tt> is the name of the Java clas
</div>
<p>
Further details can be obtained from the <a href="Java.html#exception_handling">Java exception handling</a> section.
Further details can be obtained from the <a href="Java.html#Java_exception_handling">Java exception handling</a> section.
</p>
<H3><a name="Customization_feature_flags"></a>11.3.2 Feature flags</H3>
@ -1123,7 +1123,7 @@ specifying or not specifying default arguments in a feature is not applicable as
in SWIG-1.3.23 when the approach to wrapping methods with default arguments was changed.
</p>
<H3><a name="features_example"></a>11.3.5 Feature example</H3>
<H3><a name="Customization_features_example"></a>11.3.5 Feature example</H3>
<p>

View file

@ -54,7 +54,7 @@
<li><a href="#Extending_nn36">Entry point to code generation</a>
<li><a href="#Extending_nn37">Module I/O and wrapper skeleton</a>
<li><a href="#Extending_nn38">Low-level code generators</a>
<li><a href="#Extending_nn39">Configuration files</a>
<li><a href="#Extending_configuration_files">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">User examples</a>
@ -3049,7 +3049,7 @@ but without the typemaps, there is still work to do.
</p>
<H3><a name="Extending_nn39"></a>35.10.8 Configuration files</H3>
<H3><a name="Extending_configuration_files"></a>35.10.8 Configuration files</H3>
<!-- please report bugs in this section to ttn -->
@ -3090,8 +3090,6 @@ The nickname is used in four places:
<TR><TD><B>usage</B></TD><TD><B>transform</B></TD></TR>
<TR><TD>"skip" tag</TD><TD>(none)</TD></TR>
<TR><TD>Examples/ subdir name</TD><TD>(none)</TD></TR>
<TR><TD>Examples/GIFPlot/ subdir name</TD>
<TD>capitalize (upcase first letter)</TD></TR>
<TR><TD>Examples/test-suite/ subdir name</TD><TD>(none)</TD></TR>
<!-- add more uses here (remember to adjust header) -->
</TABLE>
@ -3159,8 +3157,8 @@ skip-qux = $(skip-qux99)
<p>
Lastly, you need to modify each of <TT>check-aliveness</TT>,
<TT>check-examples</TT>, <TT>check-test-suite</TT>,
<TT>check-gifplot</TT> (all targets) and <TT>lib-languages</TT> (var).
<TT>check-examples</TT>, <TT>check-test-suite</TT>
and <TT>lib-languages</TT> (var).
Use the nickname for these, not the alias.
Note that you can do this even before you have any tests or examples
set up; the Makefile rules do some sanity checking and skip around
@ -3175,10 +3173,6 @@ and look to the existing languages for examples.
<dd> Do <TT>cp ../python/check.list .</TT> and modify to taste.
One subdir per line.
<dt> <b>Examples/GIFPlot/Qux99/check.list</b>
<dd> Do <TT>cp ../Python/check.list .</TT> and modify to taste.
One subdir per line.
<dt> <b>Lib/qux99/extra-install.list</b>
<dd> If you add your language to the top-level Makefile.in var
<TT>lib-languages</TT>, then <TT>make install</TT> will install
@ -3252,7 +3246,7 @@ These can be found, for example for Python, in
<p>
By default, all of the examples are built and run when the user types
<tt>make check</tt>. To ensure that your examples are automatically run
during this process, see the section on <a href="#n37a">configuration
during this process, see the section on <a href="#Extending_configuration_files">configuration
files</a>.
</p>
@ -3601,6 +3595,7 @@ There are various command line options which can aid debugging a SWIG interface
-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-lsymbols - Display target language layer symbols
-debug-tags - Display information about the tags found in the interface
-debug-template - Display information for debugging templates
-debug-top &lt;n&gt; - Display entire parse tree at stages 1-4, &lt;n&gt; is a csv list of stages

View file

@ -69,7 +69,7 @@ SCM interface is the default. The SCM and GH interface differ greatly in how th
pointers and have completely different run-time code. See below for more info.
<p>The GH interface to guile is deprecated. Read more about why in the
<a href="http://www.gnu.org/software/guile/docs/guile-ref/GH-deprecation.html">Guile manual</a>.
<a href="http://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/GH.html#GH">Guile manual</a>.
The idea of the GH interface was to provide a high level API that other languages and projects
could adopt. This was a good idea, but didn't pan out well for general development. But for the
specific, minimal uses that the SWIG typemaps put the GH interface to use is ideal for
@ -409,7 +409,7 @@ See also the "multivalue" example.
%feature("constasvar") can be applied to any constant, immutable variable, or enum.
Instead of exporting the constant as a function that must be called, the
constant will appear as a scheme variable. See
<a href="Customization.html#features">Features and the %feature directive</a>
<a href="Customization.html#Customization_features">Features and the %feature directive</a>
for info on how to apply the %feature.</p>
<H2><a name="Guile_nn12"></a>20.6 Representation of pointers as smobs</H2>
@ -487,7 +487,7 @@ to the destructor for this type. The destructor is the generated wrapper around
So swig still exports a wrapper for the destructor, it just does not call scm_c_define_gsubr() for
the wrapped delete function. So the only way to delete an object is from the garbage collector, since the
delete function is not available to scripts. How swig determines if a type should be garbage collected
is exactly like described in <a href="Customization.html#ownership">
is exactly like described in <a href="Customization.html#Customization_ownership">
Object ownership and %newobject</a> in the SWIG manual. All typemaps use an $owner var, and
the guile module replaces $owner with 0 or 1 depending on feature:new.</p>

File diff suppressed because it is too large Load diff

View file

@ -893,7 +893,7 @@ char *foo();
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.
See <a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for more details.
</p>
<H3><a name="Library_nn12"></a>8.3.4 cstring.i</H3>

View file

@ -6,7 +6,7 @@
</head>
<body bgcolor="#ffffff">
<H1><a name="Lisp_nn1"></a>22 SWIG and Common Lisp</H1>
<H1><a name="Lisp"></a>22 SWIG and Common Lisp</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@ -47,7 +47,7 @@
<p>
Allegro Common Lisp support in SWIG has been updated to include
support for both C and C++. You can read about the interface
<a href="Allegrocl.html#Allegrocl_nn1">here</a>
<a href="Allegrocl.html#Allegrocl">here</a>
</p>
<H2><a name="Lisp_nn3"></a>22.2 Common Foreign Function Interface(CFFI)</H2>
@ -96,14 +96,14 @@ swig -cffi -help
<tr>
<td>-generate-typedef</td>
<td>If this option is given then defctype will be used to generate<br\>
<td>If this option is given then defctype will be used to generate<br/>
shortcuts according to the typedefs in the input.
</td>
</tr>
<tr>
<td>-[no]cwrap</td>
<td>Turn on or turn off generation of an intermediate C file when<br\>
<td>Turn on or turn off generation of an intermediate C file when<br/>
creating a C interface. By default this is only done for C++ code.
</td>
</tr>
@ -269,7 +269,7 @@ The generated SWIG Code will be:
want to lispify the names, also, before we forget you want to
export the generated lisp names. To do this, we will use the
SWIG <a
href="Customization.html#features">feature directive</a>.
href="Customization.html#Customization_features">feature directive</a>.
Let's edit the interface file such that the C type "div_t*" is changed
to Lisp type ":my-pointer", we lispify all names,
export everything, and do some more stuff.

View file

@ -6,7 +6,7 @@
</head>
<body bgcolor="#ffffff">
<H1><a name="Lua_nn1"></a>23 SWIG and Lua</H1>
<H1><a name="Lua"></a>23 SWIG and Lua</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@ -1105,7 +1105,7 @@ will require a pcall, followed by a set of if statements checking the type of th
<p>
All of this code assumes that your C++ code uses exception specification (which a lot doesn't).
If it doesn't consult the "<a href="SWIGPlus.html#SWIGPlus_catches">Exception handling with %catches</a>" section
and the "<a href="Customization.html#exception">Exception handling with %exception</a>" section, for more details on how to
and the "<a href="Customization.html#Customization_exception">Exception handling with %exception</a>" section, for more details on how to
add exception specification to functions or globally (respectively).
</p>
@ -1210,7 +1210,7 @@ extern void sort_double(double* arr, int len);
<p>There are basically two ways that SWIG can deal with this. The first way, uses the <tt>&lt;carrays.i&gt;</tt> library
to create an array in C/C++ then this can be filled within Lua and passed into the function. It works, but its a bit tedious.
More details can be found in the <a href="Library.html#Library_nn5">carrays.i</a> documention.</p>
More details can be found in the <a href="Library.html#Library_carrays">carrays.i</a> documention.</p>
<p>The second and more intuitive way, would be to pass a Lua table directly into the function, and have SWIG automatically convert between Lua-table and C-array. Within the <tt>&lt;typemaps.i&gt;</tt> file there are typemaps ready written to perform this task. To use them is again a matter of using %appy in the correct manner.</p>

View file

@ -9,6 +9,7 @@
# validation.
#
# Additional html validation can be done using the validate target.
# Additional link checking can be done using the linkchecker target.
#
# Note the # and " are escaped
@ -28,9 +29,9 @@ CCache.html: ../../CCache/ccache.yo
# it is just used as a primitive HTML checker.
# CCache.html is generated by yodl2html and has a few insignificant problems, so we don't put it through tidy
check:
tidy -errors --gnu-emacs yes -quiet index.html
tidy -errors --gnu-emacs yes -quiet Sections.html
all=`sed '/^#/d' chapters | grep -v CCache.html`; for a in $$all; do tidy -errors --gnu-emacs yes -quiet $$a; done;
tidy -errors --gnu-emacs yes -quiet index.html
tidy -errors --gnu-emacs yes -quiet Sections.html
all=`sed '/^#/d' chapters | grep -v CCache.html`; for a in $$all; do tidy -errors --gnu-emacs yes -quiet $$a; done;
generate: swightml.book swigpdf.book
htmldoc --batch swightml.book || true
@ -49,7 +50,7 @@ swightml.book:
echo "Sections.html" >> swightml.book
cat chapters >> swightml.book
clean: clean-baks
maintainer-clean: clean-baks
rm -f swightml.book
rm -f swigpdf.book
rm -f CCache.html
@ -60,11 +61,15 @@ clean-baks:
rm -f *.bak
test:
grep "href=\".*\.html\"" index.html
grep "href=\".*\.html\"" Sections.html
all=`sed '/^#/d' chapters`; for a in $$all; do grep -l "href=\".*\.html\"" $$a; done;
grep "href=\".*\.html\"" index.html
grep "href=\".*\.html\"" Sections.html
all=`sed '/^#/d' chapters`; for a in $$all; do grep -l "href=\".*\.html\"" $$a; done;
# Validating using the WDG offline validator - http://www.htmlhelp.com/tools/validator/offline/
validate:
all=`sed '/^#/d' chapters`; for a in $$all; do validate --emacs $$a; done;
all=`sed '/^#/d' chapters`; for a in $$all; do validate --emacs $$a; done;
# Link checking using linkchecker (can take a while - 30 mins)
linkchecker:
linkchecker --anchors Contents.html

View file

@ -9,38 +9,38 @@
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#modula3_overview">Overview</a>
<li><a href="#Modula3_modula3_overview">Overview</a>
<ul>
<li><a href="#whyscripting">Why not scripting ?</a>
<li><a href="#whymodula3">Why Modula-3 ?</a>
<li><a href="#whycpp">Why C / C++ ?</a>
<li><a href="#whyswig">Why SWIG ?</a>
<li><a href="#Modula3_whyscripting">Why not scripting ?</a>
<li><a href="#Modula3_whymodula3">Why Modula-3 ?</a>
<li><a href="#Modula3_whycpp">Why C / C++ ?</a>
<li><a href="#Modula3_whyswig">Why SWIG ?</a>
</ul>
<li><a href="#conception">Conception</a>
<li><a href="#Modula3_conception">Conception</a>
<ul>
<li><a href="#cinterface">Interfaces to C libraries</a>
<li><a href="#cppinterface">Interfaces to C++ libraries</a>
<li><a href="#Modula3_cinterface">Interfaces to C libraries</a>
<li><a href="#Modula3_cppinterface">Interfaces to C++ libraries</a>
</ul>
<li><a href="#preliminaries">Preliminaries</a>
<li><a href="#Modula3_preliminaries">Preliminaries</a>
<ul>
<li><a href="#compilers">Compilers</a>
<li><a href="#commandline">Additional Commandline Options</a>
<li><a href="#Modula3_compilers">Compilers</a>
<li><a href="#Modula3_commandline">Additional Commandline Options</a>
</ul>
<li><a href="#modula3_typemaps">Modula-3 typemaps</a>
<li><a href="#Modula3_typemaps">Modula-3 typemaps</a>
<ul>
<li><a href="#inoutparam">Inputs and outputs</a>
<li><a href="#ordinals">Subranges, Enumerations, Sets</a>
<li><a href="#class">Objects</a>
<li><a href="#imports">Imports</a>
<li><a href="#exceptions">Exceptions</a>
<li><a href="#typemap_example">Example</a>
<li><a href="#Modula3_inoutparam">Inputs and outputs</a>
<li><a href="#Modula3_ordinals">Subranges, Enumerations, Sets</a>
<li><a href="#Modula3_class">Objects</a>
<li><a href="#Modula3_imports">Imports</a>
<li><a href="#Modula3_exceptions">Exceptions</a>
<li><a href="#Modula3_typemap_example">Example</a>
</ul>
<li><a href="#hints">More hints to the generator</a>
<li><a href="#Modula3_hints">More hints to the generator</a>
<ul>
<li><a href="#features">Features</a>
<li><a href="#pragmas">Pragmas</a>
<li><a href="#Modula3_features">Features</a>
<li><a href="#Modula3_pragmas">Pragmas</a>
</ul>
<li><a href="#remarks">Remarks</a>
<li><a href="#Modula3_remarks">Remarks</a>
</ul>
</div>
<!-- INDEX -->
@ -54,10 +54,10 @@ You should be familiar with the
<a href="SWIG.html#SWIG">basics</a>
of SWIG,
especially
<a href="Typemaps.html">typemaps</a>.
<a href="Typemaps.html#Typemaps">typemaps</a>.
</p>
<H2><a name="modula3_overview"></a>24.1 Overview</H2>
<H2><a name="Modula3_modula3_overview"></a>24.1 Overview</H2>
<p>
@ -90,7 +90,7 @@ So the introduction got a bit longer than it should ... ;-)
</p>
<H3><a name="whyscripting"></a>24.1.1 Why not scripting ?</H3>
<H3><a name="Modula3_whyscripting"></a>24.1.1 Why not scripting ?</H3>
<p>
@ -126,7 +126,7 @@ are not advantages of the language itself
but can be provided by function libraries.
</p>
<H3><a name="whymodula3"></a>24.1.2 Why Modula-3 ?</H3>
<H3><a name="Modula3_whymodula3"></a>24.1.2 Why Modula-3 ?</H3>
<p>
@ -166,7 +166,7 @@ it's statically typed, too.
</p>
<H3><a name="whycpp"></a>24.1.3 Why C / C++ ?</H3>
<H3><a name="Modula3_whycpp"></a>24.1.3 Why C / C++ ?</H3>
<p>
@ -179,7 +179,7 @@ Even more fortunately even non-C libraries may provide C header files.
This is where SWIG becomes helpful.
</p>
<H3><a name="whyswig"></a>24.1.4 Why SWIG ?</H3>
<H3><a name="Modula3_whyswig"></a>24.1.4 Why SWIG ?</H3>
<p>
@ -252,10 +252,10 @@ integrate Modula-3 code into a C / C++ project.
</p>
<H2><a name="conception"></a>24.2 Conception</H2>
<H2><a name="Modula3_conception"></a>24.2 Conception</H2>
<H3><a name="cinterface"></a>24.2.1 Interfaces to C libraries</H3>
<H3><a name="Modula3_cinterface"></a>24.2.1 Interfaces to C libraries</H3>
<p>
@ -404,7 +404,7 @@ and the principal type must be renamed (<tt>%typemap</tt>).
</p>
<H3><a name="cppinterface"></a>24.2.2 Interfaces to C++ libraries</H3>
<H3><a name="Modula3_cppinterface"></a>24.2.2 Interfaces to C++ libraries</H3>
<p>
@ -477,13 +477,13 @@ Is it possible to sub-class C++ classes with Modula-3 code?
This issue is addressed by directors,
a feature that was experimentally added to some Language modules
like
<a href="Java.html#java_directors">Java</a> and
<a href="Python.html#directors">Python</a>.
<a href="Java.html#Java_directors">Java</a> and
<a href="Python.html#Python_directors">Python</a>.
</li>
<li>
How to manage storage with the garbage collector of Modula-3?
Support for
<a href="Customization.html#ownership">
<a href="Customization.html#Customization_ownership">
<tt>%newobject</tt> and <tt>%typemap(newfree)</tt></a>
isn't implemented, yet.
What's about resources that are managed by the garbage collector
@ -494,7 +494,7 @@ as far as I know.
<li>
How to turn C++ exceptions into Modula-3 exceptions?
There's also no support for
<a href="Customization.html#exception">
<a href="Customization.html#Customization_exception">
<tt>%exception</tt></a>, yet.
</li>
</ul>
@ -505,10 +505,10 @@ There is no C++ library I wrote a SWIG interface for,
so I'm not sure if this is possible or sensible, yet.
</p>
<H2><a name="preliminaries"></a>24.3 Preliminaries</H2>
<H2><a name="Modula3_preliminaries"></a>24.3 Preliminaries</H2>
<H3><a name="compilers"></a>24.3.1 Compilers</H3>
<H3><a name="Modula3_compilers"></a>24.3.1 Compilers</H3>
<p>
@ -522,7 +522,7 @@ For testing examples I use Critical Mass cm3.
</p>
<H3><a name="commandline"></a>24.3.2 Additional Commandline Options</H3>
<H3><a name="Modula3_commandline"></a>24.3.2 Additional Commandline Options</H3>
<p>
@ -599,10 +599,10 @@ Instead generate templates for some basic typemaps.
</tr>
</table>
<H2><a name="modula3_typemaps"></a>24.4 Modula-3 typemaps</H2>
<H2><a name="Modula3_typemaps"></a>24.4 Modula-3 typemaps</H2>
<H3><a name="inoutparam"></a>24.4.1 Inputs and outputs</H3>
<H3><a name="Modula3_inoutparam"></a>24.4.1 Inputs and outputs</H3>
<p>
@ -818,7 +818,7 @@ consist of the following parts:
</table>
<H3><a name="ordinals"></a>24.4.2 Subranges, Enumerations, Sets</H3>
<H3><a name="Modula3_ordinals"></a>24.4.2 Subranges, Enumerations, Sets</H3>
<p>
@ -870,7 +870,7 @@ that I'd like to automate.
</p>
<H3><a name="class"></a>24.4.3 Objects</H3>
<H3><a name="Modula3_class"></a>24.4.3 Objects</H3>
<p>
@ -883,7 +883,7 @@ is not really useful, yet.
</p>
<H3><a name="imports"></a>24.4.4 Imports</H3>
<H3><a name="Modula3_imports"></a>24.4.4 Imports</H3>
<p>
@ -918,7 +918,7 @@ IMPORT M3toC;
</pre></div>
<H3><a name="exceptions"></a>24.4.5 Exceptions</H3>
<H3><a name="Modula3_exceptions"></a>24.4.5 Exceptions</H3>
<p>
@ -942,7 +942,7 @@ you should declare
<tt>%typemap("m3wrapinconv:throws") blah * %{OSError.E%}</tt>.
</p>
<H3><a name="typemap_example"></a>24.4.6 Example</H3>
<H3><a name="Modula3_typemap_example"></a>24.4.6 Example</H3>
<p>
@ -989,10 +989,10 @@ where almost everything is generated by a typemap:
</pre></div>
<H2><a name="hints"></a>24.5 More hints to the generator</H2>
<H2><a name="Modula3_hints"></a>24.5 More hints to the generator</H2>
<H3><a name="features"></a>24.5.1 Features</H3>
<H3><a name="Modula3_features"></a>24.5.1 Features</H3>
<table border summary="Modula-3 features">
@ -1022,14 +1022,14 @@ where almost everything is generated by a typemap:
This is necessary in the cases
where it was defined by a non-trivial C expression.
This feature is used by the
<tt>-generateconst</tt> <a href="#options">option</a>.
<tt>-generateconst</tt> <a href="#Modula3_commandline">option</a>.
In future it may be generalized to other kind of values
such as strings.
</td>
</tr>
</table>
<H3><a name="pragmas"></a>24.5.2 Pragmas</H3>
<H3><a name="Modula3_pragmas"></a>24.5.2 Pragmas</H3>
<table border summary="Modula-3 pragmas">
@ -1052,7 +1052,7 @@ where almost everything is generated by a typemap:
</tr>
</table>
<H2><a name="remarks"></a>24.6 Remarks</H2>
<H2><a name="Modula3_remarks"></a>24.6 Remarks</H2>
<ul>

View file

@ -13,7 +13,7 @@
<li><a href="#Modules_introduction">Modules Introduction</a>
<li><a href="#Modules_nn1">Basics</a>
<li><a href="#Modules_nn2">The SWIG runtime code</a>
<li><a href="#external_run_time">External access to the runtime</a>
<li><a href="#Modules_external_run_time">External access to the runtime</a>
<li><a href="#Modules_nn4">A word of caution about static libraries</a>
<li><a href="#Modules_nn5">References</a>
<li><a href="#Modules_nn6">Reducing the wrapper file size</a>
@ -241,7 +241,7 @@ can peacefully coexist. So the type structures are separated by the
is empty. Only modules compiled with the same pair will share type information.
</p>
<H2><a name="external_run_time"></a>15.4 External access to the runtime</H2>
<H2><a name="Modules_external_run_time"></a>15.4 External access to the runtime</H2>
<p>As described in <a href="Typemaps.html#runtime_type_checker">The run-time type checker</a>,

View file

@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
<H1><a name="MzScheme"></a>25 SWIG and MzScheme</H1>
<H1><a name="Mzscheme"></a>25 SWIG and MzScheme</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>

View file

@ -2921,7 +2921,7 @@ not even sure if it really works).
<p>
It is possible to override the SWIG generated proxy/shadow methods, using <tt>%feature("shadow")</tt>.
It works like all the other <a href="Customization.html#features">%feature directives</a>.
It works like all the other <a href="Customization.html#Customization_features">%feature directives</a>.
Here is a simple example showing how to add some Perl debug code to the constructor:
</p>

View file

@ -413,7 +413,7 @@ Although PHP does not support overloading functions natively, swig
will generate dispatch functions which will use <tt>%typecheck</tt>
typemaps to allow overloading. This dispatch function's operation and
precedence is described in <a
href="TypemapsSWIGPlus.html#SWIGPlus_overloaded_methods">Wrapping
href="SWIGPlus.html#SWIGPlus_overloaded_methods">Wrapping
Overloaded Functions and Methods</a>.
</p>

View file

@ -81,7 +81,7 @@ Such information generally includes type declarations (e.g., <tt>typedef</tt>) a
C++ classes that might be used as base-classes for class declarations in the interface.
The use of <tt>%import</tt> is also important when SWIG is used to generate
extensions as a collection of related modules. This is an advanced topic and is described
in later in the <a href="Modules.html">Working with Modules</a> chapter.
in later in the <a href="Modules.html#Modules">Working with Modules</a> chapter.
</p>
<P>
@ -377,7 +377,7 @@ SWIG will strip the extra <tt>%</tt> and leave the preprocessor directive in the
<p>
<a href="Typemaps.html">Typemaps</a> support a special attribute called <tt>noblock</tt> where the { ... } delimiters can be used,
<a href="Typemaps.html#Typemaps">Typemaps</a> support a special attribute called <tt>noblock</tt> where the { ... } delimiters can be used,
but the delimiters are not actually generated into the code.
The effect is then similar to using "" or %{ %} delimiters but the code <b>is</b> run through the preprocessor. For example:
</p>

View file

@ -2513,7 +2513,7 @@ in Python-2.2, an entirely new type of class system was introduced.
This new-style class system offers many enhancements including static
member functions, properties (managed attributes), and class methods.
Details about all of these changes can be found on <a
href="//www.python.org">www.python.org</a> and is not repeated here.
href="http://www.python.org">www.python.org</a> and is not repeated here.
</p>
<p>

View file

@ -58,7 +58,7 @@
<li><a href="#Ruby_nn22">C++ namespaces</a>
<li><a href="#Ruby_nn23">C++ templates</a>
<li><a href="#Ruby_nn23_1">C++ Standard Template Library (STL)</a>
<li><a href="#C_STL_Functors">C++ STL Functors</a>
<li><a href="#Ruby_C_STL_Functors">C++ STL Functors</a>
<li><a href="#Ruby_C_Iterators">C++ STL Iterators</a>
<li><a href="#Ruby_nn24">C++ Smart Pointers</a>
<li><a href="#Ruby_nn25">Cross-Language Polymorphism</a>
@ -142,7 +142,7 @@
</ul>
<li><a href="#Ruby_nn53">Advanced Topics</a>
<ul>
<li><a href="#Ruby_nn54">Operator overloading</a>
<li><a href="#Ruby_operator_overloading">Operator overloading</a>
<li><a href="#Ruby_nn55">Creating Multi-Module Packages</a>
<li><a href="#Ruby_nn56">Specifying Mixin Modules</a>
</ul>
@ -1317,7 +1317,7 @@ this code: </p>
<p> If you want to set an array member, you will need to supply a
"memberin" typemap described in the <a href="#ruby_cpp_smart_pointers">section on typemaps</a>.
"memberin" typemap described in the <a href="#Ruby_memberin_typemap">section on typemaps</a>.
As a special case, SWIG does generate code to set array members of type
<tt>char</tt> (allowing you to store a Ruby string in the
structure). </p>
@ -1956,7 +1956,7 @@ example: </p>
<p> More details about wrapping C++ operators into Ruby operators
is discussed in the <a href="#ruby_operator_overloading">section
is discussed in the <a href="#Ruby_operator_overloading">section
on operator overloading</a>. </p>
@ -2336,7 +2336,7 @@ chapter.</p>
<H3><a name="C_STL_Functors"></a>32.3.14 C++ STL Functors</H3>
<H3><a name="Ruby_C_STL_Functors"></a>32.3.14 C++ STL Functors</H3>
<p>Some containers in the STL allow you to modify their default
@ -2877,7 +2877,7 @@ method. For example: </p>
<p> SWIG's Ruby module supports cross-language polymorphism
(a.k.a. the "directors" feature) similar to that for SWIG's Python
module. Rather than duplicate the information presented in the <a href="Ruby">Python</a> chapter, this
module. Rather than duplicate the information presented in the <a href="Python.html#Python">Python</a> chapter, this
section just notes the differences that you need to be aware of when
using this feature with Ruby. </p>
@ -6089,7 +6089,7 @@ a function. For example:</p>
<p> See <a href="http://www.swig.org/Doc1.3/SWIGDocumentation.html#ownership">Object
<p> See <a href="Customization.html#Customization_ownership">Object
ownership and %newobject</a> for further details.</p>
@ -7099,8 +7099,8 @@ being created. </div>
<p> When you write a typemap, you usually have to work directly
with Ruby objects. The following functions may prove to be useful.
(These functions plus many more can be found in <a href="http://www.rubycentral.com/book"><em>Programming
Ruby</em></a>, by David Thomas and Andrew Hunt.)&nbsp;</p>
(These functions plus many more can be found in <em>Programming
Ruby</em> book, by David Thomas and Andrew Hunt.)&nbsp;</p>
<p>In addition, we list equivalent functions that SWIG defines, which
provide a language neutral conversion (these functions are defined for
each swig language supported). &nbsp;If you are trying to create a swig
@ -8510,7 +8510,7 @@ docstring and they are output together. </p>
<H2><a name="Ruby_nn53"></a>32.9 Advanced Topics</H2>
<H3><a name="Ruby_nn54"></a>32.9.1 Operator overloading</H3>
<H3><a name="Ruby_operator_overloading"></a>32.9.1 Operator overloading</H3>
<p> SWIG allows operator overloading with, by using the <tt>%extend</tt>
@ -9530,7 +9530,7 @@ parses the expression <i>a != b</i> as <i>!(a == b)</i>.
<H3><a name="Ruby_nn55"></a>32.9.2 Creating Multi-Module Packages</H3>
<p> The chapter on <a href="Modules.html">Working
<p> The chapter on <a href="Modules.html#Modules">Working
with Modules</a> discusses the basics of creating multi-module
extensions with SWIG, and in particular the considerations for sharing
runtime type information among the different modules. </p>
@ -10050,7 +10050,7 @@ above. For example:</p>
<p>In this case, the default SWIG behavior for calling member
functions is incorrect. The Ruby object should assume ownership of the
returned object. This can be done by using the %newobject directive.
See <a href="file:///d:/msys/1.0/src/SWIG/Doc/Manual/Customization.html#ownership">
See <a href="Customization.html#Customization_ownership">
Object ownership and %newobject</a> for more information. </p>

View file

@ -13,7 +13,7 @@
<li><a href="#SWIG_nn2">Running SWIG</a>
<ul>
<li><a href="#SWIG_nn3">Input format</a>
<li><a href="#output">SWIG Output</a>
<li><a href="#SWIG_output">SWIG Output</a>
<li><a href="#SWIG_nn5">Comments</a>
<li><a href="#SWIG_nn6">C Preprocessor</a>
<li><a href="#SWIG_nn7">SWIG Directives</a>
@ -193,7 +193,7 @@ semantics in SWIG is analogous to that of the declarations section
used in input files to parser generation tools such as yacc or bison.
</p>
<H3><a name="output"></a>5.1.2 SWIG Output</H3>
<H3><a name="SWIG_output"></a>5.1.2 SWIG Output</H3>
<p>
@ -1618,7 +1618,7 @@ double y; // Read-write
<p>
The <tt>%mutable</tt> and <tt>%immutable</tt> directives are actually
<a href="Customization.html#features">%feature directives</a> defined like this:
<a href="Customization.html#Customization_features">%feature directives</a> defined like this:
</p>
<div class="code"><pre>
@ -1672,7 +1672,7 @@ directive as shown :</p>
// interface.i
%rename(my_print) print;
extern void print(char *);
extern void print(const char *);
%rename(foo) a_really_long_and_annoying_name;
extern int a_really_long_and_annoying_name;
@ -1725,9 +1725,10 @@ to ignore declarations that match a given identifier. For example:
<div class="code">
<pre>
%ignore print; // Ignore all declarations named print
%ignore _HAVE_FOO_H; // Ignore an include guard constant
%ignore MYMACRO; // Ignore a macro
...
%include "foo.h" // Grab a header file
#define MYMACRO 123
void print(const char *);
...
</pre>
</div>
@ -1742,7 +1743,7 @@ declarations. If you need to remove a whole section of problematic code, the SW
<p>
More powerful variants of <tt>%rename</tt> and <tt>%ignore</tt> directives can be used to help
wrap C++ overloaded functions and methods or C++ methods which use default arguments. This is described in the
<a href="SWIGPlus.html#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section in the C++ chapter.
<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section in the C++ chapter.
</p>
<p>
@ -1752,7 +1753,7 @@ For example:
<div class="code">
<pre>
%name(output) extern void print(char *);
%name(output) extern void print(const char *);
</pre>
</div>

View file

@ -42,13 +42,16 @@
<ul>
<li><a href="#SWIGPlus_nn24">Dispatch function generation</a>
<li><a href="#SWIGPlus_nn25">Ambiguity in Overloading</a>
<li><a href="#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
<li><a href="#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
<li><a href="#SWIGPlus_nn27">Comments on overloading</a>
</ul>
<li><a href="#SWIGPlus_nn28">Wrapping overloaded operators</a>
<li><a href="#SWIGPlus_class_extension">Class extension</a>
<li><a href="#SWIGPlus_nn30">Templates</a>
<li><a href="#SWIGPlus_nn31">Namespaces</a>
<li><a href="#SWIGPlus_namespaces">Namespaces</a>
<ul>
<li><a href="#SWIGPlus_nspace">The nspace feature for namespaces</a>
</ul>
<li><a href="#SWIGPlus_renaming_templated_types_namespaces">Renaming templated types in namespaces</a>
<li><a href="#SWIGPlus_exception_specifications">Exception specifications</a>
<li><a href="#SWIGPlus_catches">Exception handling with %catches</a>
@ -1125,7 +1128,7 @@ For example if a method has ten default arguments, then eleven wrapper methods a
<p>
Please see the <a href="Customization.html#Customization_features_default_args">Features and default arguments</a>
section for more information on using <tt>%feature</tt> with functions with default arguments.
The <a href="#ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section
The <a href="#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section
also deals with using <tt>%rename</tt> and <tt>%ignore</tt> on methods with default arguments.
If you are writing your own typemaps for types used in methods with default arguments, you may also need to write a <tt>typecheck</tt> typemap.
See the <a href="Typemaps.html#Typemaps_overloading">Typemaps and overloading</a> section for details or otherwise
@ -2124,7 +2127,7 @@ it means that the target language module has not yet implemented support for ove
functions and methods. The only way to fix the problem is to read the next section.
</p>
<H3><a name="ambiguity_resolution_renaming"></a>6.15.3 Ambiguity resolution and renaming</H3>
<H3><a name="SWIGPlus_ambiguity_resolution_renaming"></a>6.15.3 Ambiguity resolution and renaming</H3>
<p>
@ -3647,12 +3650,16 @@ as the class name. For example:
Similar changes apply to typemaps and other customization features.
</p>
<H2><a name="SWIGPlus_nn31"></a>6.19 Namespaces</H2>
<H2><a name="SWIGPlus_namespaces"></a>6.19 Namespaces</H2>
<p>
Support for C++ namespaces is a relatively late addition to SWIG,
first appearing in SWIG-1.3.12. Before describing the implementation,
Support for C++ namespaces is comprehensive, but by default simple, however,
some target languages can turn on more advanced namespace support via the
<a href="#SWIGPlus_nspace">nspace feature</a>, described later.
Code within unnamed namespaces is ignored as there is no external
access to symbols declared within the unnamed namespace.
Before detailing the default implementation for named namespaces,
it is worth noting that the semantics of C++ namespaces is extremely
non-trivial--especially with regard to the C++ type system and class
machinery. At a most basic level, namespaces are sometimes used to
@ -3836,7 +3843,7 @@ When this conflict occurs, you will get an error message that resembles this:
<div class="shell">
<pre>
example.i:26. Error. 'foo' is multiply defined in the generated module.
example.i:26. Error. 'foo' is multiply defined in the generated target language module.
example.i:23. Previous declaration of 'foo'
</pre>
</div>
@ -4092,6 +4099,87 @@ with any namespace awareness. In the future, language modules may or may not p
more advanced namespace support.
</p>
<H3><a name="SWIGPlus_nspace"></a>6.19.1 The nspace feature for namespaces</H3>
<p>
Some target languages provide support for the <tt>nspace</tt> <a href="Customization.html#Customization_features">feature</a>.
The feature can be applied to any class, struct, union or enum declared within a named namespace.
The feature wraps the type within the target language specific concept of a namespace,
for example, a Java package or C# namespace.
Please see the language specific sections to see if the target language you are interested in supports the nspace feature.
</p>
<p>
The feature is demonstrated below for C# using the following example:
</p>
<div class="code">
<pre>
%feature("nspace") MyWorld::Material::Color;
%nspace MyWorld::Wrapping::Color; // %nspace is a macro for %feature("nspace")
namespace MyWorld {
namespace Material {
class Color {
...
};
}
namespace Wrapping {
class Color {
...
};
}
}
</pre>
</div>
<p>
Without the <tt>nspace</tt> feature directives above or <tt>%rename</tt>, you would get the following warning resulting in just one of the <tt>Color</tt> classes being available for use from the target language:
</p>
<div class="shell">
<pre>
example.i:9: Error: 'Color' is multiply defined in the generated target language module.
example.i:5: Error: Previous declaration of 'Color'
</pre>
</div>
<p>
With the <tt>nspace</tt> feature the two <tt>Color</tt> classes are wrapped into the equivalent C# namespaces.
A fully qualified constructor call of each these two types in C# is then:
</p>
<div class="targetlang">
<pre>
MyWorld.Material.Color materialColor = new MyWorld.Material.Color();
MyWorld.Wrapping.Color wrappingColor = new MyWorld.Wrapping.Color();
</pre>
</div>
<p>
Note that the <tt>nspace</tt> feature does not apply to variables and functions simply declared in a namespace. For example, the following symbols cannot co-exist in the target language without renaming. This may change in a future version.
</p>
<div class="code">
<pre>
namespace MyWorld {
namespace Material {
int quantity;
void dispatch();
}
namespace Wrapping {
int quantity;
void dispatch();
}
}
</pre>
</div>
<p>
<b>Compatibility Note:</b> The nspace feature was first introduced in SWIG-2.0.0.
</p>
<H2><a name="SWIGPlus_renaming_templated_types_namespaces"></a>6.20 Renaming templated types in namespaces</H2>
@ -4216,7 +4304,7 @@ is outlined in the <a href="Typemaps.html#throws_typemap">"throws" typemap</a> s
<p>
Since exception specifications are sometimes only used sparingly, this alone may not be enough to
properly handle C++ exceptions. To do that, a different set of special SWIG directives are used.
Consult the "<a href="Customization.html#exception">Exception handling with %exception</a>" section for details.
Consult the "<a href="Customization.html#Customization_exception">Exception handling with %exception</a>" section for details.
The next section details a way of simulating an exception specification or replacing an existing one.
</p>

View file

@ -41,13 +41,13 @@ to help!).
<H3>Language Module Documentation</H3>
<ul>
<li><a href="Allegrocl.html#Allegrocl_nn1">Allegro CL support</a></li>
<li><a href="Allegrocl.html#Allegrocl">Allegro CL support</a></li>
<li><a href="CSharp.html#CSharp">C# support</a></li>
<li><a href="Chicken.html#Chicken">Chicken support</a></li>
<li><a href="Guile.html#Guile">Guile support</a></li>
<li><a href="Java.html#Java">Java support</a></li>
<li><a href="Lua.html#Lua_nn1">Lua support</a></li>
<li><a href="Lisp.html#Lisp_nn1">Common Lisp support</a></li>
<li><a href="Lua.html#Lua">Lua support</a></li>
<li><a href="Lisp.html#Lisp">Common Lisp support</a></li>
<li><a href="Modula3.html#Modula3">Modula3 support</a></li>
<li><a href="Mzscheme.html#MzScheme">MzScheme support</a></li>
<li><a href="Ocaml.html#Ocaml">Ocaml support</a></li>
@ -78,9 +78,5 @@ implementation of typemaps. Make sure you read the <a href="Typemaps.html#Type
chapter above if you are using this feature.
</p>
<ul>
<li><a href="Advanced.html#Advanced">Advanced topics</a> (see <a href="Modules.html#Modules">Modules</a> for updated information).</li>
</ul>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -102,7 +102,7 @@ int foo(double); // Silently ignored.
<p>
The <tt>%warnfilter</tt> directive has the same semantics as other declaration modifiers like
<tt>%rename</tt>, <tt>%ignore</tt> and <tt>%feature</tt>, see the
<a href="Customization.html#features">%feature directive</a> section. For example, if you wanted to
<a href="Customization.html#Customization_features">%feature directive</a> section. For example, if you wanted to
suppress a warning for a method in a class hierarchy, you could do this:
</p>

View file

@ -84,6 +84,11 @@ CXXSHARED= @CXXSHARED@
OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@)
distclean:
rm -f Makefile
rm -f guile/Makefile
rm -f xml/Makefile
##################################################################
##### Tcl/Tk ######
##################################################################

View file

@ -2,9 +2,7 @@ SWIG Examples
The "perl5", "python", "tcl", "guile", "java", "mzscheme", "ruby", and
"chicken" directories contain a number of simple examples that are
primarily used for testing. The "GIFPlot" directory contains a more
complicated example that illustrates some of SWIG's more advanced
capabilities.
primarily used for testing.
The file 'index.html' is the top of a hyperlinked document that
contains information about all of the examples along with various

View file

@ -12,6 +12,3 @@ std_vector -- C++ STL vector<int> and vector<double>
Note that the examples in this directory build a special version of
Guile which includes the wrapped functions in the top-level module.
If you want to put the wrapped functions into an own module,
statically or dynamically linked, see the Examples/GIFPlot/Guile
directory.

View file

@ -46,12 +46,6 @@ language:
If your target platform is Windows, make sure you also see the <a href="../Doc/Manual/Windows.html">Windows</a> page in the main manual.
<h2>Real Life</h2>
The <a href="GIFPlot/">GIFPlot</a> directory contains examples that illustrate the use of SWIG with
a moderately complex C library for creating GIF images. Many of these
examples illustrate more advanced SWIG features.
</body>
</html>

View file

@ -66,24 +66,6 @@ The examples have been extensively tested on the following platforms:
Please see the <a href="../../Doc/Manual/Windows.html">Windows</a> page in the main manual for information on using the examples on Windows. <p>
The most recent version of Perl used for testing is as follows:
<blockquote>
<pre>
% perl -version
This is perl, v5.6.0 built for sun4-solaris
Copyright 1987-2000, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
</pre>
</blockquote>
<p>
Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
the code generated by SWIG is extremely messy. We have made every attempt to maintain compatibility with

View file

@ -1,4 +1,10 @@
/* File : example.i */
%module example
int printf(const char *fmt, ...);
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -1,10 +1,51 @@
# file: runme.py
from example import *
# This file illustrates the proxy class C++ interface generated
# by SWIG.
printf("hello\n")
import example
# ----- Object creation -----
print "Creating some objects:"
c = example.Circle(10)
print " Created circle", c
s = example.Square(10)
print " Created square", s
# ----- Access a static member -----
print "\nA total of", example.cvar.Shape_nshapes,"shapes were created"
# ----- Member data access -----
# Set the location of the object
c.x = 20
c.y = 30
s.x = -10
s.y = 5
print "\nHere is their current position:"
print " Circle = (%f, %f)" % (c.x,c.y)
print " Square = (%f, %f)" % (s.x,s.y)
# ----- Call some methods -----
print "\nHere are some properties of the shapes:"
for o in [c,s]:
print " ", o
print " area = ", o.area()
print " perimeter = ", o.perimeter()
print "\nGuess I'll clean up now"
# Note: this invokes the virtual destructor
del c
del s
s = 3
print example.cvar.Shape_nshapes,"shapes remain"
print "Goodbye"
name = "%shoot"
num = 22
printf("Hello %s. Your number is %d\n" % (name, num))
print("hello there %s." % name);
printf("Your result is 90%.\n")

View file

@ -1,22 +0,0 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS =
TARGET = example
INTERFACE = example.i
LIBS = -lm
SWIGOPT =
all::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static::
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean::
$(MAKE) -f $(TOP)/Makefile python_clean
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -1,25 +0,0 @@
This directory contains a simple example to test weave support for
SWIG wrapped objects.
The weave package provides tools for including C/C++ code in Python
code. This offers both another level of optimization to those who need
it, and an easy way to modify and extend any supported extension
libraries. Weave automatically builds an extension module from the
given C/C++ code and runs that. This can result in very significant
speedups (of upto 500x) depending on the problem. Weave also supports
inlining SWIG-1.3.x wrapped objects.
The example in this directory requires that weave be installed. Weave
is distributed as part of SciPy (http://www.scipy.org). More
information on Weave may be had from here:
http://www.scipy.org/documentation/weave
As of November 22, 2004, this example only works with weave from CVS.
If there is a more recent release of SciPy after this date, it should
work fine.
Also, you need to replace the weave file swigptr2.py by the one
provided here.

View file

@ -1,18 +0,0 @@
#ifndef _EXAMPLE_H
#define _EXAMPLE_H
class Foo {
public:
int x;
};
class Bar {
public:
int y;
};
class FooBar : public Foo, public Bar {
public:
int z;
};
#endif

View file

@ -1,15 +0,0 @@
%module(directors="1") example
%{
#include "example.h"
%}
%include "std_vector.i"
%director Foo;
%director Bar;
%include "example.h"
%template(VectorBar) std::vector<Bar*>;
%template(VectorFoo) std::vector<Foo*>;

View file

@ -1,72 +0,0 @@
"""
Test weave support for SWIG wrapped objects.
This example requires that one has weave installed. Weave is
distributed as part of SciPy (http://www.scipy.org). More information
on Weave may be had from here:
http://www.scipy.org/documentation/weave
As of November 22, 2004, this only works with weave from CVS. If
there is a more recent release of SciPy after this date, it should
work fine.
"""
import example
import weave
from weave import converters
from weave import swig2_spec
# Weave does not support swig2 by default (yet). So add this to the
# list of default converters to test.
converters.default.insert(0, swig2_spec.swig2_converter())
def test():
""" A simple test case for weave."""
a = example.Foo()
a.x = 1
b = example.Bar()
b.y = 2
c = example.FooBar()
c.x = 1
c.y = 2
c.z = 3
v = example.VectorBar()
v.append(b)
v.append(c)
d = v[0]
e = v[1]
v = example.VectorFoo()
v.append(a)
v.append(c)
f = v[0]
g = v[1]
code = """
std::cout << a->x << std::endl;
assert(a->x == 1);
std::cout << b->y << std::endl;
assert(b->y == 2);
std::cout << c->x << std::endl;
std::cout << c->y << std::endl;
std::cout << c->z << std::endl;
assert(c->x == 1);
assert(c->y == 2);
assert(c->z == 3);
std::cout << d->y << std::endl;
assert(d->y == 2);
std::cout << e->y << std::endl;
assert(e->y == 2);
std::cout << f->x << std::endl;
assert(f->x == 1);
std::cout << g->x << std::endl;
assert(g->x == 1);
"""
weave.inline(code, ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
include_dirs=['.'],
headers=['"example.h"'],
verbose=2)
if __name__ == "__main__":
test()

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@ extern int gcd(int x, int y);
if (TYPE($input) != T_ARRAY) {
SWIG_exception(SWIG_ValueError, "Expected an array");
}
$1 = RARRAY($input)->len;
$1 = RARRAY_LEN($input);
if ($1 == 0) {
SWIG_exception(SWIG_ValueError, "List must contain at least 1 element");
}
@ -47,7 +47,7 @@ extern int gcdmain(int argc, char *argv[]);
SWIG_exception(SWIG_ValueError, "Expected a string");
}
$1 = STR2CSTR($input);
$2 = RSTRING($input)->len;
$2 = RSTRING_LEN($input);
}
extern int count(char *bytes, int len, char c);
@ -61,7 +61,7 @@ extern int count(char *bytes, int len, char c);
SWIG_exception(SWIG_ValueError,"Expected a string");
}
temp = STR2CSTR($input);
$2 = RSTRING($input)->len;
$2 = RSTRING_LEN($input);
$1 = (char *) malloc($2+1);
memmove($1,temp,$2);
}

View file

@ -312,67 +312,6 @@ is no representation."
;; Test instances
#||
#+ignore
(defvar *gifplot-interface*
(run-swig (merge-pathnames "Examples/GIFPlot/Interface/gifplot.i"
*swig-source-directory*)
:directory-search-list (list (merge-pathnames "Examples/GIFPlot/Interface/" *swig-source-directory*))))
(defvar *simple-gifplot-interface*
(run-swig (merge-pathnames "Examples/GIFPlot/Include/gifplot.h"
*swig-source-directory*)
:directory-search-list (list (merge-pathnames "Examples/GIFPlot/Interface/" *swig-source-directory*))
:module "gifplot"))
(defvar *cplex-glue-directory* #p"/home/mkoeppe/cvs/cplex-glue/")
(defvar *cplex-glue-interface*
(run-swig (merge-pathnames "cplex.i" *cplex-glue-directory*)
:directory-search-list (list (merge-pathnames "Lib/guile"
*swig-source-directory*)
*cplex-glue-directory*)
:ignore-errors t))
(require 'uffi)
;;(let ((*uffi-primitive-type-alist* (cons '("Pixel" . :unsigned-int) *uffi-default-primitive-type-alist*)))
;; (eval (cons 'progn (compute-uffi-definitions *simple-gifplot-interface*))))
(with-open-file (f "/tmp/swig-uffi.lisp" :direction :output
:if-exists :supersede)
(let ((*uffi-definitions* '())
(*uffi-output* f)
(*uffi-primitive-type-alist*
(cons '("Pixel" . :unsigned-int) *uffi-default-primitive-type-alist*)))
(apply 'handle-node *simple-gifplot-interface*)))
#+cplex
(with-open-file (f "/tmp/swig-uffi.lisp" :direction :output)
(let ((*uffi-definitions* '())
(*uffi-output* f)
(*uffi-primitive-type-alist*
(cons '("Pixel" . :unsigned-int) *uffi-default-primitive-type-alist*)))
(apply 'handle-node *cplex-glue-interface*)))
(compile-file "/tmp/swig-uffi.lisp")
(uffi:load-foreign-library (merge-pathnames "Examples/GIFPlot/libgifplot.a"
*swig-source-directory*))
(load "/tmp/swig-uffi.lisp")
(load (merge-pathnames "Examples/GIFPlot/Common-Lisp/full/runme.lisp" *swig-source-directory*))
(action (namestring (merge-pathnames "Examples/GIFPlot/Common-Lisp/full/cmap"
*swig-source-directory*)))
||#
;;; Link to SWIG itself
#||

View file

@ -109,6 +109,12 @@ bool SetConstCharArrayStaticString(const char str[], unsigned int number) {
char *CharPingPong(char *str) {
return str;
}
char *CharArrayPingPong(char abcstr[]) {
return abcstr;
}
char *CharArrayDimsPingPong(char abcstr[16]) {
return abcstr;
}
// variables
char *global_char = NULL;

View file

@ -131,6 +131,7 @@ CPP_TEST_CASES += \
constructor_exception \
constructor_explicit \
constructor_ignore \
constructor_rename \
constructor_value \
contract \
conversion \
@ -198,6 +199,7 @@ CPP_TEST_CASES += \
fvirtual \
global_namespace \
global_ns_arg \
global_scope_types \
global_vars \
grouping \
ignore_parameter \
@ -241,6 +243,8 @@ CPP_TEST_CASES += \
namespace_typemap \
namespace_union \
namespace_virtual_method \
nspace \
nspace_extend \
naturalvar \
nested_class \
nested_comment \
@ -304,6 +308,7 @@ CPP_TEST_CASES += \
static_const_member_2 \
struct_initialization_cpp \
struct_value \
symbol_clash \
template \
template_arg_replace \
template_arg_scope \
@ -371,6 +376,7 @@ CPP_TEST_CASES += \
template_virtual \
template_whitespace \
threads \
threads_exception \
throw_exception \
typedef_array_member \
typedef_class \
@ -381,9 +387,11 @@ CPP_TEST_CASES += \
typedef_scope \
typedef_sizet \
typedef_struct \
typemap_global_scope \
typemap_namespace \
typemap_ns_using \
typemap_numinputs \
typemap_template \
typemap_out_optimal \
typemap_variables \
typemap_various \

View file

@ -5,7 +5,7 @@
/* % didn't work in SWIG 1.3.40 and earlier. */
const int X = 123%7;
#define FOO 12 % 6
double d_array[12 % 6];
#define FOO 12 % 9
double d_array[12 % 9];
%}

View file

@ -70,6 +70,8 @@ public:
void ret6(int*& a) {}
int*& ret7() {return GlobalIntPtr;}
void ret8(int*const& a) {}
int*const& ret9() {return GlobalIntPtr;}
ReturnValuesTest() : int3(NULL) {}
private:
ReturnValuesTest& operator=(const ReturnValuesTest&);
@ -112,7 +114,7 @@ int* const globalRet2() {return &GlobalInt;}
return b;
}
B const*& cbar(B const*& b) {
B *const& cbar(B *const& b) {
return b;
}
}

View file

@ -0,0 +1,12 @@
%module constructor_rename
%{
struct Foo {
Foo() {}
};
%}
struct Foo {
%rename(RenamedConstructor) Foo();
Foo() {}
};

View file

@ -69,14 +69,13 @@ run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
$*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
CSHARPSRCS='*.cs' csharp_compile && cd .. ; \
CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \
fi
# Clean: remove testcase directories

View file

@ -0,0 +1,39 @@
using System;
public class runme
{
static void Main()
{
{
// constructors and destructors
nspace_extendNamespace.Outer.Inner1.Color color1 = new nspace_extendNamespace.Outer.Inner1.Color();
nspace_extendNamespace.Outer.Inner1.Color color = new nspace_extendNamespace.Outer.Inner1.Color(color1);
color1.Dispose();
color1 = null;
// class methods
color.colorInstanceMethod(20.0);
nspace_extendNamespace.Outer.Inner1.Color.colorStaticMethod(20.0);
nspace_extendNamespace.Outer.Inner1.Color created = nspace_extendNamespace.Outer.Inner1.Color.create();
created.Dispose();
}
{
// constructors and destructors
nspace_extendNamespace.Outer.Inner2.Color color2 = new nspace_extendNamespace.Outer.Inner2.Color();
nspace_extendNamespace.Outer.Inner2.Color color = new nspace_extendNamespace.Outer.Inner2.Color(color2);
color2.Dispose();
color2 = null;
// class methods
color.colorInstanceMethod(20.0);
nspace_extendNamespace.Outer.Inner2.Color.colorStaticMethod(20.0);
nspace_extendNamespace.Outer.Inner2.Color created = nspace_extendNamespace.Outer.Inner2.Color.create();
created.Dispose();
// Same class different namespaces
nspace_extendNamespace.Outer.Inner1.Color col1 = new nspace_extendNamespace.Outer.Inner1.Color();
nspace_extendNamespace.Outer.Inner2.Color col2 = nspace_extendNamespace.Outer.Inner2.Color.create();
col2.colors(col1, col1, col2, col2, col2);
}
}
}

View file

@ -0,0 +1,76 @@
using System;
public class runme
{
static void Main()
{
// constructors and destructors
nspaceNamespace.Outer.Inner1.Color color1 = new nspaceNamespace.Outer.Inner1.Color();
nspaceNamespace.Outer.Inner1.Color color = new nspaceNamespace.Outer.Inner1.Color(color1);
color1.Dispose();
color1 = null;
// class methods
color.colorInstanceMethod(20.0);
nspaceNamespace.Outer.Inner1.Color.colorStaticMethod(20.0);
nspaceNamespace.Outer.Inner1.Color created = nspaceNamespace.Outer.Inner1.Color.create();
created.Dispose();
// class enums
nspaceNamespace.Outer.SomeClass someClass = new nspaceNamespace.Outer.SomeClass();
nspaceNamespace.Outer.Inner1.Color.Channel channel = someClass.GetInner1ColorChannel();
if (channel != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
throw new ApplicationException("Transmission wrong");
// class anonymous enums
int val1 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal1;
int val2 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal2;
if (val1 != 0 || val2 != 0x22)
throw new ApplicationException("ColorEnumVal wrong");
// instance member variables
color.instanceMemberVariable = 123;
if (color.instanceMemberVariable != 123)
throw new ApplicationException("instance member variable failed");
// static member variables
nspaceNamespace.Outer.Inner1.Color.staticMemberVariable = 789;
if (nspaceNamespace.Outer.Inner1.Color.staticMemberVariable != 789)
throw new ApplicationException("static member variable failed");
if (nspaceNamespace.Outer.Inner1.Color.staticConstMemberVariable != 222)
throw new ApplicationException("static const member variable failed");
if (nspaceNamespace.Outer.Inner1.Color.staticConstEnumMemberVariable != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
throw new ApplicationException("static const enum member variable failed");
// check globals in a namespace don't get mangled with the nspaceNamespace option
nspaceNamespace.nspace.namespaceFunction(color);
nspaceNamespace.nspace.namespaceVar = 111;
if (nspaceNamespace.nspace.namespaceVar != 111)
throw new ApplicationException("global var failed");
// Same class different namespaces
nspaceNamespace.Outer.Inner1.Color col1 = new nspaceNamespace.Outer.Inner1.Color();
nspaceNamespace.Outer.Inner2.Color col2 = nspaceNamespace.Outer.Inner2.Color.create();
col2.colors(col1, col1, col2, col2, col2);
// global enums
nspaceNamespace.Outer.Inner1.Channel outerChannel1 = someClass.GetInner1Channel();
if (outerChannel1 != nspaceNamespace.Outer.Inner1.Channel.Transmission1)
throw new ApplicationException("Transmission1 wrong");
nspaceNamespace.Outer.Inner2.Channel outerChannel2 = someClass.GetInner2Channel();
if (outerChannel2 != nspaceNamespace.Outer.Inner2.Channel.Transmission2)
throw new ApplicationException("Transmission2 wrong");
// turn feature off / ignoring
nspaceNamespace.Outer.nspace ns = new nspaceNamespace.Outer.nspace();
ns.Dispose();
nspaceNamespace.NoNSpacePlease nons = new nspaceNamespace.NoNSpacePlease();
nons.Dispose();
// Derived class
nspaceNamespace.Outer.Inner3.Blue blue3 = new nspaceNamespace.Outer.Inner3.Blue();
blue3.blueInstanceMethod();
nspaceNamespace.Outer.Inner4.Blue blue4 = new nspaceNamespace.Outer.Inner4.Blue();
blue4.blueInstanceMethod();
}
}

View file

@ -1,5 +1,5 @@
%module extend_template
%module xxx
%module xxx // should be ignored
namespace oss { // this doesn't
%extend Foo<0> {
int test1(int x) { return x; }

View file

@ -11,8 +11,8 @@ class Klass6 {};
class Klass7 {};
struct KlassMethods {
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, Klass7*& pr) {}
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*& pr) {}
static void methodA(::Klass1 v, const ::Klass2 cv, const ::Klass3 *cp, ::Klass4 *p, const ::Klass5 &cr, ::Klass6 &r, ::Klass7*const& pr) {}
static void methodB( Klass1 v, const Klass2 cv, const Klass3 *cp, Klass4 *p, const Klass5 &cr, Klass6 &r, Klass7*const& pr) {}
};
%}
@ -28,8 +28,8 @@ class XYZ7 {};
}
struct XYZMethods {
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, Space::XYZ7*& pr) {}
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*& pr) {}
static void methodA(::Space::XYZ1 v, const ::Space::XYZ2 cv, const ::Space::XYZ3 *cp, ::Space::XYZ4 *p, const ::Space::XYZ5 &cr, ::Space::XYZ6 &r, ::Space::XYZ7*const& pr) {}
static void methodB( Space::XYZ1 v, const Space::XYZ2 cv, const Space::XYZ3 *cp, Space::XYZ4 *p, const Space::XYZ5 &cr, Space::XYZ6 &r, Space::XYZ7*const& pr) {}
};
%}

View file

@ -0,0 +1,44 @@
%module global_scope_types
// no constructor/destructor wrappers as they do not use global scope operator which we are trying to test here
%nodefaultctor Dingaling;
%nodefaultdtor Dingaling;
%inline %{
struct Dingaling {};
typedef Dingaling DINGALING;
template <typename T> struct MyTemplate {
T tt(T t) { return t; }
T& ttr(T& t) { return t; }
};
#ifndef SWIG
// This is added so that the code will not compile, if the global scope operator on Dingaling is omitted in the generated code
namespace Spac {
class Dingaling {
Dingaling();
Dingaling(const Dingaling& t);
Dingaling& operator=(const Dingaling t);
};
}
using namespace Spac;
#endif
namespace Spac {
struct Ting {};
typedef Ting TING;
class Test {
public:
void something(::Dingaling t, ::Dingaling* pt, ::Dingaling& rt, const ::Dingaling& crt) {}
void tsomething(MyTemplate< ::Dingaling > t1, MyTemplate< const ::Dingaling* > t2) {}
// void usomething(::MyTemplate< ::DINGALING > t3, ::MyTemplate< ::DINGALING *> t4) {} // needs fixing
void nothing(::Spac::Ting*, ::Spac::TING&) {}
};
}
void funcptrtest( void (*)(::Dingaling) ) {}
%}

View file

@ -37,26 +37,28 @@ CPP_TEST_CASES = \
include $(srcdir)/../common.mk
# Overridden variables here
SWIGOPT += -package $*
JAVA_PACKAGE = $*
SWIGOPT += -package $(JAVA_PACKAGE)
INTERFACEDIR = ../../
# Custom tests - tests with additional commandline options
# none!
nspace.%: JAVA_PACKAGE = $*Package
nspace_extend.%: JAVA_PACKAGE = $*Package
# Rules for the different types of tests
%.cpptest:
$(setup)
+(cd $* && $(swig_and_compile_cpp))
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_cpp))
$(run_testcase)
%.ctest:
$(setup)
+(cd $* && $(swig_and_compile_c))
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_c))
$(run_testcase)
%.multicpptest:
$(setup)
+(cd $* && $(swig_and_compile_multi_cpp))
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_multi_cpp))
$(run_testcase)
# Makes a directory for the testcase if it does not exist
@ -66,24 +68,24 @@ setup = \
else \
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
if [ ! -d $(JAVA_PACKAGE) ]; then \
mkdir $(JAVA_PACKAGE); \
fi
# Compiles java files then runs the testcase. A testcase is only run if
# a file is found which has _runme.java appended after the testcase name.
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
cd $* && $(COMPILETOOL) $(JAVAC) -classpath . *.java && cd .. && \
cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme; \
env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) -classpath . $*_runme; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
@if [ -d $(JAVA_PACKAGE) ]; then \
rm -rf $(JAVA_PACKAGE); \
fi
clean:

View file

@ -0,0 +1,44 @@
// This tests changes the package name from nspace to nspacePackage as javac can't seem to resolve classes and packages having the same name
public class nspace_extend_runme {
static {
try {
System.loadLibrary("nspace_extend");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
{
// constructors and destructors
nspace_extendPackage.Outer.Inner1.Color color1 = new nspace_extendPackage.Outer.Inner1.Color();
nspace_extendPackage.Outer.Inner1.Color color = new nspace_extendPackage.Outer.Inner1.Color(color1);
color1.delete();
color1 = null;
// class methods
color.colorInstanceMethod(20.0);
nspace_extendPackage.Outer.Inner1.Color.colorStaticMethod(20.0);
nspace_extendPackage.Outer.Inner1.Color created = nspace_extendPackage.Outer.Inner1.Color.create();
}
{
// constructors and destructors
nspace_extendPackage.Outer.Inner2.Color color2 = new nspace_extendPackage.Outer.Inner2.Color();
nspace_extendPackage.Outer.Inner2.Color color = new nspace_extendPackage.Outer.Inner2.Color(color2);
color2.delete();
color2 = null;
// class methods
color.colorInstanceMethod(20.0);
nspace_extendPackage.Outer.Inner2.Color.colorStaticMethod(20.0);
nspace_extendPackage.Outer.Inner2.Color created = nspace_extendPackage.Outer.Inner2.Color.create();
// Same class different namespaces
nspace_extendPackage.Outer.Inner1.Color col1 = new nspace_extendPackage.Outer.Inner1.Color();
nspace_extendPackage.Outer.Inner2.Color col2 = nspace_extendPackage.Outer.Inner2.Color.create();
col2.colors(col1, col1, col2, col2, col2);
}
}
}

View file

@ -0,0 +1,80 @@
// This tests changes the package name from nspace to nspacePackage as javac can't seem to resolve classes and packages having the same name
public class nspace_runme {
static {
try {
System.loadLibrary("nspace");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
// constructors and destructors
nspacePackage.Outer.Inner1.Color color1 = new nspacePackage.Outer.Inner1.Color();
nspacePackage.Outer.Inner1.Color color = new nspacePackage.Outer.Inner1.Color(color1);
color1.delete();
color1 = null;
// class methods
color.colorInstanceMethod(20.0);
nspacePackage.Outer.Inner1.Color.colorStaticMethod(20.0);
nspacePackage.Outer.Inner1.Color created = nspacePackage.Outer.Inner1.Color.create();
// class enums
nspacePackage.Outer.SomeClass someClass = new nspacePackage.Outer.SomeClass();
nspacePackage.Outer.Inner1.Color.Channel channel = someClass.GetInner1ColorChannel();
if (channel != nspacePackage.Outer.Inner1.Color.Channel.Transmission)
throw new RuntimeException("Transmission wrong");
// class anonymous enums
int val1 = nspacePackage.Outer.Inner1.Color.ColorEnumVal1;
int val2 = nspacePackage.Outer.Inner1.Color.ColorEnumVal2;
if (val1 != 0 || val2 != 0x22)
throw new RuntimeException("ColorEnumVal wrong");
// instance member variables
color.setInstanceMemberVariable(123);
if (color.getInstanceMemberVariable() != 123)
throw new RuntimeException("instance member variable failed");
// static member variables
nspacePackage.Outer.Inner1.Color.setStaticMemberVariable(789);
if (nspacePackage.Outer.Inner1.Color.getStaticMemberVariable() != 789)
throw new RuntimeException("static member variable failed");
if (nspacePackage.Outer.Inner1.Color.staticConstMemberVariable != 222)
throw new RuntimeException("static const member variable failed");
if (nspacePackage.Outer.Inner1.Color.staticConstEnumMemberVariable != nspacePackage.Outer.Inner1.Color.Channel.Transmission)
throw new RuntimeException("static const enum member variable failed");
// Same class different namespaces
nspacePackage.Outer.Inner1.Color col1 = new nspacePackage.Outer.Inner1.Color();
nspacePackage.Outer.Inner2.Color col2 = nspacePackage.Outer.Inner2.Color.create();
col2.colors(col1, col1, col2, col2, col2);
// check globals in a namespace don't get mangled with the nspacePackage option
nspacePackage.nspace.namespaceFunction(color);
nspacePackage.nspace.setNamespaceVar(111);
if (nspacePackage.nspace.getNamespaceVar() != 111)
throw new RuntimeException("global var failed");
// global enums
nspacePackage.Outer.Inner1.Channel outerChannel1 = someClass.GetInner1Channel();
if (outerChannel1 != nspacePackage.Outer.Inner1.Channel.Transmission1)
throw new RuntimeException("Transmission1 wrong");
nspacePackage.Outer.Inner2.Channel outerChannel2 = someClass.GetInner2Channel();
if (outerChannel2 != nspacePackage.Outer.Inner2.Channel.Transmission2)
throw new RuntimeException("Transmission2 wrong");
// turn feature off / ignoring
nspacePackage.Outer.nspace ns = new nspacePackage.Outer.nspace();
nspacePackage.NoNSpacePlease nons = new nspacePackage.NoNSpacePlease();
// Derived class
nspacePackage.Outer.Inner3.Blue blue3 = new nspacePackage.Outer.Inner3.Blue();
blue3.blueInstanceMethod();
nspacePackage.Outer.Inner4.Blue blue4 = new nspacePackage.Outer.Inner4.Blue();
blue4.blueInstanceMethod();
}
}

View file

@ -16,21 +16,21 @@
%typemap(jstype) Space::Classic ** " Classic "
%typemap(javain) Space::Classic ** "Classic.getCPtr($javainput)"
// Default typemaps for pass by value, ref, pointer and pointer reference should use pgcpp
// Default typemaps for pass by value, ref, pointer and pointer const reference should use pgcpp
%inline %{
namespace Space {
struct Classic {
Classic() {}
Classic(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {}
Classic(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5, bool b) {}
Classic(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
Classic(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5, bool b) {}
void method(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {}
void methodconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5) {}
void method(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
void methodconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
};
void function(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {}
void functionconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5) {}
void function(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
void functionconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
}
%}

View file

@ -295,7 +295,7 @@ Klass& reftest(Klass& k) {
k.append(" reftest");
return k;
}
Klass*& pointerreftest(Klass*& k) {
Klass *const& pointerreftest(Klass *const& k) {
k->append(" pointerreftest");
return k;
}
@ -334,7 +334,7 @@ std::string overload_rawbyptr(int i) { return "int"; }
std::string overload_rawbyptr(Klass *k) { return "rawbyptr"; }
std::string overload_rawbyptrref(int i) { return "int"; }
std::string overload_rawbyptrref(Klass *&k) { return "rawbyptrref"; }
std::string overload_rawbyptrref(Klass *const&k) { return "rawbyptrref"; }

View file

@ -222,7 +222,7 @@ Klass& reftest(Klass& k) {
k.append(" reftest");
return k;
}
Klass*& pointerreftest(Klass*& k) {
Klass *const& pointerreftest(Klass *const& k) {
k->append(" pointerreftest");
return k;
}
@ -275,7 +275,7 @@ std::string overload_rawbyptr(int i) { return "int"; }
std::string overload_rawbyptr(Klass *k) { return "rawbyptr"; }
std::string overload_rawbyptrref(int i) { return "int"; }
std::string overload_rawbyptrref(Klass *&k) { return "rawbyptrref"; }
std::string overload_rawbyptrref(Klass *const&k) { return "rawbyptrref"; }

View file

@ -74,12 +74,6 @@ const std::vector<Struct *> & vecstructptr(const std::vector<Struct *> & vec) {
const std::vector<const Struct *> & vecstructconstptr(const std::vector<const Struct *> & vec) { return vec; }
%}
#if defined(SWIGCSHARP)
// Also test const and non-const pointers, but not strictly necessary since std::vector was enhanced in swig-1.3.40
%template(StructurePtrVector) std::vector<Structure *>;
%template(StructureConstPtrVector) std::vector<const Structure *>;
#endif
#if !defined(SWIGR)
%template(IntPtrVector) std::vector<int *>;
%template(IntConstPtrVector) std::vector<const int *>;
@ -88,7 +82,6 @@ const std::vector<const Struct *> & vecstructconstptr(const std::vector<const St
%template(StructPtrVector) std::vector<Struct *>;
%template(StructConstPtrVector) std::vector<const Struct *>;
#if !defined(SWIGTCL)
%inline {
struct MyClass {};
typedef MyClass *MyClassPtr;
@ -106,7 +99,6 @@ const std::vector<const Struct *> & vecstructconstptr(const std::vector<const St
}
};
}
#endif
#if defined(SWIGRUBY)
%template(LanguageVector) std::vector< swig::LANGUAGE_OBJ >;

View file

@ -0,0 +1,12 @@
require("import") -- the import fn
import("char_strings") -- import code
assert (char_strings.CharPingPong("hi there") == "hi there")
assert (char_strings.CharPingPong(nil) == nil)
assert (char_strings.CharArrayPingPong("hi there") == "hi there")
assert (char_strings.CharArrayPingPong(nil) == nil)
assert (char_strings.CharArrayDimsPingPong("hi there") == "hi there")
assert (char_strings.CharArrayDimsPingPong(nil) == nil)

View file

@ -75,3 +75,8 @@ int wget(SpamPtr f) {
#endif
// Was causing runtime error in Ruby
%include <std_vector.i>
%template(IntVector) std::vector<int>;

View file

@ -0,0 +1,103 @@
// Test the nspace feature
%module nspace
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%nspace;
%nonspace Outer::Inner2::NoNSpacePlease;
%copyctor;
%ignore Outer::Inner2::Color::Color();
#define CONSTANT100 100
%inline %{
namespace Outer {
class nspace {
};
namespace Inner1 {
enum Channel { Diffuse, Specular = 0x10, Transmission1 };
enum { ColorEnumVal1, ColorEnumVal2 = 0x11, ColorEnumVal3 };
struct Color {
static Color* create() { return new Color(); }
enum Channel { Diffuse, Specular = 0x20, Transmission };
enum { ColorEnumVal1, ColorEnumVal2 = 0x22, ColorEnumVal3 };
int instanceMemberVariable;
static int staticMemberVariable;
static const int staticConstMemberVariable = 222;
static const Channel staticConstEnumMemberVariable = Transmission;
void colorInstanceMethod(double d) {}
static void colorStaticMethod(double d) {}
}; // Color
int Color::staticMemberVariable = 0;
Color namespaceFunction(Color k) { return k; }
int namespaceVar = 0;
} // Inner1
namespace Inner2 {
enum Channel { Diffuse, Specular = 0x30, Transmission2 };
struct Color {
Color() : instanceMemberVariable(0) {}
static Color* create() { return new Color(); }
enum Channel { Diffuse, Specular = 0x40, Transmission };
enum { ColorEnumVal1, ColorEnumVal2 = 0x33, ColorEnumVal3 };
int instanceMemberVariable;
static int staticMemberVariable;
static const int staticConstMemberVariable = 333;
static const Channel staticConstEnumMemberVariable = Transmission;
void colorInstanceMethod(double d) {}
static void colorStaticMethod(double d) {}
void colors(const Inner1::Color& col1a,
const Outer::Inner1::Color& col1b,
const Color &col2a,
const Inner2::Color& col2b,
const Outer::Inner2::Color& col2c) {}
}; // Color
int Color::staticMemberVariable = 0;
class NoNSpacePlease {};
} // Inner2
// Derived class
namespace Inner3 {
struct Blue : Inner2::Color {
void blueInstanceMethod() {}
};
}
namespace Inner4 {
struct Blue : Inner2::Color {
void blueInstanceMethod() {}
};
}
class SomeClass {
public:
Inner1::Color::Channel GetInner1ColorChannel() { return Inner1::Color::Transmission; }
Inner2::Color::Channel GetInner2ColorChannel() { return Inner2::Color::Transmission; }
Inner1::Channel GetInner1Channel() { return Inner1::Transmission1; }
Inner2::Channel GetInner2Channel() { return Inner2::Transmission2; }
}; // SomeClass
} // Outer
namespace Outer {
struct MyWorldPart2 {};
}
struct GlobalClass {
void gmethod() {}
};
void test_classes(Outer::SomeClass c, Outer::Inner2::Color cc) {}
%}
#endif

View file

@ -0,0 +1,50 @@
// Test the nspace feature and %extend
%module nspace_extend
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%nspace;
%extend Outer::Inner1::Color {
Color() { return new Outer::Inner1::Color(); }
virtual ~Color() { delete $self; }
static Color* create() { return new Outer::Inner1::Color(); }
Color(const Color& other) { return new Outer::Inner1::Color(other); }
void colorInstanceMethod(double d) {}
static void colorStaticMethod(double d) {}
}
%inline %{
namespace Outer {
namespace Inner1 {
struct Color {
};
}
namespace Inner2 {
struct Color {
};
}
}
%}
%extend Outer::Inner2::Color {
Color() { return new Outer::Inner2::Color(); }
~Color() { delete $self; }
static Color* create() { return new Outer::Inner2::Color(); }
Color(const Color& other) { return new Outer::Inner2::Color(other); }
void colorInstanceMethod(double d) {}
static void colorStaticMethod(double d) {}
void colors(const Inner1::Color& col1a,
const Outer::Inner1::Color& col1b,
const Color &col2a,
const Inner2::Color& col2b,
const Outer::Inner2::Color& col2c) {}
}
#endif

View file

@ -29,10 +29,10 @@ struct Struct {
static Struct *pInstance;
};
void set(Struct *& s) {
void set(Struct *const& s) {
Struct::instance = *s;
}
Struct *& get() {
Struct *const& get() {
return Struct::pInstance;
}
%}

View file

@ -0,0 +1,3 @@
from constructor_rename import *
x = RenamedConstructor()

View file

@ -0,0 +1,36 @@
import threads_exception
t = threads_exception.Test()
try:
t.unknown()
except RuntimeError,e:
pass
try:
t.simple()
except RuntimeError,e:
if e.args[0] != 37:
raise RuntimeError
try:
t.message()
except RuntimeError,e:
if e.args[0] != "I died.":
raise RuntimeError
try:
t.hosed()
except threads_exception.Exc,e:
if e.code != 42:
raise RuntimeError
if e.msg != "Hosed":
raise RuntimeError
for i in range(1,4):
try:
t.multi(i)
except RuntimeError,e:
pass
except threads_exception.Exc,e:
pass

View file

@ -0,0 +1,28 @@
%module symbol_clash
// ::Vector and ::Text::Vector were incorrectly clashing in the target language symbol tables
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
#if defined(SWIGJAVA)
%include "enumtypeunsafe.swg"
#elif defined(SWIGCSHARP)
%include "enumsimple.swg"
#endif
%inline %{
class Vector
{
};
namespace Text
{
enum Preference
{
Raster,
Vector
};
}
%}
#endif

View file

@ -0,0 +1,54 @@
// Throw a lot of exceptions
// The Python runtime tests were previously failing with the -threads option on Windows due to SWIG_PYTHON_THREAD_BEGIN_ALLOW not being within the try block.
%module(threads="1") threads_exception
%{
struct A {};
%}
%inline %{
#include <string>
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
class Exc {
public:
Exc(int c, const char *m) {
code = c;
strncpy(msg,m,255);
}
int code;
char msg[256];
};
class Test {
public:
int simple() throw(int) {
throw(37);
return 1;
}
int message() throw(const char *) {
throw("I died.");
return 1;
}
int hosed() throw(Exc) {
throw(Exc(42,"Hosed"));
return 1;
}
int unknown() throw(A*) {
static A a;
throw &a;
return 1;
}
int multi(int x) throw(int, const char *, Exc) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
return 1;
}
};
%}

View file

@ -0,0 +1,215 @@
%module typemap_global_scope
// Test global scope operator :: for typemaps. Previously SWIG would not use a typemap that did not specify the global scope
// operator for a type that did have it, and vice-versa.
%typemap(in) SWIGTYPE "_this_will_not_compile_SWIGTYPE_ \"$type\""
%typemap(in) const SWIGTYPE & "_this_will_not_compile_const_SWIGTYPE_REF_ \"$type\""
%typemap(in) enum SWIGTYPE "_this_will_not_compile_enum_SWIGTYPE_ \"$type\""
%typemap(in) const enum SWIGTYPE & "_this_will_not_compile_const_enum_SWIGTYPE_REF_ \"$type\""
/////////////////////////////////////////////////////////////////////
// Structs
/////////////////////////////////////////////////////////////////////
%typemap(in) Test1, ::Test2, Space::Test3, ::Space::Test4 "/*in typemap for $type*/"
%typemap(in) const Test1 &, const ::Test2 &, const Space::Test3 &, const ::Space::Test4 & "/*in typemap for $type*/"
%inline %{
struct Test1 {};
struct Test2 {};
namespace Space {
struct Test3 {};
struct Test4 {};
}
%}
%inline %{
void test1a(Test1 t, const Test1 &tt) {}
void test1b(::Test1 t, const ::Test1 &tt) {}
void test2a(Test2 t, const Test2 &tt) {}
void test2b(::Test2 t, const ::Test2 &tt) {}
void test3a(Space::Test3 t, const Space::Test3 &tt) {}
void test3b(::Space::Test3 t, const ::Space::Test3 &tt) {}
namespace Space {
void test3c(Space::Test3 t, const Space::Test3 &tt) {}
void test3d(::Space::Test3 t, const ::Space::Test3 &tt) {}
void test3e(Test3 t, const Test3 &tt) {}
}
void test4a(Space::Test4 t, const Space::Test4 &tt) {}
void test4b(::Space::Test4 t, const ::Space::Test4 &tt) {}
namespace Space {
void test4c(Space::Test4 t, const Space::Test4 &tt) {}
void test4d(::Space::Test4 t, const ::Space::Test4 &tt) {}
void test4e(Test4 t, const Test4 &tt) {}
}
%}
/////////////////////////////////////////////////////////////////////
// Templates
/////////////////////////////////////////////////////////////////////
%inline %{
struct XX {};
%}
%typemap(in) TemplateTest1< ::XX >, ::TemplateTest2< ::XX >, Space::TemplateTest3< ::XX >, ::Space::TemplateTest4< ::XX > "/* in typemap for $type */"
%typemap(in) const TemplateTest1< XX > &, const ::TemplateTest2< XX > &, const Space::TemplateTest3< XX > &, const ::Space::TemplateTest4< XX > & "/* in typemap for $type */"
%inline %{
template<typename T> struct TemplateTest1 { T m_t; };
template<typename T> struct TemplateTest2 { T m_t; };
namespace Space {
template<typename T> struct TemplateTest3 { T m_t; };
template<typename T> struct TemplateTest4 { T m_t; };
}
%}
%template(TemplateTest1XX) TemplateTest1< ::XX >;
%template(TemplateTest2XX) TemplateTest2< ::XX >;
%template(TemplateTest3XX) Space::TemplateTest3< ::XX >;
%template(TemplateTest4XX) Space::TemplateTest4< ::XX >;
%inline %{
void test_template_1a(TemplateTest1< ::XX > t, const TemplateTest1< ::XX > &tt) {}
void test_template_1b(::TemplateTest1< ::XX > t, const ::TemplateTest1< ::XX > &tt) {}
void test_template_2a(TemplateTest2< ::XX > t, const TemplateTest2< ::XX > &tt) {}
void test_template_2b(::TemplateTest2< ::XX > t, const ::TemplateTest2< ::XX > &tt) {}
void test_template_3a(Space::TemplateTest3< ::XX > t, const Space::TemplateTest3< ::XX > &tt) {}
void test_template_3b(::Space::TemplateTest3< ::XX > t, const ::Space::TemplateTest3< ::XX > &tt) {}
namespace Space {
void test_template_3c(Space::TemplateTest3< ::XX > t, const Space::TemplateTest3< ::XX > &tt) {}
void test_template_3d(::Space::TemplateTest3< ::XX > t, const ::Space::TemplateTest3< ::XX > &tt) {}
void test_template_3e(TemplateTest3< ::XX > t, const TemplateTest3< ::XX > &tt) {}
}
void test_template_4a(Space::TemplateTest4< ::XX > t, const Space::TemplateTest4< ::XX > &tt) {}
void test_template_4b(::Space::TemplateTest4< ::XX > t, const ::Space::TemplateTest4< ::XX > &tt) {}
namespace Space {
void test_template_4c(Space::TemplateTest4< ::XX > t, const Space::TemplateTest4< ::XX > &tt) {}
void test_template_4d(::Space::TemplateTest4< ::XX > t, const ::Space::TemplateTest4< ::XX > &tt) {}
void test_template_4e(TemplateTest4< ::XX > t, const TemplateTest4< ::XX > &tt) {}
}
%}
/////////////////////////////////////////////////////////////////////
// Enums
/////////////////////////////////////////////////////////////////////
%typemap(in) Enum1, ::Enum2, Space::Enum3, ::Space::Enum4 "/*in typemap for $type*/"
%typemap(in) const Enum1 &, const ::Enum2 &, const Space::Enum3 &, const ::Space::Enum4 & "/*in typemap for $type*/"
%inline %{
enum Enum1 { enum_1 };
enum Enum2 { enum_2 };
namespace Space {
enum Enum3 { enum_3 };
enum Enum4 { enum_4 };
}
%}
%inline %{
void test_enum_1a(Enum1 t, const Enum1 &tt) {}
void test_enum_1b(::Enum1 t, const ::Enum1 &tt) {}
void test_enum_2a(Enum2 t, const Enum2 &tt) {}
void test_enum_2b(::Enum2 t, const ::Enum2 &tt) {}
void test_enum_3a(Space::Enum3 t, const Space::Enum3 &tt) {}
void test_enum_3b(::Space::Enum3 t, const ::Space::Enum3 &tt) {}
namespace Space {
void test_enum_3c(Space::Enum3 t, const Space::Enum3 &tt) {}
void test_enum_3d(::Space::Enum3 t, const ::Space::Enum3 &tt) {}
void test_enum_3e(Enum3 t, const Enum3 &tt) {}
}
void test_enum_4a(Space::Enum4 t, const Space::Enum4 &tt) {}
void test_enum_4b(::Space::Enum4 t, const ::Space::Enum4 &tt) {}
namespace Space {
void test_enum_4c(Space::Enum4 t, const Space::Enum4 &tt) {}
void test_enum_4d(::Space::Enum4 t, const ::Space::Enum4 &tt) {}
void test_enum_4e(Enum4 t, const Enum4 &tt) {}
}
%}
#if 0
/////////////////////////////////////////////////////////////////////
// Enums with enum specified in typemap
/////////////////////////////////////////////////////////////////////
%typemap(in) enum Mune1, enum ::Mune2, enum Space::Mune3, enum ::Space::Mune4 "/*in typemap for $type*/"
%typemap(in) const enum Mune1 &, const enum ::Mune2 &, const enum Space::Mune3 &, const enum ::Space::Mune4 & "/*in typemap for $type*/"
%inline %{
enum Mune1 { mune_1 };
enum Mune2 { mune_2 };
namespace Space {
enum Mune3 { mune_3 };
enum Mune4 { mune_4 };
}
%}
%inline %{
void test_mune_1a(Mune1 t, const Mune1 &tt) {}
void test_mune_1b(::Mune1 t, const ::Mune1 &tt) {}
void test_mune_2a(Mune2 t, const Mune2 &tt) {}
void test_mune_2b(::Mune2 t, const ::Mune2 &tt) {}
void test_mune_3a(Space::Mune3 t, const Space::Mune3 &tt) {}
void test_mune_3b(::Space::Mune3 t, const ::Space::Mune3 &tt) {}
namespace Space {
void test_mune_3c(Space::Mune3 t, const Space::Mune3 &tt) {}
void test_mune_3d(::Space::Mune3 t, const ::Space::Mune3 &tt) {}
void test_mune_3e(Mune3 t, const Mune3 &tt) {}
}
void test_mune_4a(Space::Mune4 t, const Space::Mune4 &tt) {}
void test_mune_4b(::Space::Mune4 t, const ::Space::Mune4 &tt) {}
namespace Space {
void test_mune_4c(Space::Mune4 t, const Space::Mune4 &tt) {}
void test_mune_4d(::Space::Mune4 t, const ::Space::Mune4 &tt) {}
void test_mune_4e(Mune4 t, const Mune4 &tt) {}
}
%}
/////////////////////////////////////////////////////////////////////
// Enums with enum specified in type
/////////////////////////////////////////////////////////////////////
%typemap(in) Nemu1, ::Nemu2, Space::Nemu3, ::Space::Nemu4 "/*in typemap for $type*/"
%typemap(in) const Nemu1 &, const ::Nemu2 &, const Space::Nemu3 &, const ::Space::Nemu4 & "/*in typemap for $type*/"
%inline %{
enum Nemu1 { nemu_1 };
enum Nemu2 { nemu_2 };
namespace Space {
enum Nemu3 { nemu_3 };
enum Nemu4 { nemu_4 };
}
%}
%inline %{
void test_nemu_1a(enum Nemu1 t, const enum Nemu1 &tt) {}
void test_nemu_1b(enum ::Nemu1 t, const enum ::Nemu1 &tt) {}
void test_nemu_2a(enum Nemu2 t, const enum Nemu2 &tt) {}
void test_nemu_2b(enum ::Nemu2 t, const enum ::Nemu2 &tt) {}
void test_nemu_3a(enum Space::Nemu3 t, const enum Space::Nemu3 &tt) {}
void test_nemu_3b(enum ::Space::Nemu3 t, const enum ::Space::Nemu3 &tt) {}
namespace Space {
void test_nemu_3c(enum Space::Nemu3 t, const enum Space::Nemu3 &tt) {}
void test_nemu_3d(enum ::Space::Nemu3 t, const enum ::Space::Nemu3 &tt) {}
void test_nemu_3e(enum Nemu3 t, const enum Nemu3 &tt) {}
}
void test_nemu_4a(enum Space::Nemu4 t, const enum Space::Nemu4 &tt) {}
void test_nemu_4b(enum ::Space::Nemu4 t, const enum ::Space::Nemu4 &tt) {}
namespace Space {
void test_nemu_4c(enum Space::Nemu4 t, const enum Space::Nemu4 &tt) {}
void test_nemu_4d(enum ::Space::Nemu4 t, const enum ::Space::Nemu4 &tt) {}
void test_nemu_4e(enum Nemu4 t, const enum Nemu4 &tt) {}
}
%}
#endif

View file

@ -0,0 +1,34 @@
%module typemap_template
/* Test bug in 1.3.40 where the presence of a generic/unspecialized typemap caused the incorrect specialized typemap to be used */
%typemap(in) SWIGTYPE "/*_this_will_not_compile_SWIGTYPE_ \"$type\" */ "
%typemap(in) const SWIGTYPE & "/*_this_will_not_compile_const_SWIGTYPE_REF_\"$type\" */ "
%typemap(in) const TemplateTest1 & {$1 = (TemplateTest1<YY> *)0; /* in typemap generic for $type */}
%typemap(in) const TemplateTest1< ZZ > & {$1 = (TemplateTest1<ZZ> *)0; /* in typemap ZZ for $type */}
%typemap(in) const TemplateTest1< int > & {$1 = (TemplateTest1<int> *)0; /* in typemap int for $type */}
%inline %{
template<typename T> struct TemplateTest1 {
void setT(const TemplateTest1& t) {}
};
%}
%inline %{
struct YY {};
struct ZZ {};
%}
%template(TTYY) TemplateTest1< YY >;
%template(TTZZ) TemplateTest1< ZZ >;
%template(TTint) TemplateTest1< int >;
%inline %{
void extratest(const TemplateTest1< YY > &t,
const TemplateTest1< ZZ > &tt,
const TemplateTest1< int > &ttt)
{}
%}

View file

@ -203,22 +203,28 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
%typemap(in) wchar_t "$1 = $input;";
%typemap(lin,numinputs=1) wchar_t "(cl::let (($out (cl:char-code $in)))\n $body)";
%typemap(lin,numinputs=1) wchar_t* "(excl:with-native-string ($out $in
%typemap(lin,numinputs=1) wchar_t * "(excl:with-native-string ($out $in
:external-format #+little-endian :fat-le #-little-endian :fat)\n
$body)"
%typemap(out) wchar_t "$result = $1;";
%typemap(lout) wchar_t "(cl::setq ACL_ffresult (cl::code-char $body))";
%typemap(lout) wchar_t* "(cl::setq ACL_ffresult (excl:native-to-string $body
%typemap(lout) wchar_t * "(cl::setq ACL_ffresult (excl:native-to-string $body
:external-format #+little-endian :fat-le #-little-endian :fat))";
%typemap(ffitype) wchar_t ":unsigned-short";
%typemap(lisptype) wchar_t "";
%typemap(ctype) wchar_t "wchar_t";
%typemap(lispclass) wchar_t "cl:character";
%typemap(lispclass) wchar_t* "cl:string";
%typemap(lispclass) wchar_t * "cl:string";
//////////////////////////////////////////////////////////////
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* name conversion for overloaded operators. */
#ifdef __cplusplus
%rename(__add__) *::operator+;

View file

@ -130,6 +130,11 @@
%typemap(lispclass) double "cl:number";
%typemap(lispclass) char * "cl:string";
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
%{

View file

@ -679,6 +679,16 @@ $result = C_SCHEME_UNDEFINED;
%apply unsigned long { size_t };
/* ------------------------------------------------------------
* Various
* ------------------------------------------------------------ */
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* Overloaded operator support
* ------------------------------------------------------------ */

View file

@ -30,7 +30,7 @@ namespace std {
%typemap(typecheck) string = char *;
%typemap(typecheck) const string & = char *;
%typemap(in) string (char* tempptr) {
%typemap(in) string (char * tempptr) {
if ($input == C_SCHEME_FALSE) {
$1.resize(0);
} else {
@ -44,8 +44,7 @@ namespace std {
}
}
%typemap(in) const string& (std::string temp,
char* tempptr) {
%typemap(in) const string& (std::string temp, char *tempptr) {
if ($input == C_SCHEME_FALSE) {
temp.resize(0);

View file

@ -1,7 +1,9 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
@ -10,6 +12,7 @@
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
@ -41,10 +44,10 @@
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = (((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -135,7 +138,7 @@
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE *& {
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;

View file

@ -522,6 +522,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -782,24 +783,21 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
} %}
/* Pointer reference typemaps */
%typemap(ctype) SWIGTYPE *& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *& "HandleRef"
%typemap(cstype) SWIGTYPE *& "$*csclassname"
%typemap(csin) SWIGTYPE *& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *& {
%typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef"
%typemap(cstype) SWIGTYPE *const& "$*csclassname"
%typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& {
IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret;
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ $result = (void *)*$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Marshal C/C++ pointer to IntPtr */
%typemap(ctype) void *VOID_INT_PTR "void *"
%typemap(imtype) void *VOID_INT_PTR "IntPtr"
@ -841,7 +839,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(csbody_derived) SWIGTYPE %{
private HandleRef swigCPtr;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclassnameUpcast(cPtr), cMemoryOwn) {
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
@ -953,6 +951,12 @@ using System.Runtime.InteropServices;
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* csharp keywords */
%include <csharpkw.swg>

View file

@ -296,14 +296,14 @@ namespace std {
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning specialize_std_map_on_key ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning specialize_std_map_on_value ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning specialize_std_map_on_both ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef

View file

@ -25,7 +25,7 @@
%include <std_common.i>
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CTYPE...)
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
%typemap(cscode) std::vector<CTYPE > %{
public $csclassname(System.Collections.ICollection c) : this() {
@ -208,16 +208,16 @@
public:
typedef size_t size_type;
typedef CTYPE value_type;
typedef CONST_REFERENCE_TYPE const_reference;
typedef CONST_REFERENCE const_reference;
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
void push_back(const value_type& x);
void push_back(CTYPE const& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
%newobject GetRange(int index, int count);
%newobject Repeat(const value_type& value, int count);
%newobject Repeat(CTYPE const& value, int count);
vector();
vector(const vector &other);
%extend {
@ -243,7 +243,7 @@
else
throw std::out_of_range("index");
}
void setitem(int index, const value_type& val) throw (std::out_of_range) {
void setitem(int index, CTYPE const& val) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
(*$self)[index] = val;
else
@ -263,7 +263,7 @@
throw std::invalid_argument("invalid range");
return new std::vector<CTYPE >($self->begin()+index, $self->begin()+index+count);
}
void Insert(int index, const value_type& x) throw (std::out_of_range) {
void Insert(int index, CTYPE const& x) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size()+1)
$self->insert($self->begin()+index, x);
else
@ -291,7 +291,7 @@
throw std::invalid_argument("invalid range");
$self->erase($self->begin()+index, $self->begin()+index+count);
}
static std::vector<CTYPE > *Repeat(const value_type& value, int count) throw (std::out_of_range) {
static std::vector<CTYPE > *Repeat(CTYPE const& value, int count) throw (std::out_of_range) {
if (count < 0)
throw std::out_of_range("count");
return new std::vector<CTYPE >(count, value);
@ -320,31 +320,31 @@
%enddef
%define SWIG_STD_VECTOR_MINIMUM(CTYPE...)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, CTYPE const&, CTYPE)
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// The class will then implement IList<>, which adds extra functionality
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
%extend {
bool Contains(const value_type& value) {
bool Contains(CTYPE const& value) {
return std::find($self->begin(), $self->end(), value) != $self->end();
}
int IndexOf(const value_type& value) {
int IndexOf(CTYPE const& value) {
int index = -1;
std::vector<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end())
index = (int)(it - $self->begin());
return index;
}
int LastIndexOf(const value_type& value) {
int LastIndexOf(CTYPE const& value) {
int index = -1;
std::vector<CTYPE >::reverse_iterator rit = std::find($self->rbegin(), $self->rend(), value);
if (rit != $self->rend())
index = (int)($self->rend() - 1 - rit);
return index;
}
bool Remove(const value_type& value) {
bool Remove(CTYPE const& value) {
std::vector<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end()) {
$self->erase(it);
@ -359,7 +359,7 @@ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector<CTYPE > {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, CTYPE)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, CTYPE const&, CTYPE)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
@ -394,16 +394,12 @@ namespace std {
template<class T> class vector {
SWIG_STD_VECTOR_MINIMUM(T)
};
// specializations for pointers
template<class T> class vector<T*> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T*)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T*)
// specialization for pointers
template<class T> class vector<T *> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, T *const&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
template<class T> class vector<const T*> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, const T*)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(const T*)
};
// bool is a bit different in the C++ standard
// bool is specialized in the C++ standard - const_reference in particular
template<> class vector<bool> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool)

View file

@ -224,7 +224,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& __getitem__(const K& key) throw (std::out_of_range) {
const T& __getitem__(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -26,7 +26,7 @@ namespace std {
%typemap(typecheck) string = char *;
%typemap(typecheck) const string & = char *;
%typemap(in) string (char* tempptr) {
%typemap(in) string (char * tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
$1.assign(tempptr);
@ -36,8 +36,7 @@ namespace std {
}
}
%typemap(in) const string & (std::string temp,
char* tempptr) {
%typemap(in) const string & (std::string temp, char *tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
temp.assign(tempptr);
@ -48,7 +47,7 @@ namespace std {
}
}
%typemap(in) string * (char* tempptr) {
%typemap(in) string * (char *tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
$1 = new std::string(tempptr);

View file

@ -208,7 +208,7 @@ namespace std {
self->pop_back();
return x;
}
T& ref(int i) throw (std::out_of_range) {
const T& ref(int i) throw (std::out_of_range) {
int size = int(self->size());
if (i>=0 && i<size)
return (*self)[i];

View file

@ -448,4 +448,10 @@ typedef unsigned long SCM;
$1 = SWIG_CheckState(res);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* typemaps.i ends here */

View file

@ -1,13 +1,16 @@
%include <intrusive_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE "(void)arg1; delete smartarg1;"
// Typemap customisations...
%typemap(in) CONST TYPE ($&1_type argp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain value
@ -66,12 +69,12 @@
#endif
%}
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain pointer by reference
temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp;
%}
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE *& %{
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
// plain pointer by reference(out)
#if ($owner)
if (*$1) {
@ -243,7 +246,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
@ -350,10 +353,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
@ -393,7 +396,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -1,15 +1,18 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in) CONST TYPE ($&1_type argp = 0) %{
@ -41,10 +44,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -129,7 +132,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -897,6 +897,7 @@
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -1025,23 +1026,20 @@
}
/* Pointer reference typemaps */
%typemap(jni) SWIGTYPE *& "jlong"
%typemap(jtype) SWIGTYPE *& "long"
%typemap(jstype) SWIGTYPE *& "$*javaclassname"
%typemap(javain) SWIGTYPE *& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *& {
%typemap(jni) SWIGTYPE *const& "jlong"
%typemap(jtype) SWIGTYPE *const& "long"
%typemap(jstype) SWIGTYPE *const& "$*javaclassname"
%typemap(javain) SWIGTYPE *const& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *const& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new $*javaclassname(cPtr, $owner);
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
%{ temp = *($1_ltype)&$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ *($1_ltype)&$result = *$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
@ -1072,7 +1070,7 @@
private long swigCPtr;
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
super($imclassname.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
super($imclassname.$javaclazznameSWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
@ -1085,7 +1083,7 @@
/* Set the default for SWIGTYPE: pointer constructor is protected,
getCPtr is protected. Season to your own taste! */
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
SWIG_JAVABODY_METHODS(public, public, SWIGTYPE)
// Typewrapper classes
%typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
@ -1132,7 +1130,7 @@ SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
*/
%define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclassname_director_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
this($imcall, OWNERSHIP);$directorconnect
}
%enddef
@ -1195,7 +1193,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
#define %nojavaexception %feature("except","0",throws="")
#define %clearjavaexception %feature("except","",throws="")
%pragma(java) jniclassclassmodifiers="class"
%pragma(java) jniclassclassmodifiers="public class"
%pragma(java) moduleclassmodifiers="public class"
/* Some ANSI C typemaps */
@ -1203,6 +1201,12 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* java keywords */
%include <javakw.swg>

View file

@ -58,119 +58,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
}

View file

@ -40,7 +40,7 @@
%typemap(consttab) long long, unsigned long long
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
%typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
// member function pointers
@ -176,7 +176,7 @@ use %include <std_except.i> instead
%{lua_pushnumber(L,(lua_Number)(int)$1);SWIG_fail; %}
// strings are just sent as errors
%typemap(throws) char*, const char*
%typemap(throws) char *, const char *
%{lua_pushstring(L,$1);SWIG_fail;%}
// char is changed to a string

View file

@ -661,7 +661,7 @@ SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
swig_lua_userdata* usr;
if (lua_isuserdata(L,tp))
{
usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
if (usr && usr->type && usr->type->str)
return usr->type->str;
return "userdata (unknown type)";

View file

@ -89,30 +89,39 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
%typemap(out) const bool&
%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%}
// strings (char* and char[])
%typemap(in,checkfn="lua_isstring") const char*, char*
// strings (char * and char[])
%fragment("SWIG_lua_isnilstring", "header") {
int SWIG_lua_isnilstring(lua_State *L, int idx) {
int ret = lua_isstring(L, idx);
if (!ret)
ret = lua_isnil(L, idx);
return ret;
}
}
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char *, char *
%{$1 = ($ltype)lua_tostring(L, $input);%}
%typemap(in,checkfn="lua_isstring") const char[ANY], char[ANY]
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char[ANY], char[ANY]
%{$1 = ($ltype)lua_tostring(L, $input);%}
%typemap(out) const char*, char*
%{ lua_pushstring(L,(const char*)$1); SWIG_arg++;%}
%typemap(out) const char *, char *
%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%}
%typemap(out) const char[ANY], char[ANY]
%{ lua_pushstring(L,(const char*)$1); SWIG_arg++;%}
%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%}
// char's
// currently treating chars as small strings, not as numbers
// (however signed & unsigned char's are numbers...)
%typemap(in,checkfn="lua_isstring") char
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") char
%{$1 = (lua_tostring(L, $input))[0];%}
%typemap(out) char
%{ lua_pushfstring(L,"%c",$1); SWIG_arg++;%}
// by const ref
%typemap(in,checkfn="lua_isstring") const char& (char temp)
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char& (char temp)
%{temp = (lua_tostring(L, $input))[0]; $1=&temp;%}
%typemap(out) const char&
@ -167,11 +176,11 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
// Also needed for object ptrs by const ref
// eg A* const& ref_pointer(A* const& a);
// found in mixed_types.i
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *&($*ltype temp)
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *const&($*ltype temp)
%{temp=($*ltype)SWIG_MustGetPtr(L,$input,$*descriptor,0,$argnum,"$symname");
$1=&temp;%}
$1=($1_ltype)&temp;%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{SWIG_NewPointerObj(L,*$1,$*descriptor,$owner); SWIG_arg++; %}
@ -288,12 +297,12 @@ parmeters match which function
}
// special check for a char (string of length 1)
%typecheck(SWIG_TYPECHECK_CHAR) char, const char& {
$1 = lua_isstring(L,$input) && (lua_strlen(L,$input)==1);
%typecheck(SWIG_TYPECHECK_CHAR,fragment="SWIG_lua_isnilstring") char, const char& {
$1 = SWIG_lua_isnilstring(L,$input) && (lua_strlen(L,$input)==1);
}
%typecheck(SWIG_TYPECHECK_STRING) char *, char[] {
$1 = lua_isstring(L,$input);
%typecheck(SWIG_TYPECHECK_STRING,fragment="SWIG_lua_isnilstring") char *, char[] {
$1 = SWIG_lua_isnilstring(L,$input);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
@ -335,7 +344,7 @@ parmeters match which function
// Also needed for object ptrs by const ref
// eg const A* ref_pointer(A* const& a);
// found in mixed_types.i
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE* const &
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
{
void *ptr;
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
@ -352,6 +361,9 @@ parmeters match which function
// Array reference typemaps
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
// size_t (which is just a unsigned long)
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };

View file

@ -12,11 +12,11 @@
%{
#include <stdlib.h>
wchar_t* str2wstr(const char* str, int len)
wchar_t* str2wstr(const char *str, int len)
{
wchar_t* p;
if (str==0 || len<1) return 0;
p=(wchar*)malloc((len+1)*sizeof(wchar_t));
p=(wchar *)malloc((len+1)*sizeof(wchar_t));
if (p==0) return 0;
if (mbstowcs(p, str, len)==-1)
{
@ -28,13 +28,13 @@ wchar_t* str2wstr(const char* str, int len)
}
%}
%typemap( in, checkfn="lua_isstring" ) wchar_t*
%typemap(in, checkfn="SWIG_lua_isnilstring", fragment="SWIG_lua_isnilstring") wchar_t *
%{
$1 = str2wstr(lua_tostring( L, $input ),lua_strlen( L, $input ));
if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);goto fail;}
%}
%typemap( freearg ) wchar_t*
%typemap(freearg) wchar_t *
%{
free($1);
%}

View file

@ -745,3 +745,10 @@ FROM BlaBla IMPORT Bla;
/* Some ANSI C typemaps */
%apply unsigned long { size_t };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -247,8 +247,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
result = scheme_make_pair(k,result);
@ -467,8 +467,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_TO(i->first);
result = scheme_make_pair(k,result);
}
@ -679,8 +679,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
result = scheme_make_pair(k,result);
@ -891,8 +891,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_K_TO(i->first);
result = scheme_make_pair(k,result);
}

View file

@ -349,3 +349,10 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -10,6 +10,8 @@
#include <string>
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
namespace Swig {
/* base class for director exceptions */
class DirectorException {

View file

@ -2,7 +2,7 @@
#define OCAML_OCAMLKW_SWG_
/* Warnings for Ocaml keywords */
#define OCAMLKW(x) %namewarn("314: '" #x "' is a ocaml keyword and it will properly renamed") #x
#define OCAMLKW(x) %namewarn("314: '" #x "' is an ocaml keyword and it will be appropriately renamed") #x
/*
from

View file

@ -29,7 +29,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
@ -53,118 +53,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
}

Some files were not shown because too many files have changed in this diff Show more