From d16d145787c45954c533c2208b9a0ae721df9002 Mon Sep 17 00:00:00 2001
From: William S Fulton
@@ -41,10 +41,10 @@ Everything in the Java chapter applies to generatin
This chapter contains a few Android specific notes and examples.
@@ -77,7 +77,7 @@ $ android list targets
The following examples are shipped with SWIG under the Examples/android directory and include a Makefile to build and install each example.
@@ -399,7 +399,7 @@ Run the app again and this time you will see the output pictured below, showing
@@ -747,7 +747,7 @@ Run the app to see the result of calling the C++ code from Java:
@@ -759,7 +759,7 @@ Note that the 'extend' example is demonstrates the directors feature.
Normally C++ exception handling and the STL is not available by default in the version of g++ shipped with Android, but this example turns these features on as described in the next section.
diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html
index fbdce7f27..2828bf4df 100644
--- a/Doc/Manual/Arguments.html
+++ b/Doc/Manual/Arguments.html
@@ -7,7 +7,7 @@
@@ -51,7 +51,7 @@ This section describes the typemaps.i library file--commonly used to
change certain properties of argument conversion.
@@ -195,7 +195,7 @@ else. To clear a typemap, the %clear directive should be used. For e
@@ -248,7 +248,7 @@ When the function is used in the scripting language interpreter, it will work li
result = add(3, 4)
@@ -315,7 +315,7 @@ iresult, dresult = foo(3.5, 2)
-
@@ -380,7 +380,7 @@ rather than directly overwriting the value of the original input object.
SWIG. Backwards compatibility is preserved, but deprecated.
@@ -414,7 +414,7 @@ Typemap declarations are lexically scoped so a typemap takes effect from the poi
file or a matching %clear declaration.
@@ -424,7 +424,7 @@ insure that a value is positive, or that a pointer is non-NULL. This
can be accomplished including the constraints.i library file.
@@ -450,7 +450,7 @@ the arguments violate the constraint condition, a scripting language
exception will be raised. As a result, it is possible to catch bad
values, prevent mysterious program crashes and so on.
@@ -466,7 +466,7 @@ NONNULL Non-NULL pointer (pointers only).
-
diff --git a/Doc/Manual/CCache.html b/Doc/Manual/CCache.html
index 6923b2e95..3a7db5c7b 100644
--- a/Doc/Manual/CCache.html
+++ b/Doc/Manual/CCache.html
@@ -7,7 +7,7 @@
-
@@ -43,7 +43,7 @@
ccache-swig - a fast compiler cache
-
@@ -53,7 +53,7 @@ ccache-swig <compiler> [COMPILER OPTIONS]
<compiler> [COMPILER OPTIONS]
-
@@ -62,7 +62,7 @@ by caching previous compiles and detecting when the same compile is
being done again. ccache-swig is ccache plus support for SWIG. ccache
and ccache-swig are used interchangeably in this document.
-
@@ -82,7 +82,7 @@ Here is a summary of the options to ccache-swig.
-
@@ -124,7 +124,7 @@ rounded down to the nearest multiple of 16 kilobytes.
-
@@ -156,7 +156,7 @@ This will work as long as /usr/local/bin comes before the path to gcc
Note! Do not use a hard link, use a symbolic link. A hardlink will
cause "interesting" problems.
-
@@ -176,7 +176,7 @@ file). By using --ccache-skip you can force an option to not be
treated as an input file name and instead be passed along to the
compiler as a command line option.
-
@@ -315,7 +315,7 @@ the use of '#pragma SWIG'.
-
@@ -328,7 +328,7 @@ When these limits are reached ccache will reduce the cache to 20%
below the numbers you specified in order to avoid doing the cache
clean operation too often.
-
@@ -339,7 +339,7 @@ performance slowdown, it significantly increases the number of files
that fit in the cache. You can turn off compression setting the
CCACHE_NOCOMPRESS environment variable.
-
@@ -364,7 +364,7 @@ compiler output that you would get without the cache. If you ever
discover a case where ccache changes the output of your compiler then
please let me know.
-
@@ -378,7 +378,7 @@ option. You just need to set the environment variable CCACHE_PREFIX to
'distcc' and ccache will prefix the command line used with the
compiler with the command 'distcc'.
-
@@ -407,7 +407,7 @@ following conditions need to be met:
versions of ccache that do not support compression.
-
@@ -423,7 +423,7 @@ I wrote ccache because I wanted to get a bit more speed out of a
compiler cache and I wanted to remove some of the limitations of the
shell-script version.
-
@@ -441,7 +441,7 @@ are:
-
@@ -453,7 +453,7 @@ Thanks to the following people for their contributions to ccache
-
diff --git a/Doc/Manual/CPlusPlus14.html b/Doc/Manual/CPlusPlus14.html
index 32798f302..b162c7818 100644
--- a/Doc/Manual/CPlusPlus14.html
+++ b/Doc/Manual/CPlusPlus14.html
@@ -14,6 +14,7 @@
diff --git a/Doc/Manual/CPlusPlus17.html b/Doc/Manual/CPlusPlus17.html
index ea42bd6a2..ae3ca5c77 100644
--- a/Doc/Manual/CPlusPlus17.html
+++ b/Doc/Manual/CPlusPlus17.html
@@ -7,7 +7,7 @@
This chapter gives you a brief overview about the SWIG
@@ -37,10 +37,10 @@ C++17 support.
Compatibility note: SWIG-4.0.0 is the first version to support any C++17 features.
@@ -72,7 +72,7 @@ namespace A {
@@ -87,7 +87,7 @@ char a = u8'a';
@@ -75,7 +75,7 @@ The Microsoft Developer Network (MSDN) h
Monodoc, available from the Mono project, has a very useful section titled Interop with native libraries.
@@ -83,7 +83,7 @@ In order to minimize name collisions between names generated based on input to S
@@ -135,7 +135,7 @@ Note that the file extension (.cs) will not be automatically added and needs to
Due to possible compiler limits it is not advisable to use -outfile for large projects.
@@ -556,7 +556,7 @@ Windows users can also get the examples working using a
Cygwin or MinGW environment for automatic configuration of the example makefiles.
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
-
@@ -574,7 +574,7 @@ void * f(void *v);
@@ -586,7 +586,7 @@ with one of the following three approaches; namely the SWIG C arrays library, P/
pinned arrays.
@@ -623,7 +623,7 @@ example.print_array(c.cast()); // Pass to C
-
@@ -750,7 +750,7 @@ and intermediary class method
-
@@ -845,7 +845,7 @@ public static extern void myArrayCopy(global::System.IntPtr jarg1, global::Syste
-
@@ -942,7 +942,7 @@ set so should only be used when a C# exception is not created.
@@ -1124,7 +1124,7 @@ method and C# code does not handle pending exceptions via the canthrow attribute
Actually it will issue this warning for any function beginning with SWIG_CSharpSetPendingException.
@@ -1189,7 +1189,7 @@ The managed code generated does check for the pending exception as mentioned ear
-
@@ -1245,7 +1245,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) {
Multiple catch handlers are generated should there be more than one exception specifications declared.
@@ -1379,7 +1379,7 @@ try {
-
@@ -1392,7 +1392,7 @@ The following sections provide information on the C# director implementation and
However, the Java directors section should also be read in order to gain more insight into directors.
@@ -1513,7 +1513,7 @@ CSharpDerived - UIntMethod(123)
-
@@ -1721,7 +1721,7 @@ before SWIG parses the Base class will change all the delegates to internal<
-
@@ -1769,7 +1769,7 @@ However, a call from C# to CSharpDefaults.DefaultMethod() will of cours
should pass the call on to CSharpDefaults.DefaultMethod(int)using the C++ default value, as shown above.
@@ -1804,7 +1804,7 @@ the [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrows
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers.
@@ -1936,7 +1936,7 @@ public class Bike : global::System.IDisposable {
Note the addReference call.
@@ -2068,7 +2068,7 @@ as mentioned earlier, setElement is actually:
-
@@ -2354,7 +2354,7 @@ public class example {
-
@@ -2454,7 +2454,7 @@ Some points to note:
@@ -2516,7 +2516,7 @@ Pay special attention to the memory management issues, using these attributes.
@@ -2616,7 +2616,7 @@ demonstrating that the class contains methods calling both unmanaged code -
The following example is an alternative approach to adding managed code to the generated proxy class.
@@ -2706,7 +2706,7 @@ Either suppress the warning or modify the generated code by copying and tweaking
'csbody' typemap code in csharp.swg by modifying swigCMemOwn to not be protected.
@@ -2745,7 +2745,7 @@ public class ExtendMe : global::System.IDisposable {
-
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index 5218cc0d9..fbfc7d751 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -340,7 +340,22 @@
-
@@ -95,7 +95,7 @@ RuntimeError: Contract violation: require: (arg1>=0)
@@ -174,7 +174,7 @@ specified for the derived class all must hold. In the above example,
this means that both the arguments to Spam::bar must be positive.
@@ -263,7 +263,7 @@ Regrettably, there is no automatic way to perform similar checks with enums valu
release.
diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html
index 27a291d0c..328bc2391 100644
--- a/Doc/Manual/Customization.html
+++ b/Doc/Manual/Customization.html
@@ -7,7 +7,7 @@
@@ -101,7 +101,7 @@ for exception handling. That directive is deprecated--%exception
provides the same functionality, but is substantially more flexible.
@@ -169,7 +169,7 @@ Each target language has its own approach to creating a runtime error/exception
and for Perl it is the croak method shown above.
@@ -245,7 +245,7 @@ Note: This implementation is only intended to illustrate the general idea. To m
modify it to handle nested try declarations.
@@ -280,7 +280,7 @@ class OutOfMemory {};
@@ -305,7 +305,7 @@ The %allowexception feature works like any other feature and so can be
@@ -442,7 +442,7 @@ declarations. However, it never really worked that well and the new
%exception directive is much better.
@@ -545,7 +545,7 @@ Below shows the expansions for the 1st of the overloaded something wrap
-
@@ -600,7 +600,7 @@ SWIG_NullReferenceError
The SWIG_exception() function can also be used in typemaps.
@@ -757,7 +757,7 @@ char *strdup(const char *s);
The results might not be what you expect.
@@ -839,7 +839,7 @@ The following are all equivalent:
The syntax in the first variation will generate the { } delimiters used whereas the other variations will not.
@@ -880,7 +880,7 @@ In the following example, MyExceptionClass is the name of the Java clas
Further details can be obtained from the Java exception handling section.
@@ -978,7 +978,7 @@ in the swig.swg Library file. The following shows the alternative synta
The concept of clearing features is discussed next.
@@ -1071,7 +1071,7 @@ The three macros below show this for the "except" feature:
-
@@ -1146,7 +1146,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.
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 1a317a005..a252650ff 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -6,7 +6,7 @@
From the D Programming Language web site: D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code. As such, it is not very surprising that D is able to directly interface with C libraries. Why would a SWIG module for D be needed then in the first place? To help addressing these issues, the SWIG C# module has been forked to support D. Is has evolved quite a lot since then, but there are still many similarities, so if you do not find what you are looking for on this page, it might be worth having a look at the chapter on C# (and also on Java, since the C# module was in turn forked from it). To activate the D module, pass the -d option to SWIG at the command line. The same standard command line switches as with any other language module are available, plus the following D specific ones: If you already know the SWIG C# module, you might find the following name comparison table useful: Mapping of types between the C/C++ library, the C/C++ library wrapper exposing the C functions, the D wrapper module importing these functions and the D proxy code. The ctype typemap is used to determine the types to use in the C wrapper functions. The types from the imtype typemap are used in the extern(C) declarations of these functions in the intermediary D module. The dtype typemap contains the D types used in the D proxy module/class. Used for converting between the types for C/C++ and D when generating the code for the wrapper functions (on the C++ side). The directorin typemap is used to convert parameters to the type used in the D director callback function, its return value is processed by directorout (see below). Typemaps for code generation in D proxy and type wrapper classes. Because, unlike many scripting languages supported by SWIG, D does not need any dynamic dispatch helper to access an overloaded function, the purpose of these is merely to issue a warning for overloaded C++ functions that cannot be overloaded in D (as more than one C++ type maps to a single D type). These typemaps are used for generating the skeleton of proxy classes for C++ types.20 SWIG and Android
+21 SWIG and Android
@@ -31,7 +31,7 @@ This chapter describes SWIG's support of Android.
-
20.1 Overview
+21.1 Overview
20.2 Android examples
+21.2 Android examples
-20.2.1 Examples introduction
+21.2.1 Examples introduction
20.2.2 Simple C example
+21.2.2 Simple C example

20.2.3 C++ class example
+21.2.3 C++ class example

20.2.4 Other examples
+21.2.4 Other examples
20.3 C++ STL
+21.3 C++ STL
11 Argument Handling
+12 Argument Handling
@@ -43,7 +43,7 @@ return multiple values through the arguments of a function. This chapter
describes some of the techniques for doing this.
-
11.1 The typemaps.i library
+12.1 The typemaps.i library
11.1.1 Introduction
+12.1.1 Introduction
11.1.2 Input parameters
+12.1.2 Input parameters
11.1.3 Output parameters
+12.1.3 Output parameters
11.1.4 Input/Output parameters
+12.1.4 Input/Output parameters
11.1.5 Using different names
+12.1.5 Using different names
11.2 Applying constraints to input values
+12.2 Applying constraints to input values
11.2.1 Simple constraint example
+12.2.1 Simple constraint example
11.2.2 Constraint methods
+12.2.2 Constraint methods
11.2.3 Applying constraints to new datatypes
+12.2.3 Applying constraints to new datatypes
19 Using SWIG with ccache - ccache-swig(1) manpage
+20 Using SWIG with ccache - ccache-swig(1) manpage
@@ -35,7 +35,7 @@
19.1 NAME
+20.1 NAME
19.2 SYNOPSIS
+20.2 SYNOPSIS
19.3 DESCRIPTION
+20.3 DESCRIPTION
19.4 OPTIONS SUMMARY
+20.4 OPTIONS SUMMARY
19.5 OPTIONS
+20.5 OPTIONS
19.6 INSTALLATION
+20.6 INSTALLATION
19.7 EXTRA OPTIONS
+20.7 EXTRA OPTIONS
19.8 ENVIRONMENT VARIABLES
+20.8 ENVIRONMENT VARIABLES
19.9 CACHE SIZE MANAGEMENT
+20.9 CACHE SIZE MANAGEMENT
19.10 CACHE COMPRESSION
+20.10 CACHE COMPRESSION
19.11 HOW IT WORKS
+20.11 HOW IT WORKS
19.12 USING CCACHE WITH DISTCC
+20.12 USING CCACHE WITH DISTCC
19.13 SHARING A CACHE
+20.13 SHARING A CACHE
19.14 HISTORY
+20.14 HISTORY
19.15 DIFFERENCES FROM COMPILERCACHE
+20.15 DIFFERENCES FROM COMPILERCACHE
19.16 CREDITS
+20.16 CREDITS
19.17 AUTHOR
+20.17 AUTHOR
8.2 Core language changes
-Binary integer literals
+8.2.1 Binary integer literals
8 SWIG and C++17
+9 SWIG and C++17
@@ -24,7 +24,7 @@
-
8.1 Introduction
+9.1 Introduction
8.2 Core language changes
+9.2 Core language changes
-8.2.1 Nested namespace definitions
+9.2.1 Nested namespace definitions
8.2.2 UTF-8 character literals
+9.2.2 UTF-8 character literals
8.3 Standard library changes
+9.3 Standard library changes
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 7a1326b54..a4e0be799 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -6,7 +6,7 @@
-21 SWIG and C#
+22 SWIG and C#
@@ -55,7 +55,7 @@
-
21.1 Introduction
+22.1 Introduction
21.1.1 SWIG 2 Compatibility
+22.1.1 SWIG 2 Compatibility
21.1.2 Additional command line options
+22.1.2 Additional command line options
21.2 Differences to the Java module
+22.2 Differences to the Java module
21.3 Void pointers
+22.3 Void pointers
21.4 C# Arrays
+22.4 C# Arrays
21.4.1 The SWIG C arrays library
+22.4.1 The SWIG C arrays library
21.4.2 Managed arrays using P/Invoke default array marshalling
+22.4.2 Managed arrays using P/Invoke default array marshalling
21.4.3 Managed arrays using pinning
+22.4.3 Managed arrays using pinning
21.5 C# Exceptions
+22.5 C# Exceptions
21.5.1 C# exception example using "check" typemap
+22.5.1 C# exception example using "check" typemap
21.5.2 C# exception example using %exception
+22.5.2 C# exception example using %exception
21.5.3 C# exception example using exception specifications
+22.5.3 C# exception example using exception specifications
21.5.4 Custom C# ApplicationException example
+22.5.4 Custom C# ApplicationException example
21.6 C# Directors
+22.6 C# Directors
21.6.1 Directors example
+22.6.1 Directors example
21.6.2 Directors implementation
+22.6.2 Directors implementation
21.6.3 Director caveats
+22.6.3 Director caveats
21.7 Multiple modules
+22.7 Multiple modules
21.8 C# Typemap examples
+22.8 C# Typemap examples
This section includes a few examples of typemaps. For more examples, you
@@ -1812,7 +1812,7 @@ might look at the files "csharp.swg" and "typemaps.i" in
the SWIG library.
-21.8.1 Memory management when returning references to member variables
+22.8.1 Memory management when returning references to member variables
21.8.2 Memory management for objects passed to the C++ layer
+22.8.2 Memory management for objects passed to the C++ layer
21.8.3 Date marshalling using the csin typemap and associated attributes
+22.8.3 Date marshalling using the csin typemap and associated attributes
21.8.4 A date example demonstrating marshalling of C# properties
+22.8.4 A date example demonstrating marshalling of C# properties
21.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors
+22.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors
21.8.6 Turning proxy classes into partial classes
+22.8.6 Turning proxy classes into partial classes
21.8.7 Turning proxy classes into sealed classes
+22.8.7 Turning proxy classes into sealed classes
21.8.8 Extending proxy classes with additional C# code
+22.8.8 Extending proxy classes with additional C# code
21.8.9 Underlying type for enums
+22.8.9 Underlying type for enums
8 SWIG and C++17
+8 SWIG and C++14
+
+
+
+
+
+9 SWIG and C++17
9 Preprocessing
+10 Preprocessing
10 SWIG library
+11 SWIG library
11 Argument Handling
+12 Argument Handling
12 Typemaps
+13 Typemaps
13 Customization Features
+14 Customization Features
14 Contracts
+15 Contracts
15 Variable Length Arguments
+16 Variable Length Arguments
16 SWIG and Doxygen Translation
+17 SWIG and Doxygen Translation
17 Warning Messages
+18 Warning Messages
18 Working with Modules
+19 Working with Modules
19 Using SWIG with ccache - ccache-swig(1) manpage
+20 Using SWIG with ccache - ccache-swig(1) manpage
20 SWIG and Android
+21 SWIG and Android
21 SWIG and C#
+22 SWIG and C#
22 SWIG and D
+23 SWIG and D
23 SWIG and Go
+24 SWIG and Go
24 SWIG and Guile
+25 SWIG and Guile
25 SWIG and Java
+26 SWIG and Java
26 SWIG and Javascript
+27 SWIG and Javascript
27 SWIG and Lua
+28 SWIG and Lua
28 SWIG and Ocaml
-
-
-
-
-
-
-29 SWIG and Octave
@@ -1812,7 +1772,62 @@
-38 Extending SWIG to support new languages
+38 SWIG and OCaml
+
+
+
+
+
+
+39 Extending SWIG to support new languages
14 Contracts
+15 Contracts
@@ -39,7 +39,7 @@ When one of the rules is violated by a script, a runtime exception is
generated rather than having the program continue to execute.
-
14.1 The %contract directive
+15.1 The %contract directive
14.2 %contract and classes
+15.2 %contract and classes
14.3 Constant aggregation and %aggregate_check
+15.3 Constant aggregation and %aggregate_check
14.4 Notes
+15.4 Notes
13 Customization Features
+14 Customization Features
@@ -46,7 +46,7 @@ of exception handling is presented. Then, a more general-purpose
customization mechanism known as "features" is described.
-
13.1 Exception handling with %exception
+14.1 Exception handling with %exception
13.1.1 Handling exceptions in C code
+14.1.1 Handling exceptions in C code
13.1.2 Exception handling with longjmp()
+14.1.2 Exception handling with longjmp()
13.1.3 Handling C++ exceptions
+14.1.3 Handling C++ exceptions
13.1.4 Exception handlers for variables
+14.1.4 Exception handlers for variables
13.1.5 Defining different exception handlers
+14.1.5 Defining different exception handlers
13.1.6 Special variables for %exception
+14.1.6 Special variables for %exception
13.1.7 Using The SWIG exception library
+14.1.7 Using The SWIG exception library
13.2 Object ownership and %newobject
+14.2 Object ownership and %newobject
13.3 Features and the %feature directive
+14.3 Features and the %feature directive
13.3.1 Feature attributes
+14.3.1 Feature attributes
13.3.2 Feature flags
+14.3.2 Feature flags
13.3.3 Clearing features
+14.3.3 Clearing features
13.3.4 Features and default arguments
+14.3.4 Features and default arguments
13.3.5 Feature example
+14.3.5 Feature example
22 SWIG and D
+23 SWIG and D
@@ -41,7 +41,7 @@
-
22.1 Introduction
+23.1 Introduction
22.2 Command line invocation
+23.2 Command line invocation
22.3 Typemaps
+23.3 Typemaps
-22.3.1 C# <-> D name comparison
+23.3.1 C# <-> D name comparison
22.3.2 ctype, imtype, dtype
+23.3.2 ctype, imtype, dtype
22.3.3 in, out, directorin, directorout
+23.3.3 in, out, directorin, directorout
22.3.4 din, dout, ddirectorin, ddirectorout
+23.3.4 din, dout, ddirectorin, ddirectorout
22.3.5 typecheck typemaps
+23.3.5 typecheck typemaps
22.3.6 Code injection typemaps
+23.3.6 Code injection typemaps
The standard SWIG special variables are available for use within typemaps as described in the Typemaps documentation, for example $1, $input, $result etc.
@@ -299,7 +299,7 @@ $importtype(AnotherInterface) -The D module defines a number of directives which modify the SWIG features set globally or for a specific declaration:
@@ -329,7 +329,7 @@ struct A { -There are a few SWIG pragmas specific to the D module, which you can use to influence the D code SWIG generates:
@@ -368,7 +368,7 @@ struct A { -Out of the box, C++ exceptions are fundamentally incompatible to their equivalent in the D world and cannot simply be propagated to a calling D method. There is, however, an easy way to solve this problem: Just catch the exception in the C/C++ wrapper layer, pass the contents to D, and make the wrapper code rethrow the exception in the D world.
@@ -378,7 +378,7 @@ struct A {As this feature is implemented in exactly the same way it is for C#, please see the C# documentation for a more detailed explanation.
-When the directors feature is activated, SWIG generates extra code on both the C++ and the D side to enable cross-language polymorphism. Essentially, this means that if you subclass a proxy class in D, C++ code can access any overridden virtual methods just as if you created a derived class in C++.
@@ -387,16 +387,16 @@ struct A { -By default, SWIG flattens all C++ namespaces into a single target language namespace, but as for Java and C#, the nspace feature is supported for D. If it is active, C++ namespaces are mapped to D packages/modules. Note, however, that like for the other languages, free variables and functions are not supported yet; currently, they are all allows written to the main proxy D module.
-Contrary to many of the scripting languages supported by SWIG, D fully supports C-style pointers. The D module thus includes a custom mechanism to wrap C pointers directly as D pointers where applicable, that is, if the type that is pointed to is represented the same in C and D (on the bit-level), dubbed a primitive type below.
@@ -408,7 +408,7 @@ struct A {To determine if a type should be considered primitive, the cprimitive attribute on its dtype attribute is used. For example, the dtype typemap for float has cprimitive="1", so the code from the nativepointer attribute is taken into account e.g. for float ** or the function pointer float (*)(float *).
-The D module comes with basic operator overloading support for both D1 and D2. There are, however, a few limitations arising from conceptual differences between C++ and D:
@@ -420,7 +420,7 @@ struct A {There are also some cases where the operators can be translated to D, but the differences in the implementation details are big enough that a rather involved scheme would be required for automatic wrapping them, which has not been implemented yet. This affects, for example, the array subscript operator, [], in combination with assignments - while operator [] in C++ simply returns a reference which is then written to, D resorts to a separate opIndexAssign method -, or implicit casting (which was introduced in D2 via alias this). Despite the lack of automatic support, manually handling these cases should be perfectly possible.
-As with any other language, the SWIG test-suite can be built for D using the *-d-test-suite targets of the top-level Makefile. By default, D1 is targeted, to build it with D2, use the optional D_VERSION variable, e.g. make check-d-test-suite D_VERSION=2.
@@ -428,14 +428,14 @@ struct A {Note: If you want to use GDC on Linux or another platform which requires you to link libdl for dynamically loading the shared library, you might have to add -ldl manually to the d_compile target in Examples/Makefile, because GDC does not currently honor the pragma(lib, ...) statement.
-There are no D-specific typemap examples yet. However, with the above name comparison table, you should be able to get an idea what can be done by looking at the corresponding C# section.
-There are a couple of features which are not implemented yet, but would be very useful and might be added in the near future:
diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 1e9bbb977..b14b05ba3 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -5,7 +5,7 @@ -@@ -73,7 +73,7 @@ a Google Summer of Code proposal from Summer 2008.
-@@ -189,7 +189,7 @@ where the comments for a code item are not put directly before or after the code These structural commands are stripped out by SWIG and are not assigned to anything.
-@@ -198,7 +198,7 @@ enabled using the command line -doxygen switch for the languages that do support it (currently Java and Python).
-@@ -206,7 +206,7 @@ Translation of Doxygen comments is influenced by the following %feature directives:
-@@ -218,7 +218,7 @@ instead of the corresponding language tool (javadoc, sphinx,
-@@ -265,7 +265,7 @@ wrappers of the C++ API.
-@@ -416,7 +416,7 @@ def func():
@@ -425,7 +425,7 @@ This is only applicable to Java at the moment.
-@@ -435,14 +435,14 @@ This is only applicable to Java at the moment.
-ALSO TO BE ADDED (Javadoc auto brief?)
-@@ -451,7 +451,7 @@ automatically placed in the correct locations in the resulting module and proxy files.
-@@ -558,7 +558,7 @@ Javadoc translator features summary directives):
-@@ -812,7 +812,7 @@ Here is the list of all Doxygen tags and the description of how they are transla -
@@ -1048,14 +1048,14 @@ comment, the whole comment block is ignored: -
TO BE ADDED.
-@@ -1066,7 +1066,7 @@ Doxygen or Javadoc, so most of Doxygen commands are translated by merely copying the appropriate command text.
-@@ -1229,7 +1229,7 @@ docs), you may want to use some tool like doxypy to do the work.
-@@ -1443,7 +1443,7 @@ Here is the list of all Doxygen tags and the description of how they are transla -
@@ -1627,21 +1627,21 @@ Here is the list of these tags: -
TO BE ADDED.
-This section contains information for developers enhancing the Doxygen translator.
-@@ -1667,7 +1667,7 @@ class for translation into the target documentation language. For example, JavaDocConverter is the Javadoc module class.
-@@ -1680,7 +1680,7 @@ detailed debug information printing. -debug-doxygen-translator - Display Doxygen translator module debugging information -
@@ -1732,7 +1732,7 @@ Runtime tests in Python are just plain string comparisons of the __doc__ properties.
-diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html index 1d9fc83ac..1deb1cb12 100644 --- a/Doc/Manual/Extending.html +++ b/Doc/Manual/Extending.html @@ -7,7 +7,7 @@
-@@ -97,7 +97,7 @@ Also, this chapter is not meant to be a hand-holding tutorial. As a starting po you should probably look at one of SWIG's existing modules.
-@@ -127,7 +127,7 @@ obvious, but almost all SWIG directives as well as the low-level generation of wrapper code are driven by C++ datatypes.
-@@ -164,7 +164,7 @@ role in making the system work. For example, both typemaps and declaration anno based on pattern matching and interact heavily with the underlying type system.
-@@ -209,7 +209,7 @@ latter stage of compilation. The next few sections briefly describe some of these stages.
-@@ -290,7 +290,7 @@ been expanded as well as everything else that goes into the low-level construction of the wrapper code.
-@@ -391,7 +391,7 @@ returning a foo and taking types a and b as arguments).
-@@ -646,7 +646,7 @@ $ swig -c++ -python -debug-module 4 example.i
@@ -665,7 +665,7 @@ that matches the name of the target language. For example, python:foo perl:foo.
-@@ -756,7 +756,7 @@ example.i:5. Previous declaration is foo_i(int ) -
@@ -812,7 +812,7 @@ For example, the exception code above is simply stored without any modifications.
-@@ -934,7 +934,7 @@ public : The role of these functions is described shortly.
-@@ -947,7 +947,7 @@ internal data structures, it may be useful to keep XML in the back of your mind as a model.
-@@ -993,7 +993,7 @@ typedef Hash Typetab; -
@@ -1134,7 +1134,7 @@ Returns the number of replacements made (if any). -
@@ -1211,7 +1211,7 @@ Returns the list of hash table keys. -
@@ -1300,7 +1300,7 @@ If t is not a standard object, it is assumed to be a char * and is used to create a String object. -
@@ -1785,7 +1785,7 @@ the attribute is optional. Swig_restore() must always be called after function. -
@@ -1794,7 +1794,7 @@ pointers, references, and pointers to members. A detailed discussion of type theory is impossible here. However, let's cover the highlights.
-@@ -1895,7 +1895,7 @@ make the final type, the two parts are just joined together using string concatenation.
-@@ -2064,7 +2064,7 @@ Returns the prefix of a type. For example, if ty is ty is unmodified. -
@@ -2151,7 +2151,7 @@ Checks if ty is a varargs type. Checks if ty is a templatized type. -
@@ -2253,7 +2253,7 @@ Fully reduces ty according to typedef rules. Resulting datatype will consist only of primitive typenames. -
@@ -2290,7 +2290,7 @@ Literal y; // type = 'Literal', ltype='p.char' -
@@ -2352,7 +2352,7 @@ SWIG, but is most commonly associated with type-descriptor objects that appear in wrappers (e.g., SWIGTYPE_p_double). -
@@ -2451,7 +2451,7 @@ included. Used to emit prototypes. Returns the number of required (non-optional) arguments in p. -
@@ -2466,7 +2466,7 @@ describes the creation of a minimal Python module. You should be able to extra this to other languages.
-@@ -2476,7 +2476,7 @@ the parsing of command line options, all aspects of code generation are controll different methods of the Language that must be defined by your module.
-@@ -2584,7 +2584,7 @@ that activates your module. For example, swig -python foo.i. The messages from your new module should appear.
-@@ -2643,7 +2643,7 @@ to mark the option as valid. If you forget to do this, SWIG will terminate wit unrecognized command line option error.
-@@ -2692,7 +2692,7 @@ an implementation file python.cxx and a configuration file python.swg.
-@@ -2750,7 +2750,7 @@ int Python::top(Node *n) { -
@@ -3205,7 +3205,7 @@ Discuss the kinds of functions typically needed for SWIG runtime support (e.g. the SWIG files that implement those functions.
-@@ -3224,7 +3224,7 @@ The following are the minimum that are usually supported: Please copy these and modify for any new language.
-@@ -3253,7 +3253,7 @@ during this process, see the section on .
-@@ -3312,7 +3312,7 @@ It is therefore essential that the runtime tests are written in a manner that di but error/exception out with an error message on stderr on failure.
-@@ -3504,7 +3504,7 @@ It can be run in the same way as the other language test-suites, replacing [lang The test cases used and the way it works is described in Examples/test-suite/errors/Makefile.in.
-@@ -3536,7 +3536,7 @@ Some topics that you'll want to be sure to address include: if available. -
@@ -3561,7 +3561,7 @@ should be avoided as unlike the SWIG developers, users will never have consisten
-@@ -3570,7 +3570,7 @@ the Target language in This section provides more details on how this status is given.
-@@ -3617,7 +3617,7 @@ A target language is given the 'Supported' status when -
@@ -3682,7 +3682,7 @@ Some minimum requirements and notes about languages with the 'Experimental' stat -
@@ -3746,7 +3746,7 @@ the existing tests.
-@@ -3773,7 +3773,7 @@ There are various command line options which can aid debugging a SWIG interface The complete list of command line options for SWIG are available by running swig -help.
-@@ -4181,7 +4181,7 @@ extern "X" { ... } declaration. -
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html index 8523f74aa..4a60e45e0 100644 --- a/Doc/Manual/Go.html +++ b/Doc/Manual/Go.html @@ -6,7 +6,7 @@
-@@ -86,7 +86,7 @@ type-safe as well. In case of type issues the build will fail and hence SWIG's are not used.
-@@ -101,7 +101,7 @@ SWIG interface file extension for backwards compatibility with Go 1.
-@@ -181,7 +181,7 @@ sequence for this approach would look like this:
@@ -264,7 +264,7 @@ swig -go -help -
There are two different approaches to generating wrapper files, @@ -308,7 +308,7 @@ combined with the compiled MODULE.go using go tool pack. -
@@ -318,7 +318,7 @@ modifications have to occur. This section briefly covers the essential aspects of this wrapping.
-@@ -328,7 +328,7 @@ directive. You may override this by using SWIG's -package command line option.
-@@ -360,7 +360,7 @@ followed by that name, and the destructor will be named Delete followed by that name.
-@@ -368,7 +368,7 @@ C/C++ constants created via #define or the %constant directive become Go constants, declared with a const declaration. -
@@ -378,7 +378,7 @@ usual). The values of the enumeration will become variables in Go; code should avoid modifying those variables.
-@@ -456,7 +456,7 @@ returns a go interface. If the returned pointer can be null, you can check for this by calling the Swigcptr() method.
-@@ -578,7 +578,7 @@ func (o *GoClassName) Close() { -
@@ -590,7 +590,7 @@ Doing the reverse will require an explicit type assertion, which will be checked dynamically.
-@@ -599,7 +599,7 @@ wrappers for a particular template instantation. To do this, use the %template directive. -
@@ -617,7 +617,7 @@ completely to avoid common pitfalls with directors in Go.
-@@ -689,7 +689,7 @@ be found in the end of the guide.
-@@ -724,7 +724,7 @@ documentation on directors.
-@@ -777,7 +777,7 @@ embedding.
-@@ -843,7 +843,7 @@ the Go methods.
-@@ -880,7 +880,7 @@ be found in the end of the guide.
-@@ -948,7 +948,7 @@ class.
-@@ -1013,7 +1013,7 @@ before using runtime.SetFinalizer to know all of its gotchas.
-@@ -1142,7 +1142,7 @@ SWIG/Examples/go/director/.
-@@ -1249,7 +1249,7 @@ that typemap, or add new values, to control how C/C++ types are mapped into Go types.
-Because of limitations in the way output arguments are processed in swig, @@ -1302,7 +1302,7 @@ void f(char *output); -
Often the APIs generated by swig are not very natural in go, especially if @@ -1397,7 +1397,7 @@ func bar() { -
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html index 6acdd2dc3..31d822599 100644 --- a/Doc/Manual/Guile.html +++ b/Doc/Manual/Guile.html @@ -8,7 +8,7 @@
-This section details guile-specific support in SWIG. -
@@ -62,7 +62,7 @@ improved performance. This is currently not tested with swig so your mileage may vary. To be safe set environment variable GUILE_AUTO_COMPILE to 0 when using swig generated guile code. -
@@ -70,7 +70,7 @@ There are three different concepts of "module" involved, defined separately for SWIG, Guile, and Libtool. To avoid horrible confusion, we explicitly prefix the context, e.g., "guile-module". -
Guile 1.8 and older could be interfaced using two different api's, the SCM @@ -81,7 +81,7 @@ or the GH API. The GH interface to guile is deprecated. Read more about why in version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please use that version if you really need the GH wrapper code. -
@@ -89,7 +89,7 @@ Guile support is complicated by a lack of user community cohesiveness, which manifests in multiple shared-library usage conventions. A set of policies implementing a usage convention is called a linkage. -
@@ -194,7 +194,7 @@ placed between the define-module form and the
SWIG_init via a preprocessor define to avoid symbol
clashes. For this case, however, passive linkage is available.
-
Passive linkage is just like simple linkage, but it generates an @@ -204,7 +204,7 @@ package name (see below).
You should use passive linkage rather than simple linkage when you are using multiple modules. -
SWIG can also generate wrapper code that does all the Guile module @@ -245,7 +245,7 @@ Newer Guile versions have a shorthand procedure for this:
Guile used to support an autoloading facility for object-code @@ -271,7 +271,7 @@ option, SWIG generates an exported module initialization function with an appropriate name. -
@@ -296,7 +296,7 @@ my/lib/libfoo.so.X.Y.Z and friends. This scheme is still very experimental; the (hobbit4d link) conventions are not well understood.
-
@@ -308,7 +308,7 @@ complained so far.
%rename to specify the Guile name of the wrapped
functions and variables (see CHANGES).
-
@@ -400,7 +400,7 @@ constant will appear as a scheme variable. See Features and the %feature directive for info on how to apply the %feature.
-
@@ -421,7 +421,7 @@ representing the expected pointer type. See also
If the Scheme object passed was not a SWIG smob representing a compatible
pointer, a wrong-type-arg exception is raised.
-
@@ -440,7 +440,7 @@ structure describing this type. If a generated GOOPS module has been loaded, sm the corresponding GOOPS class.
-Garbage collection is a feature of Guile since version 1.6. As SWIG now requires Guile > 1.8, @@ -454,14 +454,14 @@ is exactly like described in 24.8 Native Guile pointers +
In addition to SWIG smob pointers, Guile's native pointer type are accepted as arguments to wrapped SWIG functions. This can be useful for passing pointers to bytevector data to wrapped functions.
-@@ -487,7 +487,7 @@ mapping: The default when not specified here is to use "swig-error". See Lib/exception.i for details. -
If invoked with the command-line option For global variables, SWIG creates a single wrapper procedure
@@ -550,7 +550,7 @@ struct members, the procedures SWIG can also generate classes and generic functions for use with
@@ -696,7 +696,7 @@ Notice that <Foo> is used before it is defined. The fix is to just put th
As you can see in the example above, there are potential naming conflicts. The default exported
@@ -733,7 +733,7 @@ guile-modules. For example, The guile-modules generated above all need to be linked together. GOOPS support requires
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index 77a81995e..4c7b6d058 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -6,7 +6,7 @@
@@ -202,7 +202,7 @@ Various customisation tips and techniques using SWIG directives are covered.
The latter sections cover the advanced techniques of using typemaps for complete control of the wrapping process.
@@ -222,7 +222,7 @@ This is the commonly used method to load JNI code so your system will more than
Android uses Java JNI and also works with SWIG. Please read the Android chapter in conjunction with this one if you are targeting Android.
@@ -281,7 +281,7 @@ The following sections have further practical examples and details on how you mi
compiling and using the generated files.
@@ -318,7 +318,7 @@ swig -java -help
Their use will become clearer by the time you have finished reading this section on SWIG and Java.
@@ -333,7 +333,7 @@ They are usually in directories like this:
The exact location may vary on your machine, but the above locations are typical.
@@ -368,7 +368,7 @@ The name of the shared library output file is important.
If the name of your SWIG module is "example", the name of the corresponding shared library file should be "libexample.so" (or equivalent depending on your machine, see Dynamic linking problems for more information).
The name of the module is specified using the %module directive or -module command line option.
@@ -403,7 +403,7 @@ $
If it doesn't work have a look at the following section which discusses problems loading the shared library.
@@ -490,7 +490,7 @@ The following section also contains some C++ specific linking problems and solut
@@ -542,7 +542,7 @@ Finally make sure the version of JDK header files matches the version of Java th
@@ -551,7 +551,7 @@ You will want to produce a DLL that can be loaded by the Java Virtual Machine.
This section covers the process of using SWIG with Microsoft Visual C++ 6 although the procedure may be similar with other compilers.
In order for everything to work, you will need to have a JDK installed on your machine in order to read the JNI header files.
@@ -590,7 +590,7 @@ To run the native code in the DLL (example.dll), make sure that it is in your pa
If the library fails to load have a look at Dynamic linking problems.
@@ -649,7 +649,7 @@ Of course you may want to make changes for it to work for C++ by adding in the -
@@ -659,7 +659,7 @@ variables are wrapped with JavaBean type getters and setters and so forth.
This section briefly covers the essential aspects of this wrapping.
@@ -695,7 +695,7 @@ swig -java -package com.bloggs.swig -outdir com/bloggs/swig example.i
SWIG won't create the directory, so make sure it exists beforehand.
@@ -729,7 +729,7 @@ System.out.println(example.fact(4));
@@ -816,7 +816,7 @@ extern char *path; // Read-only (due to %immutable)
-
@@ -956,7 +956,7 @@ Or if you decide this practice isn't so bad and your own class implements ex
@@ -970,7 +970,7 @@ The final two approaches use simple integers for each enum item.
Before looking at the various approaches for wrapping named C/C++ enums, anonymous enums are considered.
@@ -1033,7 +1033,7 @@ As in the case of constants, you can access them through either the module class
@@ -1127,7 +1127,7 @@ When upgrading to JDK 1.5 or later, proper Java enums could be used instead, wit
The following section details proper Java enum generation.
@@ -1180,7 +1180,7 @@ The additional support methods need not be generated if none of the enum items h
Simpler Java enums for enums without initializers section.
@@ -1228,7 +1228,7 @@ Note that unlike typesafe enums, this approach requires users to mostly use diff
Thus the upgrade path to proper enums provided in JDK 1.5 is more painful.
@@ -1247,7 +1247,7 @@ SWIG-1.3.21 and earlier versions wrapped all enums using this approach.
The type unsafe approach is preferable to this one and this simple approach is only included for backwards compatibility with these earlier versions of SWIG.
@@ -1335,7 +1335,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return
a NULL pointer if the conversion can't be performed.
@@ -1503,7 +1503,7 @@ x.setA(3); // Modify x.a - this is the same as b.f.a
-
@@ -1566,7 +1566,7 @@ int bar = Spam.getBar();
-
@@ -1627,7 +1627,7 @@ Note that Java does not support multiple inheritance so any multiple inheritance
A warning is given when multiple inheritance is detected and only the first base class is used.
@@ -1682,7 +1682,7 @@ to hold the result and a pointer is returned (Java will release this memory
when the returned object's finalizer is run by the garbage collector).
@@ -1706,7 +1706,7 @@ For spam1 and spam4 above the Java null gets translat
The converse also occurs, that is, NULL pointers are translated into null Java objects when returned from a C/C++ function.
@@ -1821,7 +1821,7 @@ void spam(unsigned short); // Ignored
-
@@ -1864,7 +1864,7 @@ Further details on default arguments and how to restore this approach are given
@@ -1954,7 +1954,7 @@ If the resulting use of the nspace feature and hence packages results in a proxy
you will need to open up the visibility for the pointer constructor and getCPtr method from the default 'protected' to 'public' with the SWIG_JAVABODY_PROXY macro. See Java code typemaps.
@@ -2003,10 +2003,10 @@ Obviously, there is more to template wrapping than shown in this example.
More details can be found in the SWIG and C++ chapter.
@@ -2017,7 +2017,7 @@ in the shared_ptr smart pointer
-
@@ -2101,7 +2101,7 @@ Foo f = p.__deref__(); // Returns underlying Foo *
-
@@ -2116,7 +2116,7 @@ Finally enum classes are covered.
First, the crucial intermediary JNI class is considered.
@@ -2236,7 +2236,7 @@ If name is the same as modulename then the module class name g
from modulename to modulenameModule.
@@ -2318,7 +2318,7 @@ For example, let's change the intermediary JNI class access to just the default
All the methods in the intermediary JNI class will then not be callable outside of the package as the method modifiers have been changed from public access to default access. This is useful if you want to prevent users calling these low level functions.
@@ -2349,7 +2349,7 @@ example.egg(new Foo());
The primary reason for having the module class wrapping the calls in the intermediary JNI class is to implement static type checking. In this case only a Foo can be passed to the egg function, whereas any long can be passed to the egg function in the intermediary JNI class.
@@ -2400,7 +2400,7 @@ See The intermediary JNI class pragmas secti
@@ -2476,7 +2476,7 @@ int y = f.spam(5, new Foo());
-
@@ -2638,7 +2638,7 @@ and
@@ -2754,7 +2754,7 @@ However, true cross language polymorphism can be achieved using the 25.4.3.3 Proxy classes and garbage collection
+
@@ -2837,7 +2837,7 @@ The section on Java typemaps details how to specify
See the How to Handle Java Finalization's Memory-Retention Issues article for alternative approaches to managing memory by avoiding finalizers altogether.
@@ -2959,7 +2959,7 @@ For example:
Compatibility note: The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.
@@ -3047,7 +3047,7 @@ for (int i=0; i<100000; i++) {
-
@@ -3134,7 +3134,7 @@ public static void spam(SWIGTYPE_p_int x, SWIGTYPE_p_int y, int z) { ... }
-
@@ -3143,7 +3143,7 @@ The Enumerations section discussed these but om
The following sub-sections detail the various types of enum classes that can be generated.
@@ -3227,7 +3227,7 @@ The swigValue method is used for marshalling in the other direction.
The toString method is overridden so that the enum name is available.
@@ -3305,7 +3305,7 @@ These needn't be generated if the enum being wrapped does not have any initializ
Simpler Java enums for enums without initializers section describes how typemaps can be used to achieve this.
@@ -3336,7 +3336,7 @@ public final class Beverage {
-
@@ -3581,7 +3581,7 @@ typemap which is only used when a class is marked with the interface fe
See Java code typemaps for details.
@@ -3603,7 +3603,7 @@ The upshot is that C++ classes can be extended in Java and from C++ these extens
Neither C++ code nor Java code needs to know where a particular method is implemented: the combination of proxy classes, director classes, and C wrapper functions transparently takes care of all the cross-language method routing.
@@ -3671,7 +3671,7 @@ public:
-
@@ -3698,7 +3698,7 @@ If the correct implementation is in Java, the Java API is used to call the metho
@@ -3716,7 +3716,7 @@ This situation can be optimized by selectively enabling director methods (using
@@ -3779,7 +3779,7 @@ DirectorDerived.upcall_method() invoked.
-
@@ -3799,7 +3799,7 @@ Macros can be defined on the commandline when compiling your C++ code, or altern
-
@@ -3820,7 +3820,7 @@ However, if all director methods are expected to usually be overridden by Java s
The disadvantage is that invocation of director methods from C++ when Java doesn't actually override the method will require an additional call up into Java and back to C++. As such, this option is only useful when overrides are extremely common and instantiation is frequent enough that its performance is critical.
@@ -3896,7 +3896,7 @@ Exception in thread "main" java.lang.RuntimeException: There was a problem!
More on the Swig::DirectorException class can be found in the next section which details how to customize the handling of director exceptions.
@@ -4454,7 +4454,7 @@ Exception in thread "main" java.lang.IndexOutOfBoundsException: Index is negativ
-
@@ -4550,7 +4550,7 @@ class MyProtectedBase extends ProtectedBase
-
@@ -4562,7 +4562,7 @@ be awkward. This section describes some common SWIG features that are used
to improve the interface to existing C/C++ code.
@@ -4628,7 +4628,7 @@ hard to implement. It is possible to improve on this using Java code, typemaps,
customization features as covered in later sections, but sometimes helper functions are a quick and easy solution to difficult cases.
@@ -4691,7 +4691,7 @@ Vector(2, 3, 4)
in any way---the extensions only show up in the Java interface.
@@ -4828,7 +4828,7 @@ public class ValueUnsignedInt {
-
@@ -4987,7 +4987,7 @@ to raise exceptions. See the SWIG Library ch
The typemap example Handling C++ exception specifications as Java exceptions provides further exception handling capabilities.
@@ -5013,7 +5013,7 @@ protected static void protect_me() {
-
@@ -5023,7 +5023,7 @@ strings and arrays. This chapter discusses the common techniques for
solving these problems.
@@ -5197,7 +5197,7 @@ void foo(Bar *OUTPUT);
will not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar.
@@ -5263,7 +5263,7 @@ System.out.println("3 + 4 = " + result);
See the SWIG Library chapter for further details.
@@ -5330,7 +5330,7 @@ Please be aware that the typemaps in this library are not efficient as all the e
There is an alternative approach using the SWIG array library and this is covered in the next section.
@@ -5475,7 +5475,7 @@ well suited for applications in which you need to create buffers,
package binary data, etc.
@@ -5519,7 +5519,7 @@ len: 5 data: 68 69 0 6a 6b
-
@@ -5636,7 +5636,7 @@ model and use these functions in place of malloc and free in your own
code.
@@ -5657,7 +5657,7 @@ Before proceeding, it should be stressed that typemaps are not a required
part of using SWIG---the default wrapping behavior is enough in most cases.
Typemaps are only used if you want to change some aspect of the generated code.
-
@@ -5809,7 +5809,7 @@ However, the mappings allow the full range of values for each C type from Java.
@@ -5824,7 +5824,7 @@ So in summary, the C/C++ pointer to non-primitive types is cast into the 64 bit
The Java type is either the proxy class or type wrapper class.
@@ -5837,7 +5837,7 @@ Unfortunately it won't of course hold true for JNI code.
@@ -5960,7 +5960,7 @@ int c = example.count('e', "Hello World");
-
@@ -6240,7 +6240,7 @@ These are listed below:
-
@@ -6286,7 +6286,7 @@ The "javain" typemap has the optional 'pre', 'post' and 'pgcppname' attributes.
Note that when the 'pre' or 'post' attributes are specified and the associated type is used in a constructor, a constructor helper function is generated. This is necessary as the Java proxy constructor wrapper makes a call to a support constructor using a this call. In Java the this call must be the first statement in the constructor body. The constructor body thus calls the helper function and the helper function instead makes the JNI call, ensuring the 'pre' code is called before the JNI call is made. There is a Date marshalling example showing 'pre', 'post' and 'pgcppname' attributes in action.
@@ -6468,7 +6468,7 @@ in that it is not fully qualified with the package name when using the
nspace feature.
@@ -6505,7 +6505,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps
@@ -6801,7 +6801,7 @@ to make the method and constructor public:
-
@@ -7078,7 +7078,7 @@ The basic strategy here is to provide a default package typemap for the majority
-
@@ -7088,7 +7088,7 @@ the SWIG library.
@@ -7167,7 +7167,7 @@ This would be done by using the original versions of these typemaps in "enums.sw
@@ -7292,7 +7292,7 @@ We could alternatively have used %rename to rename what() into
@@ -7447,7 +7447,7 @@ If we were a martyr to the JNI cause, we could replace the succinct code within
If we had, we would have put it in the "in" typemap which, like all JNI and Java typemaps, also supports the 'throws' attribute.
@@ -7591,7 +7591,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify
what Java types to use.
@@ -7673,7 +7673,7 @@ example.foo(new String[]{"red", "green", "blue", "white"});
-
@@ -7791,7 +7791,7 @@ $ java runme
1 12.0 340.0
-
@@ -7997,7 +7997,7 @@ SWIG usually generates code which constructs the proxy classes using Java code a
Note that the JNI code above uses a number of string lookups to call a constructor, whereas this would not occur using byte compiled Java code.
@@ -8041,7 +8041,7 @@ System.out.println("foo1? " + foo1.equals(foo2));
-
@@ -8100,7 +8100,7 @@ This example contains some useful functionality which you may want in your code.
@@ -8280,7 +8280,7 @@ The C functional interface has been completely morphed into an object-oriented i
the Butler class would behave much like any pure Java class and feel more natural to Java users.
@@ -8403,7 +8403,7 @@ public class Bike {
Note the addReference call.
@@ -8531,7 +8531,7 @@ as mentioned earlier, setElement is actually:
-
@@ -8708,7 +8708,7 @@ A few things to note:
-
@@ -8887,10 +8887,10 @@ public abstract class UserVisibleFoo extends Foo {
@@ -8946,7 +8946,7 @@ public class Barmy {
-
@@ -9007,7 +9007,7 @@ All destructors have to be called manually for example the delete_Foo(foo)
@@ -9057,7 +9057,7 @@ This directive is only really useful if you want to mix your own hand crafted JN
@@ -9078,7 +9078,7 @@ However, you will have to be careful about memory management and make sure that
This method normally calls the C++ destructor or free() for C code.
@@ -9100,7 +9100,7 @@ The -verbose:jni and -verbose:gc are also useful options for monitoring code beh
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index 8de528511..c328bbb6b 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -7,7 +7,7 @@
This chapter describes SWIG's support of Javascript. It does not cover SWIG basics, but only information that is specific to this module. Javascript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development.
@@ -63,10 +63,10 @@ Javascript has gone beyond being a browser-based scripting language and with node-webkit there is a platform which uses Google's Suppose that you defined a SWIG module such as the following: The configuration for tests and examples currently supports Linux and Mac only and not MinGW (Windows) yet. At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues. The primary development environment has been Linux (Ubuntu 12.04). Windows and Mac OS X have been tested sporadically. Therefore, the generators might have more issues on those platforms. Please report back any problem you observe to help us improving this module quickly. This chapter gives a short introduction how to use a native Javascript extension: as a To install A more detailed explanation is given in the Examples section. Webkit is pre-installed on Mac OS X and available as a library for GTK. There is general information about programming with WebKit on Apple Developer Documentation. Details about There is general information about programming GTK at GTK documentation and in the GTK tutorial, and for Webkit there is a Webkit GTK+ API Reference. To get started with Some basic examples are shown here in more detail. The common example Note: ECMAScript 5, the currently implemented Javascript standard, does not have modules. The common example -procdoc
@@ -522,7 +522,7 @@ like this:
typemap argument doc. See Lib/guile/typemaps.i for
details.
-24.11 Procedures with setters
+25.11 Procedures with setters
(struct-member-get
pointer) and (struct-member-set pointer
value) are not generated.
-24.12 GOOPS Proxy Classes
+25.12 GOOPS Proxy Classes
%import "foo.h" before the %inline block.
24.12.1 Naming Issues
+25.12.1 Naming Issues
24.12.2 Linking
+25.12.2 Linking
25 SWIG and Java
+26 SWIG and Java
@@ -167,7 +167,7 @@ It covers most SWIG features, but certain low-level details are covered in less
-
25.1 Overview
+26.1 Overview
25.2 Preliminaries
+26.2 Preliminaries
25.2.1 Running SWIG
+26.2.1 Running SWIG
25.2.2 Additional Commandline Options
+26.2.2 Additional Commandline Options
25.2.3 Getting the right header files
+26.2.3 Getting the right header files
25.2.4 Compiling a dynamic module
+26.2.4 Compiling a dynamic module
25.2.5 Using your module
+26.2.5 Using your module
25.2.6 Dynamic linking problems
+26.2.6 Dynamic linking problems
25.2.7 Compilation problems and compiling with C++
+26.2.7 Compilation problems and compiling with C++
25.2.8 Building on Windows
+26.2.8 Building on Windows
25.2.8.1 Running SWIG from Visual Studio
+26.2.8.1 Running SWIG from Visual Studio
25.2.8.2 Using NMAKE
+26.2.8.2 Using NMAKE
25.3 A tour of basic C/C++ wrapping
+26.3 A tour of basic C/C++ wrapping
25.3.1 Modules, packages and generated Java classes
+26.3.1 Modules, packages and generated Java classes
25.3.2 Functions
+26.3.2 Functions
25.3.3 Global variables
+26.3.3 Global variables
25.3.4 Constants
+26.3.4 Constants
25.3.5 Enumerations
+26.3.5 Enumerations
25.3.5.1 Anonymous enums
+26.3.5.1 Anonymous enums
25.3.5.2 Typesafe enums
+26.3.5.2 Typesafe enums
25.3.5.3 Proper Java enums
+26.3.5.3 Proper Java enums
25.3.5.4 Type unsafe enums
+26.3.5.4 Type unsafe enums
25.3.5.5 Simple enums
+26.3.5.5 Simple enums
25.3.6 Pointers
+26.3.6 Pointers
25.3.7 Structures
+26.3.7 Structures
25.3.8 C++ classes
+26.3.8 C++ classes
25.3.9 C++ inheritance
+26.3.9 C++ inheritance
25.3.10 Pointers, references, arrays and pass by value
+26.3.10 Pointers, references, arrays and pass by value
25.3.10.1 Null pointers
+26.3.10.1 Null pointers
25.3.11 C++ overloaded functions
+26.3.11 C++ overloaded functions
25.3.12 C++ default arguments
+26.3.12 C++ default arguments
25.3.13 C++ namespaces
+26.3.13 C++ namespaces
25.3.14 C++ templates
+26.3.14 C++ templates
25.3.15 C++ Smart Pointers
+26.3.15 C++ Smart Pointers
-25.3.15.1 The shared_ptr Smart Pointer
+26.3.15.1 The shared_ptr Smart Pointer
25.3.15.2 Generic Smart Pointers
+26.3.15.2 Generic Smart Pointers
25.4 Further details on the generated Java classes
+26.4 Further details on the generated Java classes
25.4.1 The intermediary JNI class
+26.4.1 The intermediary JNI class
25.4.1.1 The intermediary JNI class pragmas
+26.4.1.1 The intermediary JNI class pragmas
25.4.2 The Java module class
+26.4.2 The Java module class
25.4.2.1 The Java module class pragmas
+26.4.2.1 The Java module class pragmas
25.4.3 Java proxy classes
+26.4.3 Java proxy classes
25.4.3.1 Memory management
+26.4.3.1 Memory management
25.4.3.2 Inheritance
+26.4.3.2 Inheritance
26.4.3.3 Proxy classes and garbage collection
25.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
+26.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
25.4.3.5 Single threaded applications and thread safety
+26.4.3.5 Single threaded applications and thread safety
25.4.4 Type wrapper classes
+26.4.4 Type wrapper classes
25.4.5 Enum classes
+26.4.5 Enum classes
25.4.5.1 Typesafe enum classes
+26.4.5.1 Typesafe enum classes
25.4.5.2 Proper Java enum classes
+26.4.5.2 Proper Java enum classes
25.4.5.3 Type unsafe enum classes
+26.4.5.3 Type unsafe enum classes
25.4.6 Interfaces
+26.4.6 Interfaces
25.5 Cross language polymorphism using directors
+26.5 Cross language polymorphism using directors
25.5.1 Enabling directors
+26.5.1 Enabling directors
25.5.2 Director classes
+26.5.2 Director classes
25.5.3 Overhead and code bloat
+26.5.3 Overhead and code bloat
25.5.4 Simple directors example
+26.5.4 Simple directors example
25.5.5 Director threading issues
+26.5.5 Director threading issues
25.5.6 Director performance tuning
+26.5.6 Director performance tuning
25.5.7 Java exceptions from directors
+26.5.7 Java exceptions from directors
25.5.7.1 Customizing director exceptions
+26.5.7.1 Customizing director exceptions
25.6 Accessing protected members
+26.6 Accessing protected members
25.7 Common customization features
+26.7 Common customization features
25.7.1 C/C++ helper functions
+26.7.1 C/C++ helper functions
25.7.2 Class extension with %extend
+26.7.2 Class extension with %extend
25.7.3 Class extension with %proxycode
+26.7.3 Class extension with %proxycode
25.7.4 Exception handling with %exception and %javaexception
+26.7.4 Exception handling with %exception and %javaexception
25.7.5 Method access with %javamethodmodifiers
+26.7.5 Method access with %javamethodmodifiers
25.8 Tips and techniques
+26.8 Tips and techniques
25.8.1 Input and output parameters using primitive pointers and references
+26.8.1 Input and output parameters using primitive pointers and references
25.8.2 Simple pointers
+26.8.2 Simple pointers
25.8.3 Wrapping C arrays with Java arrays
+26.8.3 Wrapping C arrays with Java arrays
25.8.4 Unbounded C Arrays
+26.8.4 Unbounded C Arrays
25.8.5 Binary data vs Strings
+26.8.5 Binary data vs Strings
25.8.6 Overriding new and delete to allocate from Java heap
+26.8.6 Overriding new and delete to allocate from Java heap
25.9 Java typemaps
+26.9 Java typemaps
25.9.1 Default primitive type mappings
+26.9.1 Default primitive type mappings
25.9.2 Default typemaps for non-primitive types
+26.9.2 Default typemaps for non-primitive types
25.9.3 Sixty four bit JVMs
+26.9.3 Sixty four bit JVMs
25.9.4 What is a typemap?
+26.9.4 What is a typemap?
25.9.5 Typemaps for mapping C/C++ types to Java types
+26.9.5 Typemaps for mapping C/C++ types to Java types
25.9.6 Java typemap attributes
+26.9.6 Java typemap attributes
25.9.7 Java special variables
+26.9.7 Java special variables
25.9.8 Typemaps for both C and C++ compilation
+26.9.8 Typemaps for both C and C++ compilation
25.9.9 Java code typemaps
+26.9.9 Java code typemaps
25.9.10 Director specific typemaps
+26.9.10 Director specific typemaps
25.10 Typemap Examples
+26.10 Typemap Examples
25.10.1 Simpler Java enums for enums without initializers
+26.10.1 Simpler Java enums for enums without initializers
25.10.2 Handling C++ exception specifications as Java exceptions
+26.10.2 Handling C++ exception specifications as Java exceptions
25.10.3 NaN Exception - exception handling for a particular type
+26.10.3 NaN Exception - exception handling for a particular type
25.10.4 Converting Java String arrays to char **
+26.10.4 Converting Java String arrays to char **
25.10.5 Expanding a Java object to multiple arguments
+26.10.5 Expanding a Java object to multiple arguments
25.10.6 Using typemaps to return arguments
+26.10.6 Using typemaps to return arguments
25.10.7 Adding Java downcasts to polymorphic return types
+26.10.7 Adding Java downcasts to polymorphic return types
25.10.8 Adding an equals method to the Java classes
+26.10.8 Adding an equals method to the Java classes
25.10.9 Void pointers and a common Java base class
+26.10.9 Void pointers and a common Java base class
25.10.10 Struct pointer to pointer
+26.10.10 Struct pointer to pointer
25.10.11 Memory management when returning references to member variables
+26.10.11 Memory management when returning references to member variables
25.10.12 Memory management for objects passed to the C++ layer
+26.10.12 Memory management for objects passed to the C++ layer
25.10.13 Date marshalling using the javain typemap and associated attributes
+26.10.13 Date marshalling using the javain typemap and associated attributes
25.11 Living with Java Directors
+26.11 Living with Java Directors
25.12 Odds and ends
+26.12 Odds and ends
-25.12.1 JavaDoc comments
+26.12.1 JavaDoc comments
25.12.2 Functional interface without proxy classes
+26.12.2 Functional interface without proxy classes
25.12.3 Using your own JNI functions
+26.12.3 Using your own JNI functions
25.12.4 Performance concerns and hints
+26.12.4 Performance concerns and hints
25.12.5 Debugging
+26.12.5 Debugging
25.13 Java Examples
+26.13 Java Examples
26 SWIG and Javascript
+27 SWIG and Javascript
@@ -52,7 +52,7 @@
26.1 Overview
+27.1 Overview
Chromium as Web-Browser widget and node.js for javascript extensions.
26.2 Preliminaries
+27.2 Preliminaries
-26.2.1 Running SWIG
+27.2.1 Running SWIG
v8 has a C++ API, and thus, the generated modules must be compiled as C++.
-26.2.2 Running Tests and Examples
+27.2.2 Running Tests and Examples
26.2.3 Known Issues
+27.2.3 Known Issues
26.3 Integration
+27.3 Integration
node.js module, and as an extension for an embedded Webkit.26.3.1 Creating node.js Extensions
+27.3.1 Creating node.js Extensions
node.js you can download an installer from their web-site for Mac OS X and Windows. For Linux you can either build the source yourself and run sudo checkinstall or keep to the (probably stone-age) packaged version. For Ubuntu there is a PPA available.26.3.1.1 Troubleshooting
+27.3.1.1 Troubleshooting
@@ -233,12 +233,12 @@ require("./build/Release/example")
$ sudo apt-get remove gyp
-
26.3.2 Embedded Webkit
+27.3.2 Embedded Webkit
26.3.2.1 Mac OS X
+27.3.2.1 Mac OS X
Cocoa programming are not covered here.26.3.2.2 GTK
+27.3.2.2 GTK
26.3.3 Creating Applications with node-webkit
+27.3.3 Creating Applications with node-webkit
node-webkit there is a very informative set of wiki pages.26.4 Examples
+27.4 Examples
26.4.1 Simple
+27.4.1 Simple
simple looks like this:node.js and other implementations provide this mechanism defined by the CommonJS group. For browsers this is provided by Browserify, for instance.26.4.2 Class
+27.4.2 Class
class defines three classes, Shape, Circle, and Square:prototype of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in Inheritance and the prototype chain, for instance.
The Javascript Module implementation has taken a very different approach compared to other language modules in order to support different Javascript interpreters.
-The Javascript module is implemented in Source/Modules/javascript.cxx. It dispatches the code generation to a JSEmitter instance, V8Emitter or JSCEmitter. Additionally there are some helpers: Template, for templated code generation, and JSEmitterState, which is used to manage state information during AST traversal. This rough map shall make it easier to find a way through this huge source file:
All generated code is created on the basis of code templates. The templates for JavascriptCore can be found in Lib/javascript/jsc/javascriptcode.swg, for v8 in Lib/javascript/v8/javascriptcode.swg.
Template creates a copy of that string and Template::replace uses Swig's Replaceall to replace variables in the template. Template::trim can be used to eliminate leading and trailing whitespaces. Template::print is used to write the final template string to a Swig DOH (based on Printv). All methods allow chaining.
The Javascript module delegates code generation to a JSEmitter instance. The following extract shows the essential interface:
In enterClass the emitter stores state information that is necessary when processing class members. In exitClass the wrapper code for the whole class is generated.
For storing information during the AST traversal the emitter provides a JSEmitterState with different slots to store data representing the scopes global, class, function, and variable.
State information can be retrieved using state.clazz(NAME) or with Getattr on state.clazz() which actually returns a Hash instance.
Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.
diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html index c2c02fc7d..4ef6aeb83 100644 --- a/Doc/Manual/Library.html +++ b/Doc/Manual/Library.html @@ -7,7 +7,7 @@ -@@ -99,7 +99,7 @@ Set the environment variable to hold an alternative library directory. The directories that are searched are displayed when using -verbose commandline option.
-@@ -111,7 +111,7 @@ pointers as class-like objects. Since these functions provide direct access to memory, their use is potentially unsafe and you should exercise caution.
-@@ -327,7 +327,7 @@ In this example, the function int_to_uint() would be used to cast type Note: When working with simple pointers, typemaps can often be used to provide more seamless operation.
-@@ -506,7 +506,7 @@ used with types of char or char *. SWIG's default handling of these types is to handle them as character strings and the two macros do not do enough to change this.
-@@ -667,7 +667,7 @@ Now, in a script:
@@ -769,7 +769,7 @@ char *cdata_name(type* ptr, int nitems) Clearly they are unsafe.
-@@ -789,7 +789,7 @@ morality. The modules in this section provide basic functionality for manipulating raw C strings.
-@@ -830,7 +830,7 @@ interpreter and lead to a crash). Furthermore, the default behavior does not work well with binary data. Instead, strings are assumed to be NULL-terminated.
-@@ -872,7 +872,7 @@ In the wrapper function, the passed string will be expanded to a pointer and len The (char *STRING, int LENGTH) multi-argument typemap is also available in addition to (char *STRING, size_t LENGTH).
-@@ -913,7 +913,7 @@ however, you may need to provide your own "newfree" typemap for other types. See Object ownership and %newobject for more details.
-@@ -1373,7 +1373,7 @@ structure or class instead. -
@@ -1420,7 +1420,7 @@ Please look for the library files in the appropriate language library directory.
-@@ -1504,7 +1504,7 @@ void foo(string s, const String &t); // std_string typemaps still applie -
@@ -1683,7 +1683,7 @@ if you want to make their head explode. details and the public API exposed to the interpreter vary.
-@@ -1733,10 +1733,10 @@ The %exception directive can be used by placing the following code befo Any thrown STL exceptions will then be gracefully handled instead of causing a crash.
-@@ -1832,7 +1832,7 @@ System.out.println(val1 + " " + val2); -
@@ -1923,7 +1923,7 @@ Adding the missing %shared_ptr macros will fix this: -
@@ -1945,7 +1945,7 @@ SWIG will choose to wrap just the first method by default. For the interested reader, SWIG detects that they are equivalent types via the typecheck typemaps in the shared_ptr library.
-@@ -1987,7 +1987,7 @@ The SWIG code below shows the required ordering: -
@@ -1995,7 +1995,7 @@ The languages that support shared_ptr also have support for using shared_ptr wit
-@@ -2044,10 +2044,10 @@ int value = k.getValue(); -
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html index 90bcc5a00..0fa1ecb13 100644 --- a/Doc/Manual/Lua.html +++ b/Doc/Manual/Lua.html @@ -7,7 +7,7 @@
-The current SWIG implementation is designed to work with Lua 5.0.x, 5.1.x and 5.2.x. It should work with later versions of Lua, but certainly not with Lua 4.0 due to substantial API changes. It is possible to either static link or dynamic link a Lua module into the interpreter (normally Lua static links its libraries, as dynamic linking is not available on all platforms). SWIG also has support for eLua starting from eLua 0.8. Due to substantial changes between SWIG 2.x and SWIG 3.0 and unavailability of testing platform, eLua status was downgraded to 'experimental'.
-@@ -138,7 +138,7 @@ $ swig -lua -eluac example.i The -elua option puts all the C function wrappers and variable get/set wrappers in rotables. It also generates a metatable which will control the access to these variables from eLua. It also offers a significant amount of module size compression. On the other hand, the -eluac option puts all the wrappers in a single rotable. With this option, no matter how huge the module, it will consume no additional microcontroller SRAM (crass compression). There is a catch though: Metatables are not generated with -eluac. To access any value from eLua, one must directly call the wrapper function associated with that value.
-@@ -179,7 +179,7 @@ swig -lua -help -
@@ -250,7 +250,7 @@ LUALIB_API int ( luaopen_mod )(lua_State *L ); More information on building and configuring eLua can be found here: http://www.eluaproject.net/doc/v0.8/en_building.html
-@@ -318,7 +318,7 @@ Is quite obvious (Go back and consult the Lua documents on how to enable loadlib -
@@ -336,19 +336,19 @@ $ ./my_lua >
By default, SWIG tries to build a very natural Lua interface to your C/C++ code. This section briefly covers the essential aspects of this wrapping.
-The SWIG module directive specifies the name of the Lua module. If you specify `module example', then everything is wrapped into a Lua table 'example' containing all the functions and variables. When choosing a module name, make sure you don't use the same name as a built-in Lua command or standard module name.
-@@ -389,7 +389,7 @@ It is also possible to rename the module with an assignment. 24 -
@@ -477,7 +477,7 @@ If you have used the -eluac option for your eLua module, you will have In general, functions of the form "variable_get()" and "variable_set()" are automatically generated by SWIG for use with -eluac.
-@@ -512,7 +512,7 @@ If you're using eLua and have used -elua or -eluac to generate Hello World -
@@ -568,7 +568,7 @@ If the -no-old-metatable-bindings option is used, then these old-style It is worth mentioning, that example.Test.TEST1 and example.Test_TEST1 are different entities and changing one does not change the other. Given the fact that these are constantes and they are not supposed to be changed, it is up to you to avoid such issues.
-@@ -606,7 +606,7 @@ Lua enforces the integrity of its userdata, so it is virtually impossible to cor nil -
@@ -710,7 +710,7 @@ For eLua with the -eluac option, structure manipulation has to be perfo In general, functions of the form "new_struct()", "struct_member_get()", "struct_member_set()" and "free_struct()" are automatically generated by SWIG for each structure defined in C. (Please note: This doesn't apply for modules generated with the -elua option)
-@@ -785,7 +785,7 @@ Both style names are generated by default now. However, if the -no-old-metatable-bindings option is used, then the backward compatible names are not generated in addition to ordinary ones.
-@@ -810,7 +810,7 @@ then the function spam() accepts a Foo pointer or a pointer to any clas
It is safe to use multiple inheritance with SWIG.
-@@ -841,7 +841,7 @@ Foo spam7();
then all three functions will return a pointer to some Foo object. Since the third function (spam7) returns a value, newly allocated memory is used to hold the result and a pointer is returned (Lua will release this memory when the return value is garbage collected). The other two are pointers which are assumed to be managed by the C code and so will not be garbage collected.
-@@ -927,7 +927,7 @@ Please refer to the "SWIG and C++" chapter for more information about overloadin
Dealing with the Lua coercion mechanism, the priority is roughly (integers, floats, strings, userdata). But it is better to rename the functions rather than rely upon the ordering.
-@@ -1059,7 +1059,7 @@ operators and pseudo-operators):
No other lua metafunction is inherited. For example, __gc is not inherited and must be redefined in every class. __tostring is subject to a special handling. If absent in class and in class bases, a default one will be provided by SWIG.
-@@ -1116,7 +1116,7 @@ true Extend works with both C and C++ code, on classes and structs. It does not modify the underlying object in any way---the extensions only show up in the Lua interface. The only item to take note of is the code has to use the '$self' instead of 'this', and that you cannot access protected/private members of the code (as you are not officially part of the class).
-If you have a function that allocates memory like this,
@@ -1140,7 +1140,7 @@ char *foo();This will release the allocated memory.
-@@ -1175,7 +1175,7 @@ In Lua:
Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter. Some more complicated examples will appear later.
-
@@ -1227,7 +1227,7 @@ If you ever need to access the underlying pointer returned by operator->(
> f = p:__deref__() -- Returns underlying Foo *
-27.3.16 C++ Exceptions
+28.3.16 C++ Exceptions
@@ -1370,7 +1370,7 @@ and the "Exception handling add exception specification to functions or globally (respectively).
-@@ -1421,7 +1421,7 @@ Now, from Lua usage is as follows: 19 > -
@@ -1437,7 +1437,7 @@ If SWIG is running in a backwards compatible way, i.e. without the -no-old-m
-27.3.17.2 Names
+28.3.17.2 Names
If SWIG is launched without -no-old-metatable-bindings option, then it enters backward-compatible mode. While in this mode, it tries @@ -1481,7 +1481,7 @@ surrounding scope without any prefixing. Pretending that Test2 is a struct, not > -
The internal organization of inheritance has changed. @@ -1522,12 +1522,12 @@ function > -
This section explains what typemaps are and how to use them. The default wrapping behaviour of SWIG is enough in most cases. However sometimes SWIG may need a little additional assistance to know which typemap to apply to provide the best wrapping. This section will be explaining how to use typemaps to best effect
-A typemap is nothing more than a code generation rule that is attached to a specific C datatype. For example, to convert integers from Lua to C, you might define a typemap like this:
@@ -1555,7 +1555,7 @@ Received an integer : 6 720 -There are many ready written typemaps built into SWIG for all common types (int, float, short, long, char*, enum and more), which SWIG uses automatically, with no effort required on your part.
@@ -1608,7 +1608,7 @@ void swap(int *sx, int *sy);Note: C++ references must be handled exactly the same way. However SWIG will automatically wrap a const int& as an input parameter (since that it obviously input).
-Arrays present a challenge for SWIG, because like pointers SWIG does not know whether these are input or output values, nor @@ -1672,7 +1672,7 @@ and Lua tables to be 1..N, (the indexing follows the norm for the language). In
Note: SWIG also can support arrays of pointers in a similar manner.
-Several C++ libraries use a pointer-pointer functions to create its objects. These functions require a pointer to a pointer which is then filled with the pointer to the new object. Microsoft's COM and DirectX as well as many other libraries have this kind of function. An example is given below:
@@ -1706,7 +1706,7 @@ int Create_Math(iMath** pptr); // its creator (assume it mallocs) ptr=nil -- the iMath* will be GC'ed as normal -This section describes how you can modify SWIG's default wrapping behavior for various C/C++ datatypes using the %typemap directive. This is an advanced topic that assumes familiarity with the Lua C API as well as the material in the "Typemaps" chapter.
@@ -1715,7 +1715,7 @@ ptr=nil -- the iMath* will be GC'ed as normalBefore proceeding, you should read the previous section on using typemaps, and look at the existing typemaps found in luatypemaps.swg and typemaps.i. These are both well documented and fairly easy to read. You should not attempt to write your own typemaps until you have read and can understand both of these files (they may well also give you an idea to base your work on).
-There are many different types of typemap that can be written, the full list can be found in the "Typemaps" chapter. However the following are the most commonly used ones.
@@ -1728,7 +1728,7 @@ ptr=nil -- the iMath* will be GC'ed as normal (the syntax for the typecheck is different from the typemap, see typemaps for details). -This section explains the SWIG specific Lua-C API. It does not cover the main Lua-C api, as this is well documented and not worth covering.
@@ -1777,7 +1777,7 @@ This macro, when called within the context of a SWIG wrapped function, will disp@@ -1786,7 +1786,7 @@ This section covers adding of some small extra bits to your module to add the la -
@@ -1805,7 +1805,7 @@ int native_function(lua_State*L) // my native code The %native directive in the above example, tells SWIG that there is a function int native_function(lua_State*L); which is to be added into the module under the name 'my_func'. SWIG will not add any wrapper for this function, beyond adding it into the function table. How you write your code is entirely up to you.
-@@ -1843,7 +1843,7 @@ Good uses for this feature is adding of new code, or writing helper functions to See Examples/lua/arrays for an example of this code.
-@@ -1854,7 +1854,7 @@ See Examples/lua/arrays for an example of this code.
-@@ -1914,7 +1914,7 @@ end
That way when you call 'a=example.Foo', the interpreter looks at the table 'example' sees that there is no field 'Foo' and calls __index. This will in turn check in '.get' table and find the existence of 'Foo' and then return the value of the C function call 'Foo_get()'. Similarly for the code 'example.Foo=10', the interpreter will check the table, then call the __newindex which will then check the '.set' table and call the C function 'Foo_set(10)'.
-@@ -1994,7 +1994,7 @@ Note: Both the opaque structures (like the FILE*) and normal wrapped classes/str
Note: Operator overloads are basically done in the same way, by adding functions such as '__add' & '__call' to the class' metatable. The current implementation is a bit rough as it will add any member function beginning with '__' into the metatable too, assuming its an operator overload.
-diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html index 19b69e5f4..7efd74e2b 100644 --- a/Doc/Manual/Modules.html +++ b/Doc/Manual/Modules.html @@ -7,7 +7,7 @@
-@@ -78,7 +78,7 @@ where you want to create a collection of modules. Each module in the collection is created via separate invocations of SWIG.
-@@ -177,7 +177,7 @@ in parallel from multiple threads as SWIG provides no locking - for more on that issue, read on.
-@@ -243,7 +243,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.
-As described in The run-time type checker, @@ -282,7 +282,7 @@ SWIG_TYPE_TABLE to be the same as the module whose types you are trying to access.
-@@ -293,7 +293,7 @@ into it. This is very often NOT what you want and it can lead to unexpect behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libraries.
-@@ -301,7 +301,7 @@ Due to the complexity of working with shared libraries and multiple modules, it an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
-diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 11d21ce1b..8e456b9e6 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -7,7 +7,7 @@
-@@ -106,7 +106,7 @@ file Examples/Makefile illustrate how to compile and link SWIG modules that will be loaded dynamically. This has only been tested on Linux so far.
-@@ -129,7 +129,7 @@ you will compile the file example_wrap.c with ocamlc or the resulting .ml and .mli files as well, and do the final link with -custom (not needed for native link).
-@@ -166,7 +166,7 @@ in C++ mode, you must:
@@ -242,7 +242,7 @@ let b = C_string (getenv "PATH") -
@@ -256,7 +256,7 @@ option to build your functions into the primitive list. This option is not needed when you build native code.
-@@ -267,7 +267,7 @@ liberal with pointer types may not compile under the C++ compiler. Most code meant to be compiled as C++ will not have problems.
-@@ -367,7 +367,7 @@ value items pass through directly, but you must make your own type signature for a function that uses value in this way.
-@@ -401,7 +401,7 @@ it describes the output SWIG will generate for class definitions. -
@@ -464,7 +464,7 @@ val x : Enum_test.c_obj = C_enum `a
@@ -477,10 +477,10 @@ functions imported from different modules. You must convert values to master values using the swig_val function before sharing them with another module.
-@@ -501,7 +501,7 @@ arrays of simple types with known bounds in your code, but this only works for arrays whose bounds are completely specified.
-@@ -514,7 +514,7 @@ SWIG can't predict which of these methods will be used in the array, so you have to specify it for yourself in the form of a typemap.
-@@ -528,7 +528,7 @@ Consider writing an object when the ending condition of your array is complex, such as using a required sentinel, etc.
-@@ -579,7 +579,7 @@ void printfloats( float *tab, int len ); -
@@ -622,7 +622,7 @@ the underlying pointer, so using create_[x]_from_ptr alters the returned value for the same object.
-@@ -702,7 +702,7 @@ baz # -
@@ -732,7 +732,7 @@ public: }; -
@@ -750,7 +750,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \ -L$QTPATH/lib -cclib -lqt
@@ -777,10 +777,10 @@ Assuming you have a working installation of QT, you will see a window containing the string "hi" in a button. -28.2.5 Director Classes
+38.2.5 Director Classes
-28.2.5.1 Director Introduction
+38.2.5.1 Director Introduction
@@ -807,7 +807,7 @@ class foo { };
@@ -835,7 +835,7 @@ In this example, I'll examine the objective caml code involved in providing an overloaded class. This example is contained in Examples/ocaml/shapes.
-