diff --git a/Doc/Manual/Allegrocl.html b/Doc/Manual/Allegrocl.html index 9f37d4fc5..4b6bad421 100644 --- a/Doc/Manual/Allegrocl.html +++ b/Doc/Manual/Allegrocl.html @@ -373,21 +373,21 @@ swig -allegrocl [ options ] filename -identifier-converter [name] - Binds the variable swig:*swig-identifier-convert* in the generated .cl file to name. - This function is used to generate symbols - for the lisp side of the interface. + This function is used to generate symbols + for the lisp side of the interface. -cwrap - [default] Generate a .cxx file containing C wrapper function when wrapping C code. The interface generated is similar to what is - done for C++ code. + done for C++ code. -nocwrap - Explicitly turn off generation of .cxx wrappers for C code. Reasonable for modules with simple interfaces. Can not handle all legal enum - and constant constructs, or take advantage of SWIG customization features. + and constant constructs, or take advantage of SWIG customization features. -isolate - With this command-line argument, all lisp helper functions are defined in a unique package named swig.<module-name> rather than - swig. This prevents conflicts when the module is - intended to be used with other swig generated interfaces that may, - for instance, make use of different identifier converters. + swig. This prevents conflicts when the module is + intended to be used with other swig generated interfaces that may, + for instance, make use of different identifier converters. @@ -472,7 +472,7 @@ interested in generating an interface to C++. | Foreign Code | What we're generating an interface to. |______________| | - | + | _______v______ | | (foreign side) | Wrapper code | extern "C" wrappers calling C++ @@ -484,18 +484,18 @@ interested in generating an interface to C++. | FFI Layer | Low level lisp interface. ff:def-foreign-call, |______________| ff:def-foreign-variable | - +---------------------------- + +---------------------------- _______v______ _______v______ | | | | (lisp side) | Defuns | | Defmethods | wrapper for overloaded |______________| |______________| functions or those with (lisp side) | defaulted arguments - Wrapper for non-overloaded | - functions and methods _______v______ - | | (lisp side) - | Defuns | dispatch function - |______________| to overloads based - on arity + Wrapper for non-overloaded | + functions and methods _______v______ + | | (lisp side) + | Defuns | dispatch function + |______________| to overloads based + on arity @@ -799,8 +799,8 @@ namespace car {
- Users are cautioned to get to know their constants before use, or - not use the -nocwrap command-line option. + Users are cautioned to get to know their constants before use, or + not use the -nocwrap command-line option.
For example, the following header file
-enum COL { RED, GREEN, BLUE };
+enum COL { RED, GREEN, BLUE };
enum FOO { FOO1 = 10, FOO2, FOO3 };
- SWIG provides support for dealing with templates, but by - default, it will not generate any member variable or function - wrappers for templated classes. In order to create these - wrappers, you need to explicitly tell SWIG to instantiate - them. This is done via the - %template - directive. -
++SWIG provides support for dealing with templates, but by +default, it will not generate any member variable or function +wrappers for templated classes. In order to create these +wrappers, you need to explicitly tell SWIG to instantiate +them. This is done via the +%template +directive. +
- While no wrapper code is generated for accessing member - variables, or calling member functions, type code is generated - to include these templated classes in the foreign-type and CLOS - class schema. -
++While no wrapper code is generated for accessing member +variables, or calling member functions, type code is generated +to include these templated classes in the foreign-type and CLOS +class schema. +
The result is that all references to synonym types in foreign @@ -1285,17 +1285,17 @@ synonym> criteria from a set of synonym types.
/* name conversion for overloaded operators. */
#ifdef __cplusplus
-%rename(__add__) *::operator+;
-%rename(__pos__) *::operator+();
-%rename(__pos__) *::operator+() const;
+%rename(__add__) *::operator+;
+%rename(__pos__) *::operator+();
+%rename(__pos__) *::operator+() const;
-%rename(__sub__) *::operator-;
-%rename(__neg__) *::operator-() const;
-%rename(__neg__) *::operator-();
+%rename(__sub__) *::operator-;
+%rename(__neg__) *::operator-() const;
+%rename(__neg__) *::operator-();
-%rename(__mul__) *::operator*;
-%rename(__deref__) *::operator*();
-%rename(__deref__) *::operator*() const;
+%rename(__mul__) *::operator*;
+%rename(__deref__) *::operator*();
+%rename(__deref__) *::operator*() const;
-%rename(__div__) *::operator/;
-%rename(__mod__) *::operator%;
-%rename(__logxor__) *::operator^;
-%rename(__logand__) *::operator&;
-%rename(__logior__) *::operator|;
-%rename(__lognot__) *::operator~();
-%rename(__lognot__) *::operator~() const;
+%rename(__div__) *::operator/;
+%rename(__mod__) *::operator%;
+%rename(__logxor__) *::operator^;
+%rename(__logand__) *::operator&;
+%rename(__logior__) *::operator|;
+%rename(__lognot__) *::operator~();
+%rename(__lognot__) *::operator~() const;
-%rename(__not__) *::operator!();
-%rename(__not__) *::operator!() const;
+%rename(__not__) *::operator!();
+%rename(__not__) *::operator!() const;
-%rename(__assign__) *::operator=;
+%rename(__assign__) *::operator=;
%rename(__add_assign__) *::operator+=;
-%rename(__sub_assign__) *::operator-=;
-%rename(__mul_assign__) *::operator*=;
-%rename(__div_assign__) *::operator/=;
-%rename(__mod_assign__) *::operator%=;
+%rename(__sub_assign__) *::operator-=;
+%rename(__mul_assign__) *::operator*=;
+%rename(__div_assign__) *::operator/=;
+%rename(__mod_assign__) *::operator%=;
%rename(__logxor_assign__) *::operator^=;
%rename(__logand_assign__) *::operator&=;
%rename(__logior_assign__) *::operator|=;
-%rename(__lshift__) *::operator<<;
+%rename(__lshift__) *::operator<<;
%rename(__lshift_assign__) *::operator<<=;
-%rename(__rshift__) *::operator>>;
+%rename(__rshift__) *::operator>>;
%rename(__rshift_assign__) *::operator>>=;
-%rename(__eq__) *::operator==;
-%rename(__ne__) *::operator!=;
-%rename(__lt__) *::operator<;
-%rename(__gt__) *::operator>;
-%rename(__lte__) *::operator<=;
-%rename(__gte__) *::operator>=;
+%rename(__eq__) *::operator==;
+%rename(__ne__) *::operator!=;
+%rename(__lt__) *::operator<;
+%rename(__gt__) *::operator>;
+%rename(__lte__) *::operator<=;
+%rename(__gte__) *::operator>=;
-%rename(__and__) *::operator&&;
-%rename(__or__) *::operator||;
+%rename(__and__) *::operator&&;
+%rename(__or__) *::operator||;
-%rename(__preincr__) *::operator++();
-%rename(__postincr__) *::operator++(int);
-%rename(__predecr__) *::operator--();
-%rename(__postdecr__) *::operator--(int);
+%rename(__preincr__) *::operator++();
+%rename(__postincr__) *::operator++(int);
+%rename(__predecr__) *::operator--();
+%rename(__postdecr__) *::operator--(int);
-%rename(__comma__) *::operator,();
-%rename(__comma__) *::operator,() const;
+%rename(__comma__) *::operator,();
+%rename(__comma__) *::operator,() const;
%rename(__member_ref__) *::operator->;
%rename(__member_func_ref__) *::operator->*;
-%rename(__funcall__) *::operator();
-%rename(__aref__) *::operator[];
+%rename(__funcall__) *::operator();
+%rename(__aref__) *::operator[];
@@ -1821,28 +1821,28 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
The LIN typemap accepts the following $variable references.
-%typemap(lin) SWIGTYPE "(cl:let (($out $in))\n $body)";
+%typemap(lin) SWIGTYPE "(cl:let (($out $in))\n $body)";
The LOUT typemap uses the following $variable
$ adb devices List of devices attached -A32-6DBE0001-9FF80000-015D62C3-02018028 device +A32-6DBE0001-9FF80000-015D62C3-02018028 device
$ adb install bin/SwigSimple-debug.apk 95 KB/s (4834 bytes in 0.049s) - pkg: /data/local/tmp/SwigSimple-debug.apk + pkg: /data/local/tmp/SwigSimple-debug.apk Successdiff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html index db46359d5..48ec5c629 100644 --- a/Doc/Manual/Arguments.html +++ b/Doc/Manual/Arguments.html @@ -60,7 +60,7 @@ Suppose you had a C function like this:
void add(double a, double b, double *result) {
- *result = a + b;
+ *result = a + b;
}
-int *INPUT +int *INPUT short *INPUT long *INPUT unsigned int *INPUT @@ -221,7 +221,7 @@ function:@@ -273,7 +273,7 @@ These methods can be used as shown in an earlier example. For example, if you hadouble add(double *a, double *b) { - return *a+*b; + return *a+*b; }@@ -339,7 +339,7 @@ A C function that uses this might be something like this:void add(double a, double b, double *c) { - *c = a+b; + *c = a+b; }diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html index 2d800ad6a..820d01fde 100644 --- a/Doc/Manual/Chicken.html +++ b/Doc/Manual/Chicken.html @@ -55,10 +55,10 @@void negate(double *x) { - *x = -(*x); + *x = -(*x); }-
- generates portable C code
-- includes a customizable interpreter
-- links to C libraries with a simple Foreign Function Interface
-- supports full tail-recursion and first-class continuations
+- generates portable C code
+- includes a customizable interpreter
+- links to C libraries with a simple Foreign Function Interface
+- supports full tail-recursion and first-class continuations
@@ -98,7 +98,7 @@
-% swig -chicken example.i+% swig -chicken example.i@@ -131,7 +131,7 @@
-% swig -chicken -c++ example.i+% swig -chicken -c++ example.i@@ -142,7 +142,7 @@
-% chicken example.scm -output-file oexample.c+% chicken example.scm -output-file oexample.c@@ -176,10 +176,10 @@
The name of the module must be declared one of two ways:
@@ -189,7 +189,7 @@
CHICKEN will be able to access the module using the (declare
- (uses modulename)) CHICKEN Scheme form.
+ (uses modulename)) CHICKEN Scheme form.
#define MYCONSTANT1 ...%constant int MYCONSTANT2 = ...const int MYCONSTANT3 = ...enum { MYCONSTANT4 = ... };#define MYCONSTANT1 ...%constant int MYCONSTANT2 = ...const int MYCONSTANT3 = ...enum { MYCONSTANT4 = ... };@@ -295,11 +295,11 @@
The author of TinyCLOS, Gregor Kiczales, describes TinyCLOS as: - "Tiny CLOS is a Scheme implementation of a `kernelized' CLOS, with a - metaobject protocol. The implementation is even simpler than - the simple CLOS found in `The Art of the Metaobject Protocol,' - weighing in at around 850 lines of code, including (some) - comments and documentation." + "Tiny CLOS is a Scheme implementation of a `kernelized' CLOS, with a + metaobject protocol. The implementation is even simpler than + the simple CLOS found in `The Art of the Metaobject Protocol,' + weighing in at around 850 lines of code, including (some) + comments and documentation."
diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html index d3ddecbb1..8705534f9 100644 --- a/Doc/Manual/Customization.html +++ b/Doc/Manual/Customization.html @@ -116,16 +116,18 @@ static char error_message[256]; static int error_status = 0; void throw_exception(char *msg) { - strncpy(error_message,msg,256); - error_status = 1; + strncpy(error_message,msg,256); + error_status = 1; } void clear_exception() { - error_status = 0; + error_status = 0; } char *check_exception() { - if (error_status) return error_message; - else return NULL; + if (error_status) + return error_message; + else + return NULL; }
double inv(double x) {
- if (x != 0) return 1.0/x;
- else {
- throw_exception("Division by zero");
- return 0;
- }
+ if (x != 0)
+ return 1.0/x;
+ else {
+ throw_exception("Division by zero");
+ return 0;
+ }
}
-
@@ -152,12 +154,12 @@ as the following (shown for Perl5) :
%exception {
- char *err;
- clear_exception();
- $action
- if ((err = check_exception())) {
- croak(err);
- }
+ char *err;
+ clear_exception();
+ $action
+ if ((err = check_exception())) {
+ croak(err);
+ }
}
double inv(double x) {
- if (x) return 1.0/x;
- else throw(DivisionByZero);
+ if (x)
+ return 1.0/x;
+ else
+ throw(DivisionByZero);
}
%exception {
- try {
- $action
- } catch(RangeError) {
- croak("Range Error");
- } catch(DivisionByZero) {
- croak("Division by zero");
- } catch(OutOfMemory) {
- croak("Out of memory");
- } catch(...) {
- croak("Unknown exception");
- }
+ try {
+ $action
+ } catch(RangeError) {
+ croak("Range Error");
+ } catch(DivisionByZero) {
+ croak("Division by zero");
+ } catch(OutOfMemory) {
+ croak("Out of memory");
+ } catch(...) {
+ croak("Unknown exception");
+ }
}
%exception {
- ... your exception handler ...
+ ... your exception handler ...
}
/* Define critical operations that can throw exceptions here */
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html
index 52f023f92..ced046c66 100644
--- a/Doc/Manual/Go.html
+++ b/Doc/Manual/Go.html
@@ -477,10 +477,10 @@ objects and fits nicely C++'s RAII idiom. Example:
func UseClassName(...) ... {
- o := NewClassName(...)
- defer DeleteClassName(o)
- // Use the ClassName object
- return ...
+ o := NewClassName(...)
+ defer DeleteClassName(o)
+ // Use the ClassName object
+ return ...
}
@@ -495,17 +495,17 @@ that creates a C++ object and functions called by this function. Example:
func WithClassName(constructor args, f func(ClassName, ...interface{}) error, data ...interface{}) error {
- o := NewClassName(constructor args)
- defer DeleteClassName(o)
- return f(o, data...)
+ o := NewClassName(constructor args)
+ defer DeleteClassName(o)
+ return f(o, data...)
}
func UseClassName(o ClassName, data ...interface{}) (err error) {
- // Use the ClassName object and additional data and return error.
+ // Use the ClassName object and additional data and return error.
}
func main() {
- WithClassName(constructor args, UseClassName, additional data)
+ WithClassName(constructor args, UseClassName, additional data)
}
@@ -547,33 +547,33 @@ problematic with C++ code that uses thread-local storage.
import (
- "runtime"
- "wrap" // SWIG generated wrapper code
+ "runtime"
+ "wrap" // SWIG generated wrapper code
)
type GoClassName struct {
- wcn wrap.ClassName
+ wcn wrap.ClassName
}
func NewGoClassName() *GoClassName {
- o := &GoClassName{wcn: wrap.NewClassName()}
- runtime.SetFinalizer(o, deleteGoClassName)
- return o
+ o := &GoClassName{wcn: wrap.NewClassName()}
+ runtime.SetFinalizer(o, deleteGoClassName)
+ return o
}
func deleteGoClassName(o *GoClassName) {
- // Runs typically in a different OS thread!
- wrap.DeleteClassName(o.wcn)
- o.wcn = nil
+ // Runs typically in a different OS thread!
+ wrap.DeleteClassName(o.wcn)
+ o.wcn = nil
}
func (o *GoClassName) Close() {
- // If the C++ object has a Close method.
- o.wcn.Close()
+ // If the C++ object has a Close method.
+ o.wcn.Close()
- // If the GoClassName object is no longer in an usable state.
- runtime.SetFinalizer(o, nil) // Remove finalizer.
- deleteGoClassName() // Free the C++ object.
+ // If the GoClassName object is no longer in an usable state.
+ runtime.SetFinalizer(o, nil) // Remove finalizer.
+ deleteGoClassName() // Free the C++ object.
}
@@ -635,19 +635,19 @@ explains how to implement a FooBarGo class similar to the FooBarCpp class.
class FooBarAbstract
{
public:
- FooBarAbstract() {};
- virtual ~FooBarAbstract() {};
+ FooBarAbstract() {};
+ virtual ~FooBarAbstract() {};
- std::string FooBar() {
- return this->Foo() + ", " + this->Bar();
- };
+ std::string FooBar() {
+ return this->Foo() + ", " + this->Bar();
+ };
protected:
- virtual std::string Foo() {
- return "Foo";
- };
+ virtual std::string Foo() {
+ return "Foo";
+ };
- virtual std::string Bar() = 0;
+ virtual std::string Bar() = 0;
};
if o.DirectorInterface() != nil {
- DeleteDirectorClassName(o)
+ DeleteDirectorClassName(o)
} else {
- DeleteClassName(o)
+ DeleteClassName(o)
}
type overwrittenMethodsOnFooBarAbstract struct {
- fb FooBarAbstract
+ fb FooBarAbstract
}
func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
- ...
+ ...
}
func (om *overwrittenMethodsOnFooBarAbstract) Bar() string {
- ...
+ ...
}
func NewFooBarGo() FooBarGo {
- om := &overwrittenMethodsOnFooBarAbstract{}
- fb := NewDirectorFooBarAbstract(om)
- om.fb = fb
- ...
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb
+ ...
}
virtual std::string Foo() {
- return "C++ " + FooBarAbstract::Foo();
+ return "C++ " + FooBarAbstract::Foo();
}
func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
- return "Go " + DirectorFooBarAbstractFoo(om.fb)
+ return "Go " + DirectorFooBarAbstractFoo(om.fb)
}
type FooBarGo interface {
- FooBarAbstract
- deleteFooBarAbstract()
- IsFooBarGo()
+ FooBarAbstract
+ deleteFooBarAbstract()
+ IsFooBarGo()
}
type fooBarGo struct {
- FooBarAbstract
+ FooBarAbstract
}
func (fbgs *fooBarGo) deleteFooBarAbstract() {
- DeleteDirectorFooBarAbstract(fbgs.FooBarAbstract)
+ DeleteDirectorFooBarAbstract(fbgs.FooBarAbstract)
}
func (fbgs *fooBarGo) IsFooBarGo() {}
func NewFooBarGo() FooBarGo {
- om := &overwrittenMethodsOnFooBarAbstract{}
- fb := NewDirectorFooBarAbstract(om)
- om.fb = fb
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb
- return &fooBarGo{FooBarAbstract: fb}
+ return &fooBarGo{FooBarAbstract: fb}
}
func DeleteFooBarGo(fbg FooBarGo) {
- fbg.deleteFooBarAbstract()
+ fbg.deleteFooBarAbstract()
}
type overwrittenMethodsOnFooBarAbstract struct {
- fb FooBarAbstract
+ fb FooBarAbstract
}
func NewFooBarGo() FooBarGo {
- om := &overwrittenMethodsOnFooBarAbstract{}
- fb := NewDirectorFooBarAbstract(om) // fb.v = om
- om.fb = fb // Backlink causes cycle as fb.v = om!
- ...
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om) // fb.v = om
+ om.fb = fb // Backlink causes cycle as fb.v = om!
+ ...
}
type fooBarGo struct {
- FooBarAbstract
+ FooBarAbstract
}
type overwrittenMethodsOnFooBarAbstract struct {
- fb FooBarAbstract
+ fb FooBarAbstract
}
func NewFooBarGo() FooBarGo {
- om := &overwrittenMethodsOnFooBarAbstract{}
- fb := NewDirectorFooBarAbstract(om)
- om.fb = fb // Backlink causes cycle as fb.v = om!
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb // Backlink causes cycle as fb.v = om!
- fbgs := &fooBarGo{FooBarAbstract: fb}
- runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
- return fbgs
+ fbgs := &fooBarGo{FooBarAbstract: fb}
+ runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
+ return fbgs
}
(module-map (lambda (sym var) - (module-export! (current-module) (list sym))) - (current-module)) + (module-export! (current-module) (list sym))) + (current-module))
- MAP(SWIG_MemoryError, "swig-memory-error"); - MAP(SWIG_IOError, "swig-io-error"); - MAP(SWIG_RuntimeError, "swig-runtime-error"); - MAP(SWIG_IndexError, "swig-index-error"); - MAP(SWIG_TypeError, "swig-type-error"); - MAP(SWIG_DivisionByZero, "swig-division-by-zero"); - MAP(SWIG_OverflowError, "swig-overflow-error"); - MAP(SWIG_SyntaxError, "swig-syntax-error"); - MAP(SWIG_ValueError, "swig-value-error"); - MAP(SWIG_SystemError, "swig-system-error"); + MAP(SWIG_MemoryError, "swig-memory-error"); + MAP(SWIG_IOError, "swig-io-error"); + MAP(SWIG_RuntimeError, "swig-runtime-error"); + MAP(SWIG_IndexError, "swig-index-error"); + MAP(SWIG_TypeError, "swig-type-error"); + MAP(SWIG_DivisionByZero, "swig-division-by-zero"); + MAP(SWIG_OverflowError, "swig-overflow-error"); + MAP(SWIG_SyntaxError, "swig-syntax-error"); + MAP(SWIG_ValueError, "swig-value-error"); + MAP(SWIG_SystemError, "swig-system-error");
- +
The swig command produced a new file called example_wrap.c that should be compiled along with the example.c file. Most operating systems and scripting @@ -245,8 +246,8 @@ any changes type the following (shown for Solaris):
unix > swig -perl5 example.i unix > gcc -c example.c example_wrap.c \ - -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE -unix > ld -G example.o example_wrap.o -o example.so # This is for Solaris + -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE +unix > ld -G example.o example_wrap.o -o example.so # This is for Solaris unix > perl5.003 use example; print example::fact(4), "\n"; @@ -297,7 +298,7 @@ SWIG on the C header file and specifying a module name as followsunix > swig -perl5 -module example example.h unix > gcc -c example.c example_wrap.c \ - -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE + -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE unix > ld -G example.o example_wrap.o -o example.so unix > perl5.003 use example; diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html index eeedc5d68..83d14ed64 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -464,9 +464,9 @@ If you forget to compile and link in the SWIG wrapper file into your native libr$ java runme Exception in thread "main" java.lang.UnsatisfiedLinkError: exampleJNI.gcd(II)I - at exampleJNI.gcd(Native Method) - at example.gcd(example.java:12) - at runme.main(runme.java:18) + at exampleJNI.gcd(Native Method) + at example.gcd(example.java:12) + at runme.main(runme.java:18)@@ -630,11 +630,11 @@ CFLAGS = /Z7 /Od /c /nologo JAVA_INCLUDE = -ID:\jdk1.3\include -ID:\jdk1.3\include\win32 java:: - swig -java -o $(WRAPFILE) $(INTERFACE) - $(CC) $(CFLAGS) $(JAVA_INCLUDE) $(SRCS) $(WRAPFILE) - set LIB=$(TOOLS)\lib - $(LINK) $(LOPT) -out:example.dll $(LIBS) example.obj example_wrap.obj - javac *.java + swig -java -o $(WRAPFILE) $(INTERFACE) + $(CC) $(CFLAGS) $(JAVA_INCLUDE) $(SRCS) $(WRAPFILE) + set LIB=$(TOOLS)\lib + $(LINK) $(LOPT) -out:example.dll $(LIBS) example.obj example_wrap.obj + javac *.java
@@ -1340,7 +1340,7 @@ member variables. For example,
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html index 3a4b6d69b..56f83b763 100644 --- a/Doc/Manual/Javascript.html +++ b/Doc/Manual/Javascript.html @@ -349,7 +349,7 @@ It has some extras to configurestruct Vector { - double x,y,z; + double x,y,z; };node-webkit. See the@@ -369,7 +369,7 @@ The'main'property ofpackage.jsonspecifies a web-pa the main window.-
app.html: +app.html:@@ -396,7 +396,7 @@ open new windows, and many more things.@@ -599,10 +599,10 @@ This interface file class Vector { public: - double x,y,z; - Vector(); - ~Vector(); - double magnitude(); + double x,y,z; + Vector(); + ~Vector(); + double magnitude(); }; struct Complex { @@ -722,7 +722,7 @@ returns the current value of the class variable. For example %module example class Ko { - static int threats; + static int threats; };-
app.js: +app.js:diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html index baee4ddf1..0867ba926 100644 --- a/Doc/Manual/Lisp.html +++ b/Doc/Manual/Lisp.html @@ -220,19 +220,19 @@ The generated SWIG Code will be: (cl:defconstant x (cl:ash 5 -1)) (cffi:defcstruct bar - (p :short) - (q :short) - (a :char) - (b :char) - (z :pointer) - (n :pointer)) + (p :short) + (q :short) + (a :char) + (b :char) + (z :pointer) + (n :pointer)) (cffi:defcvar ("my_struct" my_struct) :pointer) (cffi:defcstruct foo - (a :int) - (b :pointer)) + (a :int) + (b :pointer)) (cffi:defcfun ("pointer_func" pointer_func) :int (ClosureFun :pointer) @@ -248,9 +248,9 @@ The generated SWIG Code will be: (array :pointer)) (cffi:defcenum color - :RED - :BLUE - :GREEN) + :RED + :BLUE + :GREEN)@@ -336,12 +336,12 @@ The feature intern_function ensures that all C names are (cl:export '#.(swig-lispify "x" 'constant)) (cffi:defcstruct #.(swig-lispify "bar" 'classname) - (#.(swig-lispify "p" 'slotname) :short) - (#.(swig-lispify "q" 'slotname) :short) - (#.(swig-lispify "a" 'slotname) :char) - (#.(swig-lispify "b" 'slotname) :char) - (#.(swig-lispify "z" 'slotname) :pointer) - (#.(swig-lispify "n" 'slotname) :pointer)) + (#.(swig-lispify "p" 'slotname) :short) + (#.(swig-lispify "q" 'slotname) :short) + (#.(swig-lispify "a" 'slotname) :char) + (#.(swig-lispify "b" 'slotname) :char) + (#.(swig-lispify "z" 'slotname) :pointer) + (#.(swig-lispify "n" 'slotname) :pointer)) (cl:export '#.(swig-lispify "bar" 'classname)) @@ -363,8 +363,8 @@ The feature intern_function ensures that all C names are (cl:export '#.(swig-lispify "my_struct" 'variable)) (cffi:defcstruct #.(swig-lispify "foo" 'classname) - (#.(swig-lispify "a" 'slotname) :int) - (#.(swig-lispify "b" 'slotname) :pointer)) + (#.(swig-lispify "a" 'slotname) :int) + (#.(swig-lispify "b" 'slotname) :pointer)) (cl:export '#.(swig-lispify "foo" 'classname)) @@ -388,9 +388,9 @@ The feature intern_function ensures that all C names are (cl:export '#.(my-lispify "lispsort_double" 'function) 'some-other-package) (cffi:defcenum #.(swig-lispify "color" 'enumname) - #.(swig-lispify "RED" 'enumvalue :keyword) - #.(swig-lispify "BLUE" 'enumvalue :keyword) - #.(swig-lispify "GREEN" 'enumvalue :keyword)) + #.(swig-lispify "RED" 'enumvalue :keyword) + #.(swig-lispify "BLUE" 'enumvalue :keyword) + #.(swig-lispify "GREEN" 'enumvalue :keyword)) (cl:export '#.(swig-lispify "color" 'enumname)) @@ -662,14 +662,14 @@ swig -clisp -help
-extern-all If this option is given then clisp definitions for all the functions
and global variables will be created otherwise only definitions for
- externed functions and variables are created. +externed functions and variables are created.@@ -680,15 +680,15 @@ and global variables will be created otherwise only definitions for -generate-typedef If this option is given then def-c-type will be used to generate
- shortcuts according to the typedefs in the input. +shortcuts according to the typedefs in the input.
As mentioned earlier the CLISP bindings generated by SWIG may need - some modifications. The clisp module creates a lisp file with - the same name as the module name. This - lisp file contains a 'defpackage' declaration, with the - package name same as the module name. This package uses the - 'common-lisp' and 'ffi' packages. Also, package exports all - the functions, structures and variables for which an ffi - binding was generated.
- After generating the defpackage statement, the clisp module also - sets the default language. +some modifications. The clisp module creates a lisp file with +the same name as the module name. This +lisp file contains a 'defpackage' declaration, with the +package name same as the module name. This package uses the +'common-lisp' and 'ffi' packages. Also, package exports all +the functions, structures and variables for which an ffi +binding was generated.
+After generating the defpackage statement, the clisp module also +sets the default language.diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index 36f8ca981..8c483b7a0 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -136,8 +136,8 @@ least work for Linux though):(defpackage :test @@ -738,18 +738,18 @@ void test123(float x , double y); (ffi:def-call-out pointer_func (:name "pointer_func") (:arguments (ClosureFun (ffi:c-function (:arguments (arg0 (ffi:c-pointer NIL)) - (arg1 (ffi:c-pointer NIL)) - (arg2 (ffi:c-pointer NIL))) - (:return-type NIL))) - (y ffi:int)) + (arg1 (ffi:c-pointer NIL)) + (arg2 (ffi:c-pointer NIL))) + (:return-type NIL))) + (y ffi:int)) (:return-type ffi:int) (:library +library-name+)) (ffi:def-call-out func123 (:name "func123") (:arguments (x (ffi:c-pointer div_t)) - (z (ffi:c-ptr (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100))) - (y (ffi:c-ptr (ffi:c-ptr (ffi:c-array ffi:int (1000 10)))))) + (z (ffi:c-ptr (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100))) + (y (ffi:c-ptr (ffi:c-ptr (ffi:c-array ffi:int (1000 10)))))) (:return-type ffi:int) (:library +library-name+)) @@ -757,14 +757,14 @@ void test123(float x , double y); (ffi:def-call-out lispsort_double (:name "lispsort_double") (:arguments (n ffi:int) - (array (ffi:c-ptr DOUBLE-FLOAT))) + (array (ffi:c-ptr DOUBLE-FLOAT))) (:return-type NIL) (:library +library-name+)) (ffi:def-call-out test123 (:name "test") (:arguments (x SINGLE-FLOAT) - (y DOUBLE-FLOAT)) + (y DOUBLE-FLOAT)) (:return-type NIL) (:library +library-name+)) diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html index 8639e5f9e..004ca6f2b 100644 --- a/Doc/Manual/Lua.html +++ b/Doc/Manual/Lua.html @@ -202,8 +202,8 @@ int main(int argc,char* argv[]) return 0; } L=lua_open(); - luaopen_base(L); // load basic libs (eg. print) - luaopen_example(L); // load the wrapped module + luaopen_base(L); // load basic libs (eg. print) + luaopen_example(L); // load the wrapped module if (luaL_loadfile(L,argv[1])==0) // load and run the file lua_pcall(L,0,0,0); else @@ -1536,8 +1536,8 @@ function@@ -301,7 +301,7 @@ for a dynamic module, but change the link line to something like this:%module example %typemap(in) int { - $1 = (int) lua_tonumber(L,$input); - printf("Received an integer : %d\n",$1); + $1 = (int) lua_tonumber(L,$input); + printf("Received an integer : %d\n",$1); } %inline %{ extern int fact(int n); diff --git a/Doc/Manual/Mzscheme.html b/Doc/Manual/Mzscheme.html index 5b589cef1..c5c199262 100644 --- a/Doc/Manual/Mzscheme.html +++ b/Doc/Manual/Mzscheme.html @@ -56,12 +56,12 @@ Then in scheme, you can use regular struct access procedures likediff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html index 07b3ffc1f..e489c4147 100644 --- a/Doc/Manual/Ocaml.html +++ b/Doc/Manual/Ocaml.html @@ -308,19 +308,19 @@ A few functions exist which generate and return these:- ; suppose a function created a struct foo as - ; (define foo (make-diag-cntrs (#x1 #x2 #x3) (make-inspector)) - ; Then you can do - (format "0x~x" (diag-cntrs-field1 foo)) - (format "0x~x" (diag-cntrs-field2 foo)) - ;etc... + ; suppose a function created a struct foo as + ; (define foo (make-diag-cntrs (#x1 #x2 #x3) (make-inspector)) + ; Then you can do + (format "0x~x" (diag-cntrs-field1 foo)) + (format "0x~x" (diag-cntrs-field2 foo)) + ;etc...
- caml_ptr_val receives a c_obj and returns a void *. This - should be used for all pointer purposes.
+ should be used for all pointer purposes.- caml_long_val receives a c_obj and returns a long. This - should be used for most integral purposes.
+ should be used for most integral purposes.- caml_val_ptr receives a void * and returns a c_obj.
- caml_val_bool receives a C int and returns a c_obj representing - its bool value.
+ its bool value.- caml_val_(u)?(char|short|int|long|float|double) receives an - appropriate C value and returns a c_obj representing it.
+ appropriate C value and returns a c_obj representing it.- caml_val_string receives a char * and returns a string value.
- caml_val_string_len receives a char * and a length and returns - a string value.
+ a string value.- caml_val_obj receives a void * and an object type and returns - a C_obj, which contains a closure giving method access.
+ a C_obj, which contains a closure giving method access.@@ -544,24 +544,24 @@ into this type of function convenient. #include <stdio.h> void printfloats( float *tab, int len ) { - int i; + int i; - for( i = 0; i < len; i++ ) { - printf( "%f ", tab[i] ); - } + for( i = 0; i < len; i++ ) { + printf( "%f ", tab[i] ); + } - printf( "\n" ); + printf( "\n" ); } %} %typemap(in) (float *tab, int len) { - int i; - /* $*1_type */ - $2 = caml_array_len($input); - $1 = ($*1_type *)malloc( $2 * sizeof( float ) ); - for( i = 0; i < $2; i++ ) { - $1[i] = caml_double_val(caml_array_nth($input,i)); - } + int i; + /* $*1_type */ + $2 = caml_array_len($input); + $1 = ($*1_type *)malloc( $2 * sizeof( float ) ); + for( i = 0; i < $2; i++ ) { + $1[i] = caml_double_val(caml_array_nth($input,i)); + } } void printfloats( float *tab, int len ); @@ -640,7 +640,7 @@ length. Instead, use multiple returns, as in the argout_ref example. %include <stl.i> namespace std { - %template(StringVector) std::vector < string >; + %template(StringVector) std::vector < string >; }; %include "example.h" @@ -715,16 +715,16 @@ Here's a simple example using Trolltech's Qt Library: %} class QApplication { public: - QApplication( int argc, char **argv ); - void setMainWidget( QWidget *widget ); - void exec(); + QApplication( int argc, char **argv ); + void setMainWidget( QWidget *widget ); + void exec(); }; class QPushButton { public: - QPushButton( char *str, QWidget *w ); - void resize( int x, int y ); - void show(); + QPushButton( char *str, QWidget *w ); + void resize( int x, int y ); + void show(); }; @@ -848,9 +848,9 @@ let triangle_class pts ob meth args = "cover" -> (match args with C_list [ x_arg ; y_arg ] -> - let xa = x_arg as float - and ya = y_arg as float in - (point_in_triangle pts xa ya) to bool + let xa = x_arg as float + and ya = y_arg as float in + (point_in_triangle pts xa ya) to bool | _ -> raise (Failure "cover needs two double arguments.")) | _ -> (invoke ob) meth args ;; diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html index 4bb2b84c7..8d7b866d6 100644 --- a/Doc/Manual/Perl5.html +++ b/Doc/Manual/Perl5.html @@ -220,9 +220,9 @@ script such as the following:
# File : Makefile.PL use ExtUtils::MakeMaker; WriteMakefile( - `NAME' => `example', # Name of package - `LIBS' => [`-lm'], # Name of custom libraries - `OBJECT' => `example.o example_wrap.o' # Object files + `NAME' => `example', # Name of package + `LIBS' => [`-lm'], # Name of custom libraries + `OBJECT' => `example.o example_wrap.o' # Object files );$ gcc example.o example_wrap.o -L/usr/lib/perl/5.14/CORE \ - -lperl -lsocket -lnsl -lm -o myperl + -lperl -lsocket -lnsl -lm -o myperl@@ -892,9 +892,9 @@ To check to see if a value is the NULL pointer, use the
@@ -917,9 +917,9 @@ dereference them as follows:if (defined($ptr)) { - print "Not a NULL pointer."; + print "Not a NULL pointer."; } else { - print "Is a NULL pointer."; + print "Is a NULL pointer."; }@@ -978,7 +978,7 @@ accessor functions as described in the "SWIG Basics" chapter. For example,if ($$a == $$b) { - print "a and b point to the same thing in C"; + print "a and b point to the same thing in C"; } else { - print "a and b point to different objects."; + print "a and b point to different objects."; }@@ -1259,17 +1259,17 @@ The following C++ operators are currently supported by the Perl module:struct Vector { - double x,y,z; + double x,y,z; };-
@@ -1783,8 +1783,8 @@ you might define a typemap like this: %module example %typemap(in) int { - $1 = (int) SvIV($input); - printf("Received an integer : %d\n", $1); + $1 = (int) SvIV($input); + printf("Received an integer : %d\n", $1); } ... %inline %{ @@ -1829,8 +1829,8 @@ the typemap system follows typedef declarations. For example:- operator++
-- operator--
-- operator+
-- operator-
-- operator*
-- operator/
-- operator==
-- operator!=
-- operator%
-- operator>
-- operator<
+- operator++
+- operator--
+- operator+
+- operator-
+- operator*
+- operator/
+- operator==
+- operator!=
+- operator%
+- operator>
+- operator<
- operator and
- operator or
@@ -2867,23 +2868,23 @@ interface file: class Shape { public: - virtual double area() = 0; - virtual double perimeter() = 0; - void set_location(double x, double y); + virtual double area() = 0; + virtual double perimeter() = 0; + void set_location(double x, double y); }; class Circle : public Shape { public: - Circle(double radius); - ~Circle(); - double area(); - double perimeter(); + Circle(double radius); + ~Circle(); + double area(); + double perimeter(); }; class Square : public Shape { public: - Square(double size); - ~Square(); - double area(); - double perimeter(); + Square(double size); + ~Square(); + double area(); + double perimeter(); }%typemap(in) int n { - $1 = (int) SvIV($input); - printf("n = %d\n",$1); + $1 = (int) SvIV($input); + printf("n = %d\n",$1); } %inline %{ typedef int Integer; @@ -2143,47 +2143,47 @@ reference to be used as a char ** datatype. // This tells SWIG to treat char ** as a special case %typemap(in) char ** { - AV *tempav; - I32 len; - int i; - SV **tv; - if (!SvROK($input)) - croak("Argument $argnum is not a reference."); - if (SvTYPE(SvRV($input)) != SVt_PVAV) - croak("Argument $argnum is not an array."); - tempav = (AV*)SvRV($input); - len = av_len(tempav); - $1 = (char **) malloc((len+2)*sizeof(char *)); - for (i = 0; i <= len; i++) { - tv = av_fetch(tempav, i, 0); - $1[i] = (char *) SvPV(*tv,PL_na); - } - $1[i] = NULL; + AV *tempav; + I32 len; + int i; + SV **tv; + if (!SvROK($input)) + croak("Argument $argnum is not a reference."); + if (SvTYPE(SvRV($input)) != SVt_PVAV) + croak("Argument $argnum is not an array."); + tempav = (AV*)SvRV($input); + len = av_len(tempav); + $1 = (char **) malloc((len+2)*sizeof(char *)); + for (i = 0; i <= len; i++) { + tv = av_fetch(tempav, i, 0); + $1[i] = (char *) SvPV(*tv,PL_na); + } + $1[i] = NULL; }; // This cleans up the char ** array after the function call %typemap(freearg) char ** { - free($1); + free($1); } // Creates a new Perl array and places a NULL-terminated char ** into it %typemap(out) char ** { - AV *myav; - SV **svs; - int i = 0,len = 0; - /* Figure out how many elements we have */ - while ($1[len]) - len++; - svs = (SV **) malloc(len*sizeof(SV *)); - for (i = 0; i < len ; i++) { - svs[i] = sv_newmortal(); - sv_setpv((SV*)svs[i],$1[i]); - }; - myav = av_make(len,svs); - free(svs); - $result = newRV_noinc((SV*)myav); - sv_2mortal($result); - argvi++; + AV *myav; + SV **svs; + int i = 0,len = 0; + /* Figure out how many elements we have */ + while ($1[len]) + len++; + svs = (SV **) malloc(len*sizeof(SV *)); + for (i = 0; i < len ; i++) { + svs[i] = sv_newmortal(); + sv_setpv((SV*)svs[i],$1[i]); + }; + myav = av_make(len,svs); + free(svs); + $result = newRV_noinc((SV*)myav); + sv_2mortal($result); + argvi++; } // Now a few test functions @@ -2240,12 +2240,12 @@ can be done using the EXTEND() macro as in:@@ -2264,24 +2264,24 @@ its arguments. This example describes the implementation of the OUTPUT // an output value. %typemap(argout) double *OUTPUT { - $result = sv_newmortal(); - sv_setnv($result, *$input); - argvi++; /* Increment return count -- important! */ + $result = sv_newmortal(); + sv_setnv($result, *$input); + argvi++; /* Increment return count -- important! */ } // We don't care what the input value is. Ignore, but set to a temporary variable %typemap(in,numinputs=0) double *OUTPUT(double junk) { - $1 = &junk; + $1 = &junk; } // Now a function to test it %{ /* Returns the first two input arguments */ int multout(double a, double b, double *out1, double *out2) { - *out1 = a; - *out2 = b; - return 0; + *out1 = a; + *out2 = b; + return 0; }; %} @@ -2377,7 +2377,7 @@ have a C function that modifies its arguments like this:%typemap(argout) int *OUTPUT { - if (argvi >= items) { - EXTEND(sp,1); /* Extend the stack by 1 object */ - } - $result = sv_newmortal(); - sv_setiv($target,(IV) *($1)); - argvi++; + if (argvi >= items) { + EXTEND(sp,1); /* Extend the stack by 1 object */ + } + $result = sv_newmortal(); + sv_setiv($target,(IV) *($1)); + argvi++; }@@ -2558,9 +2558,9 @@ Suppose you have the following SWIG interface file:void add(double a, double b, double *c) { - *c = a + b; + *c = a + b; }@@ -2610,8 +2610,9 @@ sub DESTROY { my $self = tied(%{$_[0]}); delete $ITERATORS{$self}; if (exists $OWNER{$self}) { - examplec::delete_Vector($self)); - delete $OWNER{$self}; + examplec::delete_Vector($self)); + delete $OWNER{$self}; + } } sub FETCH { @@ -2663,8 +2664,8 @@ $v->{x} = 7.5; # Assignment of all members %$v = ( x=>3, - y=>9, - z=>-2); + y=>9, + z=>-2); # Reading members $x = $v->{x}; @@ -2685,7 +2686,7 @@ problem---suppose you had a function like this:%module example struct Vector { - Vector(double x, double y, double z); - ~Vector(); - double x,y,z; + Vector(double x, double y, double z); + ~Vector(); + double x,y,z; };@@ -2698,9 +2699,9 @@ Vector object:Vector *Vector_get(Vector *v, int index) { - return &v[i]; + return &v[i]; }@@ -2770,10 +2771,10 @@ Suppose that we have a new object that looks like this:Vector *new_Vector(double x, double y, double z) { - Vector *v; - v = new Vector(x,y,z); // Call C++ constructor - return v; + Vector *v; + v = new Vector(x,y,z); // Call C++ constructor + return v; }@@ -2789,9 +2790,9 @@ look like this (along with some supporting code): package Particle; ... %BLESSEDMEMBERS = ( - r => `Vector', - v => `Vector', - f => `Vector', + r => `Vector', + v => `Vector', + f => `Vector', );struct Particle { - Vector r; - Vector v; - Vector f; - int type; + Vector r; + Vector v; + Vector f; + int type; }- gcc `php-config --includes` -fpic -c example_wrap.c example.c - gcc -shared example_wrap.o example.o -o example.so + gcc `php-config --includes` -fpic -c example_wrap.c example.c + gcc -shared example_wrap.o example.o -o example.so34.1.2 Using PHP Extensions
@@ -150,7 +150,7 @@ load it. To do this, add a line like this to the [PHP] section of- extension=/path/to/modulename.so + extension=/path/to/modulename.so@@ -165,7 +165,7 @@ PHP script which uses your extension:
- dl("/path/to/modulename.so"); // Load the module + dl("/path/to/modulename.so"); // Load the module@@ -180,7 +180,7 @@ call for you if the extension isn't already loaded:
- include("example.php"); + include("example.php");@@ -249,7 +249,7 @@ For example,
@@ -262,9 +262,9 @@ accessed incorrectly in PHP, include("example.php"); if(EASY_TO_MISPEL) { - .... + ... } else { - .... + ... } @@ -303,7 +303,7 @@ is accessed as follows:%module example -#define EASY_TO_MISPELL 0 +#define EASY_TO_MISPELL 0@@ -348,7 +348,7 @@ Will be accessed in PHP like this : include("example.php"); $a = foo(2); $b = bar(3.5, -1.5); -$c = bar(3.5); # Use default argument for 2nd parameter +$c = bar(3.5); # Use default argument for 2nd parameterinclude("example.php"); print seki_get(); -seki_set( seki_get() * 2); # The C variable is now 4. +seki_set( seki_get() * 2); # The C variable is now 4. print seki_get();
@@ -1286,7 +1286,7 @@ a very natural interface. For example,
struct Vector {
- double x,y,z;
+ double x,y,z;
};
%typemap(in) int n {
- $1 = (int) PyLong_AsLong($input);
- printf("n = %d\n",$1);
+ $1 = (int) PyLong_AsLong($input);
+ printf("n = %d\n",$1);
}
%inline %{
typedef int Integer;
@@ -4685,11 +4685,11 @@ object to be used as a char ** object.
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem($input,i);
if (PyString_Check(o))
- $1[i] = PyString_AsString(PyList_GetItem($input,i));
+ $1[i] = PyString_AsString(PyList_GetItem($input,i));
else {
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
- free($1);
- return NULL;
+ PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ free($1);
+ return NULL;
}
}
$1[i] = 0;
@@ -4784,11 +4784,11 @@ previous example:
for (i = 0; i < $1; i++) {
PyObject *o = PyList_GetItem($input,i);
if (PyString_Check(o))
- $2[i] = PyString_AsString(PyList_GetItem($input,i));
+ $2[i] = PyString_AsString(PyList_GetItem($input,i));
else {
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
- free($2);
- return NULL;
+ PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ free($2);
+ return NULL;
}
}
$2[i] = 0;
@@ -4832,10 +4832,10 @@ arguments rather than in the return value of a function. For example:
/* Returns a status value and two values in out1 and out2 */
int spam(double a, double b, double *out1, double *out2) {
- ... Do a bunch of stuff ...
- *out1 = result1;
- *out2 = result2;
- return status;
+ ... Do a bunch of stuff ...
+ *out1 = result1;
+ *out2 = result2;
+ return status;
}
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index 4d7f92a0f..27580387b 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -4190,10 +4190,10 @@ this:
function_name(int x, int y, Foo foo=nil, Bar bar=nil) -> bool
Parameters:
- x - int
- y - int
- foo - Foo
- bar - Bar
+ x - int
+ y - int
+ foo - Foo
+ bar - Bar
# Copy a file def filecopy(source,target): - f1 = fopen(source,"r") - f2 = fopen(target,"w") - buffer = malloc(8192) - nbytes = fread(buffer,8192,1,f1) - while (nbytes > 0): - fwrite(buffer,8192,1,f2) - nbytes = fread(buffer,8192,1,f1) - free(buffer) - + f1 = fopen(source,"r") + f2 = fopen(target,"w") + buffer = malloc(8192) + nbytes = fread(buffer,8192,1,f1) + while (nbytes > 0): + fwrite(buffer,8192,1,f2) + nbytes = fread(buffer,8192,1,f1) + free(buffer)
@@ -1315,10 +1314,10 @@ gets mapped to an underlying pair of set/get functions like this :
Vector *unit_i_get() {
- return &unit_i;
+ return &unit_i;
}
void unit_i_set(Vector *value) {
- unit_i = *value;
+ unit_i = *value;
}
// File : interface.i -int a; // Can read/write +int a; // Can read/write %immutable; -int b,c,d // Read only variables +int b,c,d; // Read only variables %mutable; -double x,y // read/write +double x,y; // read/write
@@ -2129,8 +2128,8 @@ default arguments are optional in the target language. For example, this functio used in Tcl as follows :
-% plot -3.4 7.5 # Use default value -% plot -3.4 7.5 10 # set color to 10 instead +% plot -3.4 7.5 # Use default value +% plot -3.4 7.5 10 # set color to 10 instead
struct Vector {
- double x,y,z;
+ double x,y,z;
}
double Vector_x_get(struct Vector *obj) {
- return obj->x;
+ return obj->x;
}
double Vector_y_get(struct Vector *obj) {
- return obj->y;
+ return obj->y;
}
double Vector_z_get(struct Vector *obj) {
- return obj->z;
+ return obj->z;
}
void Vector_x_set(struct Vector *obj, double value) {
- obj->x = value;
+ obj->x = value;
}
void Vector_y_set(struct Vector *obj, double value) {
- obj->y = value;
+ obj->y = value;
}
void Vector_z_set(struct Vector *obj, double value) {
- obj->z = value;
+ obj->z = value;
}
typedef struct {
- double x,y,z;
+ double x,y,z;
} Vector;
double Vector_x_get(Vector *obj) {
- return obj->x;
+ return obj->x;
}
typedef struct vector_struct {
- double x,y,z;
+ double x,y,z;
} Vector;
char *Foo_name_get(Foo *obj) {
- return Foo->name;
+ return Foo->name;
}
char *Foo_name_set(Foo *obj, char *c) {
- if (obj->name) free(obj->name);
- obj->name = (char *) malloc(strlen(c)+1);
- strcpy(obj->name,c);
- return obj->name;
+ if (obj->name)
+ free(obj->name);
+ obj->name = (char *) malloc(strlen(c)+1);
+ strcpy(obj->name,c);
+ return obj->name;
}
typedef struct Integer {
- int value;
+ int value;
} Int;
%extend Integer { ... } /* Correct name */
%extend Int { ... } /* Incorrect name */
struct Float {
- float value;
+ float value;
};
typedef struct Float FloatValue;
%extend Float { ... } /* Correct name */
@@ -2866,7 +2866,7 @@ There is one exception to this rule and that is when the struct is anonymously n
typedef struct {
- double value;
+ double value;
} Double;
%extend Double { ... } /* Okay */
@@ -2975,13 +2975,13 @@ Occasionally, a C program will involve structures like this :
typedef struct Object {
- int objtype;
- union {
- int ivalue;
- double dvalue;
- char *strvalue;
- void *ptrvalue;
- } intRep;
+ int objtype;
+ union {
+ int ivalue;
+ double dvalue;
+ char *strvalue;
+ void *ptrvalue;
+ } intRep;
} Object;
@@ -2993,15 +2993,15 @@ following:
typedef union {
- int ivalue;
- double dvalue;
- char *strvalue;
- void *ptrvalue;
+ int ivalue;
+ double dvalue;
+ char *strvalue;
+ void *ptrvalue;
} Object_intRep;
typedef struct Object {
- int objType;
- Object_intRep intRep;
+ int objType;
+ Object_intRep intRep;
} Object;
@@ -3013,16 +3013,16 @@ structures. In this case, functions like this would be created :
Object_intRep *Object_intRep_get(Object *o) {
- return (Object_intRep *) &o->intRep;
+ return (Object_intRep *) &o->intRep;
}
int Object_intRep_ivalue_get(Object_intRep *o) {
- return o->ivalue;
+ return o->ivalue;
}
int Object_intRep_ivalue_set(Object_intRep *o, int value) {
- return (o->ivalue = value);
+ return (o->ivalue = value);
}
double Object_intRep_dvalue_get(Object_intRep *o) {
- return o->dvalue;
+ return o->dvalue;
}
... etc ...
@@ -3229,7 +3229,7 @@ program. For example :
%{
/* Create a new vector */
static Vector *new_Vector() {
- return (Vector *) malloc(sizeof(Vector));
+ return (Vector *) malloc(sizeof(Vector));
}
%}
@@ -3249,7 +3249,7 @@ there is a special inlined form of code block that is used as follows
%inline %{
/* Create a new vector */
Vector *new_Vector() {
- return (Vector *) malloc(sizeof(Vector));
+ return (Vector *) malloc(sizeof(Vector));
}
%}
@@ -3275,7 +3275,7 @@ initialization on module loading, you could write this:
%init %{
- init_variables();
+ init_variables();
%}
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index 82f720b21..73b242fa3 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -530,10 +530,10 @@ functions such as the following :
List * new_List(void) {
- return new List;
+ return new List;
}
void delete_List(List *l) {
- delete l;
+ delete l;
}
@@ -874,7 +874,7 @@ All member functions are roughly translated into accessor functions like this :<
int List_search(List *obj, char *value) {
- return obj->search(value);
+ return obj->search(value);
}
@@ -912,11 +912,11 @@ structures. A pair of accessor functions are effectively created. For example
int List_length_get(List *obj) {
- return obj->length;
+ return obj->length;
}
int List_length_set(List *obj, int value) {
- obj->length = value;
- return value;
+ obj->length = value;
+ return value;
}
@@ -933,7 +933,7 @@ class List {
public:
...
%immutable;
- int length;
+ int length;
%mutable;
...
};
@@ -1231,7 +1231,7 @@ into constants with the classname as a prefix. For example :
class Swig {
public:
- enum {ALE, LAGER, PORTER, STOUT};
+ enum {ALE, LAGER, PORTER, STOUT};
};
@@ -1321,7 +1321,7 @@ a declaration like this :
class Foo {
public:
- double bar(double &a);
+ double bar(double &a);
}
@@ -1331,7 +1331,7 @@ has a low-level accessor
double Foo_bar(Foo *obj, double *a) {
- obj->bar(*a);
+ obj->bar(*a);
}
@@ -1550,24 +1550,24 @@ the full C++ code has been omitted.
class Shape {
public:
- double x,y;
- virtual double area() = 0;
- virtual double perimeter() = 0;
- void set_location(double x, double y);
+ double x,y;
+ virtual double area() = 0;
+ virtual double perimeter() = 0;
+ void set_location(double x, double y);
};
class Circle : public Shape {
public:
- Circle(double radius);
- ~Circle();
- double area();
- double perimeter();
+ Circle(double radius);
+ ~Circle();
+ double area();
+ double perimeter();
};
class Square : public Shape {
public:
- Square(double size);
- ~Square();
- double area();
- double perimeter();
+ Square(double size);
+ ~Square();
+ double area();
+ double perimeter();
}
@@ -2615,7 +2615,7 @@ public:
}
Complex operator*(const Complex &c) const {
return Complex(rpart*c.rpart - ipart*c.ipart,
- rpart*c.ipart + c.rpart*ipart);
+ rpart*c.ipart + c.rpart*ipart);
}
Complex operator-() const {
return Complex(-rpart, -ipart);
@@ -2788,17 +2788,17 @@ example :
class Vector {
public:
- double x,y,z;
- Vector();
- ~Vector();
- ... bunch of C++ methods ...
- %extend {
- char *__str__() {
- static char temp[256];
- sprintf(temp,"[ %g, %g, %g ]", $self->x,$self->y,$self->z);
- return &temp[0];
- }
- }
+ double x,y,z;
+ Vector();
+ ~Vector();
+ ... bunch of C++ methods ...
+ %extend {
+ char *__str__() {
+ static char temp[256];
+ sprintf(temp,"[ %g, %g, %g ]", $self->x,$self->y,$self->z);
+ return &temp[0];
+ }
+ }
};
int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
+ if (n <= 1)
+ return 1;
+ else
+ return n*fact(n-1);
}
-int wrap_fact(ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
- int result;
- int arg0;
- if (argc != 2) {
- interp->result = "wrong # args";
- return TCL_ERROR;
- }
- arg0 = atoi(argv[1]);
- result = fact(arg0);
- sprintf(interp->result,"%d", result);
- return TCL_OK;
+int wrap_fact(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) {
+ int result;
+ int arg0;
+ if (argc != 2) {
+ interp->result = "wrong # args";
+ return TCL_ERROR;
+ }
+ arg0 = atoi(argv[1]);
+ result = fact(arg0);
+ sprintf(interp->result,"%d", result);
+ return TCL_OK;
}
int Wrap_Init(Tcl_Interp *interp) {
- Tcl_CreateCommand(interp, "fact", wrap_fact, (ClientData) NULL,
- (Tcl_CmdDeleteProc *) NULL);
- return TCL_OK;
+ Tcl_CreateCommand(interp, "fact", wrap_fact, (ClientData) NULL,
+ (Tcl_CmdDeleteProc *) NULL);
+ return TCL_OK;
}
struct Vector {
- Vector();
- ~Vector();
- double x,y,z;
+ Vector();
+ ~Vector();
+ double x,y,z;
};
class Vector {
public:
- Vector();
- ~Vector();
- double x,y,z;
+ Vector();
+ ~Vector();
+ double x,y,z;
};
struct Vector {
- double x,y,z;
+ double x,y,z;
};
%typemap(in) int n {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR) return TCL_ERROR;
- printf("n = %d\n",$1);
+ if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ return TCL_ERROR;
+ printf("n = %d\n",$1);
}
%inline %{
typedef int Integer;
@@ -2976,10 +2979,10 @@ work)
%typemap(in) int, short, long {
- int temp;
- if (Tcl_GetIntFromObj(interp, $input, &temp) == TCL_ERROR)
- return TCL_ERROR;
- $1 = ($1_ltype) temp;
+ int temp;
+ if (Tcl_GetIntFromObj(interp, $input, &temp) == TCL_ERROR)
+ return TCL_ERROR;
+ $1 = ($1_ltype) temp;
}
@@ -3154,8 +3157,8 @@ subdirectory which has the same name as the package. For example :
./example/
- pkgIndex.tcl # The file created by pkg_mkIndex
- example.so # The SWIG generated module
+ pkgIndex.tcl # The file created by pkg_mkIndex
+ example.so # The SWIG generated module
@@ -3265,14 +3268,14 @@ Our script allows easy array access as follows :
set a [Array double 100] ;# Create a double [100]
for {set i 0} {$i < 100} {incr i 1} { ;# Clear the array
- $a set $i 0.0
+ $a set $i 0.0
}
$a set 3 3.1455 ;# Set an individual element
set b [$a get 10] ;# Retrieve an element
set ia [Array int 50] ;# Create an int[50]
for {set i 0} {$i < 50} {incr i 1} { ;# Clear it
- $ia set $i 0
+ $ia set $i 0
}
$ia set 3 7 ;# Set an individual element
set ib [$ia get 10] ;# Get an individual element
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index 6dfc5d05d..0dc725a9f 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -3051,8 +3051,8 @@ For example, suppose you had a structure like this:
struct SomeObject {
- float value[4];
- ...
+ float value[4];
+ ...
};
@@ -3166,9 +3166,9 @@ checking the values of function arguments. For example:
%module math
%typemap(check) double posdouble {
- if ($1 < 0) {
- croak("Expecting a positive number");
- }
+ if ($1 < 0) {
+ croak("Expecting a positive number");
+ }
}
...
@@ -4511,22 +4511,22 @@ The following excerpt from the Python module illustrates this:
/* Note: %typecheck(X) is a macro for %typemap(typecheck,precedence=X) */
%typecheck(SWIG_TYPECHECK_INTEGER)
- int, short, long,
- unsigned int, unsigned short, unsigned long,
- signed char, unsigned char,
- long long, unsigned long long,
- const int &, const short &, const long &,
- const unsigned int &, const unsigned short &, const unsigned long &,
- const long long &, const unsigned long long &,
- enum SWIGTYPE,
- bool, const bool &
+ int, short, long,
+ unsigned int, unsigned short, unsigned long,
+ signed char, unsigned char,
+ long long, unsigned long long,
+ const int &, const short &, const long &,
+ const unsigned int &, const unsigned short &, const unsigned long &,
+ const long long &, const unsigned long long &,
+ enum SWIGTYPE,
+ bool, const bool &
{
$1 = (PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
}
%typecheck(SWIG_TYPECHECK_DOUBLE)
- float, double,
- const float &, const double &
+ float, double,
+ const float &, const double &
{
$1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
}
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index 78689c2fb..1c99804f1 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -636,7 +636,7 @@ example. For example:
PyObject *o = PyTuple_GetItem(varargs,i);
if (!PyString_Check(o)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
- free(argv);
+ free(argv);
return NULL;
}
argv[i] = PyString_AsString(o);
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index d7c1932b7..b95105bdd 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -164,7 +164,7 @@ PYTHON_LIB: D:\python21\libs\python21.lib
TCL_INCLUDE : Set this to the directory containing tcl.h
TCL_LIB : Set this to the TCL library including path for linking
-Example using ActiveTcl 8.3.3.3
+Example using ActiveTcl 8.3.3.3
TCL_INCLUDE: D:\tcl\include
TCL_LIB: D:\tcl\lib\tcl83.lib