diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html index 69173e51f..b1b5598f5 100644 --- a/Doc/Manual/Arguments.html +++ b/Doc/Manual/Arguments.html @@ -424,4 +424,4 @@ constraint, the %clear directive can be used :

SWIG 1.3 - Last Modified : October 13, 2002
- \ No newline at end of file + diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html index 463e829d4..6d10355fc 100644 --- a/Doc/Manual/Chicken.html +++ b/Doc/Manual/Chicken.html @@ -24,7 +24,7 @@
  • TinyCLOS
  • Compilation -
  • Linking +
  • Linkage - \ No newline at end of file + diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 022fb1251..b12bc85b8 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -53,30 +53,29 @@
  • Installation on Windows -
  • SWIG Windows Examples +
  • SWIG Windows Examples -
  • SWIG on Cygwin and MinGW +
  • SWIG on Cygwin and MinGW @@ -312,19 +311,20 @@
  • "memberin" typemap
  • "varin" typemap
  • "varout" typemap +
  • "throws" typemap -
  • Some typemap examples +
  • Some typemap examples -
  • Multi-argument typemaps -
  • The run-time type checker -
  • Typemaps and overloading -
  • More about %apply and %clear -
  • Reducing wrapper code size -
  • Passing data between typemaps -
  • Where to go for more information? +
  • Multi-argument typemaps +
  • The run-time type checker +
  • Typemaps and overloading +
  • More about %apply and %clear +
  • Reducing wrapper code size +
  • Passing data between typemaps +
  • Where to go for more information? @@ -381,18 +381,19 @@
  • Enabling additional warnings
  • Issuing a warning message
  • Commentary -
  • Message output format -
  • Warning number reference +
  • Warnings as errors +
  • Message output format +
  • Warning number reference -
  • History +
  • History @@ -576,7 +577,7 @@
  • Tips and techniques @@ -592,30 +593,33 @@
  • Sixty four bit JVMs
  • What is a typemap?
  • Typemaps for mapping C/C++ types to Java types -
  • Java special variables -
  • Typemaps for both C and C++ compilation -
  • Java code typemaps -
  • Director specific typemaps +
  • Java typemap attributes +
  • Java special variables +
  • Typemaps for both C and C++ compilation +
  • Java code typemaps +
  • Director specific typemaps -
  • Typemap Examples +
  • Typemap Examples -
  • Living with Java Directors -
  • Odds and ends +
  • Living with Java Directors +
  • Odds and ends -
  • Examples +
  • Examples diff --git a/Doc/Manual/Contract.html b/Doc/Manual/Contract.html index c80299ed8..8ecf98486 100644 --- a/Doc/Manual/Contract.html +++ b/Doc/Manual/Contract.html @@ -239,4 +239,4 @@ in SWIG-1.3.20.
    SWIG 1.3 - Last Modified : November 12, 2003
    - \ No newline at end of file + diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html index 35c16f8fe..5dd72ff1b 100644 --- a/Doc/Manual/Extending.html +++ b/Doc/Manual/Extending.html @@ -2817,4 +2817,4 @@ extern "X" { ... } declaration.
    SWIG 1.3 - Last Modified : January 22, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html index c57ae2b40..b18e5ee85 100644 --- a/Doc/Manual/Introduction.html +++ b/Doc/Manual/Introduction.html @@ -375,4 +375,4 @@ non-portable or unreliable programming features.
    SWIG 1.3 - Last Modified : August 10, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html index c73859c1a..8510da8e2 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -101,32 +101,33 @@
  • Sixty four bit JVMs
  • What is a typemap?
  • Typemaps for mapping C/C++ types to Java types -
  • Additional Java typemap attributes -
  • Java special variables -
  • Typemaps for both C and C++ compilation -
  • Java code typemaps -
  • Director specific typemaps +
  • Java typemap attributes +
  • Java special variables +
  • Typemaps for both C and C++ compilation +
  • Java code typemaps +
  • Director specific typemaps -
  • Typemap Examples +
  • Typemap Examples -
  • Living with Java Directors -
  • Odds and ends +
  • Living with Java Directors +
  • Odds and ends -
  • Examples +
  • Examples @@ -3900,7 +3901,9 @@ These are listed below: -

    17.8.5 Java typemap attributes

    +

    17.8.5 Java typemap attributes

    + + There is an additional typemap attribute that the Java module supports. This is the 'throws' attribute. The throws attribute is optional and specified after the typemap name and contains one or more comma separated classes for adding to the throws clause for any methods that use that typemap. @@ -3925,7 +3928,7 @@ the union of the exception classes is added to the throws clause ensuring there See the NaN exception example for further usage. -

    17.8.5 Java special variables

    +

    17.8.6 Java special variables

    The standard SWIG special variables are available for use within typemaps as described in the Typemaps documentation, for example $1, $input,$result etc. @@ -4043,7 +4046,7 @@ This special variable expands to the module name, as specified by %module$moduleJNI. -

    17.8.6 Typemaps for both C and C++ compilation

    +

    17.8.7 Typemaps for both C and C++ compilation

    JNI calls must be written differently depending on whether the code is being compiled as C or C++. @@ -4074,7 +4077,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps -

    17.8.7 Java code typemaps

    +

    17.8.8 Java code typemaps

    Most of SWIG's typemaps are used for the generation of C/C++ code. @@ -4249,7 +4252,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. -

    17.8.8 Director specific typemaps

    +

    17.8.9 Director specific typemaps

    The Java directors feature requires the "javadirectorin", "javadirectorout" and the "directorin" typemaps in order to work properly. @@ -4402,7 +4405,7 @@ The basic strategy here is to provide a default package typemap for the majority -

    17.9 Typemap Examples

    +

    17.9 Typemap Examples

    This section includes a few examples of typemaps. For more examples, you @@ -4411,7 +4414,7 @@ the SWIG library. -

    17.9.1 Simpler Java enums for enums without initializers

    +

    17.9.1 Simpler Java enums for enums without initializers

    The default Proper Java enums approach to wrapping enums is somewhat verbose. @@ -4481,7 +4484,8 @@ This would be done by using the original versions of these typemaps in "enums.sw -

    17.9.2 Handling C++ exception specifications as Java exceptions

    +

    17.9.2 Handling C++ exception specifications as Java exceptions

    + This example demonstrates various ways in which C++ exceptions can be tailored and converted into Java exceptions. Let's consider a simple file class SimpleFile and an exception class FileException which it may throw on error: @@ -4590,7 +4594,9 @@ We could alternatively have used %rename to rename what() into -

    17.9.2 NaN Exception - exception handling for a particular type

    +

    17.9.3 NaN Exception - exception handling for a particular type

    + + A Java exception can be thrown from any Java or JNI code. Therefore, as most typemaps contain either Java or JNI code, just about any typemap could throw an exception. The following example demonstrates exception handling on a type by type basis by checking for 'Not a number' (NaN) whenever a parameter of type float is wrapped. @@ -4689,7 +4695,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. -

    17.9.2 Converting Java String arrays to char **

    +

    17.9.4 Converting Java String arrays to char **

    A common problem in many C programs is the processing of command line arguments, which are usually passed in an array of NULL terminated strings. @@ -4822,7 +4828,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify what Java types to use. -

    17.9.3 Expanding a Java object to multiple arguments

    +

    17.9.5 Expanding a Java object to multiple arguments

    Suppose that you had a collection of C functions with arguments @@ -4896,7 +4902,7 @@ example.foo(new String[]{"red", "green", "blue", "white"}); -

    17.9.4 Using typemaps to return arguments

    +

    17.9.6 Using typemaps to return arguments

    A common problem in some C programs is that values may be returned in function parameters rather than in the return value of a function. @@ -4997,7 +5003,7 @@ $ java main -

    17.9.5 Adding Java downcasts to polymorphic return types

    +

    17.9.7 Adding Java downcasts to polymorphic return types

    SWIG support for polymorphism works in that the appropriate virtual function is called. However, the default generated code does not allow for downcasting. @@ -5181,7 +5187,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. -

    17.9.6 Adding an equals method to the Java classes

    +

    17.9.8 Adding an equals method to the Java classes

    When a pointer is returned from a JNI function, it is wrapped using a new Java proxy class or type wrapper class. @@ -5217,7 +5223,7 @@ System.out.println("foo1? " + foo1.equals(foo2)); -

    17.9.7 Void pointers and a common Java base class

    +

    17.9.9 Void pointers and a common Java base class

    One might wonder why the common code that SWIG emits for the proxy and type wrapper classes is not pushed into a base class. @@ -5269,7 +5275,7 @@ This example contains some useful functionality which you may want in your code. -

    17.10 Living with Java Directors

    +

    17.10 Living with Java Directors

    @@ -5435,11 +5441,11 @@ public abstract class UserVisibleFoo extends Foo { -

    17.11 Odds and ends

    +

    17.11 Odds and ends

    -

    17.11.1 JavaDoc comments

    +

    17.11.1 JavaDoc comments

    The SWIG documentation system is currently deprecated. @@ -5491,7 +5497,7 @@ public class Barmy { -

    17.11.2 Functional interface without proxy classes

    +

    17.11.2 Functional interface without proxy classes

    It is possible to run SWIG in a mode that does not produce proxy classes by using the -noproxy commandline option. @@ -5543,7 +5549,7 @@ All destructors have to be called manually for example the delete_Foo(foo) -

    17.11.3 Using your own JNI functions

    +

    17.11.3 Using your own JNI functions

    You may have some hand written JNI functions that you want to use in addition to the SWIG generated JNI functions. @@ -5584,7 +5590,7 @@ This directive is only really useful if you want to mix your own hand crafted JN -

    17.11.4 Performance concerns and hints

    +

    17.11.4 Performance concerns and hints

    If you're directly manipulating huge arrays of complex objects from Java, performance may suffer greatly when using the array functions in arrays_java.i. @@ -5602,7 +5608,7 @@ This method calls the C++ destructor or free() for C code. -

    17.12 Examples

    +

    17.12 Examples

    The directory Examples/java has a number of further examples. diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html index f67694b18..b8bbdd371 100644 --- a/Doc/Manual/Library.html +++ b/Doc/Manual/Library.html @@ -1343,4 +1343,4 @@ For example:


    SWIG 1.3 - Last Modified : May 29, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 31a3c7eee..436a3cb76 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -876,4 +876,4 @@ Catching exceptions is now supported using SWIG's %exception feature. A simple but not too useful example is provided by the throw_exception testcase in Examples/test-suite. You can provide your own exceptions, too. - \ No newline at end of file + diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html index 7f6ef58b7..9d62ac106 100644 --- a/Doc/Manual/Perl5.html +++ b/Doc/Manual/Perl5.html @@ -2500,4 +2500,4 @@ not even sure if it really works).

    SWIG 1.3 - Last Modified : Feb 13, 2003
    - \ No newline at end of file + diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index cf12a152a..a8a5171ff 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -493,4 +493,4 @@ does not have the 'dl' command as used above. - \ No newline at end of file + diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html index 0cbb51a33..578bfd70a 100644 --- a/Doc/Manual/Preface.html +++ b/Doc/Manual/Preface.html @@ -203,4 +203,4 @@ can only fix bugs if we know about them.


    SWIG 1.3 - Last Modified : March 9, 2003
    - \ No newline at end of file + diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html index 2e330a486..795b03ea9 100644 --- a/Doc/Manual/Preprocessor.html +++ b/Doc/Manual/Preprocessor.html @@ -316,4 +316,4 @@ SWIG will strip the extra % and leave the preprocessor directive in the
    SWIG 1.3 - Last Modified : March 9, 2003
    - \ No newline at end of file + diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index cab028b24..0fb994489 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -3646,4 +3646,4 @@ class object (if applicable).
    SWIG 1.3 - Last Modified : August 7, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html index 0cc608fe4..2e6c018b5 100644 --- a/Doc/Manual/Ruby.html +++ b/Doc/Manual/Ruby.html @@ -5,132 +5,87 @@ -

    23 SWIG and Ruby

    +

    23 SWIG and Ruby

    + + +

    This chapter describes SWIG's support of Ruby.


    -

    23.1 Preliminaries

    +

    23.1 Preliminaries

    + + SWIG 1.3 is known to work with Ruby versions 1.6 and later. Given the choice, you should use the latest stable version of Ruby. You should also determine if @@ -145,7 +100,9 @@ earlier chapters. At the very least, make sure you also read the "

    -

    23.1.1 Running SWIG

    +

    23.1.1 Running SWIG

    + +

    To build a Ruby module, run SWIG using the -ruby option:

    @@ -169,7 +126,9 @@ Ruby extension module. To finish building the module, you need to compile this file and link it with the rest of your program.

    -

    23.1.2 Getting the right header files

    +

    23.1.2 Getting the right header files

    + + In order to compile the wrapper code, the compiler needs the ruby.h header file. This file is usually contained in a directory such as

    @@ -191,7 +150,9 @@ can run Ruby to find out. For example: -

    23.1.3 Compiling a dynamic module

    +

    23.1.3 Compiling a dynamic module

    + + Ruby extension modules are typically compiled into shared libraries that the interpreter loads dynamically at runtime. Since the exact commands for @@ -249,7 +210,9 @@ You might also check the SWIG Wiki for additional information.

    -

    23.1.4 Using your module

    +

    23.1.4 Using your module

    + + Ruby module names must be capitalized, but the convention for Ruby feature names is to use lowercase names. So, for example, the Etc @@ -263,7 +226,9 @@ extension. So for example, a SWIG interface file that begins with: will result in an extension module using the feature name "example" and Ruby module name "Example". -

    23.1.5 Static linking

    +

    23.1.5 Static linking

    + + An alternative approach to dynamic linking is to rebuild the Ruby interpreter with your extension module added to it. In the past, this approach was sometimes necessary due to limitations in dynamic @@ -278,7 +243,9 @@ adding your directory to the list of extensions in the file, and finally rebuilding Ruby.

    -

    23.1.6 Compilation of C++ extensions

    +

    23.1.6 Compilation of C++ extensions

    + +

    On most machines, C++ extension modules should be linked using the C++ compiler. For example: @@ -310,7 +277,9 @@ into your extension, e.g.


    -

    23.2 Building Ruby Extensions under Windows 95/NT

    +

    23.2 Building Ruby Extensions under Windows 95/NT

    + + Building a SWIG extension to Ruby under Windows 95/NT is roughly similar to the process used with Unix. Normally, you will want to produce a DLL that @@ -337,7 +306,9 @@ you may need to download the source distribution to the Ruby package, as you will need the Ruby header files.

    -

    23.2.1 Running SWIG from Developer Studio

    +

    23.2.1 Running SWIG from Developer Studio

    + + If you are developing your application within Microsoft developer studio, SWIG can be invoked as a custom build option. The process roughly follows @@ -426,12 +397,16 @@ Foo = 3.0


    -

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

    +

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

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

    23.3.1 Modules

    +

    23.3.1 Modules

    + + The SWIG %module directive specifies the name of the Ruby module. If you specify: @@ -489,7 +464,9 @@ take care that the names of your constants, classes and methods don't conflict with any of Ruby's built-in names.

    -

    23.3.2 Functions

    +

    23.3.2 Functions

    + + Global functions are wrapped as Ruby module methods. For example, given the SWIG interface file example.i:

    @@ -513,7 +490,9 @@ irb(main):002:0> Example.fact(4) -

    23.3.3 Variable Linking

    +

    23.3.3 Variable Linking

    + + C/C++ global variables are wrapped as a pair of singleton methods for the module: one to get the value of the global variable and one to set it. @@ -565,7 +544,9 @@ The %immutable directive stays in effect until it is explicitly disabled using %mutable. -

    23.3.4 Constants

    +

    23.3.4 Constants

    + + C/C++ constants are wrapped as module constants initialized to the appropriate value. To create a constant, use #define or the %constant directive. For example: @@ -584,7 +565,9 @@ irb(main):002:0> Example::PI -

    23.3.5 Pointers

    +

    23.3.5 Pointers

    + + "Opaque" pointers to arbitrary C/C++ types (i.e. types that aren't explicitly declared in your SWIG interface file) are wrapped as data objects. So, @@ -605,7 +588,9 @@ internally generated Ruby class: A NULL pointer is always represented by the Ruby nil object. -

    23.3.6 Structures

    +

    23.3.6 Structures

    + + C/C++ structs are wrapped as Ruby classes, with accessor methods (i.e. "getters" and "setters") for all of the struct members. For example, this struct @@ -684,7 +669,9 @@ generates accessor functions such as this:
    Foo *Bar_f_get(Bar *b) {
    return &b->f;
    }

    void Bar_f_set(Bar *b, Foo *val) {
    b->f = *val;
    }
    -

    23.3.7 C++ classes

    +

    23.3.7 C++ classes

    + + Like structs, C++ classes are wrapped by creating a new Ruby class of the same name with accessor methods for the public class member data. @@ -719,7 +706,9 @@ In Ruby, these functions are used as follows:
    require 'Example'

    l = Example::List.new

    l.insert("Ale")
    l.insert("Stout")
    l.insert("Lager")
    Example.print(l)
    l.length()
    ----- produces the following output
    Lager
    Stout
    Ale
    3
    -

    23.3.8 C++ Inheritance

    +

    23.3.8 C++ Inheritance

    + + The SWIG type-checker is fully aware of C++ inheritance. Therefore, if you have classes like this: @@ -831,7 +820,9 @@ and Base2 (i.e. they exhibit "Duck Typing"). -

    23.3.9 C++ Overloaded Functions

    +

    23.3.9 C++ Overloaded Functions

    + + C++ overloaded functions, methods, and constructors are mostly supported by SWIG. For example, if you have two functions like this: @@ -883,7 +874,9 @@ arises--in this case, the first declaration takes precedence.

    Please refer to the "SWIG and C++" chapter for more information about overloading.

    -

    23.3.10 C++ Operators

    +

    23.3.10 C++ Operators

    + + For the most part, overloaded operators are handled automatically by SWIG and do not require any special treatment on your part. So if your class @@ -912,7 +905,9 @@ More details about wrapping C++ operators into Ruby operators is discussed in the section on operator overloading. -

    23.3.11 C++ namespaces

    +

    23.3.11 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, @@ -946,7 +941,9 @@ extension modules for each namespace separately. If your program utilizes thousands of small deeply nested namespaces each with identical symbol names, well, then you get what you deserve. -

    23.3.12 C++ templates

    +

    23.3.12 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 @@ -1000,7 +997,9 @@ examples. More details can be found in the SWIG and C++ chapter. -

    23.3.13 C++ Smart Pointers

    +

    23.3.13 C++ Smart Pointers

    + + In certain C++ programs, it is common to use classes that have been wrapped by so-called "smart pointers." Generally, this involves the use of a @@ -1036,7 +1035,9 @@ simply use the __deref__() method. For example:
    irb(main):004:0> f = p.__deref__()     # Returns underlying Foo *
    -

    23.3.14 Cross-Language Polymorphism

    +

    23.3.14 Cross-Language Polymorphism

    + + SWIG's Ruby module supports cross-language polymorphism (a.k.a. the "directors" feature) similar to that for SWIG's Python module. Rather than @@ -1047,7 +1048,9 @@ secton just notes the differences that you need to be aware of when using this feature with Ruby. -

    23.3.14.1 Exception Unrolling

    +

    23.3.14.1 Exception Unrolling

    + + Whenever a C++ director class routes one of its virtual member function calls to a Ruby instance method, there's always the possibility that an exception @@ -1070,7 +1073,9 @@ Ruby exception is raised, it will be caught here and a C++ exception is raised in its place.
    -

    23.4 Input and output parameters

    +

    23.4 Input and output parameters

    + + A common problem in some C programs is handling parameters passed as simple pointers. For example: @@ -1144,7 +1149,9 @@ In Ruby:
    -

    23.5 Simple exception handling

    +

    23.5 Simple exception handling

    + + The SWIG %exception directive can be used to define a user-definable exception handler that can convert C/C++ errors into Ruby exceptions. @@ -1197,7 +1204,9 @@ Ruby exception classes, consult a Ruby reference such as Programming Ruby.


    -

    23.6 Typemaps

    +

    23.6 Typemaps

    + + This section describes how you can modify SWIG's default wrapping behavior for various C/C++ datatypes using the %typemap directive. @@ -1212,7 +1221,9 @@ Typemaps are only used if you want to change some aspect of the primitive C-Ruby interface.

    -

    23.6.1 What is a typemap?

    +

    23.6.1 What is a typemap?

    + + A typemap is nothing more than a code generation rule that is attached to a specific C datatype. For example, to convert integers from Ruby to C, @@ -1292,7 +1303,9 @@ follows (notice how the length parameter is omitted):
    puts Example.count('o','Hello World')
    2
    -

    23.6.2 Ruby typemaps

    +

    23.6.2 Ruby typemaps

    + + The previous section illustrated an "in" typemap for converting Ruby objects to C. A variety of different typemap methods are defined by the Ruby @@ -1348,7 +1361,9 @@ Examples of these typemaps appears in the section on typemap examples -

    23.6.3 Typemap variables

    +

    23.6.3 Typemap variables

    + + Within a typemap, a number of special variables prefaced with a $ may appear. A full list of variables can be found in the "Typemaps" chapter. This is a list of the most @@ -1390,7 +1405,9 @@ so that their values can be properly assigned.
    The Ruby name of the wrapper function being created.
    -

    23.6.4 Useful Functions

    +

    23.6.4 Useful Functions

    + + When you write a typemap, you usually have to work directly with Ruby objects. The following functions may prove to be useful. (These functions plus @@ -1399,17 +1416,23 @@ more can be found in Programming Ruby, by David Thomas and Andrew Hunt.)

    -

    23.6.4.1 C Datatypes to Ruby Objects

    +

    23.6.4.1 C Datatypes to Ruby Objects

    + +
    INT2NUM(long or int)  - int to Fixnum or Bignum
    INT2FIX(long or int) - int to Fixnum (faster than INT2NUM)
    CHR2FIX(char) - char to Fixnum
    rb_str_new2(char*) - char* to String
    rb_float_new(double) - double to Float
    -

    23.6.4.2 Ruby Objects to C Datatypes

    +

    23.6.4.2 Ruby Objects to C Datatypes

    + +
              int NUM2INT(Numeric)
    int FIX2INT(Numeric)
    unsigned int NUM2UINT(Numeric)
    unsigned int FIX2UINT(Numeric)
    long NUM2LONG(Numeric)
    long FIX2LONG(Numeric)
    unsigned long FIX2ULONG(Numeric)
    char NUM2CHR(Numeric or String)
    char * STR2CSTR(String)
    char * rb_str2cstr(String, int*length)
    double NUM2DBL(Numeric)

    -

    23.6.4.3 Macros for VALUE

    +

    23.6.4.3 Macros for VALUE

    + +

    RSTRING(str)->len

    @@ -1423,7 +1446,9 @@ and Andrew Hunt.) RARRAY(arr)->ptr
    pointer to array storage
    -

    23.6.4.4 Exceptions

    +

    23.6.4.4 Exceptions

    + +

    void rb_raise(VALUE exception, const char *fmt, ...)

    @@ -1480,7 +1505,9 @@ if Ruby was invoked with the -w flag. The given format string fmt and remaining arguments are interpreted as with printf(). -

    23.6.4.5 Iterators

    +

    23.6.4.5 Iterators

    + +

    void rb_iter_break()

    @@ -1512,12 +1539,16 @@ value)
    Equivalent to Ruby's throw.
    -

    23.6.5 Typemap Examples

    +

    23.6.5 Typemap Examples

    + + This section includes a few examples of typemaps. For more examples, you might look at the examples in the Example/ruby directory. -

    23.6.6 Converting a Ruby array to a char **

    +

    23.6.6 Converting a Ruby array to a char **

    + + A common problem in many C programs is the processing of command line arguments, which are usually passed in an array of NULL terminated @@ -1543,7 +1574,9 @@ allocation is used to allocate memory for the array, the "freearg" typemap is used to later release this memory after the execution of the C function. -

    23.6.7 Collecting arguments in a hash

    +

    23.6.7 Collecting arguments in a hash

    + + Ruby's solution to the "keyword arguments" capability of some other languages is to allow the programmer to pass in one or more key-value pairs as @@ -1681,7 +1714,9 @@ the extension, can be found in the Examples/ruby/hashargs directory of the SWIG distribution. -

    23.6.8 Pointer handling

    +

    23.6.8 Pointer handling

    + + Occasionally, it might be necessary to convert pointer values that have been stored using the SWIG typed-pointer representation. Since there are @@ -1740,7 +1775,9 @@ typemap variable $1_descriptor. For example:
    %typemap(in) Foo * {
    SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);
    }
    -

    23.6.8.1 Ruby Datatype Wrapping

    +

    23.6.8.1 Ruby Datatype Wrapping

    + +

    VALUE Data_Wrap_Struct(VALUE class, void (*mark)(void *), void (*free)(void *), void *ptr) @@ -1763,7 +1800,9 @@ from the data object


    -

    23.7 Operator overloading

    +

    23.7 Operator overloading

    + + SWIG allows operator overloading with, by using the %extend or %rename commands in SWIG and the following operator names @@ -1777,7 +1816,9 @@ for defining an equivalence operator, there is no separate method for handling inequality since Ruby parses the expression a != b as !(a == b). -

    23.7.1 Example: STL Vector to Ruby Array

    +

    23.7.1 Example: STL Vector to Ruby Array

    + + FIXME: This example is out of place here!

    Another use for macros and type maps is to create a Ruby array from a STL @@ -1831,9 +1872,13 @@ types: %enddef -

    23.8 Advanced Topics

    +

    23.8 Advanced Topics

    + + -

    23.8.1 Creating Multi-Module Packages

    +

    23.8.1 Creating Multi-Module Packages

    + + The chapter on Advanced Topics discusses the basics of creating multi-module extensions with SWIG, and in particular @@ -1922,7 +1967,9 @@ irb(main):005:0> c.getX() -

    23.8.2 Defining Aliases

    +

    23.8.2 Defining Aliases

    + + It's a fairly common practice in the Ruby built-ins and standard library to provide aliases for method names. For example, Array#size is @@ -1966,7 +2013,9 @@ apply (see the chapter on "Customization Features") for more details).

    -

    23.8.3 Predicate Methods

    +

    23.8.3 Predicate Methods

    + + Predicate methods in Ruby are those which return either true or false. By convention, these methods' names end in a question @@ -2013,7 +2062,9 @@ kinds of features apply (see the chapter on "Customization Features") for more details). -

    23.8.4 Specifying Mixin Modules

    +

    23.8.4 Specifying Mixin Modules

    + + The Ruby language doesn't support multiple inheritance, but it does allow you to mix one or more modules into a class using Ruby's include @@ -2062,7 +2113,9 @@ kinds of features apply (see the chapter on "Customization Features") for more details). -

    23.8.5 Interacting with Ruby's Garbage Collector

    +

    23.8.5 Interacting with Ruby's Garbage Collector

    + + This section is still unfinished!

    By default, SWIG ensures that any C++ objects it creates are destroyed when the diff --git a/Doc/Manual/Scripting.html b/Doc/Manual/Scripting.html index 649f5a100..8dfd6e611 100644 --- a/Doc/Manual/Scripting.html +++ b/Doc/Manual/Scripting.html @@ -436,4 +436,4 @@ using shared libraries instead.

    SWIG 1.3 - Last Modified : July 16, 2001
    - \ No newline at end of file + diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html index 538091cec..e3cef3976 100644 --- a/Doc/Manual/Tcl.html +++ b/Doc/Manual/Tcl.html @@ -2927,4 +2927,4 @@ interesting things.

    SWIG 1.3 - Last Modified : May 28, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html index 90e67ad61..a2743101e 100644 --- a/Doc/Manual/Typemaps.html +++ b/Doc/Manual/Typemaps.html @@ -52,20 +52,20 @@
  • "memberin" typemap
  • "varin" typemap
  • "varout" typemap -
  • "throws" typemap +
  • "throws" typemap -
  • Some typemap examples +
  • Some typemap examples -
  • Multi-argument typemaps -
  • The run-time type checker -
  • Typemaps and overloading -
  • More about %apply and %clear -
  • Reducing wrapper code size -
  • Passing data between typemaps -
  • Where to go for more information? +
  • Multi-argument typemaps +
  • The run-time type checker +
  • Typemaps and overloading +
  • More about %apply and %clear +
  • Reducing wrapper code size +
  • Passing data between typemaps +
  • Where to go for more information? @@ -1876,7 +1876,8 @@ The "varout" typemap is used to convert a C/C++ object to an object in the targe language when reading a C/C++ global variable. This is implementation specific. -

    8.5.13 "throws" typemap

    +

    8.5.13 "throws" typemap

    + The "throws" typemap is only used when SWIG parses a C++ method with an exception specification. It provides a default mechanism for handling C++ methods that have declared the exceptions it will throw. @@ -1915,13 +1916,13 @@ catch(char const *_e) { Note that if your methods do not have an exception specification yet they do throw exceptions, SWIG cannot know how to deal with them. For a neat way to handle these, see the Exception handling with %exception section. -

    8.6 Some typemap examples

    +

    8.6 Some typemap examples

    This section contains a few examples. Consult language module documentation for more examples. -

    8.6.1 Typemaps for arrays

    +

    8.6.1 Typemaps for arrays

    A common use of typemaps is to provide support for C arrays appearing both as @@ -2151,7 +2152,7 @@ Now, you will find that member access is quite nice: Compatibility Note: SWIG1.1 used to provide a special "memberout" typemap. However, it was mostly useless and has since been eliminated. To return structure members, simply use the "out" typemap. -

    8.6.2 Implementing constraints with typemaps

    +

    8.6.2 Implementing constraints with typemaps

    One particularly interesting application of typemaps is the @@ -2197,7 +2198,7 @@ rather than blindly passing values to the underlying C/C++ program.

    Note: A more advanced constraint checking system is in development. Stay tuned. -

    8.7 Multi-argument typemaps

    +

    8.7 Multi-argument typemaps

    So far, the typemaps presented have focused on the problem of dealing with @@ -2433,7 +2434,8 @@ Numeric Python. However, it should also be stressed that some care is in order. when crossing languages you may need to worry about issues such as row-major vs. column-major ordering (and perform conversions if needed). -

    8.8 The run-time type checker

    +

    8.8 The run-time type checker

    + The run-time type checker is used by many, but not all, of SWIG's supported target languages. The run-time type checker features @@ -2631,7 +2633,7 @@ type-checking. This code is also included in every generated wrapped file so yo probably just look at the output of SWIG to get a better sense for how types are managed. -

    8.9 Typemaps and overloading

    +

    8.9 Typemaps and overloading

    In many target languages, SWIG fully supports C++ overloaded methods and functions. For example, @@ -2915,7 +2917,7 @@ Subsequent "in" typemaps would then perform more extensive type-checking.
  • Make sure you read the section on overloading in the "SWIG and C++" chapter. -

    8.10 More about %apply and %clear

    +

    8.10 More about %apply and %clear

    In order to implement certain kinds of program behavior, it is sometimes necessary to @@ -2988,7 +2990,7 @@ example: -

    8.11 Reducing wrapper code size

    +

    8.11 Reducing wrapper code size

    Since the code supplied to a typemap is inlined directly into wrapper functions, typemaps can result @@ -3064,7 +3066,7 @@ convert_float_array(PyObject *input, int size) { -

    8.12 Passing data between typemaps

    +

    8.12 Passing data between typemaps

    @@ -3098,7 +3100,7 @@ in this manner should probably be avoided. At the very least, you should make sure that the typemaps sharing information have exactly the same types and names. -

    8.13 Where to go for more information?

    +

    8.13 Where to go for more information?

    The diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html index 8be23057a..53c12deb8 100644 --- a/Doc/Manual/Varargs.html +++ b/Doc/Manual/Varargs.html @@ -828,4 +828,4 @@ this will introduce. Good luck.
    SWIG 1.3 - Last Modified : March 24, 2002
    - \ No newline at end of file + diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html index f267ca92a..5ae20e8be 100644 --- a/Doc/Manual/Warnings.html +++ b/Doc/Manual/Warnings.html @@ -13,18 +13,19 @@
  • Enabling additional warnings
  • Issuing a warning message
  • Commentary -
  • Message output format -
  • Warning number reference +
  • Warnings as errors +
  • Message output format +
  • Warning number reference -
  • History +
  • History @@ -219,10 +220,16 @@ explicitly. Certain types of SWIG problems are errors. These usually arise due to parsing errors (bad syntax) or semantic problems for which there is no obvious recovery. There is no mechanism for suppressing error -messages or handling errors as warnings---you must make changes to -the input file to fix the problem. +messages. -

    12.6 Message output format

    +

    12.6 Warnings as errors

    + + +Warnings can be handled as errors by using the -Werror command line +option. This will cause SWIG to exit with a non successful exit code if a +warning is encountered. + +

    12.7 Message output format

    The output format for both warnings and errors can be selected for @@ -239,10 +246,10 @@ $ swig -python -Fmicrosoft example.i example.i(4): Syntax error in input. -

    12.7 Warning number reference

    +

    12.8 Warning number reference

    -

    12.7.1 Deprecated features (100-199)

    +

    12.8.1 Deprecated features (100-199)

    -

    12.7.2 Preprocessor (200-299)

    +

    12.8.2 Preprocessor (200-299)

    -

    12.7.3 C/C++ Parser (300-399)

    +

    12.8.3 C/C++ Parser (300-399)

    -

    12.7.4 Types and typemaps (400-499)

    +

    12.8.4 Types and typemaps (400-499)

    -

    12.7.5 Code generation (500-599)

    +

    12.8.5 Code generation (500-599)

    -

    12.7.6 Language module specific (800-899)

    +

    12.8.6 Language module specific (800-899)

    -

    12.7.7 User defined (900-999)

    +

    12.8.7 User defined (900-999)

    These numbers can be used by your own application. -

    12.8 History

    +

    12.9 History

    The ability to control warning messages was first added to SWIG-1.3.12. @@ -446,4 +453,4 @@ The ability to control warning messages was first added to SWIG-1.3.12.


    SWIG 1.3 - Last Modified : June 28, 2003
    - \ No newline at end of file + diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index 4b233c31c..303f20256 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -12,28 +12,28 @@ -
  • SWIG Windows Examples +
  • SWIG Windows Examples -
  • SWIG on Cygwin and MinGW +
  • SWIG on Cygwin and MinGW @@ -63,7 +63,7 @@ If you want to build your own swig.exe have a look at Buildi -

    2.2 SWIG Windows Examples

    +

    2.2 SWIG Windows Examples

    Using Microsoft Visual C++ is the most common approach to compiling and linking SWIG's output. @@ -77,7 +77,7 @@ Alternatively run the examples using Cygwin. More information on each of the examples is available with the examples distributed with SWIG (Examples/index.html). -

    2.2.1 Instructions for using the Examples with Visual Studio

    +

    2.2.1 Instructions for using the Examples with Visual Studio

    Ensure the SWIG executable is as supplied in the SWIG root directory in order for the examples to work. @@ -92,7 +92,7 @@ They are usually set from the Control Panel and System properties, but this depe If you don't want to use environment variables then change all occurences of the environment variables in the .dsp files with hard coded values. If you are interested in how the project files are set up there is explanatory information in some of the language module's documentation. -

    2.2.1.1 Python

    +

    2.2.1.1 Python

    PYTHON_INCLUDE : Set this to the directory that contains python.h
    @@ -103,7 +103,7 @@ PYTHON_INCLUDE: d:\python21\include
    PYTHON_LIB: d:\python21\libs\python21.lib
    -

    2.2.1.2 TCL

    +

    2.2.1.2 TCL

    TCL_INCLUDE : Set this to the directory containing tcl.h
    @@ -114,7 +114,7 @@ TCL_INCLUDE: d:\tcl\include
    TCL_LIB: d:\tcl\lib\tcl83.lib
    -

    2.2.1.3 Perl

    +

    2.2.1.3 Perl

    PERL5_INCLUDE : Set this to the directory containing perl.h
    @@ -125,7 +125,7 @@ PERL5_INCLUDE: D:\nsPerl5.004_04\lib\CORE
    PERL5_LIB: D:\nsPerl5.004_04\lib\CORE\perl.lib
    -

    2.2.1.4 Java

    +

    2.2.1.4 Java

    JAVA_INCLUDE : Set this to the directory containing jni.h
    @@ -136,7 +136,7 @@ JAVA_INCLUDE: d:\jdk1.3\include
    JAVA_BIN: d:\jdk1.3\bin
    -

    2.2.1.5 Ruby

    +

    2.2.1.5 Ruby

    RUBY_INCLUDE : Set this to the directory containing ruby.h
    @@ -147,25 +147,25 @@ RUBY_INCLUDE: D:\ruby\lib\ruby\1.6\i586-mswin32
    RUBY_LIB: D:\ruby\lib\mswin32-ruby16.lib
    -

    2.2.1.6 C#

    +

    2.2.1.6 C#

    The C# examples do not require any environment variables to be set as a C# project file is included. Just open up the .sln solution file in Visual Studio .NET 2003 and do a Rebuild All from the Build menu. The accompanying C# and C++ project file are automatically used by the solution file. -

    2.2.2 Instructions for using the Examples with other compilers

    +

    2.2.2 Instructions for using the Examples with other compilers

    If you do not have access to Visual C++ you will have to set up project files / Makefiles for your chosen compiler. There is a section in each of the language modules detailing what needs setting up using Visual C++ which may be of some guidance. Alternatively you may want to use Cygwin as described in the following section. -

    2.3 SWIG on Cygwin and MinGW

    +

    2.3 SWIG on Cygwin and MinGW

    SWIG can also be compiled and run using Cygwin or MinGW which provides a Unix like front end to Windows and comes free with gcc, an ANSI C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied. -

    2.3.1 Building swig.exe on Windows

    +

    2.3.1 Building swig.exe on Windows

    If you want to replicate the build of swig.exe that comes with the download, follow the MinGW instructions below. @@ -173,7 +173,7 @@ This is not necessary to use the supplied swig.exe. This information is provided for those that want to modify the SWIG source code in a Windows environment. Normally this is not needed, so most people will want to ignore this section. -

    2.3.1.1 Building swig.exe using MinGW and MSYS

    +

    2.3.1.1 Building swig.exe using MinGW and MSYS

    -

    2.3.1.2 Building swig.exe using Cygwin

    +

    2.3.1.2 Building swig.exe using Cygwin

    Note that SWIG can also be built using Cygwin. @@ -192,7 +192,7 @@ Note that the Cygwin environment will also allow one to regenerate the autotool These files are generated using the autogen.sh script and will only need regenerating in circumstances such as changing the build system.

    -

    2.3.1.3 Building swig.exe alternatives

    +

    2.3.1.3 Building swig.exe alternatives

    If you don't want to install Cygwin or MinGW, use a different compiler to build @@ -201,7 +201,7 @@ file in order to build swig.exe from the Visual C++ IDE. -

    2.3.2 Running the examples on Windows using Cygwin

    +

    2.3.2 Running the examples on Windows using Cygwin

    The examples and test-suite work as successfully on Cygwin as on any other Unix operating system. diff --git a/Doc/Manual/index.html b/Doc/Manual/index.html index 1c4282353..75cd7e6c2 100644 --- a/Doc/Manual/index.html +++ b/Doc/Manual/index.html @@ -6,7 +6,7 @@

    SWIG1.3 Development Documentation

    -Last update : SWIG-1.3.21 (11 January 2004) +Last update : SWIG-1.3.22 (?? ??? 2004)

    Authors: @@ -55,6 +55,8 @@ to help!).

    Language Module Documentation

    Developer Documentation