diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 27337ea7a..25d2dbf9c 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -657,6 +657,7 @@
@@ -91,7 +91,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.
-@@ -121,7 +121,7 @@ obvious, but almost all SWIG directives as well as the low-level generation of wrapper code are driven by C++ datatypes.
-@@ -158,7 +158,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.
-@@ -203,7 +203,7 @@ latter stage of compilation. The next few sections briefly describe some of these stages.
-@@ -284,7 +284,7 @@ been expanded as well as everything else that goes into the low-level construction of the wrapper code.
-@@ -385,7 +385,7 @@ returning a foo and taking types a and b as arguments).
-@@ -640,7 +640,7 @@ $ swig -c++ -python -debug-module 4 example.i
@@ -659,7 +659,7 @@ that matches the name of the target language. For example, python:foo perl:foo.
-@@ -750,7 +750,7 @@ example.i:5. Previous declaration is foo_i(int )
@@ -806,7 +806,7 @@ For example, the exception code above is simply stored without any modifications.
-@@ -928,7 +928,7 @@ public : The role of these functions is described shortly.
-@@ -941,7 +941,7 @@ internal data structures, it may be useful to keep XML in the back of your mind as a model.
-@@ -987,7 +987,7 @@ typedef Hash Typetab; -
@@ -1128,7 +1128,7 @@ Returns the number of replacements made (if any). -
@@ -1205,7 +1205,7 @@ Returns the list of hash table keys. -
@@ -1294,7 +1294,7 @@ If t is not a standard object, it is assumed to be a char * and is used to create a String object. -
@@ -1782,7 +1782,7 @@ the attribute is optional. Swig_restore() must always be called after function. -
@@ -1791,7 +1791,7 @@ pointers, references, and pointers to members. A detailed discussion of type theory is impossible here. However, let's cover the highlights.
-@@ -1892,7 +1892,7 @@ make the final type, the two parts are just joined together using string concatenation.
-@@ -2061,7 +2061,7 @@ Returns the prefix of a type. For example, if ty is ty is unmodified. -
@@ -2148,7 +2148,7 @@ Checks if ty is a varargs type. Checks if ty is a templatized type. -
@@ -2250,7 +2250,7 @@ Fully reduces ty according to typedef rules. Resulting datatype will consist only of primitive typenames. -
@@ -2287,7 +2287,7 @@ Literal y; // type = 'Literal', ltype='p.char' -
@@ -2349,7 +2349,7 @@ SWIG, but is most commonly associated with type-descriptor objects that appear in wrappers (e.g., SWIGTYPE_p_double). -
@@ -2448,7 +2448,7 @@ included. Used to emit prototypes. Returns the number of required (non-optional) arguments in p. -
@@ -2463,7 +2463,7 @@ describes the creation of a minimal Python module. You should be able to extra this to other languages.
-@@ -2473,7 +2473,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.
-@@ -2581,7 +2581,7 @@ that activates your module. For example, swig -python foo.i. The messages from your new module should appear.
-@@ -2640,7 +2640,7 @@ to mark the option as valid. If you forget to do this, SWIG will terminate wit unrecognized command line option error.
-@@ -2689,7 +2689,7 @@ an implementation file python.cxx and a configuration file python.swg.
-@@ -2747,7 +2747,7 @@ int Python::top(Node *n) { -
@@ -3202,7 +3202,7 @@ Discuss the kinds of functions typically needed for SWIG runtime support (e.g. the SWIG files that implement those functions.
-@@ -3221,7 +3221,7 @@ The following are the minimum that are usually supported: Please copy these and modify for any new language.
-@@ -3250,7 +3250,7 @@ during this process, see the section on .
-@@ -3309,7 +3309,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.
-@@ -3477,7 +3477,7 @@ A debugger can also be invoked easily on an individual test, for example gdb: make ret_by_value.ctest RUNTOOL="gdb --args" -
@@ -3509,7 +3509,7 @@ Some topics that you'll want to be sure to address include: if available. -
@@ -3566,7 +3566,7 @@ should be added should there be an area not already covered by the existing tests.
-@@ -3590,7 +3590,7 @@ The generated C/C++ code should also follow this style as close as possible. How should be avoided as unlike the SWIG developers, users will never have consistent tab settings.
-@@ -3615,7 +3615,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.
-@@ -4023,7 +4023,7 @@ extern "X" { ... } declaration. -
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html index 8f3c5f85c..75c3d3473 100644 --- a/Doc/Manual/Guile.html +++ b/Doc/Manual/Guile.html @@ -8,7 +8,7 @@
-This section details guile-specific support in SWIG. -
@@ -55,7 +55,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". -
The guile module can currently export wrapper files that use the guile GH interface or the @@ -103,7 +103,7 @@ for the specific API. Currently only the guile language module has created a ma but there is no reason other languages (like mzscheme or chicken) couldn't also use this. If that happens, there is A LOT less code duplication in the standard typemaps.
-@@ -111,7 +111,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. -
@@ -206,7 +206,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 @@ -216,7 +216,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 @@ -257,7 +257,7 @@ Newer Guile versions have a shorthand procedure for this:
Guile used to support an autoloading facility for object-code @@ -283,7 +283,7 @@ option, SWIG generates an exported module initialization function with an appropriate name. -
@@ -308,7 +308,7 @@ my/lib/libfoo.so.X.Y.Z and friends. This scheme is still very experimental; the (hobbit4d link) conventions are not well understood.
-
@@ -320,7 +320,7 @@ complained so far.
%rename to specify the Guile name of the wrapped
functions and variables (see CHANGES).
-
@@ -412,7 +412,7 @@ constant will appear as a scheme variable. See Features and the %feature directive for info on how to apply the %feature.
-
@@ -433,7 +433,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.
-
@@ -462,7 +462,7 @@ that created them, so the first module we check will most likely be correct. Once we have a swig_type_info structure, we loop through the linked list of casts, using pointer comparisons.
-The SCM interface (using the "-scm" argument to swig) uses swigrun.swg. @@ -477,7 +477,7 @@ in the smob tag. If a generated GOOPS module has been loaded, smobs will be wra GOOPS class.
-Garbage collection is a feature of the new SCM interface, and it is automatically included @@ -491,7 +491,7 @@ is exactly like described in 20.7 Exception Handling +
@@ -517,7 +517,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
@@ -581,7 +581,7 @@ struct members, the procedures SWIG can also generate classes and generic functions for use with
@@ -730,7 +730,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
@@ -767,7 +767,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 c5778c432..f572ffa32 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -5,7 +5,7 @@
@@ -189,7 +189,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.
@@ -205,7 +205,7 @@ Run make -k check from the SWIG root directory after installing SWIG on
The Java module requires your system to support shared libraries and dynamic loading.
This is the commonly used method to load JNI code so your system will more than likely support this.
@@ -264,7 +264,7 @@ The following sections have further practical examples and details on how you mi
compiling and using the generated files.
@@ -301,7 +301,7 @@ swig -java -help
Their use will become clearer by the time you have finished reading this section on SWIG and Java.
@@ -316,7 +316,7 @@ They are usually in directories like this:
The exact location may vary on your machine, but the above locations are typical.
@@ -352,7 +352,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.
@@ -387,7 +387,7 @@ $
If it doesn't work have a look at the following section which discusses problems loading the shared library.
@@ -474,7 +474,7 @@ The following section also contains some C++ specific linking problems and solut
@@ -527,7 +527,7 @@ Finally make sure the version of JDK header files matches the version of Java th
@@ -536,7 +536,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.
@@ -575,7 +575,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.
@@ -634,7 +634,7 @@ Of course you may want to make changes for it to work for C++ by adding in the -
@@ -644,7 +644,7 @@ variables are wrapped with JavaBean type getters and setters and so forth.
This section briefly covers the essential aspects of this wrapping.
@@ -680,7 +680,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.
@@ -714,7 +714,7 @@ System.out.println(example.fact(4));
@@ -801,7 +801,7 @@ extern char *path; // Read-only (due to %immutable)
-
@@ -941,7 +941,7 @@ Or if you decide this practice isn't so bad and your own class implements ex
@@ -955,7 +955,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.
@@ -1018,7 +1018,7 @@ As in the case of constants, you can access them through either the module class
@@ -1112,7 +1112,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.
@@ -1165,7 +1165,7 @@ The additional support methods need not be generated if none of the enum items h
Simpler Java enums for enums without initializers section.
@@ -1213,7 +1213,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.
@@ -1232,7 +1232,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.
@@ -1320,7 +1320,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.
@@ -1488,7 +1488,7 @@ x.setA(3); // Modify x.a - this is the same as b.f.a
-
@@ -1551,7 +1551,7 @@ int bar = Spam.getBar();
-
@@ -1612,7 +1612,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.
@@ -1667,7 +1667,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).
@@ -1691,7 +1691,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.
@@ -1806,7 +1806,7 @@ void spam(unsigned short); // Ignored
-
@@ -1849,7 +1849,7 @@ Further details on default arguments and how to restore this approach are given
@@ -1927,7 +1927,7 @@ with -package - Java does not support types declared in a named package accessin
-
@@ -1976,7 +1976,7 @@ Obviously, there is more to template wrapping than shown in this example.
More details can be found in the SWIG and C++ chapter.
@@ -2060,7 +2060,7 @@ Foo f = p.__deref__(); // Returns underlying Foo *
-
@@ -2075,7 +2075,7 @@ Finally enum classes are covered.
First, the crucial intermediary JNI class is considered.
@@ -2195,7 +2195,7 @@ If name is the same as modulename then the module class name g
from modulename to modulenameModule.
@@ -2274,7 +2274,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.
@@ -2305,7 +2305,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.
@@ -2356,7 +2356,7 @@ See The intermediary JNI class pragmas secti
@@ -2432,7 +2432,7 @@ int y = f.spam(5, new Foo());
-
@@ -2594,7 +2594,7 @@ and
@@ -2710,7 +2710,7 @@ However, true cross language polymorphism can be achieved using the 21.4.3.3 Proxy classes and garbage collection
+
@@ -2793,7 +2793,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.
@@ -2915,7 +2915,7 @@ For example:
Compatibility note: The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.
@@ -3003,7 +3003,7 @@ for (int i=0; i<100000; i++) {
-
@@ -3090,7 +3090,7 @@ public static void spam(SWIGTYPE_p_int x, SWIGTYPE_p_int y, int z) { ... }
-
@@ -3099,7 +3099,7 @@ The Enumerations section discussed these but om
The following sub-sections detail the various types of enum classes that can be generated.
@@ -3183,7 +3183,7 @@ The swigValue method is used for marshalling in the other direction.
The toString method is overridden so that the enum name is available.
@@ -3261,7 +3261,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.
@@ -3292,7 +3292,7 @@ public final class Beverage {
-
@@ -3314,7 +3314,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.
@@ -3385,7 +3385,7 @@ public:
-
@@ -3412,7 +3412,7 @@ If the correct implementation is in Java, the Java API is used to call the metho
@@ -3430,7 +3430,7 @@ This situation can be optimized by selectively enabling director methods (using
@@ -3495,7 +3495,7 @@ DirectorDerived::upcall_method() invoked.
-
@@ -3515,7 +3515,7 @@ Macros can be defined on the commandline when compiling your C++ code, or altern
-
@@ -3611,7 +3611,7 @@ class MyProtectedBase extends ProtectedBase
-
@@ -3623,7 +3623,7 @@ be awkward. This section describes some common SWIG features that are used
to improve the interface to existing C/C++ code.
@@ -3689,7 +3689,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.
@@ -3752,7 +3752,7 @@ Vector(2,3,4)
in any way---the extensions only show up in the Java interface.
@@ -3911,7 +3911,7 @@ to raise exceptions. See the SWIG Library ch
The typemap example Handling C++ exception specifications as Java exceptions provides further exception handling capabilities.
@@ -3937,7 +3937,7 @@ protected static void protect_me() {
-
@@ -3947,7 +3947,7 @@ strings and arrays. This chapter discusses the common techniques for
solving these problems.
@@ -4121,7 +4121,7 @@ void foo(Bar *OUTPUT);
will not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar.
@@ -4187,7 +4187,7 @@ System.out.println("3 + 4 = " + result);
See the SWIG Library chapter for further details.
@@ -4254,7 +4254,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.
@@ -4399,7 +4399,7 @@ well suited for applications in which you need to create buffers,
package binary data, etc.
@@ -4516,7 +4516,7 @@ model and use these functions in place of malloc and free in your own
code.
@@ -4537,7 +4537,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.
-
@@ -4689,7 +4689,7 @@ However, the mappings allow the full range of values for each C type from Java.
@@ -4704,7 +4704,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.
@@ -4717,7 +4717,7 @@ Unfortunately it won't of course hold true for JNI code.
@@ -4840,7 +4840,7 @@ int c = example.count('e',"Hello World");
-
@@ -5100,7 +5100,7 @@ These are listed below:
-
@@ -5146,7 +5146,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.
@@ -5297,7 +5297,7 @@ This special variable expands to the intermediary class name. Usually this is th
unless the jniclassname attribute is specified in the %module directive.
@@ -5334,7 +5334,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps
@@ -5540,7 +5540,7 @@ For the typemap to be used in all type wrapper classes, all the different types
Again this is the same that is in "java.swg", barring the method modifier for getCPtr.
@@ -5765,7 +5765,7 @@ The basic strategy here is to provide a default package typemap for the majority
-
@@ -5775,7 +5775,7 @@ the SWIG library.
@@ -5854,7 +5854,7 @@ This would be done by using the original versions of these typemaps in "enums.sw
@@ -5979,7 +5979,7 @@ We could alternatively have used %rename to rename what() into
@@ -6134,7 +6134,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.
@@ -6278,7 +6278,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify
what Java types to use.
@@ -6360,7 +6360,7 @@ example.foo(new String[]{"red", "green", "blue", "white"});
-
@@ -6478,7 +6478,7 @@ $ java runme
1 12.0 340.0
-
@@ -6684,7 +6684,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.
@@ -6728,7 +6728,7 @@ System.out.println("foo1? " + foo1.equals(foo2));
-
@@ -6787,7 +6787,7 @@ This example contains some useful functionality which you may want in your code.
@@ -6967,7 +6967,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.
@@ -7090,7 +7090,7 @@ public class Bike {
Note the addReference call.
@@ -7206,7 +7206,7 @@ The 'javacode' typemap simply adds in the specified code into the Java proxy cla
-
@@ -7383,7 +7383,7 @@ A few things to note:
-
@@ -7564,10 +7564,10 @@ public abstract class UserVisibleFoo extends Foo {
@@ -7623,7 +7623,7 @@ public class Barmy {
-
@@ -7684,7 +7684,7 @@ All destructors have to be called manually for example the delete_Foo(foo)
@@ -7734,7 +7734,7 @@ This directive is only really useful if you want to mix your own hand crafted JN
@@ -7755,7 +7755,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.
@@ -7777,7 +7777,7 @@ The -verbose:jni and -verbose:gc are also useful options for monitoring code beh
diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html
index aa62250b9..b9b5b6c1e 100644
--- a/Doc/Manual/Lisp.html
+++ b/Doc/Manual/Lisp.html
@@ -6,7 +6,7 @@
@@ -50,7 +50,7 @@
here
@@ -77,7 +77,7 @@ swig -cffi -module module-name file-name
files and the various things which you can do with them.
@@ -118,7 +118,7 @@ swig -cffi -help
- This feature to SWIG (for CFFI) is very new and still far from
@@ -568,7 +568,7 @@ If you have any questions, suggestions, patches, etc., related to CFFI
module feel free to contact us on the SWIG mailing list, and
also please add a "[CFFI]" tag in the subject line.
-
@@ -608,7 +608,7 @@ Note that the block %{ ... %} is effectively a shortcut for
@@ -638,7 +638,7 @@ swig -clisp -module module-name file-name
interface file for the CLISP module. The CLISP module tries to
produce code which is both human readable and easily modifyable.
@@ -671,7 +671,7 @@ and global variables will be created otherwise only definitions for
@@ -795,7 +795,7 @@ struct bar {
-
Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ANSI C and C++). Its also a really tiny language, less than 6000 lines of code, which compiles to <100 kilobytes of binary code. It can be found at http://www.lua.org
The current SWIG implementation is designed to work with Lua 5.0.x and Lua 5.1.x. It should work with later versions of Lua, but certainly not with Lua 4.0 due to substantial API changes. ((Currently SWIG generated code has only been tested on Windows with MingW, though given the nature of Lua, is should not have problems on other OS's)). 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).
@@ -105,7 +105,7 @@ This creates a C/C++ source file example_wrap.c or example_wrap.cxx
The name of the wrapper file is derived from the name of the input file. For example, if the input file is example.i, the name of the wrapper file is example_wrap.c. To change this, you can use the -o option. The wrappered module will export one function "int luaopen_example(lua_State* L)" which must be called to register the module with the Lua interpreter. The name "luaopen_example" depends upon the name of the module.
@@ -152,7 +152,7 @@ $ gcc -c example.c -o example.o
$ gcc -I/usr/include/lua -L/usr/lib/lua min.o example_wrap.o example.o -o my_lua
@@ -220,7 +220,7 @@ Is quite obvious (Go back and consult the Lua documents on how to enable loadlib
-
@@ -238,19 +238,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.
@@ -288,7 +288,7 @@ It is also possible to rename the module with an assignment.
24
-
@@ -362,7 +362,7 @@ nil
3.142
-
@@ -385,7 +385,7 @@ example.SUNDAY=0
Constants are not guaranteed to remain constant in Lua. The name of the constant could be accidentally reassigned to refer to some other object. Unfortunately, there is no easy way for SWIG to generate code that prevents this. You will just have to be careful.
@@ -423,7 +423,7 @@ Lua enforces the integrity of its userdata, so it is virtually impossible to cor
nil
-
@@ -509,7 +509,7 @@ Because the pointer points inside the structure, you can modify the contents and
> x.a = 3 -- Modifies the same structure
-
@@ -570,7 +570,7 @@ It is not (currently) possible to access static members of an instance:
-- does NOT work
-
@@ -595,7 +595,7 @@ then the function spam() accepts a Foo pointer or a pointer to any clas
It is safe to use multiple inheritance with SWIG.
@@ -626,7 +626,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.
@@ -712,7 +712,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.
@@ -824,7 +824,7 @@ It is also possible to overload the operator[], but currently this cann
};
-
@@ -879,7 +879,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).
@@ -914,7 +914,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.
@@ -966,7 +966,7 @@ If you ever need to access the underlying pointer returned by operator->(
> f = p:__deref__() -- Returns underlying Foo *
-
@@ -1110,12 +1110,12 @@ add exception specification to functions or globally (respectively).
This section explains what typemaps are and the usage of them. The default wrappering 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 wrappering. 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: 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. 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
@@ -1260,7 +1260,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: 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. Before proceeding, you should read the previous section on using typemaps, as well as read the ready written 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 a idea to base your worn 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.-procdoc
@@ -553,7 +553,7 @@ like this:
typemap argument doc. See Lib/guile/typemaps.i for
details.
-20.9 Procedures with setters
+21.9 Procedures with setters
(struct-member-get
pointer) and (struct-member-set pointer
value) are not generated.
-20.10 GOOPS Proxy Classes
+21.10 GOOPS Proxy Classes
%import "foo.h" before the %inline block.
20.10.1 Naming Issues
+21.10.1 Naming Issues
20.10.2 Linking
+21.10.2 Linking
21 SWIG and Java
+22 SWIG and Java
@@ -154,7 +154,7 @@ It covers most SWIG features, but certain low-level details are covered in less
-
21.1 Overview
+22.1 Overview
21.2 Preliminaries
+22.2 Preliminaries
21.2.1 Running SWIG
+22.2.1 Running SWIG
21.2.2 Additional Commandline Options
+22.2.2 Additional Commandline Options
21.2.3 Getting the right header files
+22.2.3 Getting the right header files
21.2.4 Compiling a dynamic module
+22.2.4 Compiling a dynamic module
21.2.5 Using your module
+22.2.5 Using your module
21.2.6 Dynamic linking problems
+22.2.6 Dynamic linking problems
21.2.7 Compilation problems and compiling with C++
+22.2.7 Compilation problems and compiling with C++
21.2.8 Building on Windows
+22.2.8 Building on Windows
21.2.8.1 Running SWIG from Visual Studio
+22.2.8.1 Running SWIG from Visual Studio
21.2.8.2 Using NMAKE
+22.2.8.2 Using NMAKE
21.3 A tour of basic C/C++ wrapping
+22.3 A tour of basic C/C++ wrapping
21.3.1 Modules, packages and generated Java classes
+22.3.1 Modules, packages and generated Java classes
21.3.2 Functions
+22.3.2 Functions
21.3.3 Global variables
+22.3.3 Global variables
21.3.4 Constants
+22.3.4 Constants
21.3.5 Enumerations
+22.3.5 Enumerations
21.3.5.1 Anonymous enums
+22.3.5.1 Anonymous enums
21.3.5.2 Typesafe enums
+22.3.5.2 Typesafe enums
21.3.5.3 Proper Java enums
+22.3.5.3 Proper Java enums
21.3.5.4 Type unsafe enums
+22.3.5.4 Type unsafe enums
21.3.5.5 Simple enums
+22.3.5.5 Simple enums
21.3.6 Pointers
+22.3.6 Pointers
21.3.7 Structures
+22.3.7 Structures
21.3.8 C++ classes
+22.3.8 C++ classes
21.3.9 C++ inheritance
+22.3.9 C++ inheritance
21.3.10 Pointers, references, arrays and pass by value
+22.3.10 Pointers, references, arrays and pass by value
21.3.10.1 Null pointers
+22.3.10.1 Null pointers
21.3.11 C++ overloaded functions
+22.3.11 C++ overloaded functions
21.3.12 C++ default arguments
+22.3.12 C++ default arguments
21.3.13 C++ namespaces
+22.3.13 C++ namespaces
21.3.14 C++ templates
+22.3.14 C++ templates
21.3.15 C++ Smart Pointers
+22.3.15 C++ Smart Pointers
21.4 Further details on the generated Java classes
+22.4 Further details on the generated Java classes
21.4.1 The intermediary JNI class
+22.4.1 The intermediary JNI class
21.4.1.1 The intermediary JNI class pragmas
+22.4.1.1 The intermediary JNI class pragmas
21.4.2 The Java module class
+22.4.2 The Java module class
21.4.2.1 The Java module class pragmas
+22.4.2.1 The Java module class pragmas
21.4.3 Java proxy classes
+22.4.3 Java proxy classes
21.4.3.1 Memory management
+22.4.3.1 Memory management
21.4.3.2 Inheritance
+22.4.3.2 Inheritance
22.4.3.3 Proxy classes and garbage collection
21.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
+22.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
21.4.3.5 Single threaded applications and thread safety
+22.4.3.5 Single threaded applications and thread safety
21.4.4 Type wrapper classes
+22.4.4 Type wrapper classes
21.4.5 Enum classes
+22.4.5 Enum classes
21.4.5.1 Typesafe enum classes
+22.4.5.1 Typesafe enum classes
21.4.5.2 Proper Java enum classes
+22.4.5.2 Proper Java enum classes
21.4.5.3 Type unsafe enum classes
+22.4.5.3 Type unsafe enum classes
21.5 Cross language polymorphism using directors
+22.5 Cross language polymorphism using directors
21.5.1 Enabling directors
+22.5.1 Enabling directors
21.5.2 Director classes
+22.5.2 Director classes
21.5.3 Overhead and code bloat
+22.5.3 Overhead and code bloat
21.5.4 Simple directors example
+22.5.4 Simple directors example
21.5.5 Director threading issues
+22.5.5 Director threading issues
21.6 Accessing protected members
+22.6 Accessing protected members
21.7 Common customization features
+22.7 Common customization features
21.7.1 C/C++ helper functions
+22.7.1 C/C++ helper functions
21.7.2 Class extension with %extend
+22.7.2 Class extension with %extend
21.7.3 Exception handling with %exception and %javaexception
+22.7.3 Exception handling with %exception and %javaexception
21.7.4 Method access with %javamethodmodifiers
+22.7.4 Method access with %javamethodmodifiers
21.8 Tips and techniques
+22.8 Tips and techniques
21.8.1 Input and output parameters using primitive pointers and references
+22.8.1 Input and output parameters using primitive pointers and references
21.8.2 Simple pointers
+22.8.2 Simple pointers
21.8.3 Wrapping C arrays with Java arrays
+22.8.3 Wrapping C arrays with Java arrays
21.8.4 Unbounded C Arrays
+22.8.4 Unbounded C Arrays
21.8.5 Overriding new and delete to allocate from Java heap
+22.8.5 Overriding new and delete to allocate from Java heap
21.9 Java typemaps
+22.9 Java typemaps
21.9.1 Default primitive type mappings
+22.9.1 Default primitive type mappings
21.9.2 Default typemaps for non-primitive types
+22.9.2 Default typemaps for non-primitive types
21.9.3 Sixty four bit JVMs
+22.9.3 Sixty four bit JVMs
21.9.4 What is a typemap?
+22.9.4 What is a typemap?
21.9.5 Typemaps for mapping C/C++ types to Java types
+22.9.5 Typemaps for mapping C/C++ types to Java types
21.9.6 Java typemap attributes
+22.9.6 Java typemap attributes
21.9.7 Java special variables
+22.9.7 Java special variables
21.9.8 Typemaps for both C and C++ compilation
+22.9.8 Typemaps for both C and C++ compilation
21.9.9 Java code typemaps
+22.9.9 Java code typemaps
21.9.10 Director specific typemaps
+22.9.10 Director specific typemaps
21.10 Typemap Examples
+22.10 Typemap Examples
21.10.1 Simpler Java enums for enums without initializers
+22.10.1 Simpler Java enums for enums without initializers
21.10.2 Handling C++ exception specifications as Java exceptions
+22.10.2 Handling C++ exception specifications as Java exceptions
21.10.3 NaN Exception - exception handling for a particular type
+22.10.3 NaN Exception - exception handling for a particular type
21.10.4 Converting Java String arrays to char **
+22.10.4 Converting Java String arrays to char **
21.10.5 Expanding a Java object to multiple arguments
+22.10.5 Expanding a Java object to multiple arguments
21.10.6 Using typemaps to return arguments
+22.10.6 Using typemaps to return arguments
21.10.7 Adding Java downcasts to polymorphic return types
+22.10.7 Adding Java downcasts to polymorphic return types
21.10.8 Adding an equals method to the Java classes
+22.10.8 Adding an equals method to the Java classes
21.10.9 Void pointers and a common Java base class
+22.10.9 Void pointers and a common Java base class
21.10.10 Struct pointer to pointer
+22.10.10 Struct pointer to pointer
21.10.11 Memory management when returning references to member variables
+22.10.11 Memory management when returning references to member variables
21.10.12 Memory management for objects passed to the C++ layer
+22.10.12 Memory management for objects passed to the C++ layer
21.10.13 Date marshalling using the javain typemap and associated attributes
+22.10.13 Date marshalling using the javain typemap and associated attributes
21.11 Living with Java Directors
+22.11 Living with Java Directors
21.12 Odds and ends
+22.12 Odds and ends
-21.12.1 JavaDoc comments
+22.12.1 JavaDoc comments
21.12.2 Functional interface without proxy classes
+22.12.2 Functional interface without proxy classes
21.12.3 Using your own JNI functions
+22.12.3 Using your own JNI functions
21.12.4 Performance concerns and hints
+22.12.4 Performance concerns and hints
21.12.5 Debugging
+22.12.5 Debugging
21.13 Examples
+22.13 Examples
22 SWIG and Common Lisp
+23 SWIG and Common Lisp
@@ -41,7 +41,7 @@
Lisp, Common Foreign Function Interface(CFFI), CLisp and UFFI
foreign function interfaces.
-
22.1 Allegro Common Lisp
+23.1 Allegro Common Lisp
22.2 Common Foreign Function Interface(CFFI)
+23.2 Common Foreign Function Interface(CFFI)
22.2.1 Additional Commandline Options
+23.2.1 Additional Commandline Options
22.2.2 Generating CFFI bindings
+23.2.2 Generating CFFI bindings
As we mentioned earlier the ideal way to use SWIG is to use interface
@@ -392,7 +392,7 @@ The feature intern_function ensures that all C names are
22.2.3 Generating CFFI bindings for C++ code
+23.2.3 Generating CFFI bindings for C++ code
22.2.4 Inserting user code into generated files
+23.2.4 Inserting user code into generated files
22.3 CLISP
+23.3 CLISP
22.3.1 Additional Commandline Options
+23.3.1 Additional Commandline Options
-22.3.2 Details on CLISP bindings
+23.3.2 Details on CLISP bindings
22.4 UFFI
+23.4 UFFI
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index a1544d21e..c07fe66c8 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -6,7 +6,7 @@
-23 SWIG and Lua
+24 SWIG and Lua
@@ -67,13 +67,13 @@
23.1 Preliminaries
+24.1 Preliminaries
23.2 Running SWIG
+24.2 Running SWIG
23.2.1 Compiling and Linking and Interpreter
+24.2.1 Compiling and Linking and Interpreter
23.2.2 Compiling a dynamic module
+24.2.2 Compiling a dynamic module
23.2.3 Using your module
+24.2.3 Using your module
23.3 A tour of basic C/C++ wrapping
+24.3 A tour of basic C/C++ wrapping
23.3.1 Modules
+24.3.1 Modules
23.3.2 Functions
+24.3.2 Functions
23.3.3 Global variables
+24.3.3 Global variables
23.3.4 Constants and enums
+24.3.4 Constants and enums
23.3.5 Pointers
+24.3.5 Pointers
23.3.6 Structures
+24.3.6 Structures
23.3.7 C++ classes
+24.3.7 C++ classes
23.3.8 C++ inheritance
+24.3.8 C++ inheritance
23.3.9 Pointers, references, values, and arrays
+24.3.9 Pointers, references, values, and arrays
23.3.10 C++ overloaded functions
+24.3.10 C++ overloaded functions
23.3.11 C++ operators
+24.3.11 C++ operators
23.3.12 Class extension with %extend
+24.3.12 Class extension with %extend
23.3.13 C++ templates
+24.3.13 C++ templates
23.3.14 C++ Smart Pointers
+24.3.14 C++ Smart Pointers
23.3.15 C++ Exceptions
+24.3.15 C++ Exceptions
23.4 Typemaps
+24.4 Typemaps
23.4.1 What is a typemap?
+24.4.1 What is a typemap?
23.4.2 Using typemaps
+24.4.2 Using typemaps
23.4.3 Typemaps and arrays
+24.4.3 Typemaps and arrays
23.4.4 Typemaps and pointer-pointer functions
+24.4.4 Typemaps and pointer-pointer functions
23.5 Writing typemaps
+24.5 Writing typemaps
23.5.1 Typemaps you can write
+24.5.1 Typemaps you can write
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.
@@ -1365,7 +1365,7 @@ This macro, when called within the context of a SWIG wrappered function, will di@@ -1374,7 +1374,7 @@ This section covers adding of some small extra bits to your module to add the la -
@@ -1393,7 +1393,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 wrappering for this function, beyond adding it into the function table. How you write your code is entirely up to you.
-@@ -1431,7 +1431,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.
-@@ -1442,7 +1442,7 @@ See Examples/lua/arrays for an example of this code.
-@@ -1502,7 +1502,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)'.
-@@ -1582,7 +1582,7 @@ Note: Both the opaque structures (like the FILE*) and normal wrappered classes/s
Note: Operator overloads are basically done in the same way, by adding functions such as '__add' & '__call' to the classes 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/Modula3.html b/Doc/Manual/Modula3.html index ee7d2785d..71611e3c5 100644 --- a/Doc/Manual/Modula3.html +++ b/Doc/Manual/Modula3.html @@ -5,7 +5,7 @@
-@@ -84,7 +84,7 @@ FFTW -
@@ -131,10 +131,10 @@ functions), but it doesn't allow you to easily integrate a Module-3 module into a C/C++ project.
-@@ -283,7 +283,7 @@ and the principal type must be renamed (%typemap).
-@@ -384,10 +384,10 @@ There is no C++ library I wrote a SWIG interface for, so I'm not sure if this is possible or sensible, yet.
-@@ -401,7 +401,7 @@ For testing examples I use Critical Mass cm3.
-@@ -478,10 +478,10 @@ Instead generate templates for some basic typemaps. -
@@ -697,7 +697,7 @@ consist of the following parts: -
@@ -749,7 +749,7 @@ that I'd like to automate.
-@@ -762,7 +762,7 @@ is not really useful, yet.
-@@ -797,7 +797,7 @@ IMPORT M3toC;
@@ -821,7 +821,7 @@ you should declare %typemap("m3wrapinconv:throws") blah * %{OSError.E%}.
-@@ -868,10 +868,10 @@ where almost everything is generated by a typemap: -
This section contains information on SWIG's support of MzScheme. -
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index b65831192..6cbfa5510 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -6,7 +6,7 @@
-@@ -99,7 +99,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.
-@@ -122,7 +122,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).
-@@ -158,7 +158,7 @@ the user more freedom with respect to custom typing.
@@ -234,7 +234,7 @@ let b = C_string (getenv "PATH") -
@@ -248,7 +248,7 @@ When linking any ocaml bytecode with your module, use the -custom option is not needed when you build native code.
-@@ -259,7 +259,7 @@ liberal with pointer types may not compile under the C++ compiler. Most code meant to be compiled as C++ will not have problems.
-@@ -360,7 +360,7 @@ is that you must append them to the return list with swig_result = caml_list_a signature for a function that uses value in this way.
-@@ -394,7 +394,7 @@ it describes the output SWIG will generate for class definitions. -
@@ -457,7 +457,7 @@ val x : Enum_test.c_obj = C_enum `a
@@ -470,10 +470,10 @@ functions imported from different modules. You must convert values to master values using the swig_val function before sharing them with another module.
-@@ -494,7 +494,7 @@ arrays of simple types with known bounds in your code, but this only works for arrays whose bounds are completely specified.
-@@ -507,7 +507,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.
-@@ -521,7 +521,7 @@ Consider writing an object when the ending condition of your array is complex, such as using a required sentinel, etc.
-@@ -572,7 +572,7 @@ void printfloats( float *tab, int len ); -
@@ -615,7 +615,7 @@ the underlying pointer, so using create_[x]_from_ptr alters the returned value for the same object.
-@@ -695,7 +695,7 @@ baz # -
@@ -725,7 +725,7 @@ public: }; -
@@ -743,7 +743,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \ -L$QTPATH/lib -cclib -lqt
@@ -770,10 +770,10 @@ Assuming you have a working installation of QT, you will see a window containing the string "hi" in a button. -26.2.5 Director Classes
+27.2.5 Director Classes
-26.2.5.1 Director Introduction
+27.2.5.1 Director Introduction
@@ -800,7 +800,7 @@ class foo { };
@@ -828,7 +828,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.
-