diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html index 7bd536b34..9ff33699a 100644 --- a/Doc/Manual/Chicken.html +++ b/Doc/Manual/Chicken.html @@ -7,7 +7,7 @@ -

24 SWIG and Chicken

+

25 SWIG and Chicken

@@ -57,25 +57,26 @@
  • SWIG Windows Examples -
  • SWIG on Cygwin and MinGW +
  • SWIG on Cygwin and MinGW @@ -380,17 +381,18 @@
  • Enabling additional warnings
  • Issuing a warning message
  • Commentary -
  • Warning number reference +
  • Message output format +
  • Warning number reference -
  • History +
  • History @@ -603,7 +605,28 @@ -

    18 SWIG and Ocaml

    +

    18 SWIG and Modula-3

    + + + + + +

    19 SWIG and Ocaml

    -

    19 SWIG and Perl5

    +

    20 SWIG and Perl5

    -

    20 SWIG and PHP4

    +

    21 SWIG and PHP4

    -

    21 SWIG and Python

    +

    22 SWIG and Python

    -

    22 SWIG and Ruby

    +

    23 SWIG and Ruby

    -

    23 SWIG and Tcl

    +

    24 SWIG and Tcl

    -

    24 SWIG and Chicken

    +

    25 SWIG and Chicken

    -

    25 Extending SWIG

    +

    26 Extending SWIG

    -

    25.10.11 Examples and test cases

    +

    26.10.11 Examples and test cases

    Each of the language modules provides one or more examples. These examples @@ -2467,7 +2467,7 @@ By default, all of the examples are built and run when the user types during this process, see the section on configuration files. -

    25.10.12 Documentation

    +

    26.10.12 Documentation

    Don't forget to write end-user documentation for your language module. Currently, @@ -2494,13 +2494,13 @@ Some topics that you'll want to be sure to address include: if available. -

    25.11 Typemaps

    +

    26.11 Typemaps

    -

    25.11.1 Proxy classes

    +

    26.11.1 Proxy classes

    -

    25.12 Guide to parse tree nodes

    +

    26.12 Guide to parse tree nodes

    This section describes the different parse tree nodes and their attributes. @@ -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 403c2486c..c57ae2b40 100644 --- a/Doc/Manual/Introduction.html +++ b/Doc/Manual/Introduction.html @@ -17,11 +17,11 @@
  • Building a Perl5 module
  • Building a Python module
  • Shortcuts -
  • Building libraries and modules -
  • Supported C/C++ language features -
  • Non-intrusive interface building -
  • Hands off code generation +
  • Supported C/C++ language features +
  • Non-intrusive interface building +
  • Hands off code generation +
  • SWIG and freedom @@ -67,6 +67,7 @@ in scientific and engineering projects.

    1.2 Why use SWIG?

    + As stated in the previous section, the primary purpose of SWIG is to simplify the task of integrating C/C++ with other programming languages. However, why would anyone want to do that? To answer that question, it is useful to list a few strengths @@ -286,7 +287,8 @@ print $example::My_variable + 4.5, "\n"; 7.5 -

    1.4 Supported C/C++ language features

    +

    1.4 Supported C/C++ language features

    + A primary goal of the SWIG project is to make the language binding process extremely easy. Although a few simple examples have been shown, @@ -321,7 +323,8 @@ wrapping simple C++ code. In fact, SWIG is able handle C++ code that stresses the very limits of many C++ compilers. -

    1.5 Non-intrusive interface building

    +

    1.5 Non-intrusive interface building

    + When used as intended, SWIG requires minimal (if any) modification to existing C code. This makes SWIG extremely easy to use with existing @@ -330,7 +333,7 @@ the C code independent of the high level interface, you can change the interface and reuse the code in other applications. It is also possible to support different types of interfaces depending on the application. -

    1.6 Hands off code generation

    +

    1.6 Hands off code generation

    SWIG is designed to produce working code that needs no @@ -343,7 +346,8 @@ file. While this approach may limit flexibility for hard-core hackers, it allows others to forget about the low-level implementation details. -

    SWIG and freedom

    +

    1.7 SWIG and freedom

    + No, this isn't a special section on the sorry state of world politics. However, it may be useful to know that SWIG was written with a @@ -371,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 b55d82dd6..4c1e1d755 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -4789,4 +4789,4 @@ If your SWIG installation went well Unix users should be able to type makeWindows Examples. - + \ No newline at end of file diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html new file mode 100644 index 000000000..310f2100d --- /dev/null +++ b/Doc/Manual/Modula3.html @@ -0,0 +1,360 @@ + + + +SWIG and Modula-3 + + +

    18 SWIG and Modula-3

    + + + + + + +This chapter describes SWIG's support of +Modula-3. +You should be familiar with the +basics +of SWIG, +especially typemaps. + + +

    18.1 Overview

    + + +

    +The Modula-3 support is very basic and highly experimental! +Many features are still not designed satisfyingly +and I need more discussion about the odds and ends. +The Modula-3 generator was already useful for interfacing +to the + +PLPlot + +library. + + + + +

    18.2 Preliminaries

    + + + +

    18.2.1 Compilers

    + + +There are different Modula-3 compilers around: +cm3, pm3, ezm3, Klagenfurth Modula-3, Cambridge Modula-3. +SWIG itself does not contain compiler specific code +but the library file +modula3.swg +may do so. +For testing examples I used Critical Mass' cm3. + + +

    18.2.2 Additional Commandline Options

    + + +There some experimental command line options +that prevent SWIG from generating interface files. +Instead files are emitted that may assist +writing SWIG interface files. + + + + + + + + + + + + + + + + + + + + +
    Modula-3 specific options
    -generateconst <file> +Disable generation of interfaces and wrappers. +Instead generate code for computing numeric values of constants. +
    -generaterename <file> +Disable generation of interfaces and wrappers. +Instead generate suggestions for %rename. +
    -generatetypemap <file> +Disable generation of interfaces and wrappers. +Instead generate templates for some basic typemaps. +
    + + +

    18.3 Modula-3 typemaps

    + + + +

    18.3.1 Inputs and outputs

    + + +Each C procedure has a bunch of inputs and outputs. +Aside from global variables +inputs are passed as call arguments, +outputs are updated reference arguments and +the function value. + +Each C type can have several typemaps +that apply only in case the types are used +as input argument, as output argument, +or as return value. +A further typemap may specify +the direction that is used for certain parameters. + + +

    18.3.2 Exceptions

    + + +Modula-3 provides another possibility +of an output of a function: exceptions. + +Any piecec of Modula-3 code that SWIG inserts +due to a typemap can raise an exception. +This way you can also convert an error code +from a C function into an Modula-3 exception. + +The RAISES clause is controlled +by typemaps with the except extension. + + +

    18.3.3 Subranges, Enumerations, Sets

    + + + +

    18.3.4 Objects

    + + + +

    18.3.5 Example

    + + +The generation of wrappers in Modula-3 needs very fine control +to take advantage of the language features. +Here is an example of a generated wrapper +where almost everything is generated by a typemap: + +
    +         (* %relabel  m3wrapinmode m3wrapinname m3wrapintype  m3wrapindefault *)
    +  PROCEDURE Name     (READONLY       str       :    TEXT    :=      ""       )
    +              (* m3wrapoutcheck:throws *)
    +     : NameResult RAISES {E} =
    +    VAR
    +      arg0   : C.char_star;              (* m3wrapretvar *)
    +      arg1   : C.char_star;              (* m3wrapargvar *)
    +      arg2   : C.int;
    +      result : RECORD
    +           (*m3wrapretname  m3wraprettype*)
    +                 unixPath : TEXT;
    +           (*m3wrapoutname  m3wrapouttype*)
    +                 checksum : CARDINAL;
    +               END;
    +    BEGIN
    +      TRY
    +        arg1 := M3toC.SharedTtoS(str);   (* m3wrapinconv *)
    +        IF Text.Length(arg1) > 10 THEN   (* m3wrapincheck *)
    +          RAISE E("str too long");
    +        END;
    + (* m3wrapretraw           m3wrapargraw *)
    +        arg0 := MessyToUnix  (arg1,   arg2);
    +        result.unixPath := M3toC.CopyStoT(arg0);  (* m3wrapretconv *)
    +        result.checksum := arg2;         (* m3wrapoutconv *)
    +        IF result.checksum = 0 THEN      (* m3wrapoutcheck *)
    +          RAISE E("invalid checksum");
    +        END;
    +      FINALLY
    +        M3toC.FreeSharedS(str,arg1);     (* m3wrapfreearg *)
    +      END;
    +    END Name;
    +
    + + + + \ No newline at end of file diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 44eafcb0c..31a3c7eee 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -6,7 +6,7 @@ -

    18 SWIG and Ocaml

    +

    19 SWIG and Ocaml