diff --git a/Doc/Manual/Allegrocl.html b/Doc/Manual/Allegrocl.html index 664e720c8..a11d2f407 100644 --- a/Doc/Manual/Allegrocl.html +++ b/Doc/Manual/Allegrocl.html @@ -526,8 +526,8 @@ interested in generating an interface to C++.
%module ffargs
-%ffargs(strings_convert="nil",call_direct="t") foo;
-%ffargs(strings_convert="nil",release_heap=":never",optimize_for_space="t") bar;
+%ffargs(strings_convert="nil", call_direct="t") foo;
+%ffargs(strings_convert="nil", release_heap=":never", optimize_for_space="t") bar;
int foo(float f1, float f2);
int foo(float f1, char c2);
@@ -1357,7 +1357,7 @@ EXPORT float ACL___xxx__SWIG_0 (int larg1, int larg2) {
arg1 = larg1;
arg2 = larg2;
try {
- result = (float)xxx(arg1,arg2);
+ result = (float)xxx(arg1, arg2);
lresult = result;
return lresult;
@@ -1393,7 +1393,7 @@ EXPORT float ACL___xxx__SWIG_2 (A *larg1, int larg2) {
arg1 = larg1;
arg2 = larg2;
try {
- result = (float)xxx(arg1,arg2);
+ result = (float)xxx(arg1, arg2);
lresult = result;
return lresult;
@@ -1526,8 +1526,8 @@ overload>
%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->*;
diff --git a/Doc/Manual/Android.html b/Doc/Manual/Android.html
index 8838e67a9..b295b5e04 100644
--- a/Doc/Manual/Android.html
+++ b/Doc/Manual/Android.html
@@ -354,7 +354,7 @@ Modify the nativeCall method in src/org/swig/simple/SwigSimple.java
int x = 42;
int y = 105;
- int g = example.gcd(x,y);
+ int g = example.gcd(x, y);
outputText.append("The greatest common divisor of " + x + " and " + y + " is " + g + "\n");
// Manipulate the Foo global variable
@@ -661,7 +661,7 @@ public class SwigClass extends Activity
// ----- Call some methods -----
outputText.append( "\nHere are some properties of the shapes:\n" );
- Shape[] shapes = {c,s};
+ Shape[] shapes = {c, s};
for (int i=0; i<shapes.length; i++)
{
outputText.append( " " + shapes[i].toString() + "\n" );
diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html
index 48ec5c629..9dae9fdcd 100644
--- a/Doc/Manual/Arguments.html
+++ b/Doc/Manual/Arguments.html
@@ -100,7 +100,7 @@ like this (shown for Python):
->>> a = add(3,4)
+>>> a = add(3, 4)
>>> print a
7
>>>
@@ -148,7 +148,7 @@ For example, consider this code:
%include "typemaps.i"
%apply int *OUTPUT { int *width, int *height };
-// Returns a pair (width,height)
+// Returns a pair (width, height)
void getwinsize(int winid, int *width, int *height);
@@ -158,7 +158,7 @@ In this case, the function returns multiple values, allowing it to be used like
->>> w,h = genwinsize(wid)
+>>> w, h = genwinsize(wid)
>>> print w
400
>>> print h
@@ -245,7 +245,7 @@ When the function is used in the scripting language interpreter, it will work li
-result = add(3,4)
+result = add(3, 4)
10.1.3 Output parameters
diff --git a/Doc/Manual/CPlusPlus11.html b/Doc/Manual/CPlusPlus11.html
index bfac7aa5b..4d4261cd7 100644
--- a/Doc/Manual/CPlusPlus11.html
+++ b/Doc/Manual/CPlusPlus11.html
@@ -203,7 +203,7 @@ public:
And then call this constructor from your target language, for example, in Python, the following will call the constructor taking the std::vector:
->>> c = Container( [1,2,3,4] )
+>>> c = Container( [1, 2, 3, 4] )
@@ -392,7 +392,7 @@ auto SomeStruct::FuncName(int x, int y) -> int {
>>> a = SomeStruct()
->>> a.FuncName(10,5)
+>>> a.FuncName(10, 5)
15
@@ -1057,7 +1057,7 @@ It does not involve std::function.
t = Test()
-b = t(1,2) # invoke C++ function object
+b = t(1, 2) # invoke C++ function object
7.3.9 Type traits for metaprogramming
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 2707cb4a6..90b4198bd 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -602,7 +602,7 @@ For the %array_functions example, the equivalent usage would be:
SWIGTYPE_p_double a = example.new_doubleArray(10); // Create an array
for (int i=0; i<10; i++)
- example.doubleArray_setitem(a,i,2*i); // Set a value
+ example.doubleArray_setitem(a, i, 2*i); // Set a value
example.print_array(a); // Pass to C
example.delete_doubleArray(a); // Destroy array
@@ -1684,7 +1684,7 @@ void SwigDirector_Base::BaseBoolMethod(Base const &b, bool flag) {
unsigned int jflag ;
if (!swig_callbackBaseBoolMethod) {
- Base::BaseBoolMethod(b,flag);
+ Base::BaseBoolMethod(b, flag);
return;
} else {
jb = (Base *) &b;
@@ -2160,7 +2160,7 @@ The typemaps to achieve this are shown below.
%typemap(cstype) CDate & "out System.DateTime"
%typemap(csin,
pre=" CDate temp$csinput = new CDate();",
- post=" $csinput = new System.DateTime(temp$csinput.getYear(),"
+ post=" $csinput = new System.DateTime(temp$csinput.getYear(), "
" temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);",
cshin="out $csinput"
) CDate &
@@ -2266,7 +2266,7 @@ will be possible with the following CDate * typemaps
%typemap(csin,
pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);",
- post=" $csinput = new System.DateTime(temp$csinput.getYear(),"
+ post=" $csinput = new System.DateTime(temp$csinput.getYear(), "
" temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);",
cshin="ref $csinput"
) CDate *
@@ -2305,7 +2305,7 @@ The subtractYears method is nearly identical to the above addYears<
%typemap(csin,
pre=" using (CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day)) {",
- post=" $csinput = new System.DateTime(temp$csinput.getYear(),"
+ post=" $csinput = new System.DateTime(temp$csinput.getYear(), "
" temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);",
terminator=" } // terminate temp$csinput using block",
cshin="ref $csinput"
@@ -2377,7 +2377,7 @@ The typemap type required is thus CDate *. Given that the previous sect
%typemap(csin,
pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);",
- post=" $csinput = new System.DateTime(temp$csinput.getYear(),"
+ post=" $csinput = new System.DateTime(temp$csinput.getYear(), "
" temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);",
cshin="ref $csinput"
) CDate *
diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html
index 820d01fde..d7ca2a5ae 100644
--- a/Doc/Manual/Chicken.html
+++ b/Doc/Manual/Chicken.html
@@ -297,7 +297,7 @@
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,'
+ the simple CLOS found in `The Art of the Metaobject Protocol, '
weighing in at around 850 lines of code, including (some)
comments and documentation."
@@ -420,7 +420,7 @@ See the
Loading-extension-libraries in the eval unit inside the CHICKEN manual for more information.
Another alternative is to run SWIG normally and create a scheme file that contains (declare (uses modname))
-and then compile that file into the shared library as well. For example, inside the mod_load.scm file,
+and then compile that file into the shared library as well. For example, inside the mod_load.scm file,
diff --git a/Doc/Manual/Contract.html b/Doc/Manual/Contract.html
index c9bcd6f38..ef1228cfb 100644
--- a/Doc/Manual/Contract.html
+++ b/Doc/Manual/Contract.html
@@ -133,7 +133,7 @@ Thus, any contract that you specified for a base class will also be attached to
class Spam : public Foo {
public:
- int bar(int,int); // Gets contract defined for Foo::bar(int,int)
+ int bar(int, int); // Gets contract defined for Foo::bar(int, int)
};
@@ -156,12 +156,12 @@ require:
class Foo {
public:
- int bar(int,int); // Gets Foo::bar contract.
+ int bar(int, int); // Gets Foo::bar contract.
};
class Spam : public Foo {
public:
- int bar(int,int); // Gets Foo::bar and Spam::bar contract
+ int bar(int, int); // Gets Foo::bar and Spam::bar contract
};
diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html
index 014b1a3c2..5332f1fda 100644
--- a/Doc/Manual/Customization.html
+++ b/Doc/Manual/Customization.html
@@ -75,7 +75,7 @@ How the exception is handled depends on the target language, for example, Python
$action
}
catch (RangeError) {
- PyErr_SetString(PyExc_IndexError,"index out-of-bounds");
+ PyErr_SetString(PyExc_IndexError, "index out-of-bounds");
SWIG_fail;
}
}
@@ -116,7 +116,7 @@ static char error_message[256];
static int error_status = 0;
void throw_exception(char *msg) {
- strncpy(error_message,msg,256);
+ strncpy(error_message, msg, 256);
error_status = 1;
}
@@ -193,7 +193,7 @@ extern int exception_status;
#define try if ((exception_status = setjmp(exception_buffer)) == 0)
#define catch(val) else if (exception_status == val)
-#define throw(val) longjmp(exception_buffer,val)
+#define throw(val) longjmp(exception_buffer, val)
#define finally else
/* Exception codes */
@@ -569,7 +569,7 @@ common scripting language exceptions in a portable manner. For example :
} catch(OutOfMemory) {
SWIG_exception(SWIG_MemoryError, "Out of memory");
} catch(...) {
- SWIG_exception(SWIG_RuntimeError,"Unknown exception");
+ SWIG_exception(SWIG_RuntimeError, "Unknown exception");
}
}
@@ -645,7 +645,7 @@ you can attach it to class members and parameterized declarations as before. Fo
%newobject ::blah(); // Only applies to global blah
-%newobject Object::blah(int,double); // Only blah(int,double) in Object
+%newobject Object::blah(int, double); // Only blah(int, double) in Object
%newobject *::copy; // Copy method in all classes
...
@@ -779,7 +779,7 @@ using the %feature directive. For example:
}
}
-%feature("new","1") *::copy;
+%feature("new", "1") *::copy;
@@ -791,7 +791,7 @@ involving %feature:
#define %exception %feature("except")
-#define %newobject %feature("new","1")
+#define %newobject %feature("new", "1")
@@ -831,7 +831,7 @@ The following are all equivalent:
%feature("except") Object::method { $action };
%feature("except") Object::method %{ $action %};
%feature("except") Object::method " $action ";
-%feature("except","$action") Object::method;
+%feature("except", "$action") Object::method;
@@ -850,7 +850,7 @@ The following is the generic syntax for features:
-%feature("name","value", attribute1="AttributeValue1") symbol;
+%feature("name", "value", attribute1="AttributeValue1") symbol;
%feature("name", attribute1="AttributeValue1") symbol {value};
%feature("name", attribute1="AttributeValue1") symbol %{value%};
%feature("name", attribute1="AttributeValue1") symbol "value";
@@ -914,13 +914,13 @@ int red; // mutable
%feature("immutable"); // global enable
int orange; // immutable
-%feature("immutable","0"); // global disable
+%feature("immutable", "0"); // global disable
int yellow; // mutable
-%feature("immutable","1"); // another form of global enable
+%feature("immutable", "1"); // another form of global enable
int green; // immutable
-%feature("immutable",""); // clears the global feature
+%feature("immutable", ""); // clears the global feature
int blue; // mutable
-%feature("immutable","1") orange;
-%feature("immutable","1") green;
+%feature("immutable", "1") orange;
+%feature("immutable", "1") green;
int red; // mutable
int orange; // immutable
int yellow; // mutable
@@ -949,10 +949,10 @@ The logic above can of course be inverted and rewritten as:
-%feature("immutable","1");
-%feature("immutable","0") red;
-%feature("immutable","0") yellow;
-%feature("immutable","0") blue;
+%feature("immutable", "1");
+%feature("immutable", "0") red;
+%feature("immutable", "0") yellow;
+%feature("immutable", "0") blue;
int red; // mutable
int orange; // immutable
int yellow; // mutable
@@ -983,7 +983,7 @@ The concept of clearing features is discussed next.
A feature stays in effect until it is explicitly cleared. A feature is cleared by
-supplying a %feature directive with no value. For example %feature("name","").
+supplying a %feature directive with no value. For example %feature("name", "").
A cleared feature means that any feature exactly matching any previously defined feature is no longer used in the name matching rules.
So if a feature is cleared, it might mean that another name matching rule will apply.
To clarify, let's consider the except feature again (%exception):
@@ -1013,7 +1013,7 @@ To clarify, let's consider the except feature again (%exception
@@ -1027,8 +1027,8 @@ However, these clone methods will still have an exception handler (without loggi
Note that clearing a feature is not always the same as disabling it.
-Clearing the feature above with %feature("except","") *::clone() is not the same as specifying
-%feature("except","0") *::clone(). The former will disable the feature for clone methods -
+Clearing the feature above with %feature("except", "") *::clone() is not the same as specifying
+%feature("except", "0") *::clone(). The former will disable the feature for clone methods -
the feature is still a better match than the global feature.
If on the other hand, no global exception handler had been defined at all,
then clearing the feature would be the same as disabling it as no other feature would have matched.
@@ -1042,7 +1042,7 @@ For example the following attempt to clear the initial feature will not work:
%feature("except") clone() { logger.info("$action"); $action }
-%feature("except","") *::clone();
+%feature("except", "") *::clone();
@@ -1053,7 +1053,7 @@ but this will:
%feature("except") clone() { logger.info("$action"); $action }
-%feature("except","") clone();
+%feature("except", "") clone();
@@ -1066,8 +1066,8 @@ The three macros below show this for the "except" feature:
#define %exception %feature("except")
-#define %noexception %feature("except","0")
-#define %clearexception %feature("except","")
+#define %noexception %feature("except", "0")
+#define %clearexception %feature("except", "")
@@ -1158,15 +1158,15 @@ in the Python module. You might use %feature to rewrite proxy/shadow cl
%module example
-%rename(bar_id) bar(int,double);
+%rename(bar_id) bar(int, double);
// Rewrite bar() to allow some nice overloading
%feature("shadow") Foo::bar(int) %{
def bar(*args):
if len(args) == 3:
- return apply(examplec.Foo_bar_id,args)
- return apply(examplec.Foo_bar,args)
+ return apply(examplec.Foo_bar_id, args)
+ return apply(examplec.Foo_bar, args)
%}
class Foo {
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 318a9586f..1af61afd8 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -422,7 +422,7 @@ struct A {
As with any other language, the SWIG test-suite can be built for D using the *-d-test-suite targets of the top-level Makefile. By default, D1 is targeted, to build it with D2, use the optional D_VERSION variable, e.g. make check-d-test-suite D_VERSION=2.
-Note: If you want to use GDC on Linux or another platform which requires you to link libdl for dynamically loading the shared library, you might have to add -ldl manually to the d_compile target in Examples/Makefile, because GDC does not currently honor the pragma(lib,...) statement.
+Note: If you want to use GDC on Linux or another platform which requires you to link libdl for dynamically loading the shared library, you might have to add -ldl manually to the d_compile target in Examples/Makefile, because GDC does not currently honor the pragma(lib, ...) statement.
22.9 D Typemap examples
diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html
index 798a1adb9..f3ec4bd94 100644
--- a/Doc/Manual/Extending.html
+++ b/Doc/Manual/Extending.html
@@ -243,7 +243,7 @@ of swig.swg looks like this:
/* Access control directives */
-#define %immutable %feature("immutable","1")
+#define %immutable %feature("immutable", "1")
#define %mutable %feature("immutable")
/* Directives for callback functions */
@@ -306,7 +306,7 @@ datatype such as int or void. type may be
qualified with a qualifier such as const or volatile. declarator
is a name with additional type-construction modifiers attached to it (pointers, arrays, references,
functions, etc.). Examples of declarators include *x, **x, x[20], and
-(*x)(int,double). The initializer may be a value assigned using = or
+(*x)(int, double). The initializer may be a value assigned using = or
body of code enclosed in braces { ... }.
@@ -372,7 +372,7 @@ For example, in an old C program, you might see things like this:
-foo(a,b) {
+foo(a, b) {
...
}
@@ -516,8 +516,8 @@ $ swig -c++ -python -debug-module 4 example.i
+++ cdecl ----------------------------------------
| sym:name - "move"
| name - "move"
- | decl - "f(double,double)."
- | parms - double ,double
+ | decl - "f(double, double)."
+ | parms - double, double
| type - "void"
| sym:symtab - 0x40194140
|
@@ -1381,14 +1381,14 @@ List *l = (some list);
Iterator i;
for (i = First(l); i.item; i = Next(i)) {
- Printf(stdout,"%s\n", i.item);
+ Printf(stdout, "%s\n", i.item);
}
Hash *h = (some hash);
Iterator j;
for (j = First(j); j.item; j= Next(j)) {
- Printf(stdout,"%s : %s\n", j.key, j.item);
+ Printf(stdout, "%s : %s\n", j.key, j.item);
}
@@ -1414,7 +1414,7 @@ operators have the same meaning.
-int Printv(String_or_FILE *f, String_or_char *arg1,..., NULL)
+int Printv(String_or_FILE *f, String_or_char *arg1, ..., NULL)
@@ -1469,7 +1469,7 @@ Same as the C ungetc() function.
Same as the C seek() function. offset is the number
-of bytes. whence is one of SEEK_SET,SEEK_CUR,
+of bytes. whence is one of SEEK_SET, SEEK_CUR,
or SEEK_END..
@@ -1515,9 +1515,9 @@ common to see small code fragments of code generated using code like this:
/* Print into a string */
String *s = NewString("");
-Printf(s,"Hello\n");
+Printf(s, "Hello\n");
for (i = 0; i < 10; i++) {
- Printf(s,"%d\n", i);
+ Printf(s, "%d\n", i);
}
...
/* Print string into a file */
@@ -1674,9 +1674,9 @@ Since parse tree nodes are just hash tables, attributes are accessed using the <
int functionHandler(Node *n) {
- String *name = Getattr(n,"name");
- String *symname = Getattr(n,"sym:name");
- SwigType *type = Getattr(n,"type");
+ String *name = Getattr(n, "name");
+ String *symname = Getattr(n, "sym:name");
+ SwigType *type = Getattr(n, "type");
...
}
@@ -1691,7 +1691,7 @@ For example:
...
-Setattr(n,"python:docstring", doc); /* Store docstring */
+Setattr(n, "python:docstring", doc); /* Store docstring */
...
@@ -1702,7 +1702,7 @@ A quick way to check the value of an attribute is to use the checkAttribute(
-if (checkAttribute(n,"storage","virtual")) {
+if (checkAttribute(n, "storage", "virtual")) {
/* n is virtual */
...
}
@@ -1723,7 +1723,7 @@ the following functions are used:
Saves a copy of attributes name1, name2, etc. from node n.
Copies of the attributes are actually resaved in the node in a different namespace which is
-set by the ns argument. For example, if you call Swig_save("foo",n,"type",NIL),
+set by the ns argument. For example, if you call Swig_save("foo", n, "type", NIL),
then the "type" attribute will be copied and saved as "foo:type". The namespace name itself is stored in
the "view" attribute of the node. If necessary, this can be examined to find out where previous
values of attributes might have been saved.
@@ -1750,11 +1750,11 @@ Calls can be nested if necessary. Here is an example that shows how the functio
int variableHandler(Node *n) {
- Swig_save("variableHandler",n,"type","sym:name",NIL);
- String *symname = Getattr(n,"sym:name");
- SwigType *type = Getattr(n,"type");
+ Swig_save("variableHandler", n, "type", "sym:name", NIL);
+ String *symname = Getattr(n, "sym:name");
+ SwigType *type = Getattr(n, "type");
...
- Append(symname,"_global"); // Change symbol name
+ Append(symname, "_global"); // Change symbol name
SwigType_add_pointer(type); // Add pointer
...
generate wrappers
@@ -1808,7 +1808,7 @@ C datatype SWIG encoding (strings)
int "int"
int * "p.int"
const int * "p.q(const).int"
-int (*x)(int,double) "p.f(int,double).int"
+int (*x)(int, double) "p.f(int, double).int"
int [20][30] "a(20).a(30).int"
int (F::*)(int) "m(F).f(int).int"
vector<int> * "p.vector<(int)>"
@@ -1817,8 +1817,8 @@ vector<int> * "p.vector<(int)>"
Reading the SWIG encoding is often easier than figuring out the C code---just
-read it from left to right. For a type of "p.f(int,double).int" is
-a "pointer to a function(int,double) that returns int".
+read it from left to right. For a type of "p.f(int, double).int" is
+a "pointer to a function(int, double) that returns int".
@@ -1854,7 +1854,7 @@ an extremely perverted example:
-`p.a(10).p.f(int,p.f(int).int)` foo(int, int (*x)(int));
+`p.a(10).p.f(int, p.f(int).int)` foo(int, int (*x)(int));
@@ -1864,7 +1864,7 @@ This corresponds to the immediately obvious C declaration:
-(*(*foo(int,int (*)(int)))[10])(int,int (*)(int));
+(*(*foo(int, int (*)(int)))[10])(int, int (*)(int));
@@ -1947,7 +1947,7 @@ Returns number of array dimensions of ty.
-String* SwigType_array_getdim(SwigType *ty,int n)
+String* SwigType_array_getdim(SwigType *ty, int n)
@@ -2375,9 +2375,9 @@ code like this:
Parm *parms;
Parm *p;
for (p = parms; p; p = nextSibling(p)) {
- SwigType *type = Getattr(p,"type");
- String *name = Getattr(p,"name");
- String *value = Getattr(p,"value");
+ SwigType *type = Getattr(p, "type");
+ String *name = Getattr(p, "name");
+ String *value = Getattr(p, "value");
...
}
@@ -2537,7 +2537,7 @@ also return a pointer to the base class (Language) so that only the int
Save the code for your language module in a file named "python.cxx" and
place this file in the Source/Modules directory of the SWIG distribution.
To ensure that your module is compiled into SWIG along with the other language modules,
-modify the file Source/Modules/Makefile.am to include the additional source
+modify the file Source/Makefile.am to include the additional source
files. In addition, modify the file Source/Modules/swigmain.cxx
with an additional command line option that activates the module. Read the source---it's straightforward.
@@ -2593,7 +2593,7 @@ command line options, simply use code similar to this:
void Language::main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) {
if (argv[i]) {
- if(strcmp(argv[i],"-interface") == 0) {
+ if (strcmp(argv[i], "-interface") == 0) {
if (argv[i+1]) {
interface = NewString(argv[i+1]);
Swig_mark_arg(i);
@@ -2602,7 +2602,7 @@ void Language::main(int argc, char *argv[]) {
} else {
Swig_arg_error();
}
- } else if (strcmp(argv[i],"-globals") == 0) {
+ } else if (strcmp(argv[i], "-globals") == 0) {
if (argv[i+1]) {
global_name = NewString(argv[i+1]);
Swig_mark_arg(i);
@@ -2611,14 +2611,14 @@ void Language::main(int argc, char *argv[]) {
} else {
Swig_arg_error();
}
- } else if ( (strcmp(argv[i],"-proxy") == 0)) {
+ } else if ((strcmp(argv[i], "-proxy") == 0)) {
proxy_flag = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i],"-keyword") == 0) {
+ } else if (strcmp(argv[i], "-keyword") == 0) {
use_kw = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i],"-help") == 0) {
- fputs(usage,stderr);
+ } else if (strcmp(argv[i], "-help") == 0) {
+ fputs(usage, stderr);
}
...
}
@@ -2722,10 +2722,10 @@ An outline of top() might be as follows:
int Python::top(Node *n) {
/* Get the module name */
- String *module = Getattr(n,"name");
+ String *module = Getattr(n, "name");
/* Get the output file name */
- String *outfile = Getattr(n,"outfile");
+ String *outfile = Getattr(n, "outfile");
/* Initialize I/O (see next section) */
...
@@ -2858,15 +2858,15 @@ A simple modification to write some basic details to the wrapper looks like this
int Python::functionWrapper(Node *n) {
/* Get some useful attributes of this function */
- String *name = Getattr(n,"sym:name");
- SwigType *type = Getattr(n,"type");
- ParmList *parms = Getattr(n,"parms");
+ String *name = Getattr(n, "sym:name");
+ SwigType *type = Getattr(n, "type");
+ ParmList *parms = Getattr(n, "parms");
String *parmstr= ParmList_str_defaultargs(parms); // to string
String *func = SwigType_str(type, NewStringf("%s(%s)", name, parmstr));
- String *action = Getattr(n,"wrap:action");
+ String *action = Getattr(n, "wrap:action");
- Printf(f_wrappers,"functionWrapper : %s\n", func);
- Printf(f_wrappers," action : %s\n", action);
+ Printf(f_wrappers, "functionWrapper : %s\n", func);
+ Printf(f_wrappers, " action : %s\n", action);
return SWIG_OK;
}
@@ -2881,13 +2881,13 @@ This will now produce some useful information within your wrapper file.
functionWrapper : void delete_Shape(Shape *self)
action : delete arg1;
-functionWrapper : void Shape_x_set(Shape *self,double x)
+functionWrapper : void Shape_x_set(Shape *self, double x)
action : if (arg1) (arg1)->x = arg2;
functionWrapper : double Shape_x_get(Shape *self)
action : result = (double) ((arg1)->x);
-functionWrapper : void Shape_y_set(Shape *self,double y)
+functionWrapper : void Shape_y_set(Shape *self, double y)
action : if (arg1) (arg1)->y = arg2;
...
@@ -2918,7 +2918,7 @@ In general most language wrappers look a little like this:
-/* wrapper for TYPE3 some_function(TYPE1,TYPE2); */
+/* wrapper for TYPE3 some_function(TYPE1, TYPE2); */
RETURN_TYPE _wrap_some_function(ARGS){
TYPE1 arg1;
TYPE2 arg2;
@@ -2929,7 +2929,7 @@ RETURN_TYPE _wrap_some_function(ARGS){
if(ARG2 is not of TYPE2) goto fail;
arg2=(convert ARG2);
- result=some_function(arg1,arg2);
+ result=some_function(arg1, arg2);
convert 'result' to whatever the language wants;
@@ -2973,9 +2973,9 @@ There are a lot of issues to address.
virtual int functionWrapper(Node *n) {
/* get useful attributes */
- String *name = Getattr(n,"sym:name");
- SwigType *type = Getattr(n,"type");
- ParmList *parms = Getattr(n,"parms");
+ String *name = Getattr(n, "sym:name");
+ SwigType *type = Getattr(n, "type");
+ ParmList *parms = Getattr(n, "parms");
...
/* create the wrapper object */
@@ -2988,7 +2988,7 @@ virtual int functionWrapper(Node *n) {
....
/* write the wrapper function definition */
- Printv(wrapper->def,"RETURN_TYPE ", wname, "(ARGS) {",NIL);
+ Printv(wrapper->def, "RETURN_TYPE ", wname, "(ARGS) {", NIL);
/* if any additional local variable needed, add them now */
...
@@ -3006,7 +3006,7 @@ virtual int functionWrapper(Node *n) {
....
/* Emit the function call */
- emit_action(n,wrapper);
+ emit_action(n, wrapper);
/* return value if necessary */
....
@@ -3030,7 +3030,7 @@ virtual int functionWrapper(Node *n) {
...
/* Dump the function out */
- Wrapper_print(wrapper,f_wrappers);
+ Wrapper_print(wrapper, f_wrappers);
/* tidy up */
Delete(wname);
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html
index f25e9850b..89b85f9a7 100644
--- a/Doc/Manual/Go.html
+++ b/Doc/Manual/Go.html
@@ -1337,7 +1337,7 @@ func Modf(x float64) (fracPart float64, intPart float64) {
For classes, since swig generates an interface, you can add additional
methods by defining another interface that includes the swig-generated
-interface. For example,
+interface. For example,
%rename(Wrapped_MyClass) MyClass;
@@ -1372,7 +1372,7 @@ few, then you might as well define your own struct that includes the
swig-wrapped object, instead of adding methods to the swig-generated object.
If you need to import other go packages, you can do this with
-%go_import. For example,
+%go_import. For example,
%go_import("fmt", _ "unusedPackage", rp "renamed/package")
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html
index 6acdd2dc3..b21313252 100644
--- a/Doc/Manual/Guile.html
+++ b/Doc/Manual/Guile.html
@@ -727,7 +727,7 @@ In the previous example, the GOOPS definitions will be in a file named Test.scm.
Because of the naming conflicts, you can't in general use both the -primitive and the GOOPS
guile-modules at the same time. To do this, you need to rename the exported symbols from one or both
-guile-modules. For example,
+guile-modules. For example,
(use-modules ((Test-primitive) #:renamer (symbol-prefix-proc 'primitive:)))
(use-modules ((Test) #:renamer (symbol-prefix-proc 'goops:)))
diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html
index 1c29f4760..0140bfa57 100644
--- a/Doc/Manual/Introduction.html
+++ b/Doc/Manual/Introduction.html
@@ -251,7 +251,7 @@ unix > ld -G example.o example_wrap.o -o example.so # This is for Sola
unix > perl5.003
use example;
print example::fact(4), "\n";
-print example::my_mod(23,7), "\n";
+print example::my_mod(23, 7), "\n";
print $example::My_variable + 4.5, "\n";
<ctrl-d>
24
@@ -279,7 +279,7 @@ Type "copyright", "credits" or "license" for more information.
>>> import example
>>> example.fact(4)
24
->>> example.my_mod(23,7)
+>>> example.my_mod(23, 7)
2
>>> example.cvar.My_variable + 4.5
7.5
@@ -303,7 +303,7 @@ unix > ld -G example.o example_wrap.o -o example.so
unix > perl5.003
use example;
print example::fact(4), "\n";
-print example::my_mod(23,7), "\n";
+print example::my_mod(23, 7), "\n";
print $example::My_variable + 4.5, "\n";
<ctrl-d>
24
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index 9abc2b87d..7fde1bde5 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -563,7 +563,7 @@ Don't worry if the wrapper file doesn't exist yet--Visual Studio will keep a ref
Enter "SWIG" in the description field.
Enter "swig -java -o $(ProjDir)\$(InputName)_wrap.c $(InputPath)" in the "Build command(s) field"
Enter "$(ProjDir)\$(InputName)_wrap.c" in the "Output files(s) field".
- Next, select the settings for the entire project and go to C/C++ tab and select the Preprocessor category . Add the include directories to the JNI header files under "Additional include directories", eg "C:\jdk1.3\include,C:\jdk1.3\include\win32".
+ Next, select the settings for the entire project and go to C/C++ tab and select the Preprocessor category . Add the include directories to the JNI header files under "Additional include directories", eg "C:\jdk1.3\include, C:\jdk1.3\include\win32".
Next, select the settings for the entire project and go to Link tab and select the General category. Set the name of the output file to match the name of your Java module (ie. example.dll).
Next, select the example.c and example_wrap.c files and go to the C/C++ tab and select the Precompiled Headers tab in the project settings. Disabling precompiled headers for these files will overcome any precompiled header errors while building.
Finally, add the java compilation as a post build rule in the Post-build step tab in project settings, eg, "c:\jdk1.3\bin\javac *.java"
@@ -1267,7 +1267,7 @@ When wrapped, you will be able to use the functions in a natural way from Java.
-SWIGTYPE_p_FILE f = example.fopen("junk","w");
+SWIGTYPE_p_FILE f = example.fopen("junk", "w");
example.fputs("Hello World\n", f);
example.fclose(f);
@@ -1341,7 +1341,7 @@ member variables. For example,
struct Vector {
- double x,y,z;
+ double x, y, z;
};
@@ -1878,7 +1878,7 @@ submodules or packages. For example, if you have a file like this,
namespace foo {
int fact(int n);
struct Vector {
- double x,y,z;
+ double x, y, z;
};
};
@@ -1978,7 +1978,7 @@ struct pair {
~pair();
};
-%template(pairii) pair<int,int>;
+%template(pairii) pair<int, int>;
@@ -1988,7 +1988,7 @@ In Java:
-pairii p = new pairii(3,4);
+pairii p = new pairii(3, 4);
int first = p.getFirst();
int second = p.getSecond();
@@ -4285,11 +4285,11 @@ From Java, you could then write code like this:
Image im = new Image();
SWIGTYPE_p_a_4__double a = example.new_mat44();
-example.mat44_set(a,0,0,1.0);
-example.mat44_set(a,1,1,1.0);
-example.mat44_set(a,2,2,1.0);
+example.mat44_set(a, 0, 0, 1.0);
+example.mat44_set(a, 1, 1, 1.0);
+example.mat44_set(a, 2, 2, 1.0);
...
-example.set_transform(im,a);
+example.set_transform(im, a);
example.free_mat44(a);
@@ -4317,13 +4317,13 @@ Here is a simple example:
%}
struct Vector {
- double x,y,z;
+ double x, y, z;
};
%extend Vector {
char *toString() {
static char tmp[1024];
- sprintf(tmp,"Vector(%g,%g,%g)", $self->x,$self->y,$self->z);
+ sprintf(tmp, "Vector(%g, %g, %g)", $self->x, $self->y, $self->z);
return tmp;
}
Vector(double x, double y, double z) {
@@ -4343,7 +4343,7 @@ Now, in Java
-Vector v = new Vector(2,3,4);
+Vector v = new Vector(2, 3, 4);
System.out.println(v);
@@ -4354,7 +4354,7 @@ will display
-Vector(2,3,4)
+Vector(2, 3, 4)
@@ -4606,10 +4606,10 @@ In Java, this allows you to pass simple values. For example:
-int result = example.sub(7,4);
+int result = example.sub(7, 4);
System.out.println("7 - 4 = " + result);
int[] sum = {0};
-example.add(3,4,sum);
+example.add(3, 4, sum);
System.out.println("3 + 4 = " + sum[0]);
@@ -4754,7 +4754,7 @@ extern void add(int x, int y, int *result);
-The %pointer_functions(type,name) macro generates five helper functions that can be used to create,
+The %pointer_functions(type, name) macro generates five helper functions that can be used to create,
destroy, copy, assign, and dereference a pointer. In this case, the functions are as follows:
@@ -4775,20 +4775,20 @@ In Java, you would use the functions like this:
SWIGTYPE_p_int intPtr = example.new_intp();
-example.add(3,4,intPtr);
+example.add(3, 4, intPtr);
int result = example.intp_value(intPtr);
System.out.println("3 + 4 = " + result);
-If you replace %pointer_functions(int,intp) by %pointer_class(int,intp), the interface is more class-like.
+If you replace %pointer_functions(int, intp) by %pointer_class(int, intp), the interface is more class-like.
intp intPtr = new intp();
-example.add(3,4,intPtr.cast());
+example.add(3, 4, intPtr.cast());
int result = intPtr.value();
System.out.println("3 + 4 = " + result);
@@ -4907,7 +4907,7 @@ int[] array = new int[10000000]; // Array of 10-million integers
for (int i=0; i<array.length; i++) { // Set some values
array[i] = i;
}
-int sum = example.sumitems(array,10000);
+int sum = example.sumitems(array, 10000);
System.out.println("Sum = " + sum);
@@ -4939,7 +4939,7 @@ For example:
-The %array_functions(type,name) macro generates four helper functions that can be used to create and
+The %array_functions(type, name) macro generates four helper functions that can be used to create and
destroy arrays and operate on elements. In this case, the functions are as follows:
@@ -4960,15 +4960,15 @@ In Java, you would use the functions like this:
SWIGTYPE_p_int array = example.new_intArray(10000000); // Array of 10-million integers
for (int i=0; i<10000; i++) { // Set some values
- example.intArray_setitem(array,i,i);
+ example.intArray_setitem(array, i, i);
}
-int sum = example.sumitems(array,10000);
+int sum = example.sumitems(array, 10000);
System.out.println("Sum = " + sum);
-If you replace %array_functions(int,intp) by %array_class(int,intp), the interface is more class-like
+If you replace %array_functions(int, intp) by %array_class(int, intp), the interface is more class-like
and a couple more helper functions are available for casting between the array and the type wrapper class.
@@ -4989,9 +4989,9 @@ For instance, you will be able to do this in Java:
intArray array = new intArray(10000000); // Array of 10-million integers
for (int i=0; i<10000; i++) { // Set some values
- array.setitem(i,i);
+ array.setitem(i, i);
}
-int sum = example.sumitems(array.cast(),10000);
+int sum = example.sumitems(array.cast(), 10000);
System.out.println("Sum = " + sum);
@@ -5491,7 +5491,7 @@ parameter is omitted):
-int c = example.count('e',"Hello World");
+int c = example.count('e', "Hello World");
@@ -5814,7 +5814,7 @@ Note that when the 'pre' or 'post' attributes are specified and the associated t
-The standard SWIG special variables are available for use within typemaps as described in the Typemaps documentation, for example $1, $input,$result etc.
+The standard SWIG special variables are available for use within typemaps as described in the Typemaps documentation, for example $1, $input, $result etc.
@@ -6337,7 +6337,7 @@ For example, integers are converted as follows:
-%typemap(directorin,descriptor="I") int "$input = (jint) $1;"
+%typemap(directorin, descriptor="I") int "$input = (jint) $1;"
@@ -7072,7 +7072,7 @@ public class runme {
}
public static void main(String argv[]) {
- String animals[] = {"Cat","Dog","Cow","Goat"};
+ String animals[] = {"Cat", "Dog", "Cow", "Goat"};
example.print_args(animals);
String args[] = example.get_args();
for (int i=0; i<args.length; i++)
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index c133718d5..b1ec37055 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -415,7 +415,7 @@ open new windows, and many more things.
var example = require("example");
var x = 18;
var y = 24;
- var z = example.gcd(x,y);
+ var z = example.gcd(x, y);
document.querySelector('#x').innerHTML = x;
document.querySelector('#y').innerHTML = y;
document.querySelector('#z').innerHTML = z;
@@ -467,7 +467,7 @@ var example = require("./build/Release/example");
// calling the global method
var x = 42;
var y = 105;
-var g = example.gcd(x,y);
+var g = example.gcd(x, y);
// Accessing the global variable
var f = example.Foo;
@@ -742,7 +742,7 @@ t_register.replace("$jsparent", state.clazz(NAME_MANGLED))
.trim().
print(f_init_static_wrappers);
-A code template is registered with the JSEmitter via fragment(name, "template"), e.g.,
+A code template is registered with the JSEmitter via fragment(name, "template"), e.g.,
%fragment ("jsc_variable_declaration", "templates")
@@ -921,7 +921,7 @@ state.clazz(NAME, Getattr(n, "sym:name"));
Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.
-void script_exception_to_string(JSContextRef js_context,JSValueRef exception_value_ref,char* return_error_string, int return_error_string_max_length)
+void script_exception_to_string(JSContextRef js_context, JSValueRef exception_value_ref, char* return_error_string, int return_error_string_max_length)
{
JSObjectRef exception_object;
JSValueRef value_ref;
@@ -933,7 +933,7 @@ void script_exception_to_string(JSContextRef js_context,JSValueRef exception_val
exception_object = JSValueToObject(js_context, exception_value_ref, NULL);
/* source url */
- strcpy(return_error_string,"[");
+ strcpy(return_error_string, "[");
jsstring_property_name = JSStringCreateWithUTF8CString("sourceURL");
value_ref = JSObjectGetProperty(js_context, exception_object, jsstring_property_name, &temporary_exception);
JSStringRelease(jsstring_property_name);
diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html
index 59e4553e7..6aee69910 100644
--- a/Doc/Manual/Library.html
+++ b/Doc/Manual/Library.html
@@ -115,7 +115,7 @@ this module is in generating pointers to primitive datatypes such as
-%pointer_functions(type,name)
+%pointer_functions(type, name)
@@ -195,7 +195,7 @@ Now, in Python:
>>> import example
>>> c = example.new_intp() # Create an "int" for storing result
->>> example.add(3,4,c) # Call function
+>>> example.add(3, 4, c) # Call function
>>> example.intp_value(c) # Dereference
7
>>> example.delete_intp(c) # Delete
@@ -205,7 +205,7 @@ Now, in Python:
-%pointer_class(type,name)
+%pointer_class(type, name)
@@ -275,7 +275,7 @@ Now, in Python (using proxy classes)
>>> import example
>>> c = example.intp() # Create an "int" for storing result
->>> example.add(3,4,c) # Call function
+>>> example.add(3, 4, c) # Call function
>>> c.value() # Dereference
7
@@ -331,7 +331,7 @@ raw C array data.
-%array_functions(type,name)
+%array_functions(type, name)
@@ -414,8 +414,8 @@ Now, in a scripting language, you might write this:
a = new_doubleArray(10) # Create an array
-for i in range(0,10):
- doubleArray_setitem(a,i,2*i) # Set a value
+for i in range(0, 10):
+ doubleArray_setitem(a, i, 2*i) # Set a value
print_array(a) # Pass to C
delete_doubleArray(a) # Destroy array
@@ -424,7 +424,7 @@ delete_doubleArray(a) # Destroy array
-%array_class(type,name)
+%array_class(type, name)
@@ -479,7 +479,7 @@ Allows you to do this:
import example
c = example.doubleArray(10) # Create double[10]
-for i in range(0,10):
+for i in range(0, 10):
c[i] = 2*i # Assign values
example.print_array(c) # Pass to C
@@ -507,7 +507,7 @@ This module defines macros for wrapping the low-level C memory allocation functi
-%malloc(type [,name=type])
+%malloc(type [, name=type])
@@ -530,7 +530,7 @@ is not a valid identifier (e.g., "int *", "double **", etc.).
-%calloc(type [,name=type])
+%calloc(type [, name=type])
@@ -551,7 +551,7 @@ If type is void, then the size parameter sz is requir
-%realloc(type [,name=type])
+%realloc(type [, name=type])
@@ -574,7 +574,7 @@ it holds 100 integers.
-%free(type [,name=type])
+%free(type [, name=type])
@@ -590,7 +590,7 @@ void free_name(type *ptr);
-%sizeof(type [,name=type])
+%sizeof(type [, name=type])
@@ -606,7 +606,7 @@ Creates the constant:
-%allocators(type [,name=type])
+%allocators(type [, name=type])
@@ -716,14 +716,14 @@ Python example:
>>> a = intArray(10)
->>> for i in range(0,10):
+>>> for i in range(0, 10):
... a[i] = i
->>> b = cdata(a,40)
+>>> b = cdata(a, 40)
>>> b
'\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x04
\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\t'
>>> c = intArray(10)
->>> memmove(c,b)
+>>> memmove(c, b)
>>> print c[4]
4
>>>
@@ -735,7 +735,7 @@ Since the size of data is not always known, the following macro is also defined:
-%cdata(type [,name=type])
+%cdata(type [, name=type])
@@ -855,7 +855,7 @@ Now, in the target language, you can use binary string data like this:
>>> s = "H\x00\x15eg\x09\x20"
->>> parity(s,0)
+>>> parity(s, 0)
@@ -920,7 +920,7 @@ implementation:
void get_path(char *s) {
// Potential buffer overflow---uh, oh.
- sprintf(s,"%s/%s", base_directory, sub_directory);
+ sprintf(s, "%s/%s", base_directory, sub_directory);
}
...
// Somewhere else in the C program
@@ -1554,7 +1554,7 @@ To illustrate the use of this library, consider the following functions:
#include <numeric>
double average(std::vector<int> v) {
- return std::accumulate(v.begin(),v.end(),0.0)/v.size();
+ return std::accumulate(v.begin(), v.end(), 0.0)/v.size();
}
std::vector<double> half(const std::vector<double>& v) {
@@ -1565,8 +1565,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ std::transform(v.begin(), v.end(), v.begin(),
+ std::bind2nd(std::divides<double>(), 2.0));
}
@@ -1602,20 +1602,20 @@ Now, to illustrate the behavior in the scripting interpreter, consider this Pyth
>>> from example import *
>>> iv = IntVector(4) # Create an vector<int>
->>> for i in range(0,4):
+>>> for i in range(0, 4):
... iv[i] = i
>>> average(iv) # Call method
1.5
->>> average([0,1,2,3]) # Call with list
+>>> average([0, 1, 2, 3]) # Call with list
1.5
->>> half([1,2,3]) # Half a list
-(0.5,1.0,1.5)
->>> halve_in_place([1,2,3]) # Oops
+>>> half([1, 2, 3]) # Half a list
+(0.5, 1.0, 1.5)
+>>> halve_in_place([1, 2, 3]) # Oops
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: Type error. Expected _p_std__vectorTdouble_t
>>> dv = DoubleVector(4)
->>> for i in range(0,4):
+>>> for i in range(0, 4):
... dv[i] = i
>>> halve_in_place(dv) # Ok
>>> for i in dv:
@@ -1629,7 +1629,7 @@ TypeError: Type error. Expected _p_std__vectorTdouble_t
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "example.py", line 81, in __setitem__
- def __setitem__(*args): return apply(examplec.DoubleVector___setitem__,args)
+ def __setitem__(*args): return apply(examplec.DoubleVector___setitem__, args)
IndexError: vector index out of range
>>>
@@ -2014,7 +2014,7 @@ For example:
try {
$action
} catch (std::out_of_range& e) {
- SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
+ SWIG_exception(SWIG_IndexError, const_cast<char*>(e.what()));
}
}
diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html
index 190e7bdfb..ba42f735c 100644
--- a/Doc/Manual/Lisp.html
+++ b/Doc/Manual/Lisp.html
@@ -148,7 +148,7 @@ struct foo {
int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int p);
-int func123(div_t * p,int **q[100],int r[][1000][10]);
+int func123(div_t * p, int **q[100], int r[][1000][10]);
void lispsort_double (int n, double * array);
@@ -170,11 +170,11 @@ The generated SWIG Code will be:
(cl:defmacro defanonenum (&body enums)
"Converts anonymous enums to defconstants."
- `(cl:progn ,@(cl:loop for value in enums
+ `(cl:progn , @(cl:loop for value in enums
for index = 0 then (cl:1+ index)
when (cl:listp value) do (cl:setf index (cl:second value)
value (cl:first value))
- collect `(cl:defconstant ,value ,index))))
+ collect `(cl:defconstant , value , index))))
(cl:eval-when (:compile-toplevel :load-toplevel)
(cl:unless (cl:fboundp 'swig-lispify)
@@ -280,7 +280,7 @@ Let's edit the interface file such that the C type "div_t*" is changed
%typemap(cin) div_t* ":my-pointer";
-%feature("intern_function","1");
+%feature("intern_function", "1");
%feature("export");
%feature("inline") lispsort_double;
@@ -305,7 +305,7 @@ The typemap(cin) ensures that for all arguments which are input
The feature intern_function ensures that all C names are
interned using the swig-lispify function. The "1" given
to the feature is optional. The use of feature like
- %feature("intern_function","1"); globally enables
+ %feature("intern_function", "1"); globally enables
interning for everything. If you want to target a single
function, or declaration then use the targeted version of
feature, %feature("intern_function", "my-lispify")
@@ -722,7 +722,7 @@ The ffi wrappers for functions and variables are generated as shown
extern "C" {
int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int y);
-int func123(div_t * x,int **z[100],int y[][1000][10]);
+int func123(div_t * x, int **z[100], int y[][1000][10]);
void lispsort_double (int n, double * array);
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index 131d92825..917876f5b 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -193,27 +193,27 @@ Normally Lua is embedded into another program and will be statically linked. An
extern int luaopen_example(lua_State* L); // declare the wrapped module
-int main(int argc,char* argv[])
+int main(int argc, char* argv[])
{
lua_State *L;
if (argc<2)
{
- printf("%s: <filename.lua>\n",argv[0]);
+ printf("%s: <filename.lua>\n", argv[0]);
return 0;
}
L=lua_open();
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);
+ if (luaL_loadfile(L, argv[1])==0) // load and run the file
+ lua_pcall(L, 0, 0, 0);
else
- printf("unable to load %s\n",argv[1]);
+ printf("unable to load %s\n", argv[1]);
lua_close(L);
return 0;
}
-A much improved set of code can be found in the Lua distribution src/lua/lua.c. Include your module, just add the external declaration & add a #define LUA_EXTRALIBS {"example",luaopen_example}, at the relevant place.
+A much improved set of code can be found in the Lua distribution src/lua/lua.c. Include your module, just add the external declaration & add a #define LUA_EXTRALIBS {"example", luaopen_example}, at the relevant place.
The exact commands for compiling and linking vary from platform to platform. Here is a possible set of commands of doing this:
@@ -272,8 +272,8 @@ require("example")
For those using Lua 5.0.x, you will also need an interpreter with the loadlib function (such as the default interpreter compiled with Lua). In order to dynamically load a module you must call the loadlib function with two parameters: the filename of the shared library, and the function exported by SWIG. Calling loadlib should return the function, which you then call to initialise the module
-my_init=loadlib("example.so","luaopen_example") -- for Unix/Linux
---my_init=loadlib("example.dll","luaopen_example") -- for Windows
+my_init=loadlib("example.so", "luaopen_example") -- for Unix/Linux
+--my_init=loadlib("example.dll", "luaopen_example") -- for Windows
assert(my_init) -- make sure it's not nil
my_init() -- call the init fn of the lib
@@ -281,7 +281,7 @@ my_init() -- call the init fn of the lib
Or can be done in a single line of Lua code
-assert(loadlib("example.so","luaopen_example"))()
+assert(loadlib("example.so", "luaopen_example"))()
@@ -289,9 +289,9 @@ assert(loadlib("example.so","luaopen_example"))()
If the code didn't work, don't panic. The best thing to do is to copy the module and your interpreter into a single directory and then execute the interpreter and try to manually load the module (take care, all this code is case sensitive).
-a,b,c=package.loadlib("example.so","luaopen_example") -- for Unix/Linux
---a,b,c=package.loadlib("example.dll","luaopen_example") -- for Windows
-print(a,b,c)
+a, b, c=package.loadlib("example.so", "luaopen_example") -- for Unix/Linux
+--a, b, c=package.loadlib("example.dll", "luaopen_example") -- for Windows
+print(a, b, c)
Note: for Lua 5.0:
@@ -326,7 +326,7 @@ Assuming all goes well, you will be able to this:
$ ./my_lua
-> print(example.gcd(4,6))
+> print(example.gcd(4, 6))
2
> print(example.Foo)
3
@@ -373,7 +373,7 @@ This can easily overwrite existing functions, so this must be used with care.
This option is considered deprecated and will be removed in the near future.
-> for k,v in pairs(example) do _G[k]=v end
+> for k, v in pairs(example) do _G[k]=v end
> print(fact(4))
24
>
@@ -411,7 +411,7 @@ SWIG will effectively generate two functions example.Foo_set() and
> print(c)
3
> c=5 -- this will not effect the original example.Foo
-> print(example.Foo,c)
+> print(example.Foo, c)
4 5
@@ -486,7 +486,7 @@ Because Lua doesn't really have the concept of constants, C/C++ constants are no
%module example
%constant int ICONST=42;
#define SCONST "Hello World"
-enum Days{SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY};
+enum Days{SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY};
This is 'effectively' converted into the following Lua code:
@@ -584,8 +584,8 @@ int fclose(FILE *);
When wrapped, you will be able to use the functions in a natural way from Lua. For example:
-> f=example.fopen("junk","w")
-> example.fputs("Hello World",f)
+> f=example.fopen("junk", "w")
+> example.fputs("Hello World", f)
> example.fclose(f)
@@ -601,7 +601,7 @@ FILE * -- it's a FILE*
Lua enforces the integrity of its userdata, so it is virtually impossible to corrupt the data. But as the user of the pointer, you are responsible for freeing it, or closing any resources associated with it (just as you would in a C program). This does not apply so strictly to classes & structs (see below). One final note: if a function returns a NULL pointer, this is not encoded as a userdata, but as a Lua nil.
-> f=example.fopen("not there","r") -- this will return a NULL in C
+> f=example.fopen("not there", "r") -- this will return a NULL in C
> print(f)
nil
@@ -613,7 +613,7 @@ nil
If you wrap a C structure, it is also mapped to a Lua userdata. By adding a metatable to the userdata, this provides a very natural interface. For example,
struct Point{
- int x,y;
+ int x, y;
};
@@ -623,7 +623,7 @@ is used as follows:
> p=example.new_Point()
> p.x=3
> p.y=5
-> print(p.x,p.y)
+> print(p.x, p.y)
3 5
>
@@ -953,8 +953,8 @@ public:
When wrapped, it works like you expect:
-> c = Complex(3,4)
-> d = Complex(7,8)
+> c = Complex(3, 4)
+> d = Complex(7, 8)
> e = c + d
> e:re()
10.0
@@ -1000,18 +1000,18 @@ The current list of operators which can be overloaded (and the alternative funct
__le__ operator<=
-Note: in Lua, only the equals, less than, and less than equals operators are defined. The other operators (!=,>,>=) are achieved by using a logical not applied to the results of other operators.
+Note: in Lua, only the equals, less than, and less than equals operators are defined. The other operators (!=, >, >=) are achieved by using a logical not applied to the results of other operators.
The following operators cannot be overloaded (mainly because they are not supported in Lua)
-- ++ and --
- +=,-=,*= etc
- % operator (you have to use math.mod)
- assignment operator
- all bitwise/logical operations
+ ++ and -- +=, -=, *= etc % operator (you have to use math.mod) assignment operator all bitwise/logical operations
SWIG also accepts the __str__() member function which converts an object to a string. This function should return a const char*, preferably to static memory. This will be used for the print() and tostring() functions in Lua. Assuming the complex class has a function
const char* __str__()
{
static char buffer[255];
- sprintf(buffer,"Complex(%g,%g)",this->re(),this->im());
+ sprintf(buffer, "Complex(%g, %g)", this->re(), this->im());
return buffer;
}
@@ -1019,14 +1019,14 @@ SWIG also accepts the __str__() member function which converts an objec
Then this will support the following code in Lua
-> c = Complex(3,4)
-> d = Complex(7,8)
+> c = Complex(3, 4)
+> d = Complex(7, 8)
> e = c + d
> print(e)
-Complex(10,12)
+Complex(10, 12)
> s=tostring(e) -- s is the number in string form
> print(s)
-Complex(10,12)
+Complex(10, 12)
It is also possible to overload the operator[], but currently this cannot be automatically performed. To overload the operator[] you need to provide two functions, __getitem__() and __setitem__()
@@ -1035,7 +1035,7 @@ It is also possible to overload the operator[], but currently this cann
{
//....
double __getitem__(int i)const; // i is the index, returns the data
- void __setitem__(int i,double d); // i is the index, d is the data
+ void __setitem__(int i, double d); // i is the index, d is the data
};
@@ -1092,7 +1092,7 @@ Now we extend it with some new code
%extend Complex {
const char *__str__() {
static char tmp[1024];
- sprintf(tmp,"Complex(%g,%g)", $self->re(),$self->im());
+ sprintf(tmp, "Complex(%g, %g)", $self->re(), $self->im());
return tmp;
}
bool operator==(const Complex& c) {
@@ -1104,14 +1104,14 @@ Now we extend it with some new code
Now, in Lua
-> c = Complex(3,4)
-> d = Complex(7,8)
+> c = Complex(3, 4)
+> d = Complex(7, 8)
> e = c + d
> print(e) -- print uses __str__ to get the string form to print
-Complex(10,12)
-> print(e==Complex(10,12)) -- testing the == operator
+Complex(10, 12)
+> print(e==Complex(10, 12)) -- testing the == operator
true
-> print(e!=Complex(12,12)) -- the != uses the == operator
+> print(e!=Complex(12, 12)) -- the != uses the == operator
true
@@ -1121,7 +1121,7 @@ Extend works with both C and C++ code, on classes and structs. It does not modif
28.3.13 Using %newobject to release memory
- If you have a function that allocates memory like this,
+ If you have a function that allocates memory like this,
char *foo() {
char *result = (char *) malloc(...);
@@ -1164,14 +1164,14 @@ struct pair {
~pair();
};
-%template(pairii) pair<int,int>;
+%template(pairii) pair<int, int>;
In Lua:
-> p = example.pairii(3,4)
-> print(p.first,p.second)
+> p = example.pairii(3, 4)
+> print(p.first, p.second)
3 4
@@ -1265,11 +1265,11 @@ Using xpcall will allow you to obtain additional debug information (such as a st
> function a() b() end -- function a() calls function b()
> function b() message() end -- function b() calls C++ function message(), which throws
-> ok,res=pcall(a) -- call the function
-> print(ok,res)
+> ok, res=pcall(a) -- call the function
+> print(ok, res)
false I died.
-> ok,res=xpcall(a,debug.traceback) -- call the function
-> print(ok,res)
+> ok, res=xpcall(a, debug.traceback) -- call the function
+> print(ok, res)
false I died.
stack traceback:
[C]: in function 'message'
@@ -1322,7 +1322,7 @@ If you have your own class which you want output as a string you will need to ad
%typemap(throws) my_except
%{
- lua_pushstring(L,$1.what()); // assuming my_except::what() returns a const char* message
+ lua_pushstring(L, $1.what()); // assuming my_except::what() returns a const char* message
SWIG_fail; // trigger the error handler
%}
@@ -1337,26 +1337,26 @@ class Exc {
public:
Exc(int c, const char *m) {
code = c;
- strncpy(msg,m,256);
+ strncpy(msg, m, 256);
}
int code;
char msg[256];
};
void throw_exc() throw(Exc) {
- throw(Exc(42,"Hosed"));
+ throw(Exc(42, "Hosed"));
}
Then the following code can be used (note: we use pcall to catch the error so we can process the exception).
-> ok,res=pcall(throw_exc)
+> ok, res=pcall(throw_exc)
> print(ok)
false
> print(res)
userdata: 0003D880
-> print(res.code,res.msg)
+> print(res.code, res.msg)
42 Hosed
>
@@ -1537,8 +1537,8 @@ function
@@ -1950,7 +1950,7 @@ Some of the internals can be seen by looking at the metatable of a class:
> print(p)
userdata: 003FDB28
> m=getmetatable(p)
-> table.foreach(m,print)
+> table.foreach(m, print)
.type Point
__gc function: 003FB6C8
__newindex function: 003FB6B0
@@ -1966,7 +1966,7 @@ The '.type' attribute is the name of the class. The '.get' and '.set' tables wor
The Lua equivalent of the code for enabling functions looks a little like this
-function __index(obj,name)
+function __index(obj, name)
local m=getmetatable(obj) -- gets the metatable
if not m then return nil end
local g=m['.get'] -- gets the attribute table
diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html
index f324495a3..75f3f80ff 100644
--- a/Doc/Manual/Modula3.html
+++ b/Doc/Manual/Modula3.html
@@ -684,7 +684,7 @@ consist of the following parts:
m3wrapfreearg
- M3toC.FreeSharedS(str,arg1);
+ M3toC.FreeSharedS(str, arg1);
Free resources that were temporarily used in the wrapper.
Since this step should never be skipped,
@@ -858,7 +858,7 @@ where almost everything is generated by a typemap:
RAISE E("invalid checksum");
END;
FINALLY
- M3toC.FreeSharedS(str,arg1); (* m3wrapfreearg *)
+ M3toC.FreeSharedS(str, arg1); (* m3wrapfreearg *)
END;
END Name;
@@ -891,7 +891,7 @@ where almost everything is generated by a typemap:
constnumeric
%constnumeric(12) twelve; or
- %feature("constnumeric","12") twelve;
+ %feature("constnumeric", "12") twelve;
This feature can be used to tell Modula-3's back-end of SWIG
the value of an identifier.
This is necessary in the cases
diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html
index 089b1a4ad..2a0ff7985 100644
--- a/Doc/Manual/Modules.html
+++ b/Doc/Manual/Modules.html
@@ -44,7 +44,7 @@ The general form of this directive is:
-%module(option1="value1",option2="value2",...) modulename
+%module(option1="value1", option2="value2", ...) modulename
diff --git a/Doc/Manual/Mzscheme.html b/Doc/Manual/Mzscheme.html
index 08402b68c..385b241aa 100644
--- a/Doc/Manual/Mzscheme.html
+++ b/Doc/Manual/Mzscheme.html
@@ -34,13 +34,13 @@ Example interface file:
/* define a macro for the struct creation */
-%define handle_ptr(TYPE,NAME)
+%define handle_ptr(TYPE, NAME)
%typemap(argout) TYPE *NAME{
Scheme_Object *o = SWIG_NewStructFromPtr($1, $*1_mangle);
SWIG_APPEND_VALUE(o);
}
-%typemap(in,numinputs=0) TYPE *NAME (TYPE temp) {
+%typemap(in, numinputs=0) TYPE *NAME (TYPE temp) {
$1 = &temp;
}
%enddef
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index e489c4147..96c93faeb 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -90,7 +90,7 @@ If you're not familiar with the Objective Caml language, you can visit
SWIG 3.0 works with Ocaml 3.08.3 and above. Given the choice,
you should use the latest stable release. The SWIG Ocaml module has
-been tested on Linux (x86,PPC,Sparc) and Cygwin on Windows. The
+been tested on Linux (x86, PPC, Sparc) and Cygwin on Windows. The
best way to determine whether your system will work is to compile the
examples and test-suite which come with SWIG. You can do this by running
make check from the SWIG root directory after installing SWIG.
@@ -327,7 +327,7 @@ A few functions exist which generate and return these:
Because of this style, a typemap can return any kind of value it
wants from a function. This enables out typemaps and inout typemaps
to work well. The one thing to remember about outputting values
-is that you must append them to the return list with swig_result = caml_list_append(swig_result,v).
+is that you must append them to the return list with swig_result = caml_list_append(swig_result, v).
@@ -505,7 +505,7 @@ Unfortunately, unbounded arrays and pointers can't be handled in a
completely general way by SWIG, because the end-condition of such an
array can't be predicted. In some cases, it will be by consent
(e.g. an array of four or more chars), sometimes by explicit length
-(char *buffer, int len), and sometimes by sentinel value (0,-1,etc.).
+(char *buffer, int len), and sometimes by sentinel value (0, -1, etc.).
SWIG can't predict which of these methods will be used in the array,
so you have to specify it for yourself in the form of a typemap.
@@ -560,7 +560,7 @@ void printfloats( float *tab, int len ) {
$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));
+ $1[i] = caml_double_val(caml_array_nth($input, i));
}
}
@@ -684,7 +684,7 @@ C_list
- : Example.c_obj = C_void
# x '[1] ;;
- : Example.c_obj = C_string "bar"
-# x -> set (1,"spam") ;;
+# x -> set (1, "spam") ;;
- : Example.c_obj = C_void
# x '[1] ;;
- : Example.c_obj = C_string "spam"
@@ -757,11 +757,11 @@ bash-2.05a$ ./qt_top
# open Swig ;;
# open Qt ;;
-# let a = new_QApplication '(0,0) ;;
+# let a = new_QApplication '(0, 0) ;;
val a : Qt.c_obj = C_obj <fun>
-# let hello = new_QPushButton '("hi",0) ;;
+# let hello = new_QPushButton '("hi", 0) ;;
val hello : Qt.c_obj = C_obj <fun>
-# hello -> resize (100,30) ;;
+# hello -> resize (100, 30) ;;
- : Qt.c_obj = C_void
# hello -> show () ;;
- : Qt.c_obj = C_void
@@ -857,7 +857,7 @@ let triangle_class pts ob meth args =
let triangle =
new_derived_object
new_shape
- (triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
+ (triangle_class ((0.0, 0.0), (0.5, 1.0), (1.0, 0.0)))
'() ;;
let _ = _draw_shape_coverage '(triangle, C_int 60, C_int 20) ;;
@@ -901,7 +901,7 @@ The definition of the actual object triangle can be described this way:
let triangle =
new_derived_object
new_shape
- (triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
+ (triangle_class ((0.0, 0.0), (0.5, 1.0), (1.0, 0.0)))
'()
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index 25ec933ff..4245d8a8e 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -161,7 +161,7 @@ Assuming all goes well, you will be able to do this:
$ octave -q
octave:1> swigexample
-octave:2> swigexample.gcd(4,6)
+octave:2> swigexample.gcd(4, 6)
ans = 2
octave:3> swigexample.cvar.Foo
ans = 3
@@ -189,7 +189,7 @@ To load an Octave module, simply type its name:
octave:1> swigexample;
-octave:2> gcd(4,6)
+octave:2> gcd(4, 6)
ans = 2
octave:3> cvar.Foo
ans = 3
@@ -204,16 +204,16 @@ If the module is also used in the base context, however, it must first be loaded
-octave:1> function l = my_lcm(a,b)
+octave:1> function l = my_lcm(a, b)
> swigexample
-> l = abs(a*b)/swigexample.gcd(a,b);
+> l = abs(a*b)/swigexample.gcd(a, b);
> endfunction
-octave:2> my_lcm(4,6)
+octave:2> my_lcm(4, 6)
ans = 12
-octave:3> swigexample.gcd(4,6)
+octave:3> swigexample.gcd(4, 6)
error: can't perform indexing operations for <unknown type> type
octave:3> swigexample;
-octave:4> swigexample.gcd(4,6)
+octave:4> swigexample.gcd(4, 6)
ans = 2
@@ -297,7 +297,7 @@ ans = 3.1420
%module swigexample
%constant int ICONST=42;
#define SCONST "Hello World"
-enum Days{SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY};
+enum Days{SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY};
@@ -329,8 +329,8 @@ When wrapped, you will be able to use the functions in a natural way from Octave
octave:1> swigexample;
-octave:2> f=swigexample.fopen("w","junk");
-octave:3> swigexample.fputs("Hello world",f);
+octave:2> f=swigexample.fopen("w", "junk");
+octave:3> swigexample.fputs("Hello world", f);
octave:4> swigexample.fclose(f);
@@ -339,7 +339,7 @@ octave:4> swigexample.fclose(f);
octave:1> swigexample;
-octave:2> f=swigexample.fopen("junk","w");
+octave:2> f=swigexample.fopen("junk", "w");
octave:3> f
f =
@@ -352,7 +352,7 @@ f =
octave:1> swigexample;
-octave:2> f=swigexample.fopen("not there","r");
+octave:2> f=swigexample.fopen("not there", "r");
error: value on right hand side of assignment is undefined
error: evaluating assignment expression near line 2, column 2
@@ -365,7 +365,7 @@ For each wrapped structure and class, a swig_ref will be exposed that h
struct Point{
- int x,y;
+ int x, y;
};
@@ -395,12 +395,12 @@ Methods also work as expected. For example, code wrapped in the following way
class Point{
public:
- int x,y;
- Point(int _x,int _y) : x(_x),y(_y) {}
+ int x, y;
+ Point(int _x, int _y) : x(_x), y(_y) {}
double distance(const Point& rhs) {
- return sqrt(pow(x-rhs.x,2)+pow(y-rhs.y,2));
+ return sqrt(pow(x-rhs.x, 2)+pow(y-rhs.y, 2));
}
- void set(int _x,int _y) {
+ void set(int _x, int _y) {
x=_x; y=_y;
}
};
@@ -410,8 +410,8 @@ can be used from Octave like this
octave:1> swigexample;
-octave:2> p1=swigexample.Point(3,5);
-octave:3> p2=swigexample.Point(1,2);
+octave:2> p1=swigexample.Point(3, 5);
+octave:3> p2=swigexample.Point(1, 2);
octave:4> p1.distance(p2)
ans = 3.6056
@@ -433,7 +433,7 @@ This differs from the usual pass-by-value (copy-on-write) semantics that Octave
-octave:7> a=struct('x',4)
+octave:7> a=struct('x', 4)
a =
{
x = 4
@@ -464,7 +464,7 @@ However, when dealing with wrapped objects, one gets the behavior
-octave:2> a=Point(3,5)
+octave:2> a=Point(3, 5)
a =
{
@@ -478,7 +478,7 @@ b =
Point, ptr = 0x9afbbb0
}
-octave:4> b.set(2,1);
+octave:4> b.set(2, 1);
octave:5> b.x, b.y
ans = 2
ans = 1
@@ -621,7 +621,7 @@ Octave can also utilise friend (i.e. non-member) operators with a simple %rename
The %extend directive works the same as in other modules.
-You can use it to define special behavior, like for example defining Octave operators not mapped to C++ operators, or defining certain Octave mechanisms such as how an object prints. For example, the octave_value::{is_string,string_value,print} functions are routed to a special method __str__ that can be defined inside an %extend.
+You can use it to define special behavior, like for example defining Octave operators not mapped to C++ operators, or defining certain Octave mechanisms such as how an object prints. For example, the octave_value::{is_string, string_value, print} functions are routed to a special method __str__ that can be defined inside an %extend.
%extend A {
@@ -639,7 +639,7 @@ Then in Octave one gets,
octave:1> a=A(4);
octave:2> a
a = 4
-octave:3> printf("%s\n",a);
+octave:3> printf("%s\n", a);
4
octave:4> a.__str__()
4
@@ -664,7 +664,7 @@ For example, function templates can be instantiated as follows:
%module swigexample
%inline {
template<class __scalar>
- __scalar mul(__scalar a,__scalar b) {
+ __scalar mul(__scalar a, __scalar b) {
return a*b;
}
}
@@ -677,11 +677,11 @@ and then used from Octave
-octave:1> mul(4,3)
+octave:1> mul(4, 3)
ans = 12
-octave:2> mul(4.2,3.6)
+octave:2> mul(4.2, 3.6)
ans = 15.120
-octave:3> mul(3+4i,10+2i)
+octave:3> mul(3+4i, 10+2i)
ans = 22 + 46i
@@ -722,11 +722,11 @@ octave:2> a=sum_complex(2+3i);
octave:3> a.add(2)
ans =
-(4,3)
+(4, 3)
octave:4> a.add(3+i)
ans =
-(7,4)
+(7, 4)
@@ -766,7 +766,7 @@ For example,
octave:1> a=subclass();
octave:2> a.my_var = 4;
-octave:3> a.my_method = @(self) printf("my_var = ",self.my_var);
+octave:3> a.my_method = @(self) printf("my_var = ", self.my_var);
octave:4> a.my_method();
my_var = 4
@@ -790,7 +790,7 @@ void call_your_method(A& a) {
Then from Octave you can say:
-octave:1> B=@() subclass(A(),@my_method);
+octave:1> B=@() subclass(A(), @my_method);
octave:2> function my_method(self)
octave:3> printf("octave-side routine called\n");
octave:4> end
@@ -801,7 +801,7 @@ octave-side routine called
or more concisely,
-octave:1> B=@() subclass(A(),'my_method',@(self) printf("octave-side routine called\n"));
+octave:1> B=@() subclass(A(), 'my_method', @(self) printf("octave-side routine called\n"));
octave:2> call_your_method(B());
octave-side routine called
@@ -809,10 +809,10 @@ octave-side routine called
Note that you have to enable directors via the %feature directive (see other modules for this).
-subclass() will accept any number of C++ bases or other subclass()'ed objects, (string,octave_value) pairs, and function_handles. In the first case, these are taken as base classes; in the second case, as named members (either variables or functions, depending on whether the given value is a function handle); in the third case, as member functions whose name is taken from the given function handle. E.g.,
+subclass() will accept any number of C++ bases or other subclass()'ed objects, (string, octave_value) pairs, and function_handles. In the first case, these are taken as base classes; in the second case, as named members (either variables or functions, depending on whether the given value is a function handle); in the third case, as member functions whose name is taken from the given function handle. E.g.,
-octave:1> B=@(some_var=2) subclass(A(),'some_var',some_var,@some_func,'another_func',
+octave:1> B=@(some_var=2) subclass(A(), 'some_var', some_var, @some_func, 'another_func',
@(self) do_stuff())
@@ -822,7 +822,7 @@ You can also assign non-C++ member variables and functions after construct time.
There is limited support for explicitly referencing C++ bases. So, in the example above, we could have
-octave:1> B=@() subclass(A(),@my_method);
+octave:1> B=@() subclass(A(), @my_method);
octave:2> function my_method(self)
octave:3> self.A.my_method();
octave:4> printf("octave-side routine called\n");
@@ -887,7 +887,7 @@ Various STL library files are provided for wrapping STL containers.
Octave provides a rich set of classes for dealing with matrices. Currently there are no built-in typemaps to deal with those. However, these are relatively straight forward for users to add themselves (see the docs on typemaps). Without much work (a single typemap decl-- say, 5 lines of code in the interface file), it would be possible to have a function
-double my_det(const double* mat,int m,int n);
+double my_det(const double* mat, int m, int n);
that is accessed from Octave as,
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index 4722a01ba..279815302 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -322,7 +322,7 @@ all goes well, you will be able to do this:
$ perl
use example;
-print example::fact(4),"\n";
+print example::fact(4), "\n";
24
@@ -770,7 +770,7 @@ is accessed as follows:
use example;
-print $example::Spam,"\n";
+print $example::Spam, "\n";
$example::Spam = $example::Spam + 4
# ... etc ...
@@ -841,7 +841,7 @@ In Perl:
use example;
-print $example::FOO,"\n"; # OK
+print $example::FOO, "\n"; # OK
$example::FOO = 2; # Error
@@ -855,7 +855,7 @@ usually gives a more natural Perl interface, for example:
use example;
-print example::FOO,"\n";
+print example::FOO, "\n";
@@ -978,7 +978,7 @@ accessor functions as described in the "SWIG Basics" chapter. For example,
struct Vector {
- double x,y,z;
+ double x, y, z;
};
@@ -1004,8 +1004,8 @@ These functions are then used to access structure data from Perl as follows:
$v = example::new_Vector();
-print example::Vector_x_get($v),"\n"; # Get x component
-example::Vector_x_set($v,7.8); # Change x component
+print example::Vector_x_get($v), "\n"; # Get x component
+example::Vector_x_set($v, 7.8); # Change x component
@@ -1148,14 +1148,14 @@ In Perl, these functions are used in a straightforward manner:
use example;
$l = example::new_List();
-example::List_insert($l,"Ale");
-example::List_insert($l,"Stout");
-example::List_insert($l,"Lager")
+example::List_insert($l, "Ale");
+example::List_insert($l, "Stout");
+example::List_insert($l, "Lager")
example::List_print($l)
Lager
Stout
Ale
-print example::List_length_get($l),"\n";
+print example::List_length_get($l), "\n";
3
@@ -1238,8 +1238,8 @@ Now, in Perl, the methods are accessed as follows:
use example;
example::foo_i(3);
$s = example::new_Spam();
-example::Spam_foo_i($s,3);
-example::Spam_foo_d($s,3.14);
+example::Spam_foo_i($s, 3);
+example::Spam_foo_d($s, 3.14);
@@ -1286,7 +1286,7 @@ a single Perl module. The name of the module is determined by the
$ perl5
use example; # load the example module
-print example::fact(4),"\n" # Call a function in it
+print example::fact(4), "\n" # Call a function in it
24
@@ -1365,7 +1365,7 @@ all of the functions in that module will be installed into the package
use example; # Load the module like before
-print Foo::fact(4),"\n"; # Call a function in package FooBar
+print Foo::fact(4), "\n"; # Call a function in package FooBar
-->
@@ -1417,10 +1417,10 @@ In Perl, this allows you to pass simple values. For example:
-$a = example::add(3,4);
+$a = example::add(3, 4);
print "$a\n";
7
-$b = example::sub(7,4);
+$b = example::sub(7, 4);
print "$b\n";
3
@@ -1552,7 +1552,7 @@ Now, in Perl:
-($r,$c) = example::get_dimensions($m);
+($r, $c) = example::get_dimensions($m);
@@ -1578,7 +1578,7 @@ In Perl:
use example;
$c = 0.0;
-example::add(3,4,\$c);
+example::add(3, 4, \$c);
print "$c\n";
7
@@ -1830,7 +1830,7 @@ the typemap system follows typedef declarations. For example:
%typemap(in) int n {
$1 = (int) SvIV($input);
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
%inline %{
typedef int Integer;
@@ -1852,7 +1852,7 @@ Typemaps can also be defined for groups of consecutive arguments. For example:
%typemap(in) (char *str, unsigned len) {
- $1 = SvPV($input,$2);
+ $1 = SvPV($input, $2);
};
int count(char c, char *str, unsigned len);
@@ -1867,7 +1867,7 @@ parameter is omitted):
-example::count("e","Hello World");
+example::count("e", "Hello World");
1
>>>
@@ -2156,7 +2156,7 @@ reference to be used as a char ** datatype.
$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] = (char *) SvPV(*tv, PL_na);
}
$1[i] = NULL;
};
@@ -2170,16 +2170,16 @@ reference to be used as a char ** datatype.
%typemap(out) char ** {
AV *myav;
SV **svs;
- int i = 0,len = 0;
+ 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]);
+ sv_setpv((SV*)svs[i], $1[i]);
};
- myav = av_make(len,svs);
+ myav = av_make(len, svs);
free(svs);
$result = newRV_noinc((SV*)myav);
sv_2mortal($result);
@@ -2191,7 +2191,7 @@ reference to be used as a char ** datatype.
int print_args(char **argv) {
int i = 0;
while (argv[i]) {
- printf("argv[%d] = %s\n", i,argv[i]);
+ printf("argv[%d] = %s\n", i, argv[i]);
i++;
}
return i;
@@ -2216,7 +2216,7 @@ use argv;
@a = ("Dave", "Mike", "John", "Mary"); # Create an array of strings
argv::print_args(\@a); # Pass it to our C function
$b = argv::get_args(); # Get array of strings from C
-print @$b,"\n"; # Print it out
+print @$b, "\n"; # Print it out
@@ -2241,10 +2241,10 @@ can be done using the EXTEND() macro as in:
%typemap(argout) int *OUTPUT {
if (argvi >= items) {
- EXTEND(sp,1); /* Extend the stack by 1 object */
+ EXTEND(sp, 1); /* Extend the stack by 1 object */
}
$result = sv_newmortal();
- sv_setiv($target,(IV) *($1));
+ sv_setiv($target, (IV) *($1));
argvi++;
}
@@ -2271,7 +2271,7 @@ its arguments. This example describes the implementation of the OUTPUT
// We don't care what the input value is. Ignore, but set to a temporary variable
-%typemap(in,numinputs=0) double *OUTPUT(double junk) {
+%typemap(in, numinputs=0) double *OUTPUT(double junk) {
$1 = &junk;
}
@@ -2298,9 +2298,9 @@ For example:
-@r = multout(7,13);
-print "multout(7,13) = @r\n";
-($x,$y) = multout(7,13);
+@r = multout(7, 13);
+print "multout(7, 13) = @r\n";
+($x, $y) = multout(7, 13);
33.8.4 Accessing array structure members
@@ -2390,7 +2390,7 @@ A common misinterpretation of this function is the following Perl script:
$a = 3.5;
$b = 7.5;
$c = 0.0; # Output value
-add($a,$b,\$c); # Place result in c (Except that it doesn't work)
+add($a, $b, \$c); # Place result in c (Except that it doesn't work)
@@ -2426,7 +2426,7 @@ Now, if you place this before the add function, you can do this:
$a = 3.5;
$b = 7.5;
$c = 0.0;
-add($a,$b,\$c); # Now it works!
+add($a, $b, \$c); # Now it works!
print "$c\n";
@@ -2566,7 +2566,7 @@ Suppose you have the following SWIG interface file:
struct Vector {
Vector(double x, double y, double z);
~Vector();
- double x,y,z;
+ double x, y, z;
};
@@ -2608,7 +2608,7 @@ sub new () {
$OWNER{$self} = 1;
my %retval;
tie %retval, "example::Vector", $self;
- return bless \%retval,"Vector";
+ return bless \%retval, "Vector";
}
sub DESTROY {
@@ -2622,25 +2622,25 @@ sub DESTROY {
}
sub FETCH {
- my ($self,$field) = @_;
+ my ($self, $field) = @_;
my $member_func = "vectorc::Vector_${field}_get";
my $val = &$member_func($self);
if (exists $BLESSEDMEMBERS{$field}) {
return undef if (!defined($val));
my %retval;
- tie %retval,$BLESSEDMEMBERS{$field},$val;
+ tie %retval, $BLESSEDMEMBERS{$field}, $val;
return bless \%retval, $BLESSEDMEMBERS{$field};
}
return $val;
}
sub STORE {
- my ($self,$field,$newval) = @_;
+ my ($self, $field, $newval) = @_;
my $member_func = "vectorc::Vector_${field}_set";
if (exists $BLESSEDMEMBERS{$field}) {
- &$member_func($self,tied(%{$newval}));
+ &$member_func($self, tied(%{$newval}));
} else {
- &$member_func($self,$newval);
+ &$member_func($self, $newval);
}
}
@@ -2662,8 +2662,8 @@ To use our new proxy class we can simply do the following:
# Perl code using Vector class
-$v = new Vector(2,3,4);
-$w = Vector->new(-1,-2,-3);
+$v = new Vector(2, 3, 4);
+$w = Vector->new(-1, -2, -3);
# Assignment of a single member
$v->{x} = 7.5;
@@ -2706,7 +2706,7 @@ Vector object:
Vector *new_Vector(double x, double y, double z) {
Vector *v;
- v = new Vector(x,y,z); // Call C++ constructor
+ v = new Vector(x, y, z); // Call C++ constructor
return v;
}
@@ -2747,7 +2747,7 @@ done using the DISOWN method.
# Perl code to change ownership of an object
-$v = new Vector(x,y,z);
+$v = new Vector(x, y, z);
$v->DISOWN();
@@ -3002,10 +3002,10 @@ low-level helper functions. For example, this code now seems to work:
my $a =
- [[1,0,0,0],
- [0,1,0,0],
- [0,0,1,0],
- [0,0,0,1]];
+ [[1, 0, 0, 0],
+ [0, 1, 0, 0],
+ [0, 0, 1, 0],
+ [0, 0, 0, 1]];
set_transform($im, $a);
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 7d1fb997b..52bedf87f 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -295,7 +295,7 @@ the use of automatically generated accessor functions.
%inline %{
double seki = 2;
void print_seki() {
- zend_printf("seki is now %f\n",seki);
+ zend_printf("seki is now %f\n", seki);
}
%}
@@ -463,7 +463,7 @@ One can include cpointer.i to generate PHP wrappers to int
%module example
%include "cpointer.i"
-%pointer_functions(int,intp)
+%pointer_functions(int, intp)
void add( int *in1, int *in2, int *result);
@@ -513,7 +513,7 @@ include("example.php");
$in1 = 3;
$in2 = 5;
-$result= add($in1,$in2); # Note using variables for the input is unnecessary.
+$result= add($in1, $in2); # Note using variables for the input is unnecessary.
echo "The sum $in1 + $in2 = $result\n";
?>
@@ -559,7 +559,7 @@ include("example.php");
$in1 = 3;
$in2 = 5;
$result = 0;
-add($in1,$in2,$result);
+add($in1, $in2, $result);
echo "The sum $in1 + $in2 = $result\n";
?>
@@ -603,7 +603,7 @@ This interface file
class Vector {
public:
- double x,y,z;
+ double x, y, z;
Vector();
~Vector();
double magnitude();
@@ -627,7 +627,7 @@ Would be used in the following way from PHP:
$v->y = 4;
$v->z = 5;
- echo "Magnitude of ($v->x,$v->y,$v->z) = " . $v->magnitude() . "\n";
+ echo "Magnitude of ($v->x, $v->y, $v->z) = " . $v->magnitude() . "\n";
$v = NULL; # destructor called.
@@ -656,17 +656,17 @@ in the following PHP functions:
new_Vector();
-Vector_x_set($obj,$d);
+Vector_x_set($obj, $d);
Vector_x_get($obj);
-Vector_y_set($obj,$d);
+Vector_y_set($obj, $d);
Vector_y_get($obj);
-Vector_z_set($obj,$d);
+Vector_z_set($obj, $d);
Vector_z_get($obj);
Vector_magnitude($obj);
new_Complex();
-Complex_re_set($obj,$d);
+Complex_re_set($obj, $d);
Complex_re_get($obj);
-Complex_im_set($obj,$d);
+Complex_im_set($obj, $d);
Complex_im_get($obj);
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
index ab32f79c7..efa0c0f8e 100644
--- a/Doc/Manual/Preprocessor.html
+++ b/Doc/Manual/Preprocessor.html
@@ -224,7 +224,7 @@ For example:
-%define ARRAYHELPER(type,name)
+%define ARRAYHELPER(type, name)
%inline %{
type *new_ ## name (int nitems) {
return (type *) malloc(sizeof(type)*nitems);
@@ -269,7 +269,7 @@ SWIG-1.3.12 and newer releases support variadic preprocessor macros. For exampl
-#define DEBUGF(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
+#define DEBUGF(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
@@ -281,12 +281,12 @@ macros defined using %define.
SWIG allows a variable number of arguments to be empty. However, this often results
-in an extra comma (,) and syntax error in the resulting expansion. For example:
+in an extra comma (, ) and syntax error in the resulting expansion. For example:
-DEBUGF("hello"); --> fprintf(stderr,"hello",);
+DEBUGF("hello"); --> fprintf(stderr, "hello", );
@@ -296,7 +296,7 @@ To get rid of the extra comma, use ## like this:
-#define DEBUGF(fmt,...) fprintf(stderr,fmt, ##__VA_ARGS__)
+#define DEBUGF(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
@@ -306,7 +306,7 @@ SWIG also supports GNU-style variadic macros. For example:
-#define DEBUGF(fmt, args...) fprintf(stdout,fmt,args)
+#define DEBUGF(fmt, args...) fprintf(stdout, fmt, args)
@@ -425,7 +425,7 @@ whereas
#define SWIG_macro(CAST) (CAST)$input
-%typemap(in,noblock=1) Int {$1= SWIG_macro(int);}
+%typemap(in, noblock=1) Int {$1= SWIG_macro(int);}
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index cb847c074..ee435bde9 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -1294,7 +1294,7 @@ a very natural interface. For example,
struct Vector {
- double x,y,z;
+ double x, y, z;
};
@@ -1589,11 +1589,11 @@ structure. All of the usual Python utility functions work normally:
>>> b = Bar()
->>> instance(b,Foo)
+>>> instance(b, Foo)
1
->>> issubclass(Bar,Foo)
+>>> issubclass(Bar, Foo)
1
->>> issubclass(Foo,Bar)
+>>> issubclass(Foo, Bar)
0
@@ -1836,8 +1836,8 @@ When wrapped, it works like you expect:
->>> c = Complex(3,4)
->>> d = Complex(7,8)
+>>> c = Complex(3, 4)
+>>> d = Complex(7, 8)
>>> e = c + d
>>> e.re()
10.0
@@ -1905,7 +1905,7 @@ submodules or packages. For example, if you have a file like this,
namespace foo {
int fact(int n);
struct Vector {
- double x,y,z;
+ double x, y, z;
};
};
@@ -1984,7 +1984,7 @@ struct pair {
~pair();
};
-%template(pairii) pair<int,int>;
+%template(pairii) pair<int, int>;
@@ -1995,7 +1995,7 @@ In Python:
>>> import example
->>> p = example.pairii(3,4)
+>>> p = example.pairii(3, 4)
>>> p.first
3
>>> p.second
@@ -2203,8 +2203,8 @@ class Foo(object):
def __del__(self):
if self.thisown:
_example.delete_Foo(self.this)
- def spam(self,arg1):
- return _example.Foo_spam(self.this,arg1)
+ def spam(self, arg1):
+ return _example.Foo_spam(self.this, arg1)
x = property(_example.Foo_x_get, _example.Foo_x_set)
@@ -3296,11 +3296,11 @@ For example, you might get errors like this:
>>> a = [
-... [1,0,0,0],
-... [0,1,0,0],
-... [0,0,1,0],
-... [0,0,0,1]]
->>> set_transform(im,a)
+... [1, 0, 0, 0],
+... [0, 1, 0, 0],
+... [0, 0, 1, 0],
+... [0, 0, 0, 1]]
+>>> set_transform(im, a)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: Type error. Expected _p_a_4__double
@@ -3340,11 +3340,11 @@ From Python, you could then write code like this:
>>> a = new_mat44()
->>> mat44_set(a,0,0,1.0)
->>> mat44_set(a,1,1,1.0)
->>> mat44_set(a,2,2,1.0)
+>>> mat44_set(a, 0, 0, 1.0)
+>>> mat44_set(a, 1, 1, 1.0)
+>>> mat44_set(a, 2, 2, 1.0)
...
->>> set_transform(im,a)
+>>> set_transform(im, a)
>>>
@@ -3372,12 +3372,12 @@ void set_transform(Image *im, double x[4][4]);
...
/* Rewrite the high level interface to set_transform */
%pythoncode %{
-def set_transform(im,x):
+def set_transform(im, x):
a = new_mat44()
for i in range(4):
for j in range(4):
- mat44_set(a,i,j,x[i][j])
- _example.set_transform(im,a)
+ mat44_set(a, i, j, x[i][j])
+ _example.set_transform(im, a)
free_mat44(a)
%}
@@ -3391,11 +3391,11 @@ low-level helper functions. For example, this code now seems to work:
>>> a = [
-... [1,0,0,0],
-... [0,1,0,0],
-... [0,0,1,0],
-... [0,0,0,1]]
->>> set_transform(im,a)
+... [1, 0, 0, 0],
+... [0, 1, 0, 0],
+... [0, 0, 1, 0],
+... [0, 0, 0, 1]]
+>>> set_transform(im, a)
>>>
@@ -3624,13 +3624,13 @@ Here is a simple example:
%}
struct Vector {
- double x,y,z;
+ double x, y, z;
};
%extend Vector {
char *__str__() {
static char tmp[1024];
- sprintf(tmp,"Vector(%g,%g,%g)", $self->x,$self->y,$self->z);
+ sprintf(tmp, "Vector(%g, %g, %g)", $self->x, $self->y, $self->z);
return tmp;
}
Vector(double x, double y, double z) {
@@ -3650,9 +3650,9 @@ Now, in Python
->>> v = example.Vector(2,3,4)
+>>> v = example.Vector(2, 3, 4)
>>> print v
-Vector(2,3,4)
+Vector(2, 3, 4)
>>>
@@ -3683,10 +3683,10 @@ Use it like this:
>>> import example
->>> v = example.Vector(2,3,4)
->>> w = example.Vector(10,11,12)
+>>> v = example.Vector(2, 3, 4)
+>>> w = example.Vector(10, 11, 12)
>>> print v+w
-Vector(12,14,16)
+Vector(12, 14, 16)
>>>
@@ -3715,7 +3715,7 @@ or a NULL pointer perhaps). Here is a simple example of how you might handle th
%exception malloc {
$action
if (!result) {
- PyErr_SetString(PyExc_MemoryError,"Not enough memory");
+ PyErr_SetString(PyExc_MemoryError, "Not enough memory");
SWIG_fail;
}
}
@@ -3888,10 +3888,10 @@ In Python, this allows you to pass simple values. For example:
->>> a = add(3,4)
+>>> a = add(3, 4)
>>> print a
7
->>> b = sub(7,4)
+>>> b = sub(7, 4)
>>> print b
3
>>>
@@ -4034,7 +4034,7 @@ Now, in Python:
->>> r,c = get_dimensions(m)
+>>> r, c = get_dimensions(m)
@@ -4075,7 +4075,7 @@ extern void add(int x, int y, int *result);
-The %pointer_functions(type,name) macro generates five helper functions that can be used to create,
+The %pointer_functions(type, name) macro generates five helper functions that can be used to create,
destroy, copy, assign, and dereference a pointer. In this case, the functions are as follows:
@@ -4098,7 +4098,7 @@ In Python, you would use the functions like this:
>>> result = new_intp()
>>> print result
_108fea8_p_int
->>> add(3,4,result)
+>>> add(3, 4, result)
>>> print intp_value(result)
7
>>>
@@ -4106,13 +4106,13 @@ _108fea8_p_int
-If you replace %pointer_functions() by %pointer_class(type,name), the interface is more class-like.
+If you replace %pointer_functions() by %pointer_class(type, name), the interface is more class-like.
>>> result = intp()
->>> add(3,4,result)
+>>> add(3, 4, result)
>>> print result.value()
7
@@ -4164,7 +4164,7 @@ For instance, you will be able to do this in Python:
>>> a = intArray(10000000) # Array of 10-million integers
>>> for i in xrange(10000): # Set some values
... a[i] = i
->>> sumitems(a,10000)
+>>> sumitems(a, 10000)
49995000
>>>
@@ -4384,7 +4384,7 @@ you might define a typemap like this:
%typemap(in) int {
$1 = (int) PyLong_AsLong($input);
- printf("Received an integer : %d\n",$1);
+ printf("Received an integer : %d\n", $1);
}
%inline %{
extern int fact(int n);
@@ -4423,7 +4423,7 @@ You can refine this by supplying an optional parameter name. For example:
%typemap(in) int nonnegative {
$1 = (int) PyLong_AsLong($input);
if ($1 < 0) {
- PyErr_SetString(PyExc_ValueError,"Expected a nonnegative value.");
+ PyErr_SetString(PyExc_ValueError, "Expected a nonnegative value.");
SWIG_fail;
}
}
@@ -4448,7 +4448,7 @@ the typemap system follows typedef declarations. For example:
%typemap(in) int n {
$1 = (int) PyLong_AsLong($input);
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
%inline %{
typedef int Integer;
@@ -4480,7 +4480,7 @@ parameter is omitted):
->>> example.count('e','Hello World')
+>>> example.count('e', 'Hello World')
1
>>>
@@ -4756,18 +4756,18 @@ object to be used as a char ** object.
int i = 0;
$1 = (char **) malloc((size+1)*sizeof(char *));
for (i = 0; i < size; i++) {
- PyObject *o = PyList_GetItem($input,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 {
free($1);
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ PyErr_SetString(PyExc_TypeError, "list must contain strings");
SWIG_fail;
}
}
$1[i] = 0;
} else {
- PyErr_SetString(PyExc_TypeError,"not a list");
+ PyErr_SetString(PyExc_TypeError, "not a list");
SWIG_fail;
}
}
@@ -4782,7 +4782,7 @@ object to be used as a char ** object.
int print_args(char **argv) {
int i = 0;
while (argv[i]) {
- printf("argv[%d] = %s\n", i,argv[i]);
+ printf("argv[%d] = %s\n", i, argv[i]);
i++;
}
return i;
@@ -4855,18 +4855,18 @@ previous example:
$1 = PyList_Size($input);
$2 = (char **) malloc(($1+1)*sizeof(char *));
for (i = 0; i < $1; i++) {
- PyObject *o = PyList_GetItem($input,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 {
free($2);
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ PyErr_SetString(PyExc_TypeError, "list must contain strings");
SWIG_fail;
}
}
$2[i] = 0;
} else {
- PyErr_SetString(PyExc_TypeError,"not a list");
+ PyErr_SetString(PyExc_TypeError, "not a list");
SWIG_fail;
}
}
@@ -4929,7 +4929,7 @@ Traceback (most recent call last):
example.foo(["foo", "bar", "spam", "1"])
NotImplementedError: Wrong number or type of arguments for overloaded function 'foo'.
Possible C/C++ prototypes are:
- foo(int,char **)
+ foo(int, char **)
foo()
@@ -4972,12 +4972,12 @@ A typemap can be used to handle this case as follows :
if (!PyTuple_Check($result)) {
PyObject *o2 = $result;
$result = PyTuple_New(1);
- PyTuple_SetItem($result,0,o2);
+ PyTuple_SetItem($result, 0, o2);
}
o3 = PyTuple_New(1);
- PyTuple_SetItem(o3,0,o);
+ PyTuple_SetItem(o3, 0, o);
o2 = $result;
- $result = PySequence_Concat(o2,o3);
+ $result = PySequence_Concat(o2, o3);
Py_DECREF(o2);
Py_DECREF(o3);
}
@@ -5001,7 +5001,7 @@ no meaningful input value), an additional typemap can be written. For example:
-%typemap(in,numinputs=0) double *OutValue(double temp) {
+%typemap(in, numinputs=0) double *OutValue(double temp) {
$1 = &temp;
}
@@ -5015,10 +5015,10 @@ function can now be used as follows:
->>> a = spam(4,5)
+>>> a = spam(4, 5)
>>> print a
(0, 2.45, 5.0)
->>> x,y,z = spam(4,5)
+>>> x, y, z = spam(4, 5)
>>>
@@ -5043,13 +5043,13 @@ This too, can be handled used typemaps as follows :
%typemap(in) double[4](double temp[4]) { // temp[4] becomes a local variable
int i;
if (PyTuple_Check($input)) {
- if (!PyArg_ParseTuple($input,"dddd",temp,temp+1,temp+2,temp+3)) {
- PyErr_SetString(PyExc_TypeError,"tuple must have 4 elements");
+ if (!PyArg_ParseTuple($input, "dddd", temp, temp+1, temp+2, temp+3)) {
+ PyErr_SetString(PyExc_TypeError, "tuple must have 4 elements");
SWIG_fail;
}
$1 = &temp[0];
} else {
- PyErr_SetString(PyExc_TypeError,"expected a tuple.");
+ PyErr_SetString(PyExc_TypeError, "expected a tuple.");
SWIG_fail;
}
}
@@ -5062,7 +5062,7 @@ Python as follows :
->>> set_direction((0.5,0.0,1.0,-0.25))
+>>> set_direction((0.5, 0.0, 1.0, -0.25))
@@ -5084,18 +5084,18 @@ arrays of different sizes. To do this, you might write a typemap as follows:
%typemap(in) double[ANY](double temp[$1_dim0]) {
int i;
if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_TypeError,"Expecting a sequence");
+ PyErr_SetString(PyExc_TypeError, "Expecting a sequence");
SWIG_fail;
}
if (PyObject_Length($input) != $1_dim0) {
- PyErr_SetString(PyExc_ValueError,"Expecting a sequence with $1_dim0 elements");
+ PyErr_SetString(PyExc_ValueError, "Expecting a sequence with $1_dim0 elements");
SWIG_fail;
}
for (i =0; i < $1_dim0; i++) {
- PyObject *o = PySequence_GetItem($input,i);
+ PyObject *o = PySequence_GetItem($input, i);
if (!PyFloat_Check(o)) {
Py_XDECREF(o);
- PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
+ PyErr_SetString(PyExc_ValueError, "Expecting a sequence of floats");
SWIG_fail;
}
temp[i] = PyFloat_AsDouble(o);
@@ -5130,18 +5130,18 @@ to use a helper function instead. This will greatly reduce the amount of wrappe
static int convert_darray(PyObject *input, double *ptr, int size) {
int i;
if (!PySequence_Check(input)) {
- PyErr_SetString(PyExc_TypeError,"Expecting a sequence");
+ PyErr_SetString(PyExc_TypeError, "Expecting a sequence");
return 0;
}
if (PyObject_Length(input) != size) {
- PyErr_SetString(PyExc_ValueError,"Sequence size mismatch");
+ PyErr_SetString(PyExc_ValueError, "Sequence size mismatch");
return 0;
}
for (i =0; i < size; i++) {
- PyObject *o = PySequence_GetItem(input,i);
+ PyObject *o = PySequence_GetItem(input, i);
if (!PyFloat_Check(o)) {
Py_XDECREF(o);
- PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats");
+ PyErr_SetString(PyExc_ValueError, "Expecting a sequence of floats");
return 0;
}
ptr[i] = PyFloat_AsDouble(o);
@@ -5152,7 +5152,7 @@ static int convert_darray(PyObject *input, double *ptr, int size) {
%}
%typemap(in) double [ANY](double temp[$1_dim0]) {
- if (!convert_darray($input,temp,$1_dim0)) {
+ if (!convert_darray($input, temp, $1_dim0)) {
SWIG_fail;
}
$1 = &temp[0];
diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html
index 9b5993bff..40b96d6c9 100644
--- a/Doc/Manual/R.html
+++ b/Doc/Manual/R.html
@@ -146,7 +146,7 @@ file makeRData.R which contains the following
source('BigFile.R')
-save(list=ls(all=TRUE),file="BigFile.RData", compress=TRUE)
+save(list=ls(all=TRUE), file="BigFile.RData", compress=TRUE)
q(save="no")
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index cfb99e792..d71c823f1 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -1014,7 +1014,7 @@ void foo(char *c);
irb(main):002:0> foo("Hello") # foo(char *c)
-Similarly, if you have a class like this,
+Similarly, if you have a class like this,
class Foo {
@@ -1141,7 +1141,7 @@ like this,
namespace foo {
int fact(int n);
struct Vector {
- double x,y,z;
+ double x, y, z;
};
};
@@ -1210,7 +1210,7 @@ struct pair {
~pair();
};
-%template(Pairii) pair<int,int>;
+%template(Pairii) pair<int, int>;
In Ruby:
@@ -1273,7 +1273,7 @@ v.each { |x| puts x }
3
4
v.delete_if { |x| x == 3 }
-=> [2,4]
+=> [2, 4]
The SWIG Ruby module provides also the ability for all the STL
@@ -1303,7 +1303,7 @@ include NativeVector
v = NativeVector.new
v << 1
-v << [1,2]
+v << [1, 2]
v << 'hello'
class A; end
@@ -1311,7 +1311,7 @@ class A; end
v << A.new
puts v
-=> [1, [1,2], 'hello', #<A:0x245325>]
+=> [1, [1, 2], 'hello', #<A:0x245325>]
@@ -1368,15 +1368,15 @@ a << 1
a << 2
a << 3
a
-=> [1,2,3]
+=> [1, 2, 3]
# Custom sorting behavior defined by a Ruby proc
-b = IntSet.new( proc { |a,b| a > b } )
+b = IntSet.new( proc { |a, b| a > b } )
b << 1
b << 2
b << 3
b
-=> [3,2,1]
+=> [3, 2, 1]
@@ -1493,7 +1493,7 @@ like this:
}
-Then, if you have a class like this,
+Then, if you have a class like this,
class Foo {
@@ -1665,7 +1665,7 @@ a comma-separated list of aliases to the %alias
directive, e.g.
-%alias MyArray::length "amount,quantity,size";
+%alias MyArray::length "amount, quantity, size";
From an end-user's standpoint, there's no functional
@@ -1835,10 +1835,10 @@ int sub(int *INPUT, int *INPUT);
In Ruby, this allows you to pass simple values. For example:
-a = Example.add(3,4)
+a = Example.add(3, 4)
puts a
7
-b = Example.sub(7,4)
+b = Example.sub(7, 4)
puts b
3
@@ -2086,7 +2086,7 @@ public:
Then, in ruby, it can be used like:
-Window.new(0,0,360,480) { |w|
+Window.new(0, 0, 360, 480) { |w|
w.color = Fltk::RED
w.border = false
}
@@ -2102,7 +2102,7 @@ a special in typemap, like:
//
// void func(int x);
-%typemap(in,numinputs=0) int RUBY_YIELD_SELF {
+%typemap(in, numinputs=0) int RUBY_YIELD_SELF {
if ( !rb_block_given_p() )
rb_raise("No block given");
return rb_yield(self);
@@ -2384,7 +2384,7 @@ from Ruby to C, you might define a typemap like this:
%typemap(in) int {
$1 = (int) NUM2INT($input);
- printf("Received an integer : %d\n",$1);
+ printf("Received an integer : %d\n", $1);
}
%inline %{
@@ -2428,7 +2428,7 @@ supplying an optional parameter name. For example:
%typemap(in) int n {
$1 = (int) NUM2INT($input);
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
%inline %{
@@ -2450,7 +2450,7 @@ declarations. For example:
%typemap(in) int n {
$1 = (int) NUM2INT($input);
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
typedef int Integer;
@@ -2478,7 +2478,7 @@ always handled as a single Ruby object. This allows the function count
to be used as follows (notice how the length parameter is omitted):
-puts Example.count('o','Hello World')
+puts Example.count('o', 'Hello World')
2
@@ -2747,7 +2747,7 @@ functions and methods. It merely checks an argument to see whether or
not it matches a specific type. For example:
-%typemap(typecheck,precedence=SWIG_TYPECHECK_INTEGER) int {
+%typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int {
$1 = FIXNUM_P($input) ? 1 : 0;
}
@@ -2862,7 +2862,7 @@ arguments have been converted. For example:
%typemap(check) int positive {
if ($1 <= 0) {
- SWIG_exception(SWIG_ValueError,"Expected positive value.");
+ SWIG_exception(SWIG_ValueError, "Expected positive value.");
}
}
@@ -3168,7 +3168,7 @@ directive. Thus, a function can be made to return "nothing"
if you do:
-%feature("numoutputs","0") MyClass::function;
+%feature("numoutputs", "0") MyClass::function;
This feature can be useful if a function returns a status
@@ -3346,7 +3346,7 @@ across multiple languages.
rb_float_new(double)
- SWIG_From_double(double),
+ SWIG_From_double(double),
SWIG_From_float(float)
float/double to Float
@@ -3365,7 +3365,7 @@ versions do not, but return a status value to indicate success (SWIG_OK
%typemap(in) size_t (int ok)
ok = SWIG_AsVal_size_t($input, &$1);
if (!SWIG_IsOK(ok)) {
- SWIG_exception_fail(SWIG_ArgError(ok), Ruby_Format_TypeError( "$1_name", "$1_type","$symname", $argnum, $input));
+ SWIG_exception_fail(SWIG_ArgError(ok), Ruby_Format_TypeError( "$1_name", "$1_type", "$symname", $argnum, $input));
}
}
@@ -3615,7 +3615,7 @@ Array instance to be used as a char ** object.
int print_args(char **argv) {
int i = 0;
while (argv[i]) {
- printf("argv[%d] = %s\n", i,argv[i]);
+ printf("argv[%d] = %s\n", i, argv[i]);
i++;
}
return i;
@@ -3628,7 +3628,7 @@ operates as follows :
require 'Argv'
-Argv.print_args(["Dave","Mike","Mary","Jane","John"])
+Argv.print_args(["Dave", "Mike", "Mary", "Jane", "John"])
argv[0] = Dave
argv[1] = Mike
argv[2] = Mary
@@ -4591,7 +4591,7 @@ comma-separated list of module names to the %mixin
directive, e.g.
-%mixin Set "Fee,Fi,Fo,Fum";
+%mixin Set "Fee, Fi, Fo, Fum";
Note that the %mixin directive is
@@ -4941,7 +4941,7 @@ in SWIG-1.3.26. and later.
SWIG automatically keeps track of mappings between C++ objects and Ruby
objects. Note that enabling object tracking causes a slight performance
degradation. Test results show this degradation to be about 3% to 5%
-when creating and destroying 100,000 animals in a row.
+when creating and destroying 100, 000 animals in a row.
Since %trackobjects is implemented as a %feature,
it uses the same name matching rules as other kinds of features (see
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index 3c8565fdc..fd37eb541 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -480,7 +480,7 @@ Or in Python:
>>> example.sin(3)
5.2335956
->>> example.strcmp('Dave','Mike')
+>>> example.strcmp('Dave', 'Mike')
-1
>>> print example.cvar.Foo
42
@@ -649,7 +649,7 @@ print cvar.foo # Print value of foo
# Perl
$foo = 3.5; # Set foo to 3.5
-print $foo,"\n"; # Print value of foo
+print $foo, "\n"; # Print value of foo
# Ruby
Module.foo = 3.5 # Set foo to 3.5
@@ -750,7 +750,7 @@ form of type-checking however).
For enumerations, it is critical that the original enum definition be
included somewhere in the interface file (either in a header file or
-in the %{,%} block). SWIG only translates the enumeration
+in the %{, %} block). SWIG only translates the enumeration
into code needed to add the constants to a scripting language. It
needs the original enumeration declaration in order to get the correct
enum values as assigned by the C compiler.
@@ -1042,14 +1042,14 @@ expect :
# Copy a file
-def filecopy(source,target):
- f1 = fopen(source,"r")
- f2 = fopen(target,"w")
+def filecopy(source, target):
+ f1 = fopen(source, "r")
+ f2 = fopen(target, "w")
buffer = malloc(8192)
- nbytes = fread(buffer,8192,1,f1)
+ nbytes = fread(buffer, 8192, 1, f1)
while (nbytes > 0):
- fwrite(buffer,8192,1,f2)
- nbytes = fread(buffer,8192,1,f1)
+ fwrite(buffer, 8192, 1, f2)
+ nbytes = fread(buffer, 8192, 1, f1)
free(buffer)
@@ -1238,7 +1238,7 @@ creating a wrapper equivalent to the following:
double wrap_dot_product(Vector *a, Vector *b) {
Vector x = *a;
Vector y = *b;
- return dot_product(x,y);
+ return dot_product(x, y);
}
@@ -1270,7 +1270,7 @@ Vector *wrap_cross_product(Vector *v1, Vector *v2) {
Vector y = *v2;
Vector *result;
result = (Vector *) malloc(sizeof(Vector));
- *(result) = cross(x,y);
+ *(result) = cross(x, y);
return result;
}
@@ -1282,7 +1282,7 @@ or if SWIG was run with the -c++ option:
Vector *wrap_cross(Vector *v1, Vector *v2) {
Vector x = *v1;
Vector y = *v2;
- Vector *result = new Vector(cross(x,y)); // Uses default copy constructor
+ Vector *result = new Vector(cross(x, y)); // Uses default copy constructor
return result;
}
@@ -1360,14 +1360,14 @@ SWIG generates the following code:
void foo_set(char *value) {
if (foo) free(foo);
foo = (char *) malloc(strlen(value)+1);
- strcpy(foo,value);
+ strcpy(foo, value);
}
/* C++ mode. When -c++ option is used */
void foo_set(char *value) {
if (foo) delete [] foo;
foo = new char[strlen(value)+1];
- strcpy(foo,value);
+ strcpy(foo, value);
}
@@ -1382,7 +1382,7 @@ exactly like you want. For example:
%inline %{
void set_foo(char *value) {
- strncpy(foo,value, 50);
+ strncpy(foo, value, 50);
}
%}
@@ -1591,7 +1591,7 @@ char *pathname_get() {
return pathname;
}
void pathname_set(char *value) {
- strncpy(pathname,value,256);
+ strncpy(pathname, value, 256);
}
@@ -1612,9 +1612,9 @@ directive as shown :
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
@@ -1639,7 +1639,7 @@ The %mutable and %immutable directives are actually
#define %immutable %feature("immutable")
-#define %mutable %feature("immutable","")
+#define %mutable %feature("immutable", "")
@@ -1648,7 +1648,7 @@ If you wanted to make all wrapped variables read-only, barring one or two, it mi
%immutable; // Make all variables read-only
-%feature("immutable","0") x; // except, make x read/write
+%feature("immutable", "0") x; // except, make x read/write
...
double x;
double y;
@@ -2173,7 +2173,7 @@ consider a function like this:
-int binary_op(int a, int b, int (*op)(int,int));
+int binary_op(int a, int b, int (*op)(int, int));
@@ -2182,10 +2182,10 @@ may find the function to be impossible to use. For instance, in Python:
->>> def add(x,y):
+>>> def add(x, y):
... return x+y
...
->>> binary_op(3,4,add)
+>>> binary_op(3, 4, add)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: Type error. Expected _p_f_int_int__int
@@ -2202,12 +2202,12 @@ One way to do this is to use the %constant directive like this:
/* Function with a callback */
-int binary_op(int a, int b, int (*op)(int,int));
+int binary_op(int a, int b, int (*op)(int, int));
/* Some callback functions */
-%constant int add(int,int);
-%constant int sub(int,int);
-%constant int mul(int,int);
+%constant int add(int, int);
+%constant int sub(int, int);
+%constant int mul(int, int);
@@ -2217,9 +2217,9 @@ constants in the target scripting language. This allows you to use them as foll
->>> binary_op(3,4,add)
+>>> binary_op(3, 4, add)
7
->>> binary_op(3,4,mul)
+>>> binary_op(3, 4, mul)
12
>>>
@@ -2232,7 +2232,7 @@ as functions. For example:
->>> add(3,4)
+>>> add(3, 4)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: object is not callable: '_ff020efc_p_f_int_int__int'
@@ -2248,13 +2248,13 @@ can use the %callback and %nocallback directives like this:
/* Function with a callback */
-int binary_op(int a, int b, int (*op)(int,int));
+int binary_op(int a, int b, int (*op)(int, int));
/* Some callback functions */
%callback("%s_cb");
-int add(int,int);
-int sub(int,int);
-int mul(int,int);
+int add(int, int);
+int sub(int, int);
+int mul(int, int);
%nocallback;
@@ -2267,13 +2267,13 @@ disabled using %nocallback. When you do this, the interface now works
->>> binary_op(3,4,add_cb)
+>>> binary_op(3, 4, add_cb)
7
->>> binary_op(3,4,mul_cb)
+>>> binary_op(3, 4, mul_cb)
12
->>> add(3,4)
+>>> add(3, 4)
7
->>> mul(3,4)
+>>> mul(3, 4)
12
@@ -2294,9 +2294,9 @@ variation installs the callbacks as all upper case constants such as
/* Some callback functions */
%callback("%(uppercase)s");
-int add(int,int);
-int sub(int,int);
-int mul(int,int);
+int add(int, int);
+int sub(int, int);
+int mul(int, int);
%nocallback;
@@ -2332,7 +2332,7 @@ to an individual member. For example, the declaration :
struct Vector {
- double x,y,z;
+ double x, y, z;
}
@@ -2368,7 +2368,7 @@ defined in the interface. For example:
struct Vector *new_Vector() {
- return (Vector *) calloc(1,sizeof(struct Vector));
+ return (Vector *) calloc(1, sizeof(struct Vector));
}
void delete_Vector(struct Vector *obj) {
free(obj);
@@ -2384,9 +2384,9 @@ language using code like this:
v = new_Vector()
-Vector_x_set(v,2)
-Vector_y_set(v,10)
-Vector_z_set(v,-5)
+Vector_x_set(v, 2)
+Vector_y_set(v, 10)
+Vector_z_set(v, -5)
...
delete_Vector(v)
@@ -2405,7 +2405,7 @@ programs :
typedef struct {
- double x,y,z;
+ double x, y, z;
} Vector;
@@ -2430,7 +2430,7 @@ If two different names are used like this :
typedef struct vector_struct {
- double x,y,z;
+ double x, y, z;
} Vector;
@@ -2474,7 +2474,7 @@ 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);
+ strcpy(obj->name, c);
return obj->name;
}
@@ -2571,7 +2571,7 @@ language interface) results in the following code:
Bar *b;
-Foo_x_set(Bar_f_get(b),37);
+Foo_x_set(Bar_f_get(b), 37);
@@ -2727,7 +2727,7 @@ the following declaration :
/* file : vector.h */
...
typedef struct Vector {
- double x,y,z;
+ double x, y, z;
} Vector;
@@ -2760,7 +2760,7 @@ You can make a Vector look a lot like a class by writing a SWIG interfa
return sqrt($self->x*$self->x+$self->y*$self->y+$self->z*$self->z);
}
void print() {
- printf("Vector [%g, %g, %g]\n", $self->x,$self->y,$self->z);
+ printf("Vector [%g, %g, %g]\n", $self->x, $self->y, $self->z);
}
};
@@ -2780,7 +2780,7 @@ Now, when used with proxy classes in Python, you can do things like
this :
->>> v = Vector(3,4,0) # Create a new vector
+>>> v = Vector(3, 4, 0) # Create a new vector
>>> print v.magnitude() # Print magnitude
5.0
>>> v.print() # Print it out
@@ -2800,7 +2800,7 @@ of the Vector structure. For example:
%}
typedef struct Vector {
- double x,y,z;
+ double x, y, z;
%extend {
Vector(double x, double y, double z) { ... }
~Vector() { ... }
@@ -2842,9 +2842,9 @@ double Vector_magnitude(Vector *v) {
%}
typedef struct Vector {
- double x,y,z;
+ double x, y, z;
%extend {
- Vector(int,int,int); // This calls new_Vector()
+ Vector(int, int, int); // This calls new_Vector()
~Vector(); // This calls delete_Vector()
double magnitude(); // This will call Vector_magnitude()
...
@@ -2959,7 +2959,7 @@ char *Person_name_get(Person *p) {
}
void Person_name_set(Person *p, char *val) {
- strncpy(p->name,val,50);
+ strncpy(p->name, val, 50);
make_upper(p->name);
}
%}
@@ -3104,11 +3104,11 @@ _wrap_Vector_x_get(ClientData clientData, Tcl_Interp *interp,
struct Vector *arg1 ;
double result ;
- if (SWIG_GetArgs(interp, objc, objv,"p:Vector_x_get self ",&arg0,
+ if (SWIG_GetArgs(interp, objc, objv, "p:Vector_x_get self ", &arg0,
SWIGTYPE_p_Vector) == TCL_ERROR)
return TCL_ERROR;
result = (double ) (arg1->x);
- Tcl_SetObjResult(interp,Tcl_NewDoubleObj((double) result));
+ Tcl_SetObjResult(interp, Tcl_NewDoubleObj((double) result));
return TCL_OK;
}
@@ -3442,7 +3442,7 @@ header files.
Sometimes, it is necessary to use certain header files in order for
the code generated by SWIG to compile properly. Make sure you
-include certain header files by using a %{,%} block like this:
+include certain header files by using a %{, %} block like this:
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index 24eaac0b5..6fe9c2909 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -282,13 +282,13 @@ class FooProxy {
delete_Foo(self);
}
int bar(int x) {
- return Foo_bar(self,x);
+ return Foo_bar(self, x);
}
int x_get() {
return Foo_x_get(self);
}
void x_set(int x) {
- Foo_x_set(self,x);
+ Foo_x_set(self, x);
}
};
@@ -306,15 +306,15 @@ class Foo:
self.this = new_Foo()
def __del__(self):
delete_Foo(self.this)
- def bar(self,x):
- return Foo_bar(self.this,x)
- def __getattr__(self,name):
+ def bar(self, x):
+ return Foo_bar(self.this, x)
+ def __getattr__(self, name):
if name == 'x':
return Foo_x_get(self.this)
...
- def __setattr__(self,name,value):
+ def __setattr__(self, name, value):
if name == 'x':
- Foo_x_set(self.this,value)
+ Foo_x_set(self.this, value)
...
@@ -442,7 +442,7 @@ class SpamProxy {
return FooPtrProxy(Spam_value_get(self));
}
void value_set(FooProxy *v) {
- Spam_value_set(self,v->self);
+ Spam_value_set(self, v->self);
v->disown();
}
...
@@ -1435,7 +1435,7 @@ following:
Vector *wrap_cross_product(Vector *a, Vector *b) {
Vector x = *a;
Vector y = *b;
- Vector r = cross_product(x,y);
+ Vector r = cross_product(x, y);
return new Vector(r);
}
@@ -1457,7 +1457,7 @@ called the "Fulton Transform". This produces a wrapper that looks like this:
Vector cross_product(Vector *a, Vector *b) {
SwigValueWrapper<Vector> x = *a;
SwigValueWrapper<Vector> y = *b;
- SwigValueWrapper<Vector> r = cross_product(x,y);
+ SwigValueWrapper<Vector> r = cross_product(x, y);
return new Vector(r);
}
@@ -1550,7 +1550,7 @@ the full C++ code has been omitted.
class Shape {
public:
- double x,y;
+ double x, y;
virtual double area() = 0;
virtual double perimeter() = 0;
void set_location(double x, double y);
@@ -1586,7 +1586,7 @@ $ python
153.93804004599999757
>>> print shapes.Shape_area(square)
100.00000000000000000
->>> shapes.Shape_set_location(square,2,-3)
+>>> shapes.Shape_set_location(square, 2, -3)
>>> print shapes.Shape_perimeter(square)
40.00000000000000000
>>>
@@ -1892,7 +1892,7 @@ it might be used like this
>>> f = Foo() # Create a Foo
>>> f.bar(3)
>>> g = Foo(f) # Copy Foo
->>> f.bar("hello",2)
+>>> f.bar("hello", 2)
@@ -2129,7 +2129,7 @@ If you get an error message such as the following,
foo.i:6. Overloaded declaration ignored. Spam::foo(double )
foo.i:5. Previous declaration is Spam::foo(int )
-foo.i:7. Overloaded declaration ignored. Spam::foo(Bar *,Spam *,int )
+foo.i:7. Overloaded declaration ignored. Spam::foo(Bar *, Spam *, int )
foo.i:5. Previous declaration is Spam::foo(int )
@@ -2674,8 +2674,8 @@ operator normally. For example:
->>> a = Complex(3,4)
->>> b = Complex(5,2)
+>>> a = Complex(3, 4)
+>>> b = Complex(5, 2)
>>> c = a + b # Invokes __add__ method
@@ -2698,8 +2698,8 @@ The resulting scripting interface might work like this:
-a = Complex(3,4)
-b = Complex(5,2)
+a = Complex(3, 4)
+b = Complex(5, 2)
c = a.add(b) # Call a.operator+(b)
@@ -2807,14 +2807,14 @@ example :
class Vector {
public:
- double x,y,z;
+ 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);
+ sprintf(temp, "[ %g, %g, %g ]", $self->x, $self->y, $self->z);
return &temp[0];
}
}
@@ -2899,7 +2899,7 @@ is expected in an interface file. For example:
void foo(vector<int> *a, int n);
-void bar(list<int,100> *x);
+void bar(list<int, 100> *x);
@@ -2912,9 +2912,9 @@ and '>' within a constant expressions currently is not supported by SWIG
-void bar(list<int,100> *x); // OK
-void bar(list<int,2*50> *x); // OK
-void bar(list<int,(2>1 ? 100 : 50)> *x) // Not supported
+void bar(list<int, 100> *x); // OK
+void bar(list<int, 2*50> *x); // OK
+void bar(list<int, (2>1 ? 100 : 50)> *x) // Not supported
@@ -3085,7 +3085,7 @@ template vector<typename T, int max=100> class vector {
};
%template(intvec) vector<int>; // OK
-%template(vec1000) vector<int,1000>; // OK
+%template(vec1000) vector<int, 1000>; // OK
@@ -3205,8 +3205,8 @@ use the empty template instantiation, that is, %template with no name.
-// Instantiate traits<double,double>, but don't wrap it.
-%template() traits<double,double>;
+// Instantiate traits<double, double>, but don't wrap it.
+%template() traits<double, double>;
@@ -3466,8 +3466,8 @@ template<class T1, class T2> struct pair {
T2 second;
pair() : first(T1()), second(T2()) { }
pair(const T1 &x, const T2 &y) : first(x), second(y) { }
- template<class U1, class U2> pair(const pair<U1,U2> &x)
- : first(x.first),second(x.second) { }
+ template<class U1, class U2> pair(const pair<U1, U2> &x)
+ : first(x.first), second(x.second) { }
};
@@ -3481,7 +3481,7 @@ in the template class itself. For example:
%extend pair {
- %template(pair) pair<T1,T2>; // Generate default copy constructor
+ %template(pair) pair<T1, T2>; // Generate default copy constructor
};
@@ -3498,18 +3498,18 @@ Alternatively, you could expand the constructor template in selected instantiati
// Instantiate a few versions
-%template(pairii) pair<int,int>;
-%template(pairdd) pair<double,double>;
+%template(pairii) pair<int, int>;
+%template(pairdd) pair<double, double>;
// Create a default constructor only
-%extend pair<int,int> {
- %template(paird) pair<int,int>; // Default constructor
+%extend pair<int, int> {
+ %template(paird) pair<int, int>; // Default constructor
};
// Create default and conversion constructors
-%extend pair<double,double> {
- %template(paird) pair<double,dobule>; // Default constructor
- %template(pairc) pair<int,int>; // Conversion constructor
+%extend pair<double, double> {
+ %template(paird) pair<double, dobule>; // Default constructor
+ %template(pairc) pair<int, int>; // Conversion constructor
};
@@ -3522,9 +3522,9 @@ instead:
// Create default and conversion constructors
-%extend pair<double,double> {
- %template(pair) pair<double,dobule>; // Default constructor
- %template(pair) pair<int,int>; // Conversion constructor
+%extend pair<double, double> {
+ %template(pair) pair<double, dobule>; // Default constructor
+ %template(pair) pair<int, int>; // Conversion constructor
};
@@ -3745,7 +3745,7 @@ namespace math {
double cos(double);
class Complex {
- double im,re;
+ double im, re;
public:
...
};
@@ -4364,7 +4364,7 @@ write code like this:
f = Foo()
try:
f.blah()
-except Error,e:
+except Error, e:
# e is a wrapped instance of "Error"
@@ -4403,14 +4403,14 @@ struct Error2 : EBase { };
struct Error3 : EBase { };
struct Error4 : EBase { };
-%catches(Error1,Error2,...) Foo::bar();
+%catches(Error1, Error2, ...) Foo::bar();
%catches(EBase) Foo::blah();
class Foo {
public:
...
void bar();
- void blah() throw(Error1,Error2,Error3,Error4);
+ void blah() throw(Error1, Error2, Error3, Error4);
...
};
@@ -4441,9 +4441,9 @@ For example:
-double do_op(Object *o, double (Object::*callback)(double,double));
-extern double (Object::*fooptr)(double,double);
-%constant double (Object::*FOO)(double,double) = &Object::foo;
+double do_op(Object *o, double (Object::*callback)(double, double));
+extern double (Object::*fooptr)(double, double);
+%constant double (Object::*FOO)(double, double) = &Object::foo;
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index a1970e934..90bd8bb9a 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -1243,7 +1243,7 @@ struct triplet {
}
};
-%template(IntTriplet) triplet<int,int,int>;
+%template(IntTriplet) triplet<int, int, int>;
@@ -1321,7 +1321,7 @@ private:
--> c1 = new_Complex(3, 7);
---> c2 = Complex_plus(c, new_Complex(1,1));
+--> c2 = Complex_plus(c, new_Complex(1, 1));
--> Complex_toDouble(c2)
ans =
@@ -1355,7 +1355,7 @@ namespace foo {
}
struct Vector {
- double x,y,z;
+ double x, y, z;
};
};
@@ -1636,17 +1636,17 @@ double **create_matrix() {
return M;
}
-// Gets the item M(i,j) value
+// Gets the item M(i, j) value
double get_matrix(double **M, int i, int j) {
return M[i][j];
}
-// Sets the item M(i,j) value to be val
+// Sets the item M(i, j) value to be val
void set_matrix(double **M, int i, int j, double val) {
M[i][j] = val;
}
-// Prints a matrix (2,2) to console
+// Prints a matrix (2, 2) to console
void print_matrix(double **M, int nbRows, int nbCols) {
int i, j;
for (i = 0; i < 2; i++) {
@@ -1769,7 +1769,7 @@ void absolute(int *matrix, int matrixNbRow, int matrixNbCol,
The remarks made earlier for arrays also apply here:
-- The values of matrices in Scilab are column-major orderered,
+- The values of matrices in Scilab are column-major orderered,
- There is no control while converting double values to integers, double values are truncated without any checking or warning.
@@ -2062,7 +2062,7 @@ The command is:
-$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx,baa2.cxx example.i
+$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx, baa2.cxx example.i
39.7 Generated scripts
@@ -2082,12 +2082,12 @@ In this part we give some details about the generated Scilab scripts.
ilib_name = "examplelib";
files = ["example_wrap.c"];
libs = [];
-table = ["fact","_wrap_fact";"Foo_set","_wrap_Foo_set";"Foo_get","_wrap_Foo_get";];
-ilib_build(ilib_name,table,files,libs);
+table = ["fact", "_wrap_fact";"Foo_set", "_wrap_Foo_set";"Foo_get", "_wrap_Foo_get";];
+ilib_build(ilib_name, table, files, libs);
-ilib_build(lib_name,table,files,libs) is used to create shared libraries, and to generate a loader file used to dynamically load the shared library into Scilab.
+ilib_build(lib_name, table, files, libs) is used to create shared libraries, and to generate a loader file used to dynamically load the shared library into Scilab.
@@ -2118,7 +2118,7 @@ list_functions = [ 'fact';
'Foo_set';
'Foo_get';
];
-addinter(libexamplelib_path+'/libexamplelib.so','libexamplelib',list_functions);
+addinter(libexamplelib_path+'/libexamplelib.so', 'libexamplelib', list_functions);
// remove temp. variables on stack
clear libexamplelib_path;
clear list_functions;
@@ -2127,7 +2127,7 @@ clear get_file_path;
-addinter(files,spname,fcts) performs dynamic linking of a compiled C interface function.
+addinter(files, spname, fcts) performs dynamic linking of a compiled C interface function.
- files: a character string or a vector of character strings defining the object files (containing the C interface functions) to link with.
diff --git a/Doc/Manual/Scripting.html b/Doc/Manual/Scripting.html
index 18af78a68..50fdc024c 100644
--- a/Doc/Manual/Scripting.html
+++ b/Doc/Manual/Scripting.html
@@ -135,7 +135,7 @@ int wrap_fact(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
}
arg0 = atoi(argv[1]);
result = fact(arg0);
- sprintf(interp->result,"%d", result);
+ sprintf(interp->result, "%d", result);
return TCL_OK;
}
@@ -247,7 +247,7 @@ representation of a structure. For example,
struct Vector {
Vector();
~Vector();
- double x,y,z;
+ double x, y, z;
};
@@ -302,7 +302,7 @@ class Vector {
public:
Vector();
~Vector();
- double x,y,z;
+ double x, y, z;
};
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index af4880217..aa7e8a521 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -981,7 +981,7 @@ This provides a very natural interface. For example,
struct Vector {
- double x,y,z;
+ double x, y, z;
};
@@ -1663,7 +1663,7 @@ submodules or packages. For example, if you have a file like this,
namespace foo {
int fact(int n);
struct Vector {
- double x,y,z;
+ double x, y, z;
};
};
@@ -1739,7 +1739,7 @@ struct pair {
~pair();
};
-%template(pairii) pair<int,int>;
+%template(pairii) pair<int, int>;
@@ -2465,9 +2465,9 @@ you might define a typemap like this:
%module example
%typemap(in) int {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ if (Tcl_GetIntFromObj(interp, $input, &$1) == TCL_ERROR)
return TCL_ERROR;
- printf("Received an integer : %d\n",$1);
+ printf("Received an integer : %d\n", $1);
}
%inline %{
extern int fact(int n);
@@ -2504,9 +2504,9 @@ You can refine this by supplying an optional parameter name. For example:
%module example
%typemap(in) int n {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ if (Tcl_GetIntFromObj(interp, $input, &$1) == TCL_ERROR)
return TCL_ERROR;
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
%inline %{
extern int fact(int n);
@@ -2528,9 +2528,9 @@ the typemap system follows typedef declarations. For example:
%typemap(in) int n {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ if (Tcl_GetIntFromObj(interp, $input, &$1) == TCL_ERROR)
return TCL_ERROR;
- printf("n = %d\n",$1);
+ printf("n = %d\n", $1);
}
%inline %{
typedef int Integer;
@@ -2552,7 +2552,7 @@ Typemaps can also be defined for groups of consecutive arguments. For example:
%typemap(in) (char *str, int len) {
- $1 = Tcl_GetStringFromObj($input,&$2);
+ $1 = Tcl_GetStringFromObj($input, &$2);
};
int count(char c, char *str, int len);
@@ -2585,7 +2585,7 @@ like this:
%typemap(out) int {
- Tcl_SetObjResult(interp,Tcl_NewIntObj($1));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj($1));
}
@@ -2804,7 +2804,7 @@ used as a char ** object.
}
$1 = (char **) malloc((nitems+1)*sizeof(char *));
for (i = 0; i < nitems; i++) {
- $1[i] = Tcl_GetStringFromObj(listobjv[i],0);
+ $1[i] = Tcl_GetStringFromObj(listobjv[i], 0);
}
$1[i] = 0;
}
@@ -2821,7 +2821,7 @@ used as a char ** object.
int print_args(char **argv) {
int i = 0;
while (argv[i]) {
- printf("argv[%d] = %s\n", i,argv[i]);
+ printf("argv[%d] = %s\n", i, argv[i]);
i++;
}
return i;
@@ -2855,19 +2855,19 @@ function argument. For example :
// A typemap defining how to return an argument by appending it to the result
%typemap(argout) double *outvalue {
Tcl_Obj *o = Tcl_NewDoubleObj($1);
- Tcl_ListObjAppendElement(interp,$result,o);
+ Tcl_ListObjAppendElement(interp, $result, o);
}
// A typemap telling SWIG to ignore an argument for input
// However, we still need to pass a pointer to the C function
-%typemap(in,numinputs=0) double *outvalue (double temp) {
+%typemap(in, numinputs=0) double *outvalue (double temp) {
$1 = &temp;
}
// Now a function returning two values
int mypow(double a, double b, double *outvalue) {
if ((a < 0) || (b < 0)) return -1;
- *outvalue = pow(a,b);
+ *outvalue = pow(a, b);
return 0;
};
@@ -2991,7 +2991,7 @@ work)
%typemap(out) int, short, long {
- Tcl_SetIntObj($result,(int) $1);
+ Tcl_SetIntObj($result, (int) $1);
}
@@ -3038,8 +3038,8 @@ work)
-%typemap(out,noblock=1,fragment="SWIG_FromCharPtr") char *, const char * {
- Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)$1));
+%typemap(out, noblock=1, fragment="SWIG_FromCharPtr") char *, const char * {
+ Tcl_SetObjResult(interp, SWIG_FromCharPtr((const char *)$1));
}
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index 8aa5abb3f..c12d5f823 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -289,7 +289,7 @@ PyObject *wrap_gcd(PyObject *self, PyObject *args) {
arg2 = PyInt_AsLong(obj2);
}
- result = gcd(arg1,arg2);
+ result = gcd(arg1, arg2);
/* "out" typemap, return value */
{
@@ -375,7 +375,7 @@ example, you could write a typemap like this:
%typemap(in) double nonnegative {
$1 = PyFloat_AsDouble($input);
if ($1 < 0) {
- PyErr_SetString(PyExc_ValueError,"argument must be nonnegative.");
+ PyErr_SetString(PyExc_ValueError, "argument must be nonnegative.");
SWIG_fail;
}
}
@@ -623,7 +623,7 @@ function like this:
-foo("hello",3) # Reversed arguments
+foo("hello", 3) # Reversed arguments
@@ -637,7 +637,7 @@ function instead. For example:
%rename(foo) wrap_foo;
%inline %{
void wrap_foo(char *s, int x) {
- foo(x,s);
+ foo(x, s);
}
%}
@@ -777,7 +777,7 @@ Here are some examples of valid typemap specifications:
}
/* Typemap with modifiers */
-%typemap(in,doc="integer") int "$1 = scm_to_int($input);";
+%typemap(in, doc="integer") int "$1 = scm_to_int($input);";
/* Typemap applied to patterns of multiple arguments */
%typemap(in) (char *str, int len),
@@ -1248,7 +1248,7 @@ like this:
typedef int Integer;
-typedef foo<Integer,Integer> fooii;
+typedef foo<Integer, Integer> fooii;
void blah(fooii *x);
@@ -1262,9 +1262,9 @@ In this case, the following typemap patterns are searched for the argument f
fooii *x
fooii *
-# Reduce fooii --> foo<Integer,Integer>
-foo<Integer,Integer> *x
-foo<Integer,Integer> *
+# Reduce fooii --> foo<Integer, Integer>
+foo<Integer, Integer> *x
+foo<Integer, Integer> *
# Reduce Integer -> int
foo<int, Integer> *x
@@ -1279,7 +1279,7 @@ foo<int, int> *
Typemap reductions are always applied to the left-most type that appears. Only when no reductions can be made to the left-most
type are reductions made to other parts of the type. This behavior means that you could define a typemap for
-foo<int,Integer>, but a typemap for foo<Integer,int> would never be matched. Admittedly, this
+foo<int, Integer>, but a typemap for foo<Integer, int> would never be matched. Admittedly, this
is rather esoteric--there's little practical reason to write a typemap quite like that. Of course, you could rely on this
to confuse your coworkers even more.
@@ -1714,7 +1714,7 @@ you'll find the full typemap contents (example shown below for Python):
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | 0 );
+ res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0 );
if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ArgError(res), "in method '" "$symname" "', argument "
"$argnum"" of type '" "$type""'");
@@ -1736,7 +1736,7 @@ SWIGINTERN PyObject *_wrap_foo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
void *argp1 = 0 ;
int res1 = 0 ;
...
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_a_4__int, 0 | 0 );
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_a_4__int, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "foo" "', argument "
"1"" of type '" "int [10][4]""'");
@@ -1758,7 +1758,7 @@ For example, the output for the code in the
-%typemap(typecheck,precedence=SWIG_TYPECHECK_INTEGER) int {
+%typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int {
$1 = PyInt_Check($input) ? 1 : 0;
}
@@ -2690,7 +2690,7 @@ converted. For example:
%typemap(check) int positive {
if ($1 <= 0) {
- SWIG_exception(SWIG_ValueError,"Expected positive value.");
+ SWIG_exception(SWIG_ValueError, "Expected positive value.");
}
}
@@ -2963,19 +2963,19 @@ similar to this:
%typemap(in) float value[4] (float temp[4]) {
int i;
if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a sequence");
+ PyErr_SetString(PyExc_ValueError, "Expected a sequence");
SWIG_fail;
}
if (PySequence_Length($input) != 4) {
- PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected 4 elements");
+ PyErr_SetString(PyExc_ValueError, "Size mismatch. Expected 4 elements");
SWIG_fail;
}
for (i = 0; i < 4; i++) {
- PyObject *o = PySequence_GetItem($input,i);
+ PyObject *o = PySequence_GetItem($input, i);
if (PyNumber_Check(o)) {
temp[i] = (float) PyFloat_AsDouble(o);
} else {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+ PyErr_SetString(PyExc_ValueError, "Sequence elements must be numbers");
SWIG_fail;
}
}
@@ -3008,19 +3008,19 @@ If you wanted to generalize the typemap to apply to arrays of all dimensions you
%typemap(in) float value[ANY] (float temp[$1_dim0]) {
int i;
if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a sequence");
+ PyErr_SetString(PyExc_ValueError, "Expected a sequence");
SWIG_fail;
}
if (PySequence_Length($input) != $1_dim0) {
- PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected $1_dim0 elements");
+ PyErr_SetString(PyExc_ValueError, "Size mismatch. Expected $1_dim0 elements");
SWIG_fail;
}
for (i = 0; i < $1_dim0; i++) {
- PyObject *o = PySequence_GetItem($input,i);
+ PyObject *o = PySequence_GetItem($input, i);
if (PyNumber_Check(o)) {
temp[i] = (float) PyFloat_AsDouble(o);
} else {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+ PyErr_SetString(PyExc_ValueError, "Sequence elements must be numbers");
SWIG_fail;
}
}
@@ -3052,21 +3052,21 @@ as shown. To work with heap allocated data, the following technique can be use
%typemap(in) float value[ANY] {
int i;
if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a sequence");
+ PyErr_SetString(PyExc_ValueError, "Expected a sequence");
SWIG_fail;
}
if (PySequence_Length($input) != $1_dim0) {
- PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected $1_dim0 elements");
+ PyErr_SetString(PyExc_ValueError, "Size mismatch. Expected $1_dim0 elements");
SWIG_fail;
}
$1 = (float *) malloc($1_dim0*sizeof(float));
for (i = 0; i < $1_dim0; i++) {
- PyObject *o = PySequence_GetItem($input,i);
+ PyObject *o = PySequence_GetItem($input, i);
if (PyNumber_Check(o)) {
$1[i] = (float) PyFloat_AsDouble(o);
} else {
free($1);
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+ PyErr_SetString(PyExc_ValueError, "Sequence elements must be numbers");
SWIG_fail;
}
}
@@ -3169,7 +3169,7 @@ To fix this, you can write an "out" typemap. For example:
$result = PyList_New($1_dim0);
for (i = 0; i < $1_dim0; i++) {
PyObject *o = PyFloat_FromDouble((double) $1[i]);
- PyList_SetItem($result,i,o);
+ PyList_SetItem($result, i, o);
}
}
@@ -3228,7 +3228,7 @@ pointers. For example:
%typemap(check) Vector * {
if ($1 == 0) {
- PyErr_SetString(PyExc_TypeError,"NULL Pointer not allowed");
+ PyErr_SetString(PyExc_TypeError, "NULL Pointer not allowed");
SWIG_fail;
}
}
@@ -3268,7 +3268,7 @@ The example above also shows a common approach of issuing a warning for an as ye
Compatibility note: In SWIG-1.1 different languages could be distinguished with the language name being put within the %typemap directive, for example,
-%typemap(ruby,in) int "$1 = NUM2INT($input);".
+%typemap(ruby, in) int "$1 = NUM2INT($input);".
11.8 Optimal code generation when returning by value
@@ -3513,7 +3513,7 @@ maps perform the conversion described for the above example:
$1 = PyList_Size($input);
$2 = (char **) malloc(($1+1)*sizeof(char *));
for (i = 0; i < $1; i++) {
- PyObject *s = PyList_GetItem($input,i);
+ PyObject *s = PyList_GetItem($input, i);
if (!PyString_Check(s)) {
free($2);
PyErr_SetString(PyExc_ValueError, "List items must be strings");
@@ -3661,7 +3661,7 @@ might write typemaps like this:
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
- $result = PyString_FromStringAndSize($1,result);
+ $result = PyString_FromStringAndSize($1, result);
free($1);
}
@@ -3680,16 +3680,16 @@ Now, in a script, you can write code that simply passes buffers as strings like
>>> f = example.open("Makefile")
->>> example.read(f,40)
+>>> example.read(f, 40)
'TOP = ../..\nSWIG = $(TOP)/.'
->>> example.read(f,40)
+>>> example.read(f, 40)
'./swig\nSRCS = example.c\nTARGET '
>>> example.close(f)
0
>>> g = example.open("foo", example.O_WRONLY | example.O_CREAT, 0644)
->>> example.write(g,"Hello world\n")
+>>> example.write(g, "Hello world\n")
12
->>> example.write(g,"This is a test\n")
+>>> example.write(g, "This is a test\n")
15
>>> example.close(g)
0
@@ -3959,7 +3959,7 @@ list. Consider:
-%typemap(in, fragment="frag1,frag2,frag3") {...}
+%typemap(in, fragment="frag1, frag2, frag3") {...}
@@ -4421,7 +4421,7 @@ You can access the functions in a normal way from the scripting interpreter:
# Python
foo(3) # foo(int)
foo(3.5) # foo(double)
-foo("hello",5) # foo(char *, int)
+foo("hello", 5) # foo(char *, int)
# Tcl
foo 3 # foo(int)
@@ -4463,7 +4463,7 @@ _wrap_foo_2(argc, args[]) { // foo(char *, int)
...
arg1 = FromString(args[0]);
arg2 = FromInteger(args[1]);
- result = foo(arg1,arg2);
+ result = foo(arg1, arg2);
return ToInteger(result);
}
@@ -4479,15 +4479,15 @@ Next, a dynamic dispatch function is generated:
_wrap_foo(argc, args[]) {
if (argc == 1) {
if (IsInteger(args[0])) {
- return _wrap_foo_0(argc,args);
+ return _wrap_foo_0(argc, args);
}
if (IsDouble(args[0])) {
- return _wrap_foo_1(argc,args);
+ return _wrap_foo_1(argc, args);
}
}
if (argc == 2) {
if (IsString(args[0]) && IsInteger(args[1])) {
- return _wrap_foo_2(argc,args);
+ return _wrap_foo_2(argc, args);
}
}
error("No matching function!\n");
@@ -4568,7 +4568,7 @@ The following excerpt from the Python module illustrates this:
/* Python type checking rules */
-/* Note: %typecheck(X) is a macro for %typemap(typecheck,precedence=X) */
+/* Note: %typecheck(X) is a macro for %typemap(typecheck, precedence=X) */
%typecheck(SWIG_TYPECHECK_INTEGER)
int, short, long,
@@ -4599,7 +4599,7 @@ The following excerpt from the Python module illustrates this:
$1 = PyString_Check($input) ? 1 : 0;
}
-%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * {
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, noblock=1) SWIGTYPE * {
void *vptr = 0;
int res = SWIG_ConvertPtr($input, &vptr, $1_descriptor, 0);
$1 = SWIG_IsOK(res) ? 1 : 0;
@@ -4659,7 +4659,7 @@ If you write a typecheck typemap and omit the precedence level, for example comm
-%typemap(typecheck /*,precedence=SWIG_TYPECHECK_INTEGER*/) int {
+%typemap(typecheck /*, precedence=SWIG_TYPECHECK_INTEGER*/) int {
$1 = PyInt_Check($input) ? 1 : 0;
}
@@ -4711,7 +4711,7 @@ a set of typemaps like this:
-%typemap(in,numinputs=0) int *OUTPUT (int temp) {
+%typemap(in, numinputs=0) int *OUTPUT (int temp) {
$1 = &temp;
}
%typemap(argout) int *OUTPUT {
@@ -4762,7 +4762,7 @@ For example:
%typemap(check) int *POSITIVE {
if (*$1 <= 0) {
- SWIG_exception(SWIG_ValueError,"Expected a positive number!\n");
+ SWIG_exception(SWIG_ValueError, "Expected a positive number!\n");
return NULL;
}
}
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index 7f15d6d27..fb58ee39a 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -95,7 +95,7 @@ int execlp(const char *path, const char *arg1, ...);
...
/* Example */
-execlp("ls","ls","-l",NULL);
+execlp("ls", "ls", "-l", NULL);
@@ -189,9 +189,9 @@ In contrast, suppose you attempted to make some kind of wrapper around
int wrap_printf(const char *fmt, ...) {
va_list ap;
- va_start(ap,fmt);
+ va_start(ap, fmt);
...
- printf(fmt,ap);
+ printf(fmt, ap);
...
va_end(ap);
};
@@ -478,7 +478,7 @@ wrap_printf() {
arg1 = "%s";
arg2 = (void *) PyString_AsString(arg2obj);
...
- result = printf(arg1,arg2);
+ result = printf(arg1, arg2);
...
}
@@ -633,10 +633,10 @@ example. For example:
argc = PyTuple_Size(varargs);
argv = (char **) malloc(sizeof(char *)*(argc+1));
for (i = 0; i < argc; i++) {
- PyObject *o = PyTuple_GetItem(varargs,i);
+ PyObject *o = PyTuple_GetItem(varargs, i);
if (!PyString_Check(o)) {
free(argv);
- PyErr_SetString(PyExc_ValueError,"Expected a string");
+ PyErr_SetString(PyExc_ValueError, "Expected a string");
SWIG_fail;
}
argv[i] = PyString_AsString(o);
@@ -733,7 +733,7 @@ As a more extreme example of libffi, here is some code that attempts to wrap -w command line option. For example:
% swig -python -w501 example.i
-% swig -python -w501,505,401 example.i
+% swig -python -w501, 505, 401 example.i
@@ -81,7 +81,7 @@ into the input file:
%module example
#pragma SWIG nowarn=501
-#pragma SWIG nowarn=501,505,401
+#pragma SWIG nowarn=501, 505, 401
@@ -170,7 +170,7 @@ previous section--simply add a "+" to all warning numbers. For example:
-% swig -w+309,+452 example.i
+% swig -w+309, +452 example.i
@@ -180,7 +180,7 @@ or in your interface file use either
-#pragma SWIG nowarn=+309,+452
+#pragma SWIG nowarn=+309, +452
@@ -190,7 +190,7 @@ or
-%warnfilter(+309,+452) foo;
+%warnfilter(+309, +452) foo;
@@ -205,12 +205,12 @@ You can of course also enable all warnings and suppress a select few, for exampl
-% swig -Wextra -w309,452 example.i
+% swig -Wextra -w309, 452 example.i
-The warnings on the right take precedence over the warnings on the left, so in the above example -Wextra adds numerous warnings including 452, but then -w309,452 overrides this and so 452 is suppressesed.
+The warnings on the right take precedence over the warnings on the left, so in the above example -Wextra adds numerous warnings including 452, but then -w309, 452 overrides this and so 452 is suppressesed.
diff --git a/Examples/python/class/index.html b/Examples/python/class/index.html
index 2e1baa395..755c11470 100644
--- a/Examples/python/class/index.html
+++ b/Examples/python/class/index.html
@@ -86,7 +86,7 @@ Note: when creating a C++ extension, you must run SWIG with the -c++ op
A sample Python script
-Click here to see a script that calls the C++ functions from Python.
+Click here to see a script that calls the C++ functions from Python.
Key points
diff --git a/Examples/python/constants/index.html b/Examples/python/constants/index.html
index 35cc0d7e6..6f9e2018b 100644
--- a/Examples/python/constants/index.html
+++ b/Examples/python/constants/index.html
@@ -17,7 +17,7 @@ to see a SWIG interface with some constant declarations in it.
Accessing Constants from Python
-Click here to see a script that prints out the values
+Click here to see a script that prints out the values
of the constants contained in the above file.
Key points
diff --git a/Examples/python/enum/index.html b/Examples/python/enum/index.html
index 776030ffa..2f7c42095 100644
--- a/Examples/python/enum/index.html
+++ b/Examples/python/enum/index.html
@@ -19,7 +19,7 @@ of enumerated types are handled as integers.
- example.h. Header file containing some enums.
- example.i. Interface file.
-
- example.py. Sample Python script.
+
- runme.py. Sample Python script.
Notes
diff --git a/Examples/python/funcptr/index.html b/Examples/python/funcptr/index.html
index e41e0db45..58790276e 100644
--- a/Examples/python/funcptr/index.html
+++ b/Examples/python/funcptr/index.html
@@ -65,7 +65,7 @@ Here are some files that illustrate this with a simple example:
example.c
example.h
example.i (SWIG interface)
- example.py (Sample script)
+ runme.py (Sample script)
Notes
diff --git a/Examples/python/pointer/index.html b/Examples/python/pointer/index.html
index b99c8fe4c..ae52eddfd 100644
--- a/Examples/python/pointer/index.html
+++ b/Examples/python/pointer/index.html
@@ -145,7 +145,7 @@ extraction.
- example.c (C Source)
- example.i (SWIG interface)
-
- example.py (Python Script)
+
- runme.py (Python Script)
Notes
diff --git a/Examples/python/reference/index.html b/Examples/python/reference/index.html
index 25d40299e..7ad39797b 100644
--- a/Examples/python/reference/index.html
+++ b/Examples/python/reference/index.html
@@ -121,7 +121,7 @@ Click here to see a SWIG interface file with these addit
Sample Python script
-Click here to see a script that manipulates some C++ references.
+Click here to see a script that manipulates some C++ references.
Notes:
diff --git a/Examples/python/simple/index.html b/Examples/python/simple/index.html
index dace471a3..a32f788f5 100644
--- a/Examples/python/simple/index.html
+++ b/Examples/python/simple/index.html
@@ -65,7 +65,7 @@ to create the extension examplemodule.so.
Using the extension
-Click here to see a script that calls our C functions from Python.
+Click here to see a script that calls our C functions from Python.
Key points
diff --git a/Examples/python/variables/index.html b/Examples/python/variables/index.html
index 2940d8a6b..4efe34fcc 100644
--- a/Examples/python/variables/index.html
+++ b/Examples/python/variables/index.html
@@ -48,7 +48,7 @@ double foo;
it will be accessed in the Python module as cvar.foo. Click
-here to see a script that updates and prints
+here to see a script that updates and prints
out the values of the variables using this technique.
Key points