From e7e337ed1302dca96279c1449cbe568820511c07 Mon Sep 17 00:00:00 2001 From: Jan Jezabek Date: Tue, 12 Aug 2008 14:51:58 +0000 Subject: Changed the name 'guid seed' to 'master guid' which sounds a bit better to me. Added preliminary documentation. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-jezabek@10754 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/COM.html | 1243 +++++++++++++++++++++++++++++++++++++++++++++ Doc/Manual/CSharp.html | 38 +- Doc/Manual/Chicken.html | 40 +- Doc/Manual/Contents.html | 93 +++- Doc/Manual/Extending.html | 96 ++-- Doc/Manual/Guile.html | 42 +- Doc/Manual/Java.html | 204 ++++---- Doc/Manual/Lisp.html | 22 +- Doc/Manual/Lua.html | 56 +- Doc/Manual/Modula3.html | 46 +- Doc/Manual/Mzscheme.html | 4 +- Doc/Manual/Ocaml.html | 62 +-- Doc/Manual/Octave.html | 46 +- Doc/Manual/Perl5.html | 94 ++-- Doc/Manual/Php.html | 35 +- Doc/Manual/Pike.html | 24 +- Doc/Manual/Python.html | 144 +++--- Doc/Manual/R.html | 16 +- Doc/Manual/Ruby.html | 196 +++---- Doc/Manual/Tcl.html | 90 ++-- Doc/Manual/chapters | 1 + Source/Modules/com.cxx | 28 +- 22 files changed, 1959 insertions(+), 661 deletions(-) create mode 100644 Doc/Manual/COM.html diff --git a/Doc/Manual/COM.html b/Doc/Manual/COM.html new file mode 100644 index 000000000..c48fe36a1 --- /dev/null +++ b/Doc/Manual/COM.html @@ -0,0 +1,1243 @@ + + + +SWIG and COM + + + +

17 SWIG and COM

+ +
+ +
+ + + + +

+This chapter describes SWIG's support of Java. +It covers most SWIG features, but certain low-level details are covered in less depth than in earlier chapters. +

+ + +

17.1 Overview

+ + +

+COM is a component technology included in the Windows operating system. It is supported by a wide range of tools - scripting languages +(VBScript, Perl, Python), compiled languages (Delphi, Visual Basic, C#) and even complex applications (MS Office, OpenOffice.org). Thus +writing a COM component is a good way to extend all of these applications at one time. Unfortunately writing COM components is C/C++ +is a non-trivial task which is even harder if you do not use Microsoft's tools (especially if you use some form of GCC). +

+ +

+SWIG's COM extension allows you to easily make your C/C++ code accessible to COM-aware tools using the compiler of your choice. It takes care +of many low-level tasks like component registration, memory management, object layout, etc. It preserves the class hierarchy contained in +the C++ code with some limitations - notably only single inheritance is supported. You should try using the COM extension if you have +a large code base using a custom programming interface. On the other hand if you need to implement a fixed COM interface (e.g. a 'visual component' +or a DirectShow filter) then SWIG will probably not be the right tool for you. +

+ +

+This chapter is focused mostly on COM-aware scripting languages. The examples - unless noted otherwise - are provided in a subset of Basic +which should work in Visual Basic (including VBA), VBScript and OpenOffice.org Basic. This should not discourage you if you plan to use another language - +the code should be very similar, if not identical, in other scripting languages. The code generated by the COM extension has also been verified to work well in +Delphi and C#. +

+ + +

17.2 Preliminaries

+ + +

+To compile the generated code you will need a compiler that supports generating DLLs and understands the __stdcall calling convention. +The compilers that have been tested extensively are MS Visual C++ and MinGW. OpenWatcom, Digital Mars C++, Borland C++ and Cygwin are +tested occasionally and should have no problems. Winegcc can be used on Unix systems but has some limitations. Please note that the +code has only been tested on 32-bit x86 processors. You will also need an IDL compiler - most probably this will +be MIDL (shipped with the Windows SDK, previously known as Platform SDK) but WIDL (shipped with WINE) can be used +too. +

+ + +

17.2.1 Running SWIG

+ + +

+Suppose that you defined a SWIG module such as the following: +

+ +
+
+/* File: example.i */
+%module test
+%{
+#include "stuff.h"
+%}
+int fact(int n);
+
+
+ + +

+To build a COM module, run SWIG using the -com option :

+ +
+%swig -com example.i
+
+ +

+If building C++, add the -c++ option: +

+ +
+$ swig -c++ -com example.i
+
+ +

+This will generate four files: example_wrap.c (or example_wrap.cxx), +example.idl, example.def and example_rc.rc. The first file +contains code responsible for object layout, reference counting, etc. The example.idl +file contains a description of the interface exposed to the client applications. The remaining +two files are used during compilation. All these files need to be linked with the rest of +your C/C++ application. +

+ +

+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. +It is also possible to change the output directory that the COM files are generated into using -outdir. +

+ +

+The following sections have further practical examples and details on how you might go about +compiling and using the generated files. +

+ +

17.2.2 Additional Commandline Options

+ + +

+The following table list the additional commandline options available for the COM module. They can also be seen by using: +

+ +
+swig -com -help 
+
+ + + + + + + + + + + + + + + + + + + + + +
COM specific options
-nopgcppsuppress the premature garbage collection prevention parameter
-noproxygenerate the low-level functional interface instead of proxy classes
-package <name>set name of the Java package to <name>
+ +

+Their use will become clearer by the time you have finished reading this section on SWIG and Java. +

+ +

17.2.3 Compiling a dynamic module

+ + +

+Before your module can be used by COM clients it needs to be built as a dynamically linked library (DLL). +This process is compiler specific. Examples are provided below for Visual C++: +

+ +
+$ # MS Visual Studio 2008
+$ midl example.idl
+$ rc example_rc.rc
+$ cl /LD /Feexample.dll example_wrap.c example.def example_rc.res ole32.lib uuid.lib advapi32.lib oleaut32.lib
+
+ +

+and for MinGW under Linux (using WIDL): +

+ +
+$ # MinGW and WIDL
+$ widl -t -I /usr/include/wine/windows example.idl
+$ i586-mingw32msvc-windres example_rc.rc example_rc.o
+$ i586-mingw32msvc-gcc -shared -o example.dll example_wrap.c example.def example_rc.o -lole32 -luuid -ladvapi32 -loleaut32
+
+ +

+On a Windows installation of MinGW the names of the executables will most probably simply be windres and +gcc, and midl can be used in place of widl. +

+ +

+Warning
+A common source of mistakes is the omission of example_rc.[res|o] during compilation. This produces no +errors or warnings but results in a non-working module. +

+ +

+Before you can use your module you need to register it (on the machine where it will be used): +

+ +
+$ regsvr32 example.dll
+
+ +

+This will create entries in the registry needed to locate your module. Please note that this will store +the filesystem path to example.dll so you should not move this file to another location. If +you wish to unregister your module simply type: +

+ +
+$ regsvr32 /u example.dll
+
+ +

17.2.4 Using your module

+ + +

+The precise way how you can load your module depends on the target language. In Basic you can use the +CreateObject subroutine: +

+ +
+Dim example
+Set example = CreateObject("example.example")
+
+
+

+The variable example now contains a reference to an object of the module class which +allows you to call global functions and access global variables defined in your module. It also +allows you to create instances of C++ classes and to call static member functions. +

+ +

17.3 A tour of basic C/C++ wrapping

+ + +

+SWIG will try to create an interface as similar to the C/C++ code as possible. However because +of differences between C/C++ and COM there are some aspects that need +special attention. They are described in this section +

+ +

17.3.1 Global functions

+ + +

+In COM there are no global functions and therefore SWIG uses a workaround. It defines a class known as +the module class which contains the global functions and variables from your C/C++ module. +The example below shows how you can call a global function from a COM client: +

+ +
+%module example
+int fact(int n);
+
+ +

+From VB (and most other languages derived from Basic) you can invoke it as follows: +

+ +
+Dim example
+Set example = CreateObject("example.example")
+Print example.fact(4)
+
+ + +

17.3.2 Global variables

+ + +

+Global variables are wrapped as COM properties. This allows you to use them just as you would use them in +C/C++. For example this module: +

+ +
+// SWIG interface file with global variables
+%module example
+...
+%inline %{
+extern int My_variable;
+extern double density;
+%}
+...
+
+ +

+Can be used in the following way: +

+ +
+Dim example
+Set example = CreateObject("example.example")
+
+Rem Print out the value of a C global variable
+Print example.My_variable
+
+Rem Set the value of a C global variable
+example.density = 0.8442
+
+ +

+If a variable is declared as const, it is wrapped as a read-only property. +This means that its value can be read, but cannot be modified. To make ordinary variables read-only, +you can use the %immutable directive. For example: +

+ +
+
+%{
+extern char *path;
+%}
+%immutable;
+extern char *path;
+%mutable;
+
+
+ +

+The %immutable directive stays in effect until it is explicitly disabled or cleared using +%mutable. +See the Creating read-only variables section for further details. +

+ +

+If you just want to make a specific variable immutable, supply a declaration name. For example: +

+ +
+
+%{
+extern char *path;
+%}
+%immutable path;
+...
+extern char *path;      // Read-only (due to %immutable)
+
+
+ + +

17.3.3 Constants

+ + +

+C/C++ constants are wrapped as immutable properties. This applies both to constants +created using #define preprocessor directive and the SWIG %constant +directive. Examples are provided below: +

+ +
+
+#define PI 3.14159
+#define VERSION "1.0"
+%constant int FOO = 42;
+%constant const char *path = "/usr/local";
+
+
+ +

+Please note that SWIG can infer the C type from the #define directive - PI +is wrapped as a floating point value while VERSION is wrapped as a string. +

+ +

17.3.4 Enumerations

+ + +

+TODO +

+ +

17.3.5 Pointers

+ + +

+C/C++ pointers are fully supported by SWIG. Furthermore, SWIG has no problem working with +incomplete type information. Here is a rather simple interface: +

+ +
+
+%module example
+
+FILE *fopen(const char *filename, const char *mode);
+int fputs(const char *, FILE *);
+int fclose(FILE *);
+
+
+ +

+When wrapped, you will be able to use the functions in a natural way from a COM client. For example: +

+ +
+
+Dim example
+Dim f
+
+Set example = CreateObject("example.example")
+Set f = example.fopen("junk","w")
+example.fputs("Hello World", f)
+example.fclose(f)
+
+
+ +

+Since the FILE structure is not known to SWIG the pointer is stored as a void * pointer. You +can pass this pointer to other functions that expect to receive a pointer to FILE. You cannot dereference +the pointer or manipulate it in any other way. +

+ +

+To allow for static type checking a class is generated for each unknown type. In this case the FILE * +pointer is wrapped as an object implementing interface ISWIGTYPE_p_FILE. +

+ +

+If you need to perform any complex operations (like casting, dereferencing, etc. ) on the pointer consider creating some +helper functions. For example: +

+ +
+
+%inline %{
+/* C-style cast */
+Bar *FooToBar(Foo *f) {
+   return (Bar *) f;
+}
+
+/* C++-style cast */
+Foo *BarToFoo(Bar *b) {
+   return dynamic_cast<Foo*>(b);
+}
+
+Foo *IncrFoo(Foo *f, int i) {
+    return f+i;
+}
+%}
+
+
+ +

+When working with C++ classes you should use the C++ style casts (static_cast, dynamic_cast). +This is especially important when you use a cast from a supertype to a subtype; in this +case only dynamic_cast is guaranteed to work reliably. +

+ +

17.3.6 Structures

+ + +

+A C structure will in most cases work as you would expect. For example, +

+ +
+struct Vector {
+	double x,y,z;
+};
+
+
+ +

+is used as follows: +

+ +
+Dim v
+v = CreateObject("example.Vector")
+v.x = 3.5
+v.y = 7.2
+Dim x, y
+x = v.x
+y = v.y
+
+ +

+Similar access is provided for unions and the public data members of C++ classes. +In fact structures are handled in exactly the same way as C++ classes. More details +about how SWIG handles C++ classes is provided in the next section. +

+ + +

17.3.7 C++ classes

+ + +

+C++ classes are wrapped as COM interfaces. Additionally if a class is not abstract and has +a default (possibly implicit) constructor then a class definition and a class factory +are also generated. For example, if you have this class, +

+ +
+class List {
+public:
+  List();
+  ~List();
+  int  search(char *item);
+  void insert(char *item);
+  void remove(char *item);
+  char *get(int n);
+  int  length;
+};
+
+ +

+you can use it in Basic like this: +

+ +
+Dim l
+Set l = CreateObject("example.List")
+l.insert("Ale")
+l.insert("Stout")
+l.insert("Lager")
+Dim item
+item = l.get(2)
+Dim length
+length = l.length
+
+ +

+Class data members are accessed in the same manner as C structures. +

+ +

+Static class members can be accessed in two ways. Let us consider the following +class: +

+ +
+
+class Spam {
+public:
+   static void foo();
+   static int bar;
+};
+
+
+ +

+You can access Spam's static members just like you would access any non-static members: +

+ +
+
+Dim Spam
+Set Spam = CreateObject("example.Spam")
+Spam.foo()
+Dim bar
+bar = Spam.bar
+
+
+ +

+In some circumstances it might be necessary to access Spam's static members without +having an instance of Spam. This could be because Spam is an abstract class +or because creating it has some side effects. In this case you can use Spam's static +members in the following way: +

+ +
+
+Dim example
+Set example = CreateObject("example.example")
+example.Spam.foo()
+Dim bar
+bar = example.Spam.bar
+
+
+ +

+The code above uses the module class object example and the class object example.Spam. +As was shown in the previous sections the module class object can serve for accessing global +functions and variables. The class object serves the same purpose but for static functions and +static variables of the class Spam. Please note that neither creating the module class object +nor creating the class object has any side effects. You should also note that SWIG does not provide any +synchronization of access for static functions and variables (or in fact for any other global/member +functions/variable). If you plan to create a multi-threaded program you should ensure synchronization +either within the wrapped C/C++ code or in the target language. +

+ +

17.3.8 C++ inheritance

+ + +

+SWIG's COM module currently only supports single inheritance. While it might be possible +to support multiple inheritance it would greatly increase the complexity of the code +generator and also of the generated code. If your C++ class has more than one superclass +then all but the first one will be ignored. If this is not what you want you can use +%feature("ignore") for the unwanted base classes. +

+ +

+SWIG generates a class hierarchy which mirrors that of the C++ code. Therefore, +if you have code like this +

+ +
+
+class Foo {
+...
+};
+
+class Bar : public Foo {
+...
+};
+
+void spam(Foo *f);
+
+
+ +

+you can use an instance of Bar as argument to spam: +

+ +
+
+Dim example, b
+Set example = CreateInstance("example.example")
+Set b = CreateInstance("example.bar")
+example.spam(b)
+
+
+ + +

17.3.9 Pointers, references, arrays and pass by value

+ + +

+COM expects all complex objects to be passed by pointer. Therefore if you define +your function in any of these ways: +

+ +
+
+void spam1(Foo *x);      // Pass by pointer
+void spam2(Foo &x);      // Pass by reference
+void spam3(Foo x);       // Pass by value
+void spam4(Foo x[]);     // Array of objects
+
+
+ +

+COM will wrap the functions as if they would accept pointers to Foo. +Naturally in the case of spam3 there is a difference in semantics +i.e. all changes made by the function will be done on a copy of the passed +object, just as you would expect in C++. +

+ +

+All of these functions are called in the same way: +

+ +
+
+Dim example, f
+
+Set example = CreateObject("example.example")
+Set f = CreateObject("example.Foo")
+example.spam1(f)
+example.spam2(f)
+example.spam3(f)
+example.spam4(f)
+
+
+ +

+Similar behavior occurs for return values. For example, if you had +functions like this, +

+ +
+
+Foo *spam5();
+Foo &spam6();
+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 (the generated COM code will free this +memory when the object is no longer needed, that is when its reference count reaches 0). +

+ +

17.3.9.1 Null pointers

+ + +

+TODO +

+ +
+
+example.spam1(null);   // Pointer - ok
+example.spam2(null);   // Reference - NullPointerException
+example.spam3(null);   // Value - NullPointerException
+example.spam4(null);   // Array - ok
+
+
+ +

+For spam1 and spam4 above the Java null gets translated into a NULL pointer for passing to the C/C++ function. +The converse also occurs, that is, NULL pointers are translated into null Java objects when returned from a C/C++ function. +

+ +

17.3.10 C++ overloaded functions

+ + +

+Unfortunately COM does not support overloading functions (including constructors). Thus all +functions with the same name except for the first one will be ignored. If this is not what +you want you will need to either rename or ignore +some of the methods. For example: +

+ +
+
+%rename(spam_ushort) spam(unsigned short);
+...
+void spam(int);    
+void spam(unsigned short);   // Now renamed to spam_ushort
+
+
+ +

+or +

+ +
+
+%ignore spam(unsigned short);
+...
+void spam(int);    
+void spam(unsigned short);   // Ignored
+
+
+ + +

17.3.11 C++ default arguments

+ + +

+In SWIG function with a default argument is wrapped by generating an additional function for each argument +that is defaulted. However since COM does not support function overloading the additional functions +will be ignored. You can change this behavior using the %rename directive: +

+ +
+
+%module example
+
+%rename(defaults2) defaults(double);
+%rename(defaults3) defaults();
+void defaults(double d=10.0, int i=0);
+
+
+ + +

17.3.12 C++ namespaces

+ + +

+SWIG is aware of C++ namespaces, but namespace names do not appear in +the module nor do namespaces result in a module that is broken up into +submodules or packages. For example, if you have a file like this, +

+ +
+
+%module example
+
+namespace foo {
+   int fact(int n);
+   struct Vector {
+       double x,y,z;
+   };
+};
+
+
+ +

+it works in Basic as follows: +

+ +
+
+Dim example, f, v, y
+
+Set example = CreateObject("example.example")
+f = example.fact(3)
+Set v = CreateObject("example.Vector")
+v.x = 3.4
+y = v.y
+
+
+ +

+If your program has more than one namespace, name conflicts (if any) can be resolved using %rename +For example: +

+ +
+
+%rename(Bar_spam) Bar::spam;
+
+namespace Foo {
+    int spam();
+}
+
+namespace Bar {
+    int spam();
+}
+
+
+ +

+If you have more than one namespace and you want to keep their +symbols separate, consider wrapping them as separate SWIG modules. +

+ +

17.3.13 Constructors

+ + +

+COM has no specific support for constructors. Thus constructors are wrapped by SWIG's COM +module as methods inside of the class object. For example if you have the following definition: +

+ +
+
+class Vector {
+public:
+  double x, y;
+  Vector(double a_x, double a_y): x(a_x), y(a_y) {}
+};
+
+
+ +

+you can use the constructor in the following way: +

+ +
+
+Dim example, v
+
+example = CreateObject("example.example")
+v = example.Vector.new_Vector(1.42, 10)
+
+
+ +

+Remember that COM does not support method overloading and therefore if there are multiple +constructors that you would like to use then you will need to rename some of them. +

+ +

+If your class has a default constructor then you can also use an alternate way of creating +objects. In this case you can use the following code: +

+ +
+
+Dim v
+
+v = CreateObject("example.Vector")
+
+
+ +

+Obviously there is no way to use this syntax for calling a constructor that expects to +receive parameters. +

+ +

17.3.14 C++ templates

+ + +

+C++ templates don't present a huge problem for SWIG. However, in order +to create wrappers, you have to tell SWIG to create wrappers for a particular +template instantiation. To do this, you use the %template directive. +For example: +

+ +
+
+%module example
+%{
+#include <utility>
+%}
+
+template<class T1, class T2>
+struct pair {
+   typedef T1 first_type;
+   typedef T2 second_type;
+   T1 first;
+   T2 second;
+   pair();
+   pair(const T1&, const T2&);
+  ~pair();
+};
+
+%template(pairii) pair<int,int>;
+
+
+ +

+In Basic: +

+ +
+
+Dim example, p, first, second
+
+Set example = CreateObject("example.example")
+Set p = example.pairii.new_pairii(3, 4)
+first = p.first
+second = p.second
+
+
+ +

+Obviously, there is more to template wrapping than shown in this example. +More details can be found in the SWIG and C++ chapter. +

+ +

17.3.15 C++ Smart Pointers

+ + +

+TODO +

+ + +

17.4 Further details on COM wrapping

+ + +

+The previous sections were meant as a quick start guide for wrapping C/C++ code as +COM objects. For users wanting to have a better understanding of how things work +beneath the surface this section provides some mor details. +

+ +

17.4.1 Classes and interfaces

+ + +

+There is no direct COM counterpart to a C++ class. COM defines two entities - the +interface which is comparable to a 'pure virtual' class, and the COM class which +is an implementation of one or more interfaces. There is no hierarchy of COM classes +but there is a hierarchy of interfaces. For each C++ class SWIG creates an interface +containing declarations of public functions and property getters and setters. If the +C++ class derives from a superclass then this relationship is preserved for their +corresponding interfaces (but as was stated before only single inheritance is supported). +The definition of a COM class serves the purpose of providing a way to locate a class's +factory object. Therefore the COM class in defined only when the class is not abstract +and has a default constructor. The following example shows two C++ classes +

+ +
+
+class A {
+public:
+  virtual int foo(A *) = 0;
+};
+
+class B : public A {
+public:
+  int foo(A *) { return 0; }
+  int bar() { return 0; }
+};
+
+
+ +

+and their corresponding definitions in the generated IDL file: +

+ +
+
+[ ... ]
+interface IA : IDispatch {
+  HRESULT foo(A *arg1, [ retval, out ] int *SWIG_result);
+};
+
+[ ... ]
+interface IB : IA {
+  HRESULT bar([ retval, out ] int *SWIG_result);
+};
+
+[ ... ]
+coclass BImpl {
+  interface IB;
+  interface ISWIGWrappedObject;
+};
+
+
+ +

+Some notable things above are the use of IDispatch as the base interface, +the use of HRESULT as return value along with the wrapping of the real return +value as an out parameter, and the ISWIGWrappedObject interface. +They will be described in later subsections. +

+ +

17.4.2 Module class and class objects

+ + +

+Since COM does not support global functions and variables the module class is used as +a workaround. The name of the module class is the same as the name of the module itself. +There may be multiple objects of the module class but all of them will work on the +same data - your module's global variables. SWIG does not provide any synchronization +and therefore if you plan to use global variables from multiple threads you will need +to take care of multithreading issues either in the C/C++ code or in the target language. +

+ +

+Class objects serve a very similar purpose as the module class with regard to static +member functions and variables. Note: They should not be confused with what COM calls +'class objects' which is just another name for class factories. +Technically static functions and variables could be +a part of the module class and the class objects created by SWIG serve only the purpose of creating +a logical namespace layout. Class objects can be accessed as read-only properties +of the module class, e.g. if you have the following class: +

+ +
+
+%module example
+
+class A {
+public:
+  static int func(void) { return 15; }
+};
+
+
+ +

+then SWIG will define definitions in the IDL file similar to these: +

+ +
+
+[ ... ]
+interface IAStatic : IDispatch {
+  HRESULT func([ retval, out ] int *SWIG_result);
+};
+
+[ ... ]
+interface Iexample : IDispatch {
+  [ propget ]
+  HRESULT A([ retval, out ] IAStatic **SWIG_result);
+}
+
+
+ +

+The code can then be used in the following way: +

+ +
+
+Dim example
+
+Set example = CreateObject("example.example")
+Print example.A.func()
+
+
+ +

+The same considerations apply for class objects as for the module class object. Even though +there might be several objects for the class A defined above they will all be +accessing the same static variables. Please note that currently you cannot directly create +a class object (e.g. using CreateObject in Basic) and need to use the module +class. There is no good reason for it other than that it has not yet been implemented. +

+ +

17.4.3 GUID handling

+ + +

+COM uses 128-bit identifiers called GUIDs (or UUIDs) for uniquely identifying classes, interfaces +and type libraries. Ideally you should generate CLSIDs (class GUIDs) and IIDs (interface GUIDs) +for each wrapped class and change them each time that you make an incompatible change to a +class's public interface. Since this is a time consuming process you can delegate some of this +work to SWIG. +

+ +

+You can specify a CLSID and an IID for each class using the %feature directive: +

+ +
+
+%feature("iid"="12345678-1234-1234-1234-000000000000") A;
+%feature("clsid"="12345678-1234-1234-1234-000000000001") A;
+
+
+ +

+For the module class you can define the CLSID and IID as part of the module directive: +

+ +
+
+%module(moduleiid="12345678-1234-1234-1234-000000000002", moduleclsid="12345678-1234-1234-1234-000000000003") example
+
+
+ +

+Finally there is also a GUID (called TLBID) for the type library which is the COM description of your +whole module. You can customize it in this way: +

+ +
+
+%module(tlbid="12345678-1234-1234-1234-000000000004") example
+
+
+ +

+If you do not want to provide all of the above GUIDs you can offload some work to SWIG. To do this +you can define a 'master' GUID which will serve as a seed value for automatically generating GUIDs: +

+ +
+
+%module(master_guid="12345678-1234-1234-1234-000000000005") example
+
+
+ +

+When SWIG wraps a class for which no IID or CLSID has been specified it will concatenate the +binary representation of master_guid, the module name, the class name and a suffix +specifying whether the GUID is generated for a class, interface or type library. Then it +will compute the SHA-1 hash of this string and use the resulting bits for generating a GUID +(this process has been described in RFC 4122 as variant 5 of the generation algorithm). +

+ +

+This process reduces the number of GUIDs you need to generate to only one - the master GUID. +You can generate it in various ways, e.g. by using guidgen from Microsoft's SDK or +one of many GUID/UUID generators available on the web. The procedure described above ensures +that your GUIDs will remain the same when you re-run SWIG. If for some reason you need to +change the public interface of some of your wrapped classes you can do this either by +manually specifying their new CLSIDs and IIDs, or by changing the master GUID. +

+ +

17.4.4 Class factories and aggregation

+ + +

+SWIG creates class factories for all defined COM classes. This means that class factories +are created for proxies of non-abstract classes with a default destructor and also for the +module class. +

+ +

+SWIG supports COM aggregation for proxy classes. The module class currently cannot be +aggregated. +

+ +

17.4.5 IDispatch and HRESULT as return value

+ + +

+All interfaces generated by SWIG are dual interfaces - this means that they support +both early binding (sometimes called VTBL binding - used mostly by compiled languages) +and late binding (sometimes called 'name binding' - used in scripting languages) by +implementing the IDispatch interface. As a result the return values of all interface +functions need to be instances of HRESULT. This is used for reporting whether the +function call succeeded or failed (e.g. when the call is made remotely using DCOM). +The 'real' return value, if any, needs to be therefore transformed to an out parameter +of the function. If you use the generated COM object from a scripting language then most +likely you will not see any difference - you will be able to use the function just as +it would be returning a value. However if you use a compiled language (like C, C++ or Delphi) +then you will need to explicitly provide a pointer to the address where the return value +is to be stored. +

+ +

17.4.6 ISWIGWrappedObject interface

+ + +

17.4.7 Memory management

+ + +

17.4.8 Exceptions

+ + +

17.5 Customization features

+ + +

17.5.1 Typemaps

+ + +

17.5.2 Exception handling

+ + + + + diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html index 97cb75409..94e3eca79 100644 --- a/Doc/Manual/CSharp.html +++ b/Doc/Manual/CSharp.html @@ -5,7 +5,7 @@ -

17 SWIG and C#

+

18 SWIG and C#

    @@ -39,7 +39,7 @@ -

    17.1 Introduction

    +

    18.1 Introduction

    @@ -59,7 +59,7 @@ The Microsoft Developer Network (MSDN) h Monodoc, available from the Mono project, has a very useful section titled Interop with native libraries.

    -

    17.2 Differences to the Java module

    +

    18.2 Differences to the Java module

    @@ -397,7 +397,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 three C# compilers (Portable.NET, Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path. -

    17.3 C# Exceptions

    +

    18.3 C# Exceptions

    @@ -494,7 +494,7 @@ set so should only be used when a C# exception is not created.

    -

    17.3.1 C# exception example using "check" typemap

    +

    18.3.1 C# exception example using "check" typemap

    @@ -676,7 +676,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.

    -

    17.3.2 C# exception example using %exception

    +

    18.3.2 C# exception example using %exception

    @@ -741,7 +741,7 @@ The managed code generated does check for the pending exception as mentioned ear

-

17.3.3 C# exception example using exception specifications

+

18.3.3 C# exception example using exception specifications

@@ -798,7 +798,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) { Multiple catch handlers are generated should there be more than one exception specifications declared.

-

17.3.4 Custom C# ApplicationException example

+

18.3.4 Custom C# ApplicationException example

@@ -932,7 +932,7 @@ try { -

17.4 C# Directors

+

18.4 C# Directors

@@ -945,7 +945,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.

-

17.4.1 Directors example

+

18.4.1 Directors example

@@ -1066,7 +1066,7 @@ CSharpDerived - UIntMethod(123) -

17.4.2 Directors implementation

+

18.4.2 Directors implementation

@@ -1252,7 +1252,7 @@ void SwigDirector_Base::BaseBoolMethod(Base const &b, bool flag) { -

17.4.3 Director caveats

+

18.4.3 Director caveats

@@ -1300,7 +1300,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.

-

17.5 C# Typemap examples

+

18.5 C# Typemap examples

This section includes a few examples of typemaps. For more examples, you @@ -1308,7 +1308,7 @@ might look at the files "csharp.swg" and "typemaps.i" in the SWIG library. -

17.5.1 Memory management when returning references to member variables

+

18.5.1 Memory management when returning references to member variables

@@ -1432,7 +1432,7 @@ public class Bike : IDisposable { Note the addReference call.

-

17.5.2 Memory management for objects passed to the C++ layer

+

18.5.2 Memory management for objects passed to the C++ layer

@@ -1551,7 +1551,7 @@ The 'cscode' typemap simply adds in the specified code into the C# proxy class. -

17.5.3 Date marshalling using the csin typemap and associated attributes

+

18.5.3 Date marshalling using the csin typemap and associated attributes

@@ -1788,7 +1788,7 @@ public class example { -

17.5.4 A date example demonstrating marshalling of C# properties

+

18.5.4 A date example demonstrating marshalling of C# properties

@@ -1888,7 +1888,7 @@ Some points to note: -

17.5.5 Turning wrapped classes into partial classes

+

18.5.5 Turning wrapped classes into partial classes

@@ -1988,7 +1988,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.

-

17.5.6 Extending proxy classes with additional C# code

+

18.5.6 Extending proxy classes with additional C# code

diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html index bd1b3d94b..98372a0f7 100644 --- a/Doc/Manual/Chicken.html +++ b/Doc/Manual/Chicken.html @@ -8,7 +8,7 @@ -

18 SWIG and Chicken

+

19 SWIG and Chicken

    @@ -72,7 +72,7 @@

    -

    18.1 Preliminaries

    +

    19.1 Preliminaries

    @@ -90,7 +90,7 @@ CHICKEN.

    -

    18.1.1 Running SWIG in C mode

    +

    19.1.1 Running SWIG in C mode

    @@ -123,7 +123,7 @@ object files and linked into your project.

    -

    18.1.2 Running SWIG in C++ mode

    +

    19.1.2 Running SWIG in C++ mode

    @@ -152,10 +152,10 @@ object files and linked into your project.

    -

    18.2 Code Generation

    +

    19.2 Code Generation

    -

    18.2.1 Naming Conventions

    +

    19.2.1 Naming Conventions

    @@ -171,7 +171,7 @@ %rename SWIG directive in the SWIG interface file.

    -

    18.2.2 Modules

    +

    19.2.2 Modules

    @@ -193,7 +193,7 @@ (uses modulename)) CHICKEN Scheme form.

    -

    18.2.3 Constants and Variables

    +

    19.2.3 Constants and Variables

    @@ -230,7 +230,7 @@ for info on how to apply the %feature.

    -

    18.2.4 Functions

    +

    19.2.4 Functions

    @@ -249,7 +249,7 @@ parameters). The return values can then be accessed with (call-with-values).

    -

    18.2.5 Exceptions

    +

    19.2.5 Exceptions

    The SWIG chicken module has support for exceptions thrown from @@ -291,7 +291,7 @@

-

18.3 TinyCLOS

+

19.3 TinyCLOS

@@ -334,7 +334,7 @@

-

18.4 Linkage

+

19.4 Linkage

@@ -355,7 +355,7 @@

-

18.4.1 Static binary or shared library linked at compile time

+

19.4.1 Static binary or shared library linked at compile time

We can easily use csc to build a static binary.

@@ -396,7 +396,7 @@ in which case the test script does not need to be linked with example.so. The t be run with csi.

-

18.4.2 Building chicken extension libraries

+

19.4.2 Building chicken extension libraries

Building a shared library like in the above section only works if the library @@ -454,7 +454,7 @@ distributed and used by anyone, even if SWIG is not installed.

See the Examples/chicken/egg directory in the SWIG source for an example that builds two eggs, one using the first method and one using the second method.

-

18.4.3 Linking multiple SWIG modules with TinyCLOS

+

19.4.3 Linking multiple SWIG modules with TinyCLOS

Linking together multiple modules that share type information using the %import @@ -478,7 +478,7 @@ with (declare (uses ...)). To create an extension library or an egg, just create a module_load.scm file that (declare (uses ...)) all the modules.

-

18.5 Typemaps

+

19.5 Typemaps

@@ -487,7 +487,7 @@ all the modules.

Lib/chicken/chicken.swg.

-

18.6 Pointers

+

19.6 Pointers

@@ -520,7 +520,7 @@ all the modules.

type. flags is either zero or SWIG_POINTER_DISOWN (see below).

-

18.6.1 Garbage collection

+

19.6.1 Garbage collection

If the owner flag passed to SWIG_NewPointerObj is 1, NewPointerObj will add a @@ -551,7 +551,7 @@ all the modules.

must be called manually.

-

18.7 Unsupported features and known problems

+

19.7 Unsupported features and known problems

-

18.7.1 TinyCLOS problems with Chicken version <= 1.92

+

19.7.1 TinyCLOS problems with Chicken version <= 1.92

In Chicken versions equal to or below 1.92, TinyCLOS has a limitation such that generic methods do not properly work on methods diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index c3197b9dc..ce7636732 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -162,7 +162,7 @@

  • Character strings and structures
  • Array members
  • Structure data members -
  • C constructors and destructors +
  • C constructors and destructors
  • Adding member functions to C structures
  • Nested structures
  • Other things to note about structure wrapping @@ -581,7 +581,61 @@ -

    17 SWIG and C#

    +

    17 SWIG and COM

    + + + + + +

    18 SWIG and C#

    @@ -614,7 +668,7 @@
    -

    18 SWIG and Chicken

    +

    19 SWIG and Chicken

    @@ -652,7 +706,7 @@
    -

    19 SWIG and Guile

    +

    20 SWIG and Guile

    @@ -687,7 +741,7 @@
    -

    20 SWIG and Java

    +

    21 SWIG and Java

    @@ -829,7 +883,7 @@
    -

    21 SWIG and Common Lisp

    +

    22 SWIG and Common Lisp

    @@ -852,7 +906,7 @@
    -

    22 SWIG and Lua

    +

    23 SWIG and Lua

    @@ -894,7 +948,7 @@
    -

    23 SWIG and Modula-3

    +

    24 SWIG and Modula-3

    @@ -935,7 +989,7 @@
    -

    24 SWIG and MzScheme

    +

    25 SWIG and MzScheme

    @@ -945,7 +999,7 @@
    -

    25 SWIG and Ocaml

    +

    26 SWIG and Ocaml

    @@ -996,7 +1050,7 @@
    -

    26 SWIG and Octave

    +

    27 SWIG and Octave

    @@ -1031,7 +1085,7 @@
    -

    27 SWIG and Perl5

    +

    28 SWIG and Perl5

    @@ -1098,7 +1152,7 @@
    -

    28 SWIG and PHP

    +

    29 SWIG and PHP

    @@ -1106,7 +1160,6 @@
  • Generating PHP Extensions
  • Basic PHP interface @@ -1129,7 +1182,7 @@ -

    29 SWIG and Pike

    +

    30 SWIG and Pike

    @@ -1153,7 +1206,7 @@
    -

    30 SWIG and Python

    +

    31 SWIG and Python

    @@ -1253,7 +1306,7 @@
    -

    31 SWIG and Ruby

    +

    32 SWIG and Ruby

    @@ -1387,7 +1440,7 @@
    -

    32 SWIG and Tcl

    +

    33 SWIG and Tcl

    @@ -1452,7 +1505,7 @@
    -

    33 SWIG and R

    +

    34 SWIG and R

    @@ -1468,7 +1521,7 @@
    -

    34 Extending SWIG to support new languages

    +

    35 Extending SWIG to support new languages

    diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html index 5639663a1..617327c9f 100644 --- a/Doc/Manual/Extending.html +++ b/Doc/Manual/Extending.html @@ -6,7 +6,7 @@ -

    34 Extending SWIG to support new languages

    +

    35 Extending SWIG to support new languages

      @@ -73,7 +73,7 @@ -

      34.1 Introduction

      +

      35.1 Introduction

      @@ -89,7 +89,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.

      -

      34.2 Prerequisites

      +

      35.2 Prerequisites

      @@ -119,7 +119,7 @@ obvious, but almost all SWIG directives as well as the low-level generation of wrapper code are driven by C++ datatypes.

      -

      34.3 The Big Picture

      +

      35.3 The Big Picture

      @@ -156,7 +156,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.

      -

      34.4 Execution Model

      +

      35.4 Execution Model

      @@ -201,7 +201,7 @@ latter stage of compilation. The next few sections briefly describe some of these stages.

      -

      34.4.1 Preprocessing

      +

      35.4.1 Preprocessing

      @@ -281,7 +281,7 @@ been expanded as well as everything else that goes into the low-level construction of the wrapper code.

      -

      34.4.2 Parsing

      +

      35.4.2 Parsing

      @@ -382,7 +382,7 @@ returning a foo and taking types a and b as arguments).

      -

      34.4.3 Parse Trees

      +

      35.4.3 Parse Trees

      @@ -637,7 +637,7 @@ $ swig -c++ -python -debug-module 4 example.i

    -

    34.4.4 Attribute namespaces

    +

    35.4.4 Attribute namespaces

    @@ -656,7 +656,7 @@ that matches the name of the target language. For example, python:foo perl:foo.

    -

    34.4.5 Symbol Tables

    +

    35.4.5 Symbol Tables

    @@ -747,7 +747,7 @@ example.i:5. Previous declaration is foo_i(int )

    -

    34.4.6 The %feature directive

    +

    35.4.6 The %feature directive

    @@ -803,7 +803,7 @@ For example, the exception code above is simply stored without any modifications.

    -

    34.4.7 Code Generation

    +

    35.4.7 Code Generation

    @@ -925,7 +925,7 @@ public : The role of these functions is described shortly.

    -

    34.4.8 SWIG and XML

    +

    35.4.8 SWIG and XML

    @@ -938,7 +938,7 @@ internal data structures, it may be useful to keep XML in the back of your mind as a model.

    -

    34.5 Primitive Data Structures

    +

    35.5 Primitive Data Structures

    @@ -984,7 +984,7 @@ typedef Hash Typetab; -

    34.5.1 Strings

    +

    35.5.1 Strings

    @@ -1125,7 +1125,7 @@ Returns the number of replacements made (if any). -

    34.5.2 Hashes

    +

    35.5.2 Hashes

    @@ -1202,7 +1202,7 @@ Returns the list of hash table keys. -

    34.5.3 Lists

    +

    35.5.3 Lists

    @@ -1291,7 +1291,7 @@ If t is not a standard object, it is assumed to be a char * and is used to create a String object. -

    34.5.4 Common operations

    +

    35.5.4 Common operations

    The following operations are applicable to all datatypes. @@ -1346,7 +1346,7 @@ objects and report errors. Gets the line number associated with x. -

    34.5.5 Iterating over Lists and Hashes

    +

    35.5.5 Iterating over Lists and Hashes

    To iterate over the elements of a list or a hash table, the following functions are used: @@ -1391,7 +1391,7 @@ for (j = First(j); j.item; j= Next(j)) { -

    34.5.6 I/O

    +

    35.5.6 I/O

    Special I/O functions are used for all internal I/O. These operations @@ -1527,7 +1527,7 @@ Similarly, the preprocessor and parser all operate on string-files. -

    34.6 Navigating and manipulating parse trees

    +

    35.6 Navigating and manipulating parse trees

    Parse trees are built as collections of hash tables. Each node is a hash table in which @@ -1661,7 +1661,7 @@ Deletes a node from the parse tree. Deletion reconnects siblings and properly u the parent so that sibling nodes are unaffected. -

    34.7 Working with attributes

    +

    35.7 Working with attributes

    @@ -1778,7 +1778,7 @@ the attribute is optional. Swig_restore() must always be called after function. -

    34.8 Type system

    +

    35.8 Type system

    @@ -1787,7 +1787,7 @@ pointers, references, and pointers to members. A detailed discussion of type theory is impossible here. However, let's cover the highlights.

    -

    34.8.1 String encoding of types

    +

    35.8.1 String encoding of types

    @@ -1888,7 +1888,7 @@ make the final type, the two parts are just joined together using string concatenation.

    -

    34.8.2 Type construction

    +

    35.8.2 Type construction

    @@ -2057,7 +2057,7 @@ Returns the prefix of a type. For example, if ty is ty is unmodified. -

    34.8.3 Type tests

    +

    35.8.3 Type tests

    @@ -2144,7 +2144,7 @@ Checks if ty is a varargs type. Checks if ty is a templatized type. -

    34.8.4 Typedef and inheritance

    +

    35.8.4 Typedef and inheritance

    @@ -2246,7 +2246,7 @@ Fully reduces ty according to typedef rules. Resulting datatype will consist only of primitive typenames. -

    34.8.5 Lvalues

    +

    35.8.5 Lvalues

    @@ -2283,7 +2283,7 @@ Literal y; // type = 'Literal', ltype='p.char' -

    34.8.6 Output functions

    +

    35.8.6 Output functions

    @@ -2345,7 +2345,7 @@ SWIG, but is most commonly associated with type-descriptor objects that appear in wrappers (e.g., SWIGTYPE_p_double). -

    34.9 Parameters

    +

    35.9 Parameters

    @@ -2444,7 +2444,7 @@ included. Used to emit prototypes. Returns the number of required (non-optional) arguments in p. -

    34.10 Writing a Language Module

    +

    35.10 Writing a Language Module

    @@ -2459,7 +2459,7 @@ describes the creation of a minimal Python module. You should be able to extra this to other languages.

    -

    34.10.1 Execution model

    +

    35.10.1 Execution model

    @@ -2469,7 +2469,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.

    -

    34.10.2 Starting out

    +

    35.10.2 Starting out

    @@ -2577,7 +2577,7 @@ that activates your module. For example, swig -python foo.i. The messages from your new module should appear.

    -

    34.10.3 Command line options

    +

    35.10.3 Command line options

    @@ -2636,7 +2636,7 @@ to mark the option as valid. If you forget to do this, SWIG will terminate wit unrecognized command line option error.

    -

    34.10.4 Configuration and preprocessing

    +

    35.10.4 Configuration and preprocessing

    @@ -2685,7 +2685,7 @@ an implementation file python.cxx and a configuration file python.swg.

    -

    34.10.5 Entry point to code generation

    +

    35.10.5 Entry point to code generation

    @@ -2743,7 +2743,7 @@ int Python::top(Node *n) { -

    34.10.6 Module I/O and wrapper skeleton

    +

    35.10.6 Module I/O and wrapper skeleton

    @@ -2885,7 +2885,7 @@ functionWrapper : void Shape_y_set(Shape *self,double y) -

    34.10.7 Low-level code generators

    +

    35.10.7 Low-level code generators

    @@ -3039,7 +3039,7 @@ but without the typemaps, there is still work to do.

    -

    34.10.8 Configuration files

    +

    35.10.8 Configuration files

    @@ -3189,7 +3189,7 @@ politely displays the ignoring language message. -

    34.10.9 Runtime support

    +

    35.10.9 Runtime support

    @@ -3198,7 +3198,7 @@ Discuss the kinds of functions typically needed for SWIG runtime support (e.g. the SWIG files that implement those functions.

    -

    34.10.10 Standard library files

    +

    35.10.10 Standard library files

    @@ -3217,7 +3217,7 @@ The following are the minimum that are usually supported: Please copy these and modify for any new language.

    -

    34.10.11 Examples and test cases

    +

    35.10.11 Examples and test cases

    @@ -3246,7 +3246,7 @@ during this process, see the section on configuration files.

    -

    34.10.12 Documentation

    +

    35.10.12 Documentation

    @@ -3278,7 +3278,7 @@ Some topics that you'll want to be sure to address include: if available. -

    34.10.13 Prerequisites for adding a new language module to the SWIG distribution

    +

    35.10.13 Prerequisites for adding a new language module to the SWIG distribution

    @@ -3335,7 +3335,7 @@ should be added should there be an area not already covered by the existing tests.

    -

    34.10.14 Coding style guidelines

    +

    35.10.14 Coding style guidelines

    @@ -3359,13 +3359,13 @@ 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.

    -

    34.11 Typemaps

    +

    35.11 Typemaps

    -

    34.11.1 Proxy classes

    +

    35.11.1 Proxy classes

    -

    34.12 Guide to parse tree nodes

    +

    35.12 Guide to parse tree nodes

    diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html index 20ab716e4..cf7e8da2c 100644 --- a/Doc/Manual/Guile.html +++ b/Doc/Manual/Guile.html @@ -8,7 +8,7 @@ -

    19 SWIG and Guile

    +

    20 SWIG and Guile

      @@ -47,7 +47,7 @@

      This section details guile-specific support in SWIG. -

      19.1 Meaning of "Module"

      +

      20.1 Meaning of "Module"

      @@ -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". -

      19.2 Using the SCM or GH Guile API

      +

      20.2 Using the SCM or GH Guile API

      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.

      -

      19.3 Linkage

      +

      20.3 Linkage

      @@ -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. -

      19.3.1 Simple Linkage

      +

      20.3.1 Simple 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. -

      19.3.2 Passive Linkage

      +

      20.3.2 Passive Linkage

      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. -

      19.3.3 Native Guile Module Linkage

      +

      20.3.3 Native Guile Module Linkage

      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:

    -

    19.3.4 Old Auto-Loading Guile Module Linkage

    +

    20.3.4 Old Auto-Loading Guile Module Linkage

    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. -

    19.3.5 Hobbit4D Linkage

    +

    20.3.5 Hobbit4D Linkage

    @@ -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.

    -

    19.4 Underscore Folding

    +

    20.4 Underscore Folding

    @@ -320,7 +320,7 @@ complained so far. %rename to specify the Guile name of the wrapped functions and variables (see CHANGES). -

    19.5 Typemaps

    +

    20.5 Typemaps

    @@ -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.

    -

    19.6 Representation of pointers as smobs

    +

    20.6 Representation of pointers as smobs

    @@ -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. -

    19.6.1 GH Smobs

    +

    20.6.1 GH Smobs

    @@ -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.

    -

    19.6.2 SCM Smobs

    +

    20.6.2 SCM Smobs

    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.

    -

    19.6.3 Garbage Collection

    +

    20.6.3 Garbage Collection

    Garbage collection is a feature of the new SCM interface, and it is automatically included @@ -491,7 +491,7 @@ is exactly like described in Object ownership and %newobject in the SWIG manual. All typemaps use an $owner var, and the guile module replaces $owner with 0 or 1 depending on feature:new.

    -

    19.7 Exception Handling

    +

    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. -

    19.8 Procedure documentation

    +

    20.8 Procedure documentation

    If invoked with the command-line option -procdoc @@ -553,7 +553,7 @@ like this: typemap argument doc. See Lib/guile/typemaps.i for details. -

    19.9 Procedures with setters

    +

    20.9 Procedures with setters

    For global variables, SWIG creates a single wrapper procedure @@ -581,7 +581,7 @@ struct members, the procedures (struct-member-get pointer) and (struct-member-set pointer value) are not generated. -

    19.10 GOOPS Proxy Classes

    +

    20.10 GOOPS Proxy Classes

    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 %import "foo.h" before the %inline block.

    -

    19.10.1 Naming Issues

    +

    20.10.1 Naming Issues

    As you can see in the example above, there are potential naming conflicts. The default exported @@ -769,7 +769,7 @@ guile-modules. For example,

    TODO: Renaming class name prefixes?

    -

    19.10.2 Linking

    +

    20.10.2 Linking

    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 518426f5a..21085c803 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -5,7 +5,7 @@ -

    20 SWIG and Java

    +

    21 SWIG and Java

      @@ -154,7 +154,7 @@ It covers most SWIG features, but certain low-level details are covered in less

      -

      20.1 Overview

      +

      21.1 Overview

      @@ -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.

      -

      20.2 Preliminaries

      +

      21.2 Preliminaries

      @@ -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.

      -

      20.2.1 Running SWIG

      +

      21.2.1 Running SWIG

      @@ -258,7 +258,7 @@ The following sections have further practical examples and details on how you mi compiling and using the generated files.

      -

      20.2.2 Additional Commandline Options

      +

      21.2.2 Additional Commandline Options

      @@ -295,7 +295,7 @@ swig -java -help Their use will become clearer by the time you have finished reading this section on SWIG and Java.

      -

      20.2.3 Getting the right header files

      +

      21.2.3 Getting the right header files

      @@ -310,7 +310,7 @@ They are usually in directories like this:

      The exact location may vary on your machine, but the above locations are typical.

      -

      20.2.4 Compiling a dynamic module

      +

      21.2.4 Compiling a dynamic module

      @@ -346,7 +346,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.

      -

      20.2.5 Using your module

      +

      21.2.5 Using your module

      @@ -381,7 +381,7 @@ $ If it doesn't work have a look at the following section which discusses problems loading the shared library.

      -

      20.2.6 Dynamic linking problems

      +

      21.2.6 Dynamic linking problems

      @@ -455,7 +455,7 @@ The following section also contains some C++ specific linking problems and solut

      -

      20.2.7 Compilation problems and compiling with C++

      +

      21.2.7 Compilation problems and compiling with C++

      @@ -508,7 +508,7 @@ Finally make sure the version of JDK header files matches the version of Java th

      -

      20.2.8 Building on Windows

      +

      21.2.8 Building on Windows

      @@ -517,7 +517,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.

      -

      20.2.8.1 Running SWIG from Visual Studio

      +

      21.2.8.1 Running SWIG from Visual Studio

      @@ -556,7 +556,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.

      -

      20.2.8.2 Using NMAKE

      +

      21.2.8.2 Using NMAKE

      @@ -615,7 +615,7 @@ Of course you may want to make changes for it to work for C++ by adding in the -

      -

      20.3 A tour of basic C/C++ wrapping

      +

      21.3 A tour of basic C/C++ wrapping

      @@ -625,7 +625,7 @@ variables are wrapped with JavaBean type getters and setters and so forth. This section briefly covers the essential aspects of this wrapping.

      -

      20.3.1 Modules, packages and generated Java classes

      +

      21.3.1 Modules, packages and generated Java classes

      @@ -659,7 +659,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. -

      20.3.2 Functions

      +

      21.3.2 Functions

      @@ -693,7 +693,7 @@ System.out.println(example.fact(4));

    -

    20.3.3 Global variables

    +

    21.3.3 Global variables

    @@ -780,7 +780,7 @@ extern char *path; // Read-only (due to %immutable) -

    20.3.4 Constants

    +

    21.3.4 Constants

    @@ -920,7 +920,7 @@ Or if you decide this practice isn't so bad and your own class implements ex

    -

    20.3.5 Enumerations

    +

    21.3.5 Enumerations

    @@ -934,7 +934,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.

    -

    20.3.5.1 Anonymous enums

    +

    21.3.5.1 Anonymous enums

    @@ -997,7 +997,7 @@ As in the case of constants, you can access them through either the module class

    -

    20.3.5.2 Typesafe enums

    +

    21.3.5.2 Typesafe enums

    @@ -1090,7 +1090,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.

    -

    20.3.5.3 Proper Java enums

    +

    21.3.5.3 Proper Java enums

    @@ -1143,7 +1143,7 @@ The additional support methods need not be generated if none of the enum items h Simpler Java enums for enums without initializers section.

    -

    20.3.5.4 Type unsafe enums

    +

    21.3.5.4 Type unsafe enums

    @@ -1191,7 +1191,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.

    -

    20.3.5.5 Simple enums

    +

    21.3.5.5 Simple enums

    @@ -1210,7 +1210,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.

    -

    20.3.6 Pointers

    +

    21.3.6 Pointers

    @@ -1298,7 +1298,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.

    -

    20.3.7 Structures

    +

    21.3.7 Structures

    @@ -1466,7 +1466,7 @@ x.setA(3); // Modify x.a - this is the same as b.f.a -

    20.3.8 C++ classes

    +

    21.3.8 C++ classes

    @@ -1529,7 +1529,7 @@ int bar = Spam.getBar(); -

    20.3.9 C++ inheritance

    +

    21.3.9 C++ inheritance

    @@ -1590,7 +1590,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.

    -

    20.3.10 Pointers, references, arrays and pass by value

    +

    21.3.10 Pointers, references, arrays and pass by value

    @@ -1645,7 +1645,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).

    -

    20.3.10.1 Null pointers

    +

    21.3.10.1 Null pointers

    @@ -1669,7 +1669,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.

    -

    20.3.11 C++ overloaded functions

    +

    21.3.11 C++ overloaded functions

    @@ -1784,7 +1784,7 @@ void spam(unsigned short); // Ignored -

    20.3.12 C++ default arguments

    +

    21.3.12 C++ default arguments

    @@ -1827,7 +1827,7 @@ Further details on default arguments and how to restore this approach are given

    -

    20.3.13 C++ namespaces

    +

    21.3.13 C++ namespaces

    @@ -1887,7 +1887,7 @@ symbols separate, consider wrapping them as separate SWIG modules. Each SWIG module can be placed into a separate package.

    -

    20.3.14 C++ templates

    +

    21.3.14 C++ templates

    @@ -1936,7 +1936,7 @@ Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter.

    -

    20.3.15 C++ Smart Pointers

    +

    21.3.15 C++ Smart Pointers

    @@ -2020,7 +2020,7 @@ Foo f = p.__deref__(); // Returns underlying Foo * -

    20.4 Further details on the generated Java classes

    +

    21.4 Further details on the generated Java classes

    @@ -2035,7 +2035,7 @@ Finally enum classes are covered. First, the crucial intermediary JNI class is considered.

    -

    20.4.1 The intermediary JNI class

    +

    21.4.1 The intermediary JNI class

    @@ -2155,7 +2155,7 @@ If name is the same as modulename then the module class name g from modulename to modulenameModule.

    -

    20.4.1.1 The intermediary JNI class pragmas

    +

    21.4.1.1 The intermediary JNI class pragmas

    @@ -2234,7 +2234,7 @@ For example, let's change the intermediary JNI class access to public. All the methods in the intermediary JNI class will then be callable outside of the package as the method modifiers are public by default.

    -

    20.4.2 The Java module class

    +

    21.4.2 The Java module class

    @@ -2265,7 +2265,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.

    -

    20.4.2.1 The Java module class pragmas

    +

    21.4.2.1 The Java module class pragmas

    @@ -2316,7 +2316,7 @@ See The intermediary JNI class pragmas section fo

    -

    20.4.3 Java proxy classes

    +

    21.4.3 Java proxy classes

    @@ -2392,7 +2392,7 @@ int y = f.spam(5, new Foo()); -

    20.4.3.1 Memory management

    +

    21.4.3.1 Memory management

    @@ -2554,7 +2554,7 @@ and

    -

    20.4.3.2 Inheritance

    +

    21.4.3.2 Inheritance

    @@ -2670,7 +2670,7 @@ However, true cross language polymorphism can be achieved using the 20.4.3.3 Proxy classes and garbage collection +

    21.4.3.3 Proxy classes and garbage collection

    @@ -2753,7 +2753,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.

    -

    20.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling

    +

    21.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling

    @@ -2875,7 +2875,7 @@ For example: Compatibility note: The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.

    -

    20.4.3.5 Single threaded applications and thread safety

    +

    21.4.3.5 Single threaded applications and thread safety

    @@ -2963,7 +2963,7 @@ for (int i=0; i<100000; i++) { -

    20.4.4 Type wrapper classes

    +

    21.4.4 Type wrapper classes

    @@ -3050,7 +3050,7 @@ public static void spam(SWIGTYPE_p_int x, SWIGTYPE_p_int y, int z) { ... } -

    20.4.5 Enum classes

    +

    21.4.5 Enum classes

    @@ -3059,7 +3059,7 @@ The Enumerations section discussed these but omitted The following sub-sections detail the various types of enum classes that can be generated.

    -

    20.4.5.1 Typesafe enum classes

    +

    21.4.5.1 Typesafe enum classes

    @@ -3143,7 +3143,7 @@ The swigValue method is used for marshalling in the other direction. The toString method is overridden so that the enum name is available.

    -

    20.4.5.2 Proper Java enum classes

    +

    21.4.5.2 Proper Java enum classes

    @@ -3221,7 +3221,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.

    -

    20.4.5.3 Type unsafe enum classes

    +

    21.4.5.3 Type unsafe enum classes

    @@ -3252,7 +3252,7 @@ public final class Beverage { -

    20.5 Cross language polymorphism using directors

    +

    21.5 Cross language polymorphism using directors

    @@ -3274,7 +3274,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.

    -

    20.5.1 Enabling directors

    +

    21.5.1 Enabling directors

    @@ -3345,7 +3345,7 @@ public: -

    20.5.2 Director classes

    +

    21.5.2 Director classes

    @@ -3372,7 +3372,7 @@ If the correct implementation is in Java, the Java API is used to call the metho

    -

    20.5.3 Overhead and code bloat

    +

    21.5.3 Overhead and code bloat

    @@ -3390,7 +3390,7 @@ This situation can be optimized by selectively enabling director methods (using

    -

    20.5.4 Simple directors example

    +

    21.5.4 Simple directors example

    @@ -3455,7 +3455,7 @@ DirectorDerived::upcall_method() invoked. -

    20.5.5 Director threading issues

    +

    21.5.5 Director threading issues

    @@ -3475,7 +3475,7 @@ Macros can be defined on the commandline when compiling your C++ code, or altern -

    20.6 Accessing protected members

    +

    21.6 Accessing protected members

    @@ -3571,7 +3571,7 @@ class MyProtectedBase extends ProtectedBase -

    20.7 Common customization features

    +

    21.7 Common customization features

    @@ -3583,7 +3583,7 @@ be awkward. This section describes some common SWIG features that are used to improve the interface to existing C/C++ code.

    -

    20.7.1 C/C++ helper functions

    +

    21.7.1 C/C++ helper functions

    @@ -3649,7 +3649,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.

    -

    20.7.2 Class extension with %extend

    +

    21.7.2 Class extension with %extend

    @@ -3712,7 +3712,7 @@ Vector(2,3,4) in any way---the extensions only show up in the Java interface.

    -

    20.7.3 Exception handling with %exception and %javaexception

    +

    21.7.3 Exception handling with %exception and %javaexception

    @@ -3869,7 +3869,7 @@ to raise exceptions. See the SWIG Library ch The typemap example Handling C++ exception specifications as Java exceptions provides further exception handling capabilities.

    -

    20.7.4 Method access with %javamethodmodifiers

    +

    21.7.4 Method access with %javamethodmodifiers

    @@ -3895,7 +3895,7 @@ protected static void protect_me() { -

    20.8 Tips and techniques

    +

    21.8 Tips and techniques

    @@ -3905,7 +3905,7 @@ strings and arrays. This chapter discusses the common techniques for solving these problems.

    -

    20.8.1 Input and output parameters using primitive pointers and references

    +

    21.8.1 Input and output parameters using primitive pointers and references

    @@ -4079,7 +4079,7 @@ void foo(Bar *OUTPUT); will not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar.

    -

    20.8.2 Simple pointers

    +

    21.8.2 Simple pointers

    @@ -4145,7 +4145,7 @@ System.out.println("3 + 4 = " + result); See the SWIG Library chapter for further details.

    -

    20.8.3 Wrapping C arrays with Java arrays

    +

    21.8.3 Wrapping C arrays with Java arrays

    @@ -4212,7 +4212,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.

    -

    20.8.4 Unbounded C Arrays

    +

    21.8.4 Unbounded C Arrays

    @@ -4357,7 +4357,7 @@ well suited for applications in which you need to create buffers, package binary data, etc.

    -

    20.8.5 Overriding new and delete to allocate from Java heap

    +

    21.8.5 Overriding new and delete to allocate from Java heap

    @@ -4474,7 +4474,7 @@ model and use these functions in place of malloc and free in your own code.

    -

    20.9 Java typemaps

    +

    21.9 Java typemaps

    @@ -4495,7 +4495,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. -

    20.9.1 Default primitive type mappings

    +

    21.9.1 Default primitive type mappings

    @@ -4647,7 +4647,7 @@ However, the mappings allow the full range of values for each C type from Java.

    -

    20.9.2 Default typemaps for non-primitive types

    +

    21.9.2 Default typemaps for non-primitive types

    @@ -4662,7 +4662,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.

    -

    20.9.3 Sixty four bit JVMs

    +

    21.9.3 Sixty four bit JVMs

    @@ -4675,7 +4675,7 @@ Unfortunately it won't of course hold true for JNI code.

    -

    20.9.4 What is a typemap?

    +

    21.9.4 What is a typemap?

    @@ -4798,7 +4798,7 @@ int c = example.count('e',"Hello World"); -

    20.9.5 Typemaps for mapping C/C++ types to Java types

    +

    21.9.5 Typemaps for mapping C/C++ types to Java types

    @@ -5058,7 +5058,7 @@ These are listed below: -

    20.9.6 Java typemap attributes

    +

    21.9.6 Java typemap attributes

    @@ -5104,7 +5104,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.

    -

    20.9.7 Java special variables

    +

    21.9.7 Java special variables

    @@ -5247,7 +5247,7 @@ This special variable expands to the intermediary class name. Usually this is th unless the jniclassname attribute is specified in the %module directive.

    -

    20.9.8 Typemaps for both C and C++ compilation

    +

    21.9.8 Typemaps for both C and C++ compilation

    @@ -5284,7 +5284,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps

    -

    20.9.9 Java code typemaps

    +

    21.9.9 Java code typemaps

    @@ -5480,7 +5480,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.

    -

    20.9.10 Director specific typemaps

    +

    21.9.10 Director specific typemaps

    @@ -5705,7 +5705,7 @@ The basic strategy here is to provide a default package typemap for the majority -

    20.10 Typemap Examples

    +

    21.10 Typemap Examples

    @@ -5715,7 +5715,7 @@ the SWIG library.

    -

    20.10.1 Simpler Java enums for enums without initializers

    +

    21.10.1 Simpler Java enums for enums without initializers

    @@ -5794,7 +5794,7 @@ This would be done by using the original versions of these typemaps in "enums.sw

    -

    20.10.2 Handling C++ exception specifications as Java exceptions

    +

    21.10.2 Handling C++ exception specifications as Java exceptions

    @@ -5919,7 +5919,7 @@ We could alternatively have used %rename to rename what() into

    -

    20.10.3 NaN Exception - exception handling for a particular type

    +

    21.10.3 NaN Exception - exception handling for a particular type

    @@ -6074,7 +6074,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.

    -

    20.10.4 Converting Java String arrays to char **

    +

    21.10.4 Converting Java String arrays to char **

    @@ -6218,7 +6218,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify what Java types to use.

    -

    20.10.5 Expanding a Java object to multiple arguments

    +

    21.10.5 Expanding a Java object to multiple arguments

    @@ -6300,7 +6300,7 @@ example.foo(new String[]{"red", "green", "blue", "white"}); -

    20.10.6 Using typemaps to return arguments

    +

    21.10.6 Using typemaps to return arguments

    @@ -6418,7 +6418,7 @@ $ java main 1 12.0 340.0 -

    20.10.7 Adding Java downcasts to polymorphic return types

    +

    21.10.7 Adding Java downcasts to polymorphic return types

    @@ -6624,7 +6624,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.

    -

    20.10.8 Adding an equals method to the Java classes

    +

    21.10.8 Adding an equals method to the Java classes

    @@ -6668,7 +6668,7 @@ System.out.println("foo1? " + foo1.equals(foo2)); -

    20.10.9 Void pointers and a common Java base class

    +

    21.10.9 Void pointers and a common Java base class

    @@ -6727,7 +6727,7 @@ This example contains some useful functionality which you may want in your code.

  • It also has a function which effectively implements a cast from the type of the proxy/type wrapper class to a void pointer. This is necessary for passing a proxy class or a type wrapper class to a function that takes a void pointer. -

    20.10.10 Struct pointer to pointer

    +

    21.10.10 Struct pointer to pointer

    @@ -6907,7 +6907,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.

    -

    20.10.11 Memory management when returning references to member variables

    +

    21.10.11 Memory management when returning references to member variables

    @@ -7030,7 +7030,7 @@ public class Bike { Note the addReference call.

    -

    20.10.12 Memory management for objects passed to the C++ layer

    +

    21.10.12 Memory management for objects passed to the C++ layer

    @@ -7146,7 +7146,7 @@ The 'javacode' typemap simply adds in the specified code into the Java proxy cla -

    20.10.13 Date marshalling using the javain typemap and associated attributes

    +

    21.10.13 Date marshalling using the javain typemap and associated attributes

    @@ -7323,7 +7323,7 @@ A few things to note: -

    20.11 Living with Java Directors

    +

    21.11 Living with Java Directors

    @@ -7504,10 +7504,10 @@ public abstract class UserVisibleFoo extends Foo {

  • -

    20.12 Odds and ends

    +

    21.12 Odds and ends

    -

    20.12.1 JavaDoc comments

    +

    21.12.1 JavaDoc comments

    @@ -7563,7 +7563,7 @@ public class Barmy { -

    20.12.2 Functional interface without proxy classes

    +

    21.12.2 Functional interface without proxy classes

    @@ -7624,7 +7624,7 @@ All destructors have to be called manually for example the delete_Foo(foo) -

    20.12.3 Using your own JNI functions

    +

    21.12.3 Using your own JNI functions

    @@ -7674,7 +7674,7 @@ This directive is only really useful if you want to mix your own hand crafted JN

    -

    20.12.4 Performance concerns and hints

    +

    21.12.4 Performance concerns and hints

    @@ -7695,7 +7695,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.

    -

    20.12.5 Debugging

    +

    21.12.5 Debugging

    @@ -7717,7 +7717,7 @@ The -verbose:jni and -verbose:gc are also useful options for monitoring code beh

    -

    20.13 Examples

    +

    21.13 Examples

    diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html index ca2d0414e..14abead00 100644 --- a/Doc/Manual/Lisp.html +++ b/Doc/Manual/Lisp.html @@ -6,7 +6,7 @@ -

    21 SWIG and Common Lisp

    +

    22 SWIG and Common Lisp

      @@ -41,7 +41,7 @@ Lisp, Common Foreign Function Interface(CFFI), CLisp and UFFI foreign function interfaces.

      -

      21.1 Allegro Common Lisp

      +

      22.1 Allegro Common Lisp

      @@ -50,7 +50,7 @@ here

      -

      21.2 Common Foreign Function Interface(CFFI)

      +

      22.2 Common Foreign Function Interface(CFFI)

      @@ -77,7 +77,7 @@ swig -cffi -module module-name file-name files and the various things which you can do with them.

      -

      21.2.1 Additional Commandline Options

      +

      22.2.1 Additional Commandline Options

      @@ -118,7 +118,7 @@ swig -cffi -help -

      21.2.2 Generating CFFI bindings

      +

      22.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
    -

    21.2.3 Generating CFFI bindings for C++ code

    +

    22.2.3 Generating CFFI bindings for C++ code

    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. -

    21.2.4 Inserting user code into generated files

    +

    22.2.4 Inserting user code into generated files

    @@ -608,7 +608,7 @@ Note that the block %{ ... %} is effectively a shortcut for

    -

    21.3 CLISP

    +

    22.3 CLISP

    @@ -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.

    -

    21.3.1 Additional Commandline Options

    +

    22.3.1 Additional Commandline Options

    @@ -671,7 +671,7 @@ and global variables will be created otherwise only definitions for
    -

    21.3.2 Details on CLISP bindings

    +

    22.3.2 Details on CLISP bindings

    @@ -795,7 +795,7 @@ struct bar { -

    21.4 UFFI

    +

    22.4 UFFI

    diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html index 4ebf02349..99c7c9a3c 100644 --- a/Doc/Manual/Lua.html +++ b/Doc/Manual/Lua.html @@ -6,7 +6,7 @@ -

    22 SWIG and Lua

    +

    23 SWIG and Lua

      @@ -52,13 +52,13 @@

      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

      -

      22.1 Preliminaries

      +

      23.1 Preliminaries

      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).

      -

      22.2 Running SWIG

      +

      23.2 Running SWIG

      @@ -90,7 +90,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.

      -

      22.2.1 Compiling and Linking and Interpreter

      +

      23.2.1 Compiling and Linking and Interpreter

      @@ -137,7 +137,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

    -

    22.2.2 Compiling a dynamic module

    +

    23.2.2 Compiling a dynamic module

    @@ -205,7 +205,7 @@ Is quite obvious (Go back and consult the Lua documents on how to enable loadlib -

    22.2.3 Using your module

    +

    23.2.3 Using your module

    @@ -223,19 +223,19 @@ $ ./my_lua > -

    22.3 A tour of basic C/C++ wrapping

    +

    23.3 A tour of basic C/C++ wrapping

    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.

    -

    22.3.1 Modules

    +

    23.3.1 Modules

    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.

    -

    22.3.2 Functions

    +

    23.3.2 Functions

    @@ -273,7 +273,7 @@ It is also possible to rename the module with an assignment. 24 -

    22.3.3 Global variables

    +

    23.3.3 Global variables

    @@ -347,7 +347,7 @@ nil 3.142 -

    22.3.4 Constants and enums

    +

    23.3.4 Constants and enums

    @@ -370,7 +370,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.

    -

    22.3.5 Pointers

    +

    23.3.5 Pointers

    @@ -408,7 +408,7 @@ Lua enforces the integrity of its userdata, so it is virtually impossible to cor nil -

    22.3.6 Structures

    +

    23.3.6 Structures

    @@ -494,7 +494,7 @@ Because the pointer points inside the structure, you can modify the contents and > x.a = 3 -- Modifies the same structure -

    22.3.7 C++ classes

    +

    23.3.7 C++ classes

    @@ -555,7 +555,7 @@ It is not (currently) possible to access static members of an instance: -- does NOT work -

    22.3.8 C++ inheritance

    +

    23.3.8 C++ inheritance

    @@ -580,7 +580,7 @@ then the function spam() accepts a Foo pointer or a pointer to any clas

    It is safe to use multiple inheritance with SWIG.

    -

    22.3.9 Pointers, references, values, and arrays

    +

    23.3.9 Pointers, references, values, and arrays

    @@ -611,7 +611,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.

    -

    22.3.10 C++ overloaded functions

    +

    23.3.10 C++ overloaded functions

    @@ -697,7 +697,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.

    -

    22.3.11 C++ operators

    +

    23.3.11 C++ operators

    @@ -809,7 +809,7 @@ It is also possible to overload the operator[], but currently this cann }; -

    22.3.12 Class extension with %extend

    +

    23.3.12 Class extension with %extend

    @@ -864,7 +864,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).

    -

    22.3.13 C++ templates

    +

    23.3.13 C++ templates

    @@ -899,7 +899,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.

    -

    22.3.14 C++ Smart Pointers

    +

    23.3.14 C++ Smart Pointers

    @@ -951,7 +951,7 @@ If you ever need to access the underlying pointer returned by operator->( > f = p:__deref__() -- Returns underlying Foo * -

    22.3.15 C++ Exceptions

    +

    23.3.15 C++ Exceptions

    @@ -1098,7 +1098,7 @@ add exception specification to functions or globally (respectively).

    -

    22.3.16 Writing your own custom wrappers

    +

    23.3.16 Writing your own custom wrappers

    @@ -1117,7 +1117,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.

    -

    22.3.17 Adding additional Lua code

    +

    23.3.17 Adding additional Lua code

    @@ -1155,7 +1155,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.

    -

    22.4 Details on the Lua binding

    +

    23.4 Details on the Lua binding

    @@ -1166,7 +1166,7 @@ See Examples/lua/arrays for an example of this code.

    -

    22.4.1 Binding global data into the module.

    +

    23.4.1 Binding global data into the module.

    @@ -1226,7 +1226,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)'.

    -

    22.4.2 Userdata and Metatables

    +

    23.4.2 Userdata and Metatables

    @@ -1306,7 +1306,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.

    -

    22.4.3 Memory management

    +

    23.4.3 Memory management

    diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html index ff70fc143..7a6bacd34 100644 --- a/Doc/Manual/Modula3.html +++ b/Doc/Manual/Modula3.html @@ -5,7 +5,7 @@ -

    23 SWIG and Modula-3

    +

    24 SWIG and Modula-3

      @@ -57,7 +57,7 @@ especially typemaps.

      -

      23.1 Overview

      +

      24.1 Overview

      @@ -90,7 +90,7 @@ So the introduction got a bit longer than it should ... ;-)

      -

      23.1.1 Why not scripting ?

      +

      24.1.1 Why not scripting ?

      @@ -126,7 +126,7 @@ are not advantages of the language itself but can be provided by function libraries.

      -

      23.1.2 Why Modula-3 ?

      +

      24.1.2 Why Modula-3 ?

      @@ -166,7 +166,7 @@ it's statically typed, too.

      -

      23.1.3 Why C / C++ ?

      +

      24.1.3 Why C / C++ ?

      @@ -179,7 +179,7 @@ Even more fortunately even non-C libraries may provide C header files. This is where SWIG becomes helpful.

      -

      23.1.4 Why SWIG ?

      +

      24.1.4 Why SWIG ?

      @@ -252,10 +252,10 @@ integrate Modula-3 code into a C / C++ project.

      -

      23.2 Conception

      +

      24.2 Conception

      -

      23.2.1 Interfaces to C libraries

      +

      24.2.1 Interfaces to C libraries

      @@ -404,7 +404,7 @@ and the principal type must be renamed (%typemap).

      -

      23.2.2 Interfaces to C++ libraries

      +

      24.2.2 Interfaces to C++ libraries

      @@ -505,10 +505,10 @@ There is no C++ library I wrote a SWIG interface for, so I'm not sure if this is possible or sensible, yet.

      -

      23.3 Preliminaries

      +

      24.3 Preliminaries

      -

      23.3.1 Compilers

      +

      24.3.1 Compilers

      @@ -522,7 +522,7 @@ For testing examples I use Critical Mass cm3.

      -

      23.3.2 Additional Commandline Options

      +

      24.3.2 Additional Commandline Options

      @@ -599,10 +599,10 @@ Instead generate templates for some basic typemaps. -

      23.4 Modula-3 typemaps

      +

      24.4 Modula-3 typemaps

      -

      23.4.1 Inputs and outputs

      +

      24.4.1 Inputs and outputs

      @@ -818,7 +818,7 @@ consist of the following parts: -

      23.4.2 Subranges, Enumerations, Sets

      +

      24.4.2 Subranges, Enumerations, Sets

      @@ -870,7 +870,7 @@ that I'd like to automate.

      -

      23.4.3 Objects

      +

      24.4.3 Objects

      @@ -883,7 +883,7 @@ is not really useful, yet.

      -

      23.4.4 Imports

      +

      24.4.4 Imports

      @@ -918,7 +918,7 @@ IMPORT M3toC;

    -

    23.4.5 Exceptions

    +

    24.4.5 Exceptions

    @@ -942,7 +942,7 @@ you should declare %typemap("m3wrapinconv:throws") blah * %{OSError.E%}.

    -

    23.4.6 Example

    +

    24.4.6 Example

    @@ -989,10 +989,10 @@ where almost everything is generated by a typemap: -

    23.5 More hints to the generator

    +

    24.5 More hints to the generator

    -

    23.5.1 Features

    +

    24.5.1 Features

    @@ -1029,7 +1029,7 @@ where almost everything is generated by a typemap:
    -

    23.5.2 Pragmas

    +

    24.5.2 Pragmas

    @@ -1052,7 +1052,7 @@ where almost everything is generated by a typemap:
    -

    23.6 Remarks

    +

    24.6 Remarks

      diff --git a/Doc/Manual/Mzscheme.html b/Doc/Manual/Mzscheme.html index 699168322..9413bb010 100644 --- a/Doc/Manual/Mzscheme.html +++ b/Doc/Manual/Mzscheme.html @@ -8,7 +8,7 @@ -

      24 SWIG and MzScheme

      +

      25 SWIG and MzScheme

        @@ -22,7 +22,7 @@

        This section contains information on SWIG's support of MzScheme. -

        24.1 Creating native MzScheme structures

        +

        25.1 Creating native MzScheme structures

        diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 79ede443f..6dbf24c11 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -6,7 +6,7 @@ -

        25 SWIG and Ocaml

        +

        26 SWIG and Ocaml

          @@ -80,7 +80,7 @@ If you're not familiar with the Objective Caml language, you can visit The Ocaml Website.

          -

          25.1 Preliminaries

          +

          26.1 Preliminaries

          @@ -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.

          -

          25.1.1 Running SWIG

          +

          26.1.1 Running SWIG

          @@ -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).

          -

          25.1.2 Compiling the code

          +

          26.1.2 Compiling the code

          @@ -158,7 +158,7 @@ the user more freedom with respect to custom typing.

        -

        25.1.3 The camlp4 module

        +

        26.1.3 The camlp4 module

        @@ -234,7 +234,7 @@ let b = C_string (getenv "PATH") -

        25.1.4 Using your module

        +

        26.1.4 Using your module

        @@ -248,7 +248,7 @@ When linking any ocaml bytecode with your module, use the -custom option is not needed when you build native code.

        -

        25.1.5 Compilation problems and compiling with C++

        +

        26.1.5 Compilation problems and compiling with C++

        @@ -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.

        -

        25.2 The low-level Ocaml/C interface

        +

        26.2 The low-level Ocaml/C interface

        @@ -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.

        -

        25.2.1 The generated module

        +

        26.2.1 The generated module

        @@ -394,7 +394,7 @@ it describes the output SWIG will generate for class definitions. -

        25.2.2 Enums

        +

        26.2.2 Enums

        @@ -457,7 +457,7 @@ val x : Enum_test.c_obj = C_enum `a

      -

      25.2.2.1 Enum typing in Ocaml

      +

      26.2.2.1 Enum typing in Ocaml

      @@ -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.

      -

      25.2.3 Arrays

      +

      26.2.3 Arrays

      -

      25.2.3.1 Simple types of bounded arrays

      +

      26.2.3.1 Simple types of bounded arrays

      @@ -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.

      -

      25.2.3.2 Complex and unbounded arrays

      +

      26.2.3.2 Complex and unbounded arrays

      @@ -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.

      -

      25.2.3.3 Using an object

      +

      26.2.3.3 Using an object

      @@ -521,7 +521,7 @@ Consider writing an object when the ending condition of your array is complex, such as using a required sentinel, etc.

      -

      25.2.3.4 Example typemap for a function taking float * and int

      +

      26.2.3.4 Example typemap for a function taking float * and int

      @@ -572,7 +572,7 @@ void printfloats( float *tab, int len ); -

      25.2.4 C++ Classes

      +

      26.2.4 C++ Classes

      @@ -615,7 +615,7 @@ the underlying pointer, so using create_[x]_from_ptr alters the returned value for the same object.

      -

      25.2.4.1 STL vector and string Example

      +

      26.2.4.1 STL vector and string Example

      @@ -695,7 +695,7 @@ baz # -

      25.2.4.2 C++ Class Example

      +

      26.2.4.2 C++ Class Example

      @@ -725,7 +725,7 @@ public: }; -

      25.2.4.3 Compiling the example

      +

      26.2.4.3 Compiling the example

      @@ -743,7 +743,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
         -L$QTPATH/lib -cclib -lqt
       
      -

      25.2.4.4 Sample Session

      +

      26.2.4.4 Sample Session

      @@ -770,10 +770,10 @@ Assuming you have a working installation of QT, you will see a window
       containing the string "hi" in a button.  
       

      -

      25.2.5 Director Classes

      +

      26.2.5 Director Classes

      -

      25.2.5.1 Director Introduction

      +

      26.2.5.1 Director Introduction

      @@ -800,7 +800,7 @@ class foo { };

      -

      25.2.5.2 Overriding Methods in Ocaml

      +

      26.2.5.2 Overriding Methods in Ocaml

      @@ -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.

      -

      25.2.5.3 Director Usage Example

      +

      26.2.5.3 Director Usage Example

      @@ -887,7 +887,7 @@ in a more effortless style in ocaml, while leaving the "engine" part of the program in C++.

      -

      25.2.5.4 Creating director objects

      +

      26.2.5.4 Creating director objects

      @@ -928,7 +928,7 @@ object from causing a core dump, as long as the object is destroyed properly.

      -

      25.2.5.5 Typemaps for directors, directorin, directorout, directorargout

      +

      26.2.5.5 Typemaps for directors, directorin, directorout, directorargout

      @@ -939,7 +939,7 @@ well as a function return value in the same way you provide function arguments, and to receive arguments the same way you normally receive function returns.

      -

      25.2.5.6 directorin typemap

      +

      26.2.5.6 directorin typemap

      @@ -950,7 +950,7 @@ code receives when you are called. In general, a simple directorin typ can use the same body as a simple out typemap.

      -

      25.2.5.7 directorout typemap

      +

      26.2.5.7 directorout typemap

      @@ -961,7 +961,7 @@ for the same type, except when there are special requirements for object ownership, etc.

      -

      25.2.5.8 directorargout typemap

      +

      26.2.5.8 directorargout typemap

      @@ -978,7 +978,7 @@ In the event that you don't specify all of the necessary values, integral values will read zero, and struct or object returns have undefined results.

      -

      25.2.6 Exceptions

      +

      26.2.6 Exceptions

      diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html index 97e1be17c..7409d78f1 100644 --- a/Doc/Manual/Octave.html +++ b/Doc/Manual/Octave.html @@ -8,7 +8,7 @@ -

      26 SWIG and Octave

      +

      27 SWIG and Octave

        @@ -54,14 +54,14 @@ More information can be found at www.octave.org< Also, there are a dozen or so examples in the Examples/octave directory, and hundreds in the test suite (Examples/test-suite and Examples/test-suite/octave).

        -

        26.1 Preliminaries

        +

        27.1 Preliminaries

        The current SWIG implemention is based on Octave 2.9.12. Support for other versions (in particular the recent 3.0) has not been tested, nor has support for any OS other than Linux.

        -

        26.2 Running SWIG

        +

        27.2 Running SWIG

        @@ -89,7 +89,7 @@ This creates a C/C++ source file example_wrap.cxx. The generated C++ so The swig command line has a number of options you can use, like to redirect it's output. Use swig --help to learn about these.

        -

        26.2.1 Compiling a dynamic module

        +

        27.2.1 Compiling a dynamic module

        @@ -116,7 +116,7 @@ $ mkoctfile example_wrap.cxx example.c

        octave:1> example
        -

        26.2.2 Using your module

        +

        27.2.2 Using your module

        @@ -134,10 +134,10 @@ octave:4> example.cvar.Foo=4; octave:5> example.cvar.Foo ans = 4

      -

      26.3 A tour of basic C/C++ wrapping

      +

      27.3 A tour of basic C/C++ wrapping

      -

      26.3.1 Modules

      +

      27.3.1 Modules

      @@ -179,7 +179,7 @@ One can also rename it by simple assignment, e.g., octave:1> some_vars = cvar; -

      26.3.2 Functions

      +

      27.3.2 Functions

      @@ -196,7 +196,7 @@ int fact(int n);

      octave:1> example.fact(4)
       24 
      -

      26.3.3 Global variables

      +

      27.3.3 Global variables

      @@ -249,7 +249,7 @@ octave:2> example.PI=3.142; octave:3> example.PI ans = 3.1420 -

      26.3.4 Constants and enums

      +

      27.3.4 Constants and enums

      @@ -271,7 +271,7 @@ example.SCONST="Hello World" example.SUNDAY=0 .... -

      26.3.5 Pointers

      +

      27.3.5 Pointers

      @@ -318,7 +318,7 @@ octave:2> f=example.fopen("not there","r"); error: value on right hand side of assignment is undefined error: evaluating assignment expression near line 2, column 2 -

      26.3.6 Structures and C++ classes

      +

      27.3.6 Structures and C++ classes

      @@ -453,7 +453,7 @@ ans = 1 Depending on the ownership setting of a swig_ref, it may call C++ destructors when its reference count goes to zero. See the section on memory management below for details.

      -

      26.3.7 C++ inheritance

      +

      27.3.7 C++ inheritance

      @@ -462,7 +462,7 @@ This information contains the full class hierarchy. When an indexing operation ( the tree is walked to find a match in the current class as well as any of its bases. The lookup is then cached in the swig_ref.

      -

      26.3.8 C++ overloaded functions

      +

      27.3.8 C++ overloaded functions

      @@ -472,7 +472,7 @@ The dispatch function selects which overload to call (if any) based on the passe typecheck typemaps are used to analyze each argument, as well as assign precedence. See the chapter on typemaps for details.

      -

      26.3.9 C++ operators

      +

      27.3.9 C++ operators

      @@ -572,7 +572,7 @@ On the C++ side, the default mappings are as follows: %rename(__brace) *::operator[]; -

      26.3.10 Class extension with %extend

      +

      27.3.10 Class extension with %extend

      @@ -602,7 +602,7 @@ octave:3> printf("%s\n",a); octave:4> a.__str() 4 -

      26.3.11 C++ templates

      +

      27.3.11 C++ templates

      @@ -679,14 +679,14 @@ ans = -

      26.3.12 C++ Smart Pointers

      +

      27.3.12 C++ Smart Pointers

      C++ smart pointers are fully supported as in other modules.

      -

      26.3.13 Directors (calling Octave from C++ code)

      +

      27.3.13 Directors (calling Octave from C++ code)

      @@ -766,14 +766,14 @@ c-side routine called octave-side routine called -

      26.3.14 Threads

      +

      27.3.14 Threads

      The use of threads in wrapped Director code is not supported; i.e., an Octave-side implementation of a C++ class must be called from the Octave interpreter's thread. Anything fancier (apartment/queue model, whatever) is left to the user. Without anything fancier, this amounts to the limitation that Octave must drive the module... like, for example, an optimization package that calls Octave to evaluate an objective function.

      -

      26.3.15 Memory management

      +

      27.3.15 Memory management

      @@ -807,14 +807,14 @@ The %newobject directive may be used to control this behavior for pointers retur In the case where one wishes for the C++ side to own an object that was created in Octave (especially a Director object), one can use the __disown() method to invert this logic. Then letting the Octave reference count go to zero will not destroy the object, but destroying the object will invalidate the Octave-side object if it still exists (and call destructors of other C++ bases in the case of multiple inheritance/subclass()'ing).

      -

      26.3.16 STL support

      +

      27.3.16 STL support

      This is some skeleton support for various STL containers.

      -

      26.3.17 Matrix typemaps

      +

      27.3.17 Matrix typemaps

      diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html index b7cdaf0e5..1dc8e7d2f 100644 --- a/Doc/Manual/Perl5.html +++ b/Doc/Manual/Perl5.html @@ -6,7 +6,7 @@ -

      27 SWIG and Perl5

      +

      28 SWIG and Perl5

        @@ -87,7 +87,7 @@ later. Earlier versions are problematic and SWIG generated extensions may not compile or run correctly.

        -

        27.1 Overview

        +

        28.1 Overview

        @@ -108,7 +108,7 @@ described. Advanced customization features, typemaps, and other options are found near the end of the chapter.

        -

        27.2 Preliminaries

        +

        28.2 Preliminaries

        @@ -133,7 +133,7 @@ To build the module, you will need to compile the file example_wrap.c and link it with the rest of your program.

        -

        27.2.1 Getting the right header files

        +

        28.2.1 Getting the right header files

        @@ -165,7 +165,7 @@ loaded, an easy way to find out is to run Perl itself.

      -

      27.2.2 Compiling a dynamic module

      +

      28.2.2 Compiling a dynamic module

      @@ -198,7 +198,7 @@ the target should be named `example.so', `example.sl', or the appropriate dynamic module name on your system.

      -

      27.2.3 Building a dynamic module with MakeMaker

      +

      28.2.3 Building a dynamic module with MakeMaker

      @@ -232,7 +232,7 @@ the preferred approach to compilation. More information about MakeMaker can be found in "Programming Perl, 2nd ed." by Larry Wall, Tom Christiansen, and Randal Schwartz.

      -

      27.2.4 Building a static version of Perl

      +

      28.2.4 Building a static version of Perl

      @@ -301,7 +301,7 @@ added to it. Depending on your machine, you may need to link with additional libraries such as -lsocket, -lnsl, -ldl, etc.

      -

      27.2.5 Using the module

      +

      28.2.5 Using the module

      @@ -456,7 +456,7 @@ system configuration (this requires root access and you will need to read the man pages).

      -

      27.2.6 Compilation problems and compiling with C++

      +

      28.2.6 Compilation problems and compiling with C++

      @@ -599,7 +599,7 @@ have to find the macro that conflicts and add an #undef into the .i file. Pleas any conflicting macros you find to swig-user mailing list.

      -

      27.2.7 Compiling for 64-bit platforms

      +

      28.2.7 Compiling for 64-bit platforms

      @@ -626,7 +626,7 @@ also introduce problems on platforms that support more than one linking standard (e.g., -o32 and -n32 on Irix).

      -

      27.3 Building Perl Extensions under Windows

      +

      28.3 Building Perl Extensions under Windows

      @@ -637,7 +637,7 @@ section assumes you are using SWIG with Microsoft Visual C++ although the procedure may be similar with other compilers.

      -

      27.3.1 Running SWIG from Developer Studio

      +

      28.3.1 Running SWIG from Developer Studio

      @@ -700,7 +700,7 @@ print "$a\n"; -

      27.3.2 Using other compilers

      +

      28.3.2 Using other compilers

      @@ -708,7 +708,7 @@ SWIG is known to work with Cygwin and may work with other compilers on Windows. For general hints and suggestions refer to the Windows chapter.

      -

      27.4 The low-level interface

      +

      28.4 The low-level interface

      @@ -718,7 +718,7 @@ can be used to control your application. However, it is also used to construct more user-friendly proxy classes as described in the next section.

      -

      27.4.1 Functions

      +

      28.4.1 Functions

      @@ -741,7 +741,7 @@ use example; $a = &example::fact(2); -

      27.4.2 Global variables

      +

      28.4.2 Global variables

      @@ -811,7 +811,7 @@ extern char *path; // Declared later in the input -

      27.4.3 Constants

      +

      28.4.3 Constants

      @@ -838,7 +838,7 @@ $example::FOO = 2; # Error -

      27.4.4 Pointers

      +

      28.4.4 Pointers

      @@ -947,7 +947,7 @@ as XS and xsubpp. Given the advancement of the SWIG typesystem and the SWIG and XS, this is no longer supported.

      -

      27.4.5 Structures

      +

      28.4.5 Structures

      @@ -1081,7 +1081,7 @@ void Bar_f_set(Bar *b, Foo *val) { -

      27.4.6 C++ classes

      +

      28.4.6 C++ classes

      @@ -1146,7 +1146,7 @@ provides direct access to C++ objects. A higher level interface using Perl prox can be built using these low-level accessors. This is described shortly.

      -

      27.4.7 C++ classes and type-checking

      +

      28.4.7 C++ classes and type-checking

      @@ -1182,7 +1182,7 @@ If necessary, the type-checker also adjusts the value of the pointer (as is nece multiple inheritance is used).

      -

      27.4.8 C++ overloaded functions

      +

      28.4.8 C++ overloaded functions

      @@ -1226,7 +1226,7 @@ example::Spam_foo_d($s,3.14); Please refer to the "SWIG Basics" chapter for more information.

      -

      27.4.9 Operators

      +

      28.4.9 Operators

      @@ -1253,7 +1253,7 @@ The following C++ operators are currently supported by the Perl module:

    • operator or
    • -

      27.4.10 Modules and packages

      +

      28.4.10 Modules and packages

      @@ -1348,7 +1348,7 @@ print Foo::fact(4),"\n"; # Call a function in package FooBar --> -

      27.5 Input and output parameters

      +

      28.5 Input and output parameters

      @@ -1567,7 +1567,7 @@ print "$c\n"; Note: The REFERENCE feature is only currently supported for numeric types (integers and floating point).

      -

      27.6 Exception handling

      +

      28.6 Exception handling

      @@ -1732,7 +1732,7 @@ This is still supported, but it is deprecated. The newer %exception di functionality, but it has additional capabilities that make it more powerful.

      -

      27.7 Remapping datatypes with typemaps

      +

      28.7 Remapping datatypes with typemaps

      @@ -1749,7 +1749,7 @@ Typemaps are only used if you want to change some aspect of the primitive C-Perl interface.

      -

      27.7.1 A simple typemap example

      +

      28.7.1 A simple typemap example

      @@ -1853,7 +1853,7 @@ example::count("e","Hello World"); -

      27.7.2 Perl5 typemaps

      +

      28.7.2 Perl5 typemaps

      @@ -1958,7 +1958,7 @@ Return of C++ member data (all languages). Check value of input parameter. -

      27.7.3 Typemap variables

      +

      28.7.3 Typemap variables

      @@ -2029,7 +2029,7 @@ properly assigned. The Perl name of the wrapper function being created. -

      27.7.4 Useful functions

      +

      28.7.4 Useful functions

      @@ -2098,7 +2098,7 @@ int sv_isa(SV *, char *0; -

      27.8 Typemap Examples

      +

      28.8 Typemap Examples

      @@ -2107,7 +2107,7 @@ might look at the files "perl5.swg" and "typemaps.i" in the SWIG library.

      -

      27.8.1 Converting a Perl5 array to a char **

      +

      28.8.1 Converting a Perl5 array to a char **

      @@ -2199,7 +2199,7 @@ print @$b,"\n"; # Print it out -

      27.8.2 Return values

      +

      28.8.2 Return values

      @@ -2228,7 +2228,7 @@ can be done using the EXTEND() macro as in : } -

      27.8.3 Returning values from arguments

      +

      28.8.3 Returning values from arguments

      @@ -2282,7 +2282,7 @@ print "multout(7,13) = @r\n"; ($x,$y) = multout(7,13); -

      27.8.4 Accessing array structure members

      +

      28.8.4 Accessing array structure members

      @@ -2345,7 +2345,7 @@ the "in" typemap in the previous section would be used to convert an to copy the converted array into a C data structure.

      -

      27.8.5 Turning Perl references into C pointers

      +

      28.8.5 Turning Perl references into C pointers

      @@ -2410,7 +2410,7 @@ print "$c\n"; -

      27.8.6 Pointer handling

      +

      28.8.6 Pointer handling

      @@ -2489,7 +2489,7 @@ For example: -

      27.9 Proxy classes

      +

      28.9 Proxy classes

      @@ -2505,7 +2505,7 @@ to the underlying code. This section describes the implementation details of the proxy interface.

      -

      27.9.1 Preliminaries

      +

      28.9.1 Preliminaries

      @@ -2527,7 +2527,7 @@ SWIG creates a collection of high-level Perl wrappers. In your scripts, you wil high level wrappers. The wrappers, in turn, interact with the low-level procedural module.

      -

      27.9.2 Structure and class wrappers

      +

      28.9.2 Structure and class wrappers

      @@ -2653,7 +2653,7 @@ $v->DESTROY(); -

      27.9.3 Object Ownership

      +

      28.9.3 Object Ownership

      @@ -2740,7 +2740,7 @@ counting, garbage collection, or advanced features one might find in sophisticated languages.

      -

      27.9.4 Nested Objects

      +

      28.9.4 Nested Objects

      @@ -2793,7 +2793,7 @@ $p->{f}->{x} = 0.0; %${$p->{v}} = ( x=>0, y=>0, z=>0); -

      27.9.5 Proxy Functions

      +

      28.9.5 Proxy Functions

      @@ -2827,7 +2827,7 @@ This function replaces the original function, but operates in an identical manner.

      -

      27.9.6 Inheritance

      +

      28.9.6 Inheritance

      @@ -2903,7 +2903,7 @@ particular, inheritance of data members is extremely tricky (and I'm not even sure if it really works).

      -

      27.9.7 Modifying the proxy methods

      +

      28.9.7 Modifying the proxy methods

      @@ -2931,7 +2931,7 @@ public: }; -

      27.10 Adding additional Perl code

      +

      28.10 Adding additional Perl code

      diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index 8adbc36b1..e0f1e200a 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -7,14 +7,13 @@ -

      28 SWIG and PHP

      +

      29 SWIG and PHP

      • Generating PHP Extensions
      • Basic PHP interface @@ -70,7 +69,7 @@ your extension into php directly, you will need the complete PHP source tree available.

        -

        28.1 Generating PHP Extensions

        +

        29.1 Generating PHP Extensions

        @@ -117,7 +116,8 @@ and it doesn't play nicely with package system. We don't recommend this approach, or provide explicit support for it.

        -

        28.1.1 Building a loadable extension

        +

        29.1.1 Building a loadable extension

        +

        To build your module as a dynamically loadable extension, use compilation @@ -131,7 +131,8 @@ least work for Linux though): gcc -shared example_wrap.o -o example.so

      -

      28.1.3 Using PHP Extensions

      +

      29.1.2 Using PHP Extensions

      +

      To test the extension from a PHP script, you need to load it first. You @@ -161,7 +162,7 @@ attempts to do the dl() call for you: include("example.php"); -

      28.2 Basic PHP interface

      +

      29.2 Basic PHP interface

      @@ -171,7 +172,7 @@ possible for names of symbols in one extension module to clash with other symbols unless care is taken to %rename them.

      -

      28.2.1 Constants

      +

      29.2.1 Constants

      @@ -296,7 +297,7 @@ both point to the same value, without the case test taking place. ( Apologies, this paragraph needs rewriting to make some sense. )

      -

      28.2.2 Global Variables

      +

      29.2.2 Global Variables

      @@ -345,7 +346,7 @@ undefined. At this time SWIG does not support custom accessor methods.

      -

      28.2.3 Functions

      +

      29.2.3 Functions

      @@ -398,7 +399,7 @@ print $s; # The value of $s was not changed. --> -

      28.2.4 Overloading

      +

      29.2.4 Overloading

      @@ -454,7 +455,7 @@ taking the integer argument.

      --> -

      28.2.5 Pointers and References

      +

      29.2.5 Pointers and References

      @@ -586,7 +587,7 @@ PHP in a number of ways: by using unset on an existing variable, or assigning NULL to a variable.

      -

      28.2.6 Structures and C++ classes

      +

      29.2.6 Structures and C++ classes

      @@ -645,7 +646,7 @@ Would be used in the following way from PHP5: Member variables and methods are accessed using the -> operator.

      -

      28.2.6.1 Using -noproxy

      +

      29.2.6.1 Using -noproxy

      @@ -671,7 +672,7 @@ Complex_im_set($obj,$d); Complex_im_get($obj); -

      28.2.6.2 Constructors and Destructors

      +

      29.2.6.2 Constructors and Destructors

      @@ -712,7 +713,7 @@ the programmer can either reassign the variable or call unset($v)

      -

      28.2.6.3 Static Member Variables

      +

      29.2.6.3 Static Member Variables

      @@ -755,7 +756,7 @@ Ko::threats(10); echo "There has now been " . Ko::threats() . " threats\n"; -

      28.2.6.4 Static Member Functions

      +

      29.2.6.4 Static Member Functions

      @@ -777,7 +778,7 @@ Ko::threats(); -

      28.2.7 PHP Pragmas, Startup and Shutdown code

      +

      29.2.7 PHP Pragmas, Startup and Shutdown code

      diff --git a/Doc/Manual/Pike.html b/Doc/Manual/Pike.html index 3e39d4062..a47d07865 100644 --- a/Doc/Manual/Pike.html +++ b/Doc/Manual/Pike.html @@ -6,7 +6,7 @@ -

      29 SWIG and Pike

      +

      30 SWIG and Pike

        @@ -46,10 +46,10 @@ least, make sure you read the "SWIG Basics" chapter.

        -

        29.1 Preliminaries

        +

        30.1 Preliminaries

        -

        29.1.1 Running SWIG

        +

        30.1.1 Running SWIG

        @@ -94,7 +94,7 @@ can use the -o option:

        $ swig -pike -o pseudonym.c example.i
        -

        29.1.2 Getting the right header files

        +

        30.1.2 Getting the right header files

        @@ -114,7 +114,7 @@ You're looking for files with the names global.h, program.h and so on.

        -

        29.1.3 Using your module

        +

        30.1.3 Using your module

        @@ -129,10 +129,10 @@ Pike v7.4 release 10 running Hilfe v3.5 (Incremental Pike Frontend) (1) Result: 24

      -

      29.2 Basic C/C++ Mapping

      +

      30.2 Basic C/C++ Mapping

      -

      29.2.1 Modules

      +

      30.2.1 Modules

      @@ -143,7 +143,7 @@ concerned), SWIG's %module directive doesn't really have any significance.

      -

      29.2.2 Functions

      +

      30.2.2 Functions

      @@ -168,7 +168,7 @@ exactly as you'd expect it to: (1) Result: 24 -

      29.2.3 Global variables

      +

      30.2.3 Global variables

      @@ -197,7 +197,7 @@ will result in two functions, Foo_get() and Foo_set(): (3) Result: 3.141590 -

      29.2.4 Constants and enumerated types

      +

      30.2.4 Constants and enumerated types

      @@ -205,7 +205,7 @@ Enumerated types in C/C++ declarations are wrapped as Pike constants, not as Pike enums.

      -

      29.2.5 Constructors and Destructors

      +

      30.2.5 Constructors and Destructors

      @@ -213,7 +213,7 @@ Constructors are wrapped as create() methods, and destructors are wrapped as destroy() methods, for Pike classes.

      -

      29.2.6 Static Members

      +

      30.2.6 Static Members

      diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index 62b72fabf..5a8653597 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -6,7 +6,7 @@ -

      30 SWIG and Python

      +

      31 SWIG and Python

        @@ -125,7 +125,7 @@ very least, make sure you read the "SWIG Basics" chapter.

        -

        30.1 Overview

        +

        31.1 Overview

        @@ -152,10 +152,10 @@ described followed by a discussion of low-level implementation details.

        -

        30.2 Preliminaries

        +

        31.2 Preliminaries

        -

        30.2.1 Running SWIG

        +

        31.2.1 Running SWIG

        @@ -253,7 +253,7 @@ The following sections have further practical examples and details on how you might go about compiling and using the generated files.

        -

        30.2.2 Using distutils

        +

        31.2.2 Using distutils

        @@ -345,7 +345,7 @@ This same approach works on all platforms if the appropriate compiler is install can even build extensions to the standard Windows Python using MingGW)

        -

        30.2.3 Hand compiling a dynamic module

        +

        31.2.3 Hand compiling a dynamic module

        @@ -393,7 +393,7 @@ module actually consists of two files; socket.py and

        -

        30.2.4 Static linking

        +

        31.2.4 Static linking

        @@ -472,7 +472,7 @@ If using static linking, you might want to rely on a different approach (perhaps using distutils).

        -

        30.2.5 Using your module

        +

        31.2.5 Using your module

        @@ -629,7 +629,7 @@ system configuration (this requires root access and you will need to read the man pages).

        -

        30.2.6 Compilation of C++ extensions

        +

        31.2.6 Compilation of C++ extensions

        @@ -728,7 +728,7 @@ erratic program behavior. If working with lots of software components, you might want to investigate using a more formal standard such as COM.

        -

        30.2.7 Compiling for 64-bit platforms

        +

        31.2.7 Compiling for 64-bit platforms

        @@ -765,7 +765,7 @@ and -m64 allow you to choose the desired binary format for your python extension.

        -

        30.2.8 Building Python Extensions under Windows

        +

        31.2.8 Building Python Extensions under Windows

        @@ -874,7 +874,7 @@ SWIG Wiki.

        -

        30.3 A tour of basic C/C++ wrapping

        +

        31.3 A tour of basic C/C++ wrapping

        @@ -883,7 +883,7 @@ to your C/C++ code. Functions are wrapped as functions, classes are wrapped as This section briefly covers the essential aspects of this wrapping.

        -

        30.3.1 Modules

        +

        31.3.1 Modules

        @@ -896,7 +896,7 @@ module name, make sure you don't use the same name as a built-in Python command or standard module name.

        -

        30.3.2 Functions

        +

        31.3.2 Functions

        @@ -920,7 +920,7 @@ like you think it does: >>>

      -

      30.3.3 Global variables

      +

      31.3.3 Global variables

      @@ -1058,7 +1058,7 @@ that starts with a leading underscore. SWIG does not create cvar if there are no global variables in a module.

      -

      30.3.4 Constants and enums

      +

      31.3.4 Constants and enums

      @@ -1098,7 +1098,7 @@ other object. Unfortunately, there is no easy way for SWIG to generate code that prevents this. You will just have to be careful.

      -

      30.3.5 Pointers

      +

      31.3.5 Pointers

      @@ -1239,7 +1239,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return None if the conversion can't be performed.

      -

      30.3.6 Structures

      +

      31.3.6 Structures

      @@ -1428,7 +1428,7 @@ everything works just like you would expect. For example: -

      30.3.7 C++ classes

      +

      31.3.7 C++ classes

      @@ -1517,7 +1517,7 @@ they are accessed through cvar like this: -

      30.3.8 C++ inheritance

      +

      31.3.8 C++ inheritance

      @@ -1572,7 +1572,7 @@ then the function spam() accepts Foo * or a pointer to any cla It is safe to use multiple inheritance with SWIG.

      -

      30.3.9 Pointers, references, values, and arrays

      +

      31.3.9 Pointers, references, values, and arrays

      @@ -1633,7 +1633,7 @@ treated as a returning value, and it will follow the same allocation/deallocation process.

      -

      30.3.10 C++ overloaded functions

      +

      31.3.10 C++ overloaded functions

      @@ -1756,7 +1756,7 @@ first declaration takes precedence. Please refer to the "SWIG and C++" chapter for more information about overloading.

      -

      30.3.11 C++ operators

      +

      31.3.11 C++ operators

      @@ -1845,7 +1845,7 @@ Also, be aware that certain operators don't map cleanly to Python. For instance overloaded assignment operators don't map to Python semantics and will be ignored.

      -

      30.3.12 C++ namespaces

      +

      31.3.12 C++ namespaces

      @@ -1912,7 +1912,7 @@ utilizes thousands of small deeply nested namespaces each with identical symbol names, well, then you get what you deserve.

      -

      30.3.13 C++ templates

      +

      31.3.13 C++ templates

      @@ -1966,7 +1966,7 @@ Some more complicated examples will appear later.

      -

      30.3.14 C++ Smart Pointers

      +

      31.3.14 C++ Smart Pointers

      @@ -2051,7 +2051,7 @@ simply use the __deref__() method. For example: -

      30.3.15 C++ Reference Counted Objects (ref/unref)

      +

      31.3.15 C++ Reference Counted Objects (ref/unref)

      @@ -2213,7 +2213,7 @@ python releases the proxy instance.

      -

      30.4 Further details on the Python class interface

      +

      31.4 Further details on the Python class interface

      @@ -2226,7 +2226,7 @@ of low-level details were omitted. This section provides a brief overview of how the proxy classes work.

      -

      30.4.1 Proxy classes

      +

      31.4.1 Proxy classes

      @@ -2315,7 +2315,7 @@ you can attach new Python methods to the class and you can even inherit from it by Python built-in types until Python 2.2).

      -

      30.4.2 Memory management

      +

      31.4.2 Memory management

      @@ -2507,7 +2507,7 @@ It is also possible to deal with situations like this using typemaps--an advanced topic discussed later.

      -

      30.4.3 Python 2.2 and classic classes

      +

      31.4.3 Python 2.2 and classic classes

      @@ -2544,7 +2544,7 @@ class itself. In Python-2.1 and earlier, they have to be accessed as a global function or through an instance (see the earlier section).

      -

      30.5 Cross language polymorphism

      +

      31.5 Cross language polymorphism

      @@ -2578,7 +2578,7 @@ proxy classes, director classes, and C wrapper functions takes care of all the cross-language method routing transparently.

      -

      30.5.1 Enabling directors

      +

      31.5.1 Enabling directors

      @@ -2671,7 +2671,7 @@ class MyFoo(mymodule.Foo): -

      30.5.2 Director classes

      +

      31.5.2 Director classes

      @@ -2753,7 +2753,7 @@ so there is no need for the extra overhead involved with routing the calls through Python.

      -

      30.5.3 Ownership and object destruction

      +

      31.5.3 Ownership and object destruction

      @@ -2820,7 +2820,7 @@ deleting all the Foo pointers it contains at some point. Note that no hard references to the Foo objects remain in Python.

      -

      30.5.4 Exception unrolling

      +

      31.5.4 Exception unrolling

      @@ -2879,7 +2879,7 @@ Swig::DirectorMethodException is thrown, Python will register the exception as soon as the C wrapper function returns.

      -

      30.5.5 Overhead and code bloat

      +

      31.5.5 Overhead and code bloat

      @@ -2913,7 +2913,7 @@ directive) for only those methods that are likely to be extended in Python.

      -

      30.5.6 Typemaps

      +

      31.5.6 Typemaps

      @@ -2927,7 +2927,7 @@ need to be supported.

      -

      30.5.7 Miscellaneous

      +

      31.5.7 Miscellaneous

      @@ -2974,7 +2974,7 @@ methods that return const references.

      -

      30.6 Common customization features

      +

      31.6 Common customization features

      @@ -2987,7 +2987,7 @@ This section describes some common SWIG features that are used to improve your the interface to an extension module.

      -

      30.6.1 C/C++ helper functions

      +

      31.6.1 C/C++ helper functions

      @@ -3068,7 +3068,7 @@ hard to implement. It is possible to clean this up using Python code, typemaps, customization features as covered in later sections.

      -

      30.6.2 Adding additional Python code

      +

      31.6.2 Adding additional Python code

      @@ -3217,7 +3217,7 @@ public: -

      30.6.3 Class extension with %extend

      +

      31.6.3 Class extension with %extend

      @@ -3306,7 +3306,7 @@ Vector(12,14,16) in any way---the extensions only show up in the Python interface.

      -

      30.6.4 Exception handling with %exception

      +

      31.6.4 Exception handling with %exception

      @@ -3432,7 +3432,7 @@ The language-independent exception.i library file can also be used to raise exceptions. See the SWIG Library chapter.

      -

      30.7 Tips and techniques

      +

      31.7 Tips and techniques

      @@ -3442,7 +3442,7 @@ strings, binary data, and arrays. This chapter discusses the common techniques solving these problems.

      -

      30.7.1 Input and output parameters

      +

      31.7.1 Input and output parameters

      @@ -3655,7 +3655,7 @@ void foo(Bar *OUTPUT); may not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar.

      -

      30.7.2 Simple pointers

      +

      31.7.2 Simple pointers

      @@ -3724,7 +3724,7 @@ If you replace %pointer_functions() by %pointer_class(type,name)SWIG Library chapter for further details.

      -

      30.7.3 Unbounded C Arrays

      +

      31.7.3 Unbounded C Arrays

      @@ -3786,7 +3786,7 @@ well suited for applications in which you need to create buffers, package binary data, etc.

      -

      30.7.4 String handling

      +

      31.7.4 String handling

      @@ -3855,16 +3855,16 @@ If you need to return binary data, you might use the also be used to extra binary data from arbitrary pointers.

      -

      30.7.5 Arrays

      +

      31.7.5 Arrays

      -

      30.7.6 String arrays

      +

      31.7.6 String arrays

      -

      30.7.7 STL wrappers

      +

      31.7.7 STL wrappers

      -

      30.8 Typemaps

      +

      31.8 Typemaps

      @@ -3881,7 +3881,7 @@ Typemaps are only used if you want to change some aspect of the primitive C-Python interface or if you want to elevate your guru status.

      -

      30.8.1 What is a typemap?

      +

      31.8.1 What is a typemap?

      @@ -3997,7 +3997,7 @@ parameter is omitted): -

      30.8.2 Python typemaps

      +

      31.8.2 Python typemaps

      @@ -4038,7 +4038,7 @@ a look at the SWIG library version 1.3.20 or so.

      -

      30.8.3 Typemap variables

      +

      31.8.3 Typemap variables

      @@ -4109,7 +4109,7 @@ properly assigned. The Python name of the wrapper function being created. -

      30.8.4 Useful Python Functions

      +

      31.8.4 Useful Python Functions

      @@ -4237,7 +4237,7 @@ write me -

      30.9 Typemap Examples

      +

      31.9 Typemap Examples

      @@ -4246,7 +4246,7 @@ might look at the files "python.swg" and "typemaps.i" in the SWIG library.

      -

      30.9.1 Converting Python list to a char **

      +

      31.9.1 Converting Python list to a char **

      @@ -4326,7 +4326,7 @@ memory allocation is used to allocate memory for the array, the the C function.

      -

      30.9.2 Expanding a Python object into multiple arguments

      +

      31.9.2 Expanding a Python object into multiple arguments

      @@ -4405,7 +4405,7 @@ to supply the argument count. This is automatically set by the typemap code. F -

      30.9.3 Using typemaps to return arguments

      +

      31.9.3 Using typemaps to return arguments

      @@ -4494,7 +4494,7 @@ function can now be used as follows: >>> -

      30.9.4 Mapping Python tuples into small arrays

      +

      31.9.4 Mapping Python tuples into small arrays

      @@ -4543,7 +4543,7 @@ array, such an approach would not be recommended for huge arrays, but for small structures, this approach works fine.

      -

      30.9.5 Mapping sequences to C arrays

      +

      31.9.5 Mapping sequences to C arrays

      @@ -4632,7 +4632,7 @@ static int convert_darray(PyObject *input, double *ptr, int size) { -

      30.9.6 Pointer handling

      +

      31.9.6 Pointer handling

      @@ -4729,7 +4729,7 @@ class object (if applicable). -

      30.10 Docstring Features

      +

      31.10 Docstring Features

      @@ -4757,7 +4757,7 @@ of your users much simpler.

      -

      30.10.1 Module docstring

      +

      31.10.1 Module docstring

      @@ -4791,7 +4791,7 @@ layout of controls on a panel, etc. to be loaded from an XML file." -

      30.10.2 %feature("autodoc")

      +

      31.10.2 %feature("autodoc")

      @@ -4818,7 +4818,7 @@ names, default values if any, and return type if any. There are also three options for autodoc controlled by the value given to the feature, described below. -

      30.10.2.1 %feature("autodoc", "0")

      +

      31.10.2.1 %feature("autodoc", "0")

      @@ -4847,7 +4847,7 @@ def function_name(*args, **kwargs): -

      30.10.2.2 %feature("autodoc", "1")

      +

      31.10.2.2 %feature("autodoc", "1")

      @@ -4872,7 +4872,7 @@ def function_name(*args, **kwargs): -

      30.10.2.3 %feature("autodoc", "docstring")

      +

      31.10.2.3 %feature("autodoc", "docstring")

      @@ -4891,7 +4891,7 @@ void GetPosition(int* OUTPUT, int* OUTPUT); -

      30.10.3 %feature("docstring")

      +

      31.10.3 %feature("docstring")

      @@ -4923,7 +4923,7 @@ with more than one line. -

      30.11 Python Packages

      +

      31.11 Python Packages

      diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html index 3b37d53a0..0ed43fc52 100644 --- a/Doc/Manual/R.html +++ b/Doc/Manual/R.html @@ -6,7 +6,7 @@ -

      33 SWIG and R

      +

      34 SWIG and R

        @@ -33,7 +33,7 @@ compile and run an R interface to QuantLib running on Mandriva Linux with gcc. The R bindings also work on Microsoft Windows using Visual C++.

        -

        33.1 Bugs

        +

        34.1 Bugs

        @@ -45,7 +45,7 @@ Currently the following features are not implemented or broken:

      • C Array wrappings
      -

      33.2 Using R and SWIG

      +

      34.2 Using R and SWIG

      @@ -99,7 +99,7 @@ Without it, inheritance of wrapped objects may fail. These two files can be loaded in any order

      -

      33.3 Precompiling large R files

      +

      34.3 Precompiling large R files

      In cases where the R file is large, one make save a lot of loading @@ -117,7 +117,7 @@ will save a large amount of loading time. -

      33.4 General policy

      +

      34.4 General policy

      @@ -126,7 +126,7 @@ wrapping over the underlying functions and rely on the R type system to provide R syntax.

      -

      33.5 Language conventions

      +

      34.5 Language conventions

      @@ -135,7 +135,7 @@ and [ are overloaded to allow for R syntax (one based indices and slices)

      -

      33.6 C++ classes

      +

      34.6 C++ classes

      @@ -147,7 +147,7 @@ keep track of the pointer object which removes the necessity for a lot of the proxy class baggage you see in other languages.

      -

      33.7 Enumerations

      +

      34.7 Enumerations

      diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html index 9cd83d494..7360f732d 100644 --- a/Doc/Manual/Ruby.html +++ b/Doc/Manual/Ruby.html @@ -26,7 +26,7 @@ -

      31 SWIG and Ruby

      +

      32 SWIG and Ruby

        @@ -167,7 +167,7 @@ -

        31.1 Preliminaries

        +

        32.1 Preliminaries

        SWIG 1.3 is known to work with Ruby versions 1.6 and later. @@ -190,7 +190,7 @@ of Ruby.

        -

        31.1.1 Running SWIG

        +

        32.1.1 Running SWIG

        To build a Ruby module, run SWIG using the -ruby @@ -244,7 +244,7 @@ to compile this file and link it with the rest of your program.

        -

        31.1.2 Getting the right header files

        +

        32.1.2 Getting the right header files

        In order to compile the wrapper code, the compiler needs the ruby.h @@ -288,7 +288,7 @@ installed, you can run Ruby to find out. For example:

        -

        31.1.3 Compiling a dynamic module

        +

        32.1.3 Compiling a dynamic module

        Ruby extension modules are typically compiled into shared @@ -443,7 +443,7 @@ manual pages for your compiler and linker to determine the correct set of options. You might also check the SWIG Wiki for additional information.

        -

        31.1.4 Using your module

        +

        32.1.4 Using your module

        Ruby module names must be capitalized, @@ -498,7 +498,7 @@ begins with:

        -

        31.1.5 Static linking

        +

        32.1.5 Static linking

        An alternative approach to dynamic linking is to rebuild the @@ -519,7 +519,7 @@ finally rebuilding Ruby.

        -

        31.1.6 Compilation of C++ extensions

        +

        32.1.6 Compilation of C++ extensions

        On most machines, C++ extension modules should be linked @@ -571,7 +571,7 @@ extension, e.g.

        -

        31.2 Building Ruby Extensions under Windows 95/NT

        +

        32.2 Building Ruby Extensions under Windows 95/NT

        Building a SWIG extension to Ruby under Windows 95/NT is @@ -610,7 +610,7 @@ files.

        -

        31.2.1 Running SWIG from Developer Studio

        +

        32.2.1 Running SWIG from Developer Studio

        If you are developing your application within Microsoft @@ -752,7 +752,7 @@ directory, then run the Ruby script from the DOS/Command prompt:

        -

        31.3 The Ruby-to-C/C++ Mapping

        +

        32.3 The Ruby-to-C/C++ Mapping

        This section describes the basics of how SWIG maps C or C++ @@ -762,7 +762,7 @@ declarations in your SWIG interface files to Ruby constructs.

        -

        31.3.1 Modules

        +

        32.3.1 Modules

        The SWIG %module directive specifies @@ -931,7 +931,7 @@ Ruby's built-in names.

        -

        31.3.2 Functions

        +

        32.3.2 Functions

        Global functions are wrapped as Ruby module methods. For @@ -994,7 +994,7 @@ module that can be used like so:

        -

        31.3.3 Variable Linking

        +

        32.3.3 Variable Linking

        C/C++ global variables are wrapped as a pair of singleton @@ -1094,7 +1094,7 @@ effect until it is explicitly disabled using %mutable. -

        31.3.4 Constants

        +

        32.3.4 Constants

        C/C++ constants are wrapped as module constants initialized @@ -1138,7 +1138,7 @@ constant values, e.g.

        -

        31.3.5 Pointers

        +

        32.3.5 Pointers

        "Opaque" pointers to arbitrary C/C++ types (i.e. types that @@ -1190,7 +1190,7 @@ the Ruby nil object.

        -

        31.3.6 Structures

        +

        32.3.6 Structures

        C/C++ structs are wrapped as Ruby classes, with accessor @@ -1365,7 +1365,7 @@ pointers. For example,

        -

        31.3.7 C++ classes

        +

        32.3.7 C++ classes

        Like structs, C++ classes are wrapped by creating a new Ruby @@ -1451,7 +1451,7 @@ class. -

        31.3.8 C++ Inheritance

        +

        32.3.8 C++ Inheritance

        The SWIG type-checker is fully aware of C++ inheritance. @@ -1682,7 +1682,7 @@ Typing").

        -

        31.3.9 C++ Overloaded Functions

        +

        32.3.9 C++ Overloaded Functions

        C++ overloaded functions, methods, and constructors are @@ -1878,7 +1878,7 @@ and C++" chapter for more information about overloading.

        -

        31.3.10 C++ Operators

        +

        32.3.10 C++ Operators

        For the most part, overloaded operators are handled @@ -1959,7 +1959,7 @@ on operator overloading.

        -

        31.3.11 C++ namespaces

        +

        32.3.11 C++ namespaces

        SWIG is aware of C++ namespaces, but namespace names do not @@ -2035,7 +2035,7 @@ identical symbol names, well, then you get what you deserve.

        -

        31.3.12 C++ templates

        +

        32.3.12 C++ templates

        C++ templates don't present a huge problem for SWIG. However, @@ -2079,7 +2079,7 @@ directive. For example:

        -

        31.3.13 C++ Standard Template Library (STL)

        +

        32.3.13 C++ Standard Template Library (STL)

        On a related note, the standard SWIG library contains a @@ -2332,7 +2332,7 @@ chapter.

        -

        31.3.14 C++ STL Functors

        +

        32.3.14 C++ STL Functors

        Some containers in the STL allow you to modify their default @@ -2532,7 +2532,7 @@ b
        -

        31.3.15 C++ STL Iterators

        +

        32.3.15 C++ STL Iterators

        The STL is well known for the use of iterators.  There @@ -2743,7 +2743,7 @@ i
        -

        31.3.16 C++ Smart Pointers

        +

        32.3.16 C++ Smart Pointers

        In certain C++ programs, it is common to use classes that @@ -2868,7 +2868,7 @@ method. For example:

        -

        31.3.17 Cross-Language Polymorphism

        +

        32.3.17 Cross-Language Polymorphism

        SWIG's Ruby module supports cross-language polymorphism @@ -2881,7 +2881,7 @@ using this feature with Ruby.

        -

        31.3.17.1 Exception Unrolling

        +

        32.3.17.1 Exception Unrolling

        Whenever a C++ director class routes one of its virtual @@ -2919,7 +2919,7 @@ caught here and a C++ exception is raised in its place.

        -

        31.4 Naming

        +

        32.4 Naming

        Ruby has several common naming conventions. Constants are @@ -3015,7 +3015,7 @@ planned to become the default option in future releases.

        -

        31.4.1 Defining Aliases

        +

        32.4.1 Defining Aliases

        It's a fairly common practice in the Ruby built-ins and @@ -3107,7 +3107,7 @@ Features") for more details).

        -

        31.4.2 Predicate Methods

        +

        32.4.2 Predicate Methods

        Ruby methods that return a boolean value and end in a @@ -3196,7 +3196,7 @@ Features") for more details).

        -

        31.4.3 Bang Methods

        +

        32.4.3 Bang Methods

        Ruby methods that modify an object in-place and end in an @@ -3260,7 +3260,7 @@ Features") for more details).

        -

        31.4.4 Getters and Setters

        +

        32.4.4 Getters and Setters

        Often times a C++ library will expose properties through @@ -3330,7 +3330,7 @@ methods to be exposed in Ruby as value and value=. -

        31.5 Input and output parameters

        +

        32.5 Input and output parameters

        A common problem in some C programs is handling parameters @@ -3581,10 +3581,10 @@ of %apply

        -

        31.6 Exception handling

        +

        32.6 Exception handling

        -

        31.6.1 Using the %exception directive

        +

        32.6.1 Using the %exception directive

        The SWIG %exception directive can be @@ -3679,7 +3679,7 @@ Features for more examples.

        -

        31.6.2 Handling Ruby Blocks

        +

        32.6.2 Handling Ruby Blocks

        One of the highlights of Ruby and most of its standard library @@ -3860,7 +3860,7 @@ RUBY_YIELD_SELF );

        For more information on typemaps, see Typemaps.

        -

        31.6.3 Raising exceptions

        +

        32.6.3 Raising exceptions

        There are three ways to raise exceptions from C++ code to @@ -4621,7 +4621,7 @@ the built-in Ruby exception types.

        -

        31.6.4 Exception classes

        +

        32.6.4 Exception classes

        Starting with SWIG 1.3.28, the Ruby module supports the %exceptionclass @@ -4679,7 +4679,7 @@ providing for a more natural integration between C++ code and Ruby code.

        -

        31.7 Typemaps

        +

        32.7 Typemaps

        This section describes how you can modify SWIG's default @@ -4702,7 +4702,7 @@ of the primitive C-Ruby interface.

        -

        31.7.1 What is a typemap?

        +

        32.7.1 What is a typemap?

        A typemap is nothing more than a code generation rule that is @@ -4964,7 +4964,7 @@ to be used as follows (notice how the length parameter is omitted):

        -

        31.7.2 Typemap scope

        +

        32.7.2 Typemap scope

        Once defined, a typemap remains in effect for all of the @@ -5012,7 +5012,7 @@ where the class itself is defined. For example:

        -

        31.7.3 Copying a typemap

        +

        32.7.3 Copying a typemap

        A typemap is copied by using assignment. For example:

        @@ -5114,7 +5114,7 @@ rules as for -

        31.7.4 Deleting a typemap

        +

        32.7.4 Deleting a typemap

        A typemap can be deleted by simply defining no code. For @@ -5166,7 +5166,7 @@ typemaps immediately after the clear operation.

        -

        31.7.5 Placement of typemaps

        +

        32.7.5 Placement of typemaps

        Typemap declarations can be declared in the global scope, @@ -5250,7 +5250,7 @@ string -

        31.7.6 Ruby typemaps

        +

        32.7.6 Ruby typemaps

        The following list details all of the typemap methods that @@ -5260,7 +5260,7 @@ can be used by the Ruby module:

        -

        31.7.6.1  "in" typemap

        +

        32.7.6.1  "in" typemap

        Converts Ruby objects to input @@ -5503,7 +5503,7 @@ arguments to be specified. For example:

        -

        31.7.6.2 "typecheck" typemap

        +

        32.7.6.2 "typecheck" typemap

        The "typecheck" typemap is used to support overloaded @@ -5544,7 +5544,7 @@ on "Typemaps and Overloading."

        -

        31.7.6.3  "out" typemap

        +

        32.7.6.3  "out" typemap

        Converts return value of a C function @@ -5776,7 +5776,7 @@ version of the C datatype matched by the typemap. -

        31.7.6.4 "arginit" typemap

        +

        32.7.6.4 "arginit" typemap

        The "arginit" typemap is used to set the initial value of a @@ -5801,7 +5801,7 @@ applications. For example:

        -

        31.7.6.5 "default" typemap

        +

        32.7.6.5 "default" typemap

        The "default" typemap is used to turn an argument into a @@ -5843,7 +5843,7 @@ default argument wrapping.

        -

        31.7.6.6 "check" typemap

        +

        32.7.6.6 "check" typemap

        The "check" typemap is used to supply value checking code @@ -5867,7 +5867,7 @@ arguments have been converted. For example:

        -

        31.7.6.7 "argout" typemap

        +

        32.7.6.7 "argout" typemap

        The "argout" typemap is used to return values from arguments. @@ -6025,7 +6025,7 @@ some function like SWIG_Ruby_AppendOutput.

        -

        31.7.6.8 "freearg" typemap

        +

        32.7.6.8 "freearg" typemap

        The "freearg" typemap is used to cleanup argument data. It is @@ -6061,7 +6061,7 @@ abort prematurely.

        -

        31.7.6.9 "newfree" typemap

        +

        32.7.6.9 "newfree" typemap

        The "newfree" typemap is used in conjunction with the %newobject @@ -6092,7 +6092,7 @@ ownership and %newobject for further details.

        -

        31.7.6.10 "memberin" typemap

        +

        32.7.6.10 "memberin" typemap

        The "memberin" typemap is used to copy data from an @@ -6125,7 +6125,7 @@ other objects.

        -

        31.7.6.11 "varin" typemap

        +

        32.7.6.11 "varin" typemap

        The "varin" typemap is used to convert objects in the target @@ -6136,7 +6136,7 @@ This is implementation specific.

        -

        31.7.6.12 "varout" typemap

        +

        32.7.6.12 "varout" typemap

        The "varout" typemap is used to convert a C/C++ object to an @@ -6147,7 +6147,7 @@ This is implementation specific.

        -

        31.7.6.13 "throws" typemap

        +

        32.7.6.13 "throws" typemap

        The "throws" typemap is only used when SWIG parses a C++ @@ -6206,7 +6206,7 @@ handling with %exception section.

        -

        31.7.6.14 directorin typemap

        +

        32.7.6.14 directorin typemap

        Converts C++ objects in director @@ -6460,7 +6460,7 @@ referring to the class itself. -

        31.7.6.15 directorout typemap

        +

        32.7.6.15 directorout typemap

        Converts Ruby objects in director @@ -6720,7 +6720,7 @@ exception.
        -

        31.7.6.16 directorargout typemap

        +

        32.7.6.16 directorargout typemap

        Output argument processing in director @@ -6960,7 +6960,7 @@ referring to the instance of the class itself -

        31.7.6.17 ret typemap

        +

        32.7.6.17 ret typemap

        Cleanup of function return values @@ -6970,7 +6970,7 @@ referring to the instance of the class itself -

        31.7.6.18 globalin typemap

        +

        32.7.6.18 globalin typemap

        Setting of C global variables @@ -6980,7 +6980,7 @@ referring to the instance of the class itself -

        31.7.7 Typemap variables

        +

        32.7.7 Typemap variables

        @@ -7090,7 +7090,7 @@ being created.

      -

      31.7.8 Useful Functions

      +

      32.7.8 Useful Functions

      When you write a typemap, you usually have to work directly @@ -7114,7 +7114,7 @@ across multiple languages.

      -

      31.7.8.1 C Datatypes to Ruby Objects

      +

      32.7.8.1 C Datatypes to Ruby Objects

      @@ -7170,7 +7170,7 @@ SWIG_From_float(float) -

      31.7.8.2 Ruby Objects to C Datatypes

      +

      32.7.8.2 Ruby Objects to C Datatypes

      Here, while the Ruby versions return the value directly, the SWIG @@ -7259,7 +7259,7 @@ Ruby_Format_TypeError( "$1_name", "$1_type","$symname", $argnum, $input -

      31.7.8.3 Macros for VALUE

      +

      32.7.8.3 Macros for VALUE

      RSTRING_LEN(str)

      @@ -7322,7 +7322,7 @@ Ruby_Format_TypeError( "$1_name", "$1_type","$symname", $argnum, $input -

      31.7.8.4 Exceptions

      +

      32.7.8.4 Exceptions

      void rb_raise(VALUE exception, const char *fmt, @@ -7489,7 +7489,7 @@ arguments are interpreted as with printf().

      -

      31.7.8.5 Iterators

      +

      32.7.8.5 Iterators

      void rb_iter_break()

      @@ -7591,7 +7591,7 @@ VALUE), VALUE value)

      -

      31.7.9 Typemap Examples

      +

      32.7.9 Typemap Examples

      This section includes a few examples of typemaps. For more @@ -7602,7 +7602,7 @@ directory.

      -

      31.7.10 Converting a Ruby array to a char **

      +

      32.7.10 Converting a Ruby array to a char **

      A common problem in many C programs is the processing of @@ -7657,7 +7657,7 @@ after the execution of the C function.

      -

      31.7.11 Collecting arguments in a hash

      +

      32.7.11 Collecting arguments in a hash

      Ruby's solution to the "keyword arguments" capability of some @@ -7936,7 +7936,7 @@ directory of the SWIG distribution.

      -

      31.7.12 Pointer handling

      +

      32.7.12 Pointer handling

      Occasionally, it might be necessary to convert pointer values @@ -8035,7 +8035,7 @@ For example:

      -

      31.7.12.1 Ruby Datatype Wrapping

      +

      32.7.12.1 Ruby Datatype Wrapping

      VALUE Data_Wrap_Struct(VALUE class, void @@ -8086,7 +8086,7 @@ and assigns that pointer to ptr.

      -

      31.7.13 Example: STL Vector to Ruby Array

      +

      32.7.13 Example: STL Vector to Ruby Array

      Another use for macros and type maps is to create a Ruby array @@ -8195,7 +8195,7 @@ the C++ Standard Template Library.
      -

      31.8 Docstring Features

      +

      32.8 Docstring Features

      @@ -8256,7 +8256,7 @@ generate ri documentation from a c wrap file, you could do:

      -

      31.8.1 Module docstring

      +

      32.8.1 Module docstring

      @@ -8307,7 +8307,7 @@ macro. For example: -

      31.8.2 %feature("autodoc")

      +

      32.8.2 %feature("autodoc")

      Since SWIG does know everything about the function it wraps, @@ -8336,7 +8336,7 @@ feature, described below. -

      31.8.2.1 %feature("autodoc", "0")

      +

      32.8.2.1 %feature("autodoc", "0")

      @@ -8384,7 +8384,7 @@ Then Ruby code like this will be generated: -

      31.8.2.2 %feature("autodoc", "1")

      +

      32.8.2.2 %feature("autodoc", "1")

      @@ -8416,7 +8416,7 @@ this: -

      31.8.2.3 %feature("autodoc", "2")

      +

      32.8.2.3 %feature("autodoc", "2")

      @@ -8432,7 +8432,7 @@ this: -

      31.8.2.4 %feature("autodoc", "3")

      +

      32.8.2.4 %feature("autodoc", "3")

      @@ -8460,7 +8460,7 @@ this: -

      31.8.2.5 %feature("autodoc", "docstring")

      +

      32.8.2.5 %feature("autodoc", "docstring")

      @@ -8488,7 +8488,7 @@ generated string. For example: -

      31.8.3 %feature("docstring")

      +

      32.8.3 %feature("docstring")

      @@ -8503,10 +8503,10 @@ docstring and they are output together.

      -

      31.9 Advanced Topics

      +

      32.9 Advanced Topics

      -

      31.9.1 Operator overloading

      +

      32.9.1 Operator overloading

      SWIG allows operator overloading with, by using the %extend @@ -9523,7 +9523,7 @@ parses the expression a != b as !(a == b). -

      31.9.2 Creating Multi-Module Packages

      +

      32.9.2 Creating Multi-Module Packages

      The chapter on Working @@ -9704,7 +9704,7 @@ initialized:

      -

      31.9.3 Specifying Mixin Modules

      +

      32.9.3 Specifying Mixin Modules

      The Ruby language doesn't support multiple inheritance, but @@ -9802,7 +9802,7 @@ Features") for more details).

      -

      31.10 Memory Management

      +

      32.10 Memory Management

      One of the most common issues in generating SWIG bindings for @@ -9849,7 +9849,7 @@ understanding of how the underlying library manages memory.

      -

      31.10.1 Mark and Sweep Garbage Collector

      +

      32.10.1 Mark and Sweep Garbage Collector

      Ruby uses a mark and sweep garbage collector. When the garbage @@ -9897,7 +9897,7 @@ this memory.

      -

      31.10.2 Object Ownership

      +

      32.10.2 Object Ownership

      As described above, memory management depends on clearly @@ -10124,7 +10124,7 @@ classes is:

      -

      31.10.3 Object Tracking

      +

      32.10.3 Object Tracking

      The remaining parts of this section will use the class library @@ -10338,7 +10338,7 @@ methods.

      -

      31.10.4 Mark Functions

      +

      32.10.4 Mark Functions

      With a bit more testing, we see that our class library still @@ -10456,7 +10456,7 @@ test suite.

      -

      31.10.5 Free Functions

      +

      32.10.5 Free Functions

      By default, SWIG creates a "free" function that is called when @@ -10611,7 +10611,7 @@ been freed, and thus raises a runtime exception.

      -

      31.10.6 Embedded Ruby and the C++ Stack

      +

      32.10.6 Embedded Ruby and the C++ Stack

      As has been said, the Ruby GC runs and marks objects before diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html index e837a5b17..b36395cab 100644 --- a/Doc/Manual/Tcl.html +++ b/Doc/Manual/Tcl.html @@ -6,7 +6,7 @@ -

      32 SWIG and Tcl

      +

      33 SWIG and Tcl

        @@ -82,7 +82,7 @@ Tcl 8.0 or a later release. Earlier releases of SWIG supported Tcl 7.x, but this is no longer supported.

        -

        32.1 Preliminaries

        +

        33.1 Preliminaries

        @@ -108,7 +108,7 @@ build a Tcl extension module. To finish building the module, you need to compile this file and link it with the rest of your program.

        -

        32.1.1 Getting the right header files

        +

        33.1.1 Getting the right header files

        @@ -126,7 +126,7 @@ this is the case, you should probably make a symbolic link so that tcl.h -

        32.1.2 Compiling a dynamic module

        +

        33.1.2 Compiling a dynamic module

        @@ -161,7 +161,7 @@ The name of the module is specified using the %module directive or the -module command line option.

        -

        32.1.3 Static linking

        +

        33.1.3 Static linking

        @@ -227,7 +227,7 @@ minimal in most situations (and quite frankly not worth the extra hassle in the opinion of this author).

        -

        32.1.4 Using your module

        +

        33.1.4 Using your module

        @@ -355,7 +355,7 @@ to the default system configuration (this requires root access and you will need the man pages).

        -

        32.1.5 Compilation of C++ extensions

        +

        33.1.5 Compilation of C++ extensions

        @@ -438,7 +438,7 @@ erratic program behavior. If working with lots of software components, you might want to investigate using a more formal standard such as COM.

        -

        32.1.6 Compiling for 64-bit platforms

        +

        33.1.6 Compiling for 64-bit platforms

        @@ -465,7 +465,7 @@ also introduce problems on platforms that support more than one linking standard (e.g., -o32 and -n32 on Irix).

        -

        32.1.7 Setting a package prefix

        +

        33.1.7 Setting a package prefix

        @@ -484,7 +484,7 @@ option will append the prefix to the name when creating a command and call it "Foo_bar".

        -

        32.1.8 Using namespaces

        +

        33.1.8 Using namespaces

        @@ -506,7 +506,7 @@ When the -namespace option is used, objects in the module are always accessed with the namespace name such as Foo::bar.

        -

        32.2 Building Tcl/Tk Extensions under Windows 95/NT

        +

        33.2 Building Tcl/Tk Extensions under Windows 95/NT

        @@ -517,7 +517,7 @@ covers the process of using SWIG with Microsoft Visual C++. although the procedure may be similar with other compilers.

        -

        32.2.1 Running SWIG from Developer Studio

        +

        33.2.1 Running SWIG from Developer Studio

        @@ -575,7 +575,7 @@ MSDOS > tclsh80 %

      -

      32.2.2 Using NMAKE

      +

      33.2.2 Using NMAKE

      @@ -638,7 +638,7 @@ to get you started. With a little practice, you'll be making lots of Tcl extensions.

      -

      32.3 A tour of basic C/C++ wrapping

      +

      33.3 A tour of basic C/C++ wrapping

      @@ -649,7 +649,7 @@ classes. This section briefly covers the essential aspects of this wrapping.

      -

      32.3.1 Modules

      +

      33.3.1 Modules

      @@ -683,7 +683,7 @@ To fix this, supply an extra argument to load like this: -

      32.3.2 Functions

      +

      33.3.2 Functions

      @@ -708,7 +708,7 @@ like you think it does: % -

      32.3.3 Global variables

      +

      33.3.3 Global variables

      @@ -788,7 +788,7 @@ extern char *path; // Read-only (due to %immutable) -

      32.3.4 Constants and enums

      +

      33.3.4 Constants and enums

      @@ -872,7 +872,7 @@ When an identifier name is given, it is used to perform an implicit hash-table l conversion. This allows the global statement to be omitted.

      -

      32.3.5 Pointers

      +

      33.3.5 Pointers

      @@ -968,7 +968,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return None if the conversion can't be performed.

      -

      32.3.6 Structures

      +

      33.3.6 Structures

      @@ -1250,7 +1250,7 @@ Note: Tcl only destroys the underlying object if it has ownership. See the memory management section that appears shortly.

      -

      32.3.7 C++ classes

      +

      33.3.7 C++ classes

      @@ -1317,7 +1317,7 @@ In Tcl, the static member is accessed as follows: -

      32.3.8 C++ inheritance

      +

      33.3.8 C++ inheritance

      @@ -1366,7 +1366,7 @@ For instance: It is safe to use multiple inheritance with SWIG.

      -

      32.3.9 Pointers, references, values, and arrays

      +

      33.3.9 Pointers, references, values, and arrays

      @@ -1420,7 +1420,7 @@ to hold the result and a pointer is returned (Tcl will release this memory when the return value is garbage collected).

      -

      32.3.10 C++ overloaded functions

      +

      33.3.10 C++ overloaded functions

      @@ -1543,7 +1543,7 @@ first declaration takes precedence. Please refer to the "SWIG and C++" chapter for more information about overloading.

      -

      32.3.11 C++ operators

      +

      33.3.11 C++ operators

      @@ -1645,7 +1645,7 @@ There are ways to make this operator appear as part of the class using the % Keep reading.

      -

      32.3.12 C++ namespaces

      +

      33.3.12 C++ namespaces

      @@ -1709,7 +1709,7 @@ utilizes thousands of small deeply nested namespaces each with identical symbol names, well, then you get what you deserve.

      -

      32.3.13 C++ templates

      +

      33.3.13 C++ templates

      @@ -1761,7 +1761,7 @@ More details can be found in the SWIG and C++ -

      32.3.14 C++ Smart Pointers

      +

      33.3.14 C++ Smart Pointers

      @@ -1845,7 +1845,7 @@ simply use the __deref__() method. For example: -

      32.4 Further details on the Tcl class interface

      +

      33.4 Further details on the Tcl class interface

      @@ -1858,7 +1858,7 @@ of low-level details were omitted. This section provides a brief overview of how the proxy classes work.

      -

      32.4.1 Proxy classes

      +

      33.4.1 Proxy classes

      @@ -1923,7 +1923,7 @@ function. This allows objects to be encapsulated objects that look a lot like as shown in the last section.

      -

      32.4.2 Memory management

      +

      33.4.2 Memory management

      @@ -2111,7 +2111,7 @@ typemaps--an advanced topic discussed later.

      -

      32.5 Input and output parameters

      +

      33.5 Input and output parameters

      @@ -2299,7 +2299,7 @@ set c [lindex $dim 1] -

      32.6 Exception handling

      +

      33.6 Exception handling

      @@ -2433,7 +2433,7 @@ Since SWIG's exception handling is user-definable, you are not limited to C++ ex See the chapter on "Customization Features" for more examples.

      -

      32.7 Typemaps

      +

      33.7 Typemaps

      @@ -2450,7 +2450,7 @@ Typemaps are only used if you want to change some aspect of the primitive C-Tcl interface.

      -

      32.7.1 What is a typemap?

      +

      33.7.1 What is a typemap?

      @@ -2567,7 +2567,7 @@ parameter is omitted): -

      32.7.2 Tcl typemaps

      +

      33.7.2 Tcl typemaps

      @@ -2705,7 +2705,7 @@ Initialize an argument to a value before any conversions occur. Examples of these methods will appear shortly.

      -

      32.7.3 Typemap variables

      +

      33.7.3 Typemap variables

      @@ -2776,7 +2776,7 @@ properly assigned. The Tcl name of the wrapper function being created. -

      32.7.4 Converting a Tcl list to a char **

      +

      33.7.4 Converting a Tcl list to a char **

      @@ -2838,7 +2838,7 @@ argv[2] = Larry 3 -

      32.7.5 Returning values in arguments

      +

      33.7.5 Returning values in arguments

      @@ -2880,7 +2880,7 @@ result, a Tcl function using these typemaps will work like this : % -

      32.7.6 Useful functions

      +

      33.7.6 Useful functions

      @@ -2957,7 +2957,7 @@ int Tcl_IsShared(Tcl_Obj *obj); -

      32.7.7 Standard typemaps

      +

      33.7.7 Standard typemaps

      @@ -3041,7 +3041,7 @@ work) -

      32.7.8 Pointer handling

      +

      33.7.8 Pointer handling

      @@ -3117,7 +3117,7 @@ For example: -

      32.8 Turning a SWIG module into a Tcl Package.

      +

      33.8 Turning a SWIG module into a Tcl Package.

      @@ -3189,7 +3189,7 @@ As a final note, most SWIG examples do not yet use the to use the load command instead.

      -

      32.9 Building new kinds of Tcl interfaces (in Tcl)

      +

      33.9 Building new kinds of Tcl interfaces (in Tcl)

      @@ -3288,7 +3288,7 @@ danger of blowing something up (although it is easily accomplished with an out of bounds array access).

      -

      32.9.1 Proxy classes

      +

      33.9.1 Proxy classes

      diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters index 55a0aec13..66c7caa19 100644 --- a/Doc/Manual/chapters +++ b/Doc/Manual/chapters @@ -14,6 +14,7 @@ Varargs.html Warnings.html Modules.html Allegrocl.html +COM.html CSharp.html Chicken.html Guile.html diff --git a/Source/Modules/com.cxx b/Source/Modules/com.cxx index 74496cbcf..fe74a52ac 100644 --- a/Source/Modules/com.cxx +++ b/Source/Modules/com.cxx @@ -197,7 +197,7 @@ class COM:public Language { GUID *proxy_iid; GUID *proxy_static_iid; GUID *proxy_clsid; - GUID guid_seed; + GUID master_guid; GUID typelib_guid; GUID module_iid; GUID module_clsid; @@ -243,7 +243,7 @@ public: clsid_list(NewString("")), namespce(NULL) { /* Use NIL GUID by default */ - memset(&guid_seed, 0, sizeof(GUID)); + memset(&master_guid, 0, sizeof(GUID)); memset(&typelib_guid, 0, sizeof(GUID)); memset(&module_iid, 0, sizeof(GUID)); memset(&module_clsid, 0, sizeof(GUID)); @@ -324,8 +324,8 @@ public: Node *optionsnode = Getattr(Getattr(n, "module"), "options"); if (optionsnode) { - if (Getattr(optionsnode, "guidseed")) { - if (!parseGUID(Getattr(optionsnode, "guidseed"), &guid_seed)) { + if (Getattr(optionsnode, "masterguid")) { + if (!parseGUID(Getattr(optionsnode, "masterguid"), &master_guid)) { /* Bad GUID */ /* FIXME: report an error */ } @@ -1251,18 +1251,18 @@ public: char *prep_input = new char[16 + name_len]; - /* guid_seed serves as a "name space ID" as used in RFC 4122. */ - prep_input[0] = (guid_seed.Data1 >> 24) & 0xff; - prep_input[1] = (guid_seed.Data1 >> 16) & 0xff; - prep_input[2] = (guid_seed.Data1 >> 8) & 0xff; - prep_input[3] = guid_seed.Data1 & 0xff; - prep_input[4] = (guid_seed.Data2 >> 8) & 0xff; - prep_input[5] = guid_seed.Data2 & 0xff; - prep_input[6] = (guid_seed.Data3 >> 8) & 0xff; - prep_input[7] = guid_seed.Data3 & 0xff; + /* master_guid serves as a "name space ID" as used in RFC 4122. */ + prep_input[0] = (master_guid.Data1 >> 24) & 0xff; + prep_input[1] = (master_guid.Data1 >> 16) & 0xff; + prep_input[2] = (master_guid.Data1 >> 8) & 0xff; + prep_input[3] = master_guid.Data1 & 0xff; + prep_input[4] = (master_guid.Data2 >> 8) & 0xff; + prep_input[5] = master_guid.Data2 & 0xff; + prep_input[6] = (master_guid.Data3 >> 8) & 0xff; + prep_input[7] = master_guid.Data3 & 0xff; for (int i = 0; i < 8; ++i) { - prep_input[8 + i] = guid_seed.Data4[i]; + prep_input[8 + i] = master_guid.Data4[i]; } for (int i = 0; i < name_len; ++i) { -- cgit v1.2.1