Escape < and > in HTML since unescaped instances confuse htmldoc and cause it
to mangle the "one HTML page" version of the manual. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4f605e12e2
commit
8d304ae602
9 changed files with 81 additions and 81 deletions
|
|
@ -760,14 +760,14 @@ namespace car {
|
||||||
</p>
|
</p>
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
#define A 1 => (swig-defconstant "A" 1)
|
#define A 1 => (swig-defconstant "A" 1)
|
||||||
#define B 'c' => (swig-defconstant "B" #\c)
|
#define B 'c' => (swig-defconstant "B" #\c)
|
||||||
#define C B => (swig-defconstant "C" #\c)
|
#define C B => (swig-defconstant "C" #\c)
|
||||||
#define D 1.0e2 => (swig-defconstant "D" 1.0d2)
|
#define D 1.0e2 => (swig-defconstant "D" 1.0d2)
|
||||||
#define E 2222 => (swig-defconstant "E" 2222)
|
#define E 2222 => (swig-defconstant "E" 2222)
|
||||||
#define F (unsigned int)2222 => no code generated
|
#define F (unsigned int)2222 => no code generated
|
||||||
#define G 1.02e2f => (swig-defconstant "G" 1.02f2)
|
#define G 1.02e2f => (swig-defconstant "G" 1.02f2)
|
||||||
#define H foo => no code generated
|
#define H foo => no code generated
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -789,13 +789,13 @@ namespace car {
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
#define I A + E => (swig-defconstant "I" (+ 1 2222))
|
#define I A + E => (swig-defconstant "I" (+ 1 2222))
|
||||||
#define J 1|2 => (swig-defconstant "J" (logior 1 2))
|
#define J 1|2 => (swig-defconstant "J" (logior 1 2))
|
||||||
#define Y 1 + 2 * 3 + 4 => (swig-defconstant "Y" (* (+ 1 2) (+ 3 4)))
|
#define Y 1 + 2 * 3 + 4 => (swig-defconstant "Y" (* (+ 1 2) (+ 3 4)))
|
||||||
#define Y1 (1 + 2) * (3 + 4) => (swig-defconstant "Y1" (* (+ 1 2) (+ 3 4)))
|
#define Y1 (1 + 2) * (3 + 4) => (swig-defconstant "Y1" (* (+ 1 2) (+ 3 4)))
|
||||||
#define Y2 1 * 2 + 3 * 4 => (swig-defconstant "Y2" (* 1 (+ 2 3) 4)) ;; WRONG
|
#define Y2 1 * 2 + 3 * 4 => (swig-defconstant "Y2" (* 1 (+ 2 3) 4)) ;; WRONG
|
||||||
#define Y3 (1 * 2) + (3 * 4) => (swig-defconstant "Y3" (* 1 (+ 2 3) 4)) ;; WRONG
|
#define Y3 (1 * 2) + (3 * 4) => (swig-defconstant "Y3" (* 1 (+ 2 3) 4)) ;; WRONG
|
||||||
#define Z 1 + 2 - 3 + 4 * 5 => (swig-defconstant "Z" (* (+ 1 (- 2 3) 4) 5)) ;; WRONG
|
#define Z 1 + 2 - 3 + 4 * 5 => (swig-defconstant "Z" (* (+ 1 (- 2 3) 4) 5)) ;; WRONG
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -863,20 +863,20 @@ namespace nnn {
|
||||||
|
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
<pre>
|
<pre>
|
||||||
user> (load "globalvar.dll")
|
user> (load "globalvar.dll")
|
||||||
; Foreign loading globalvar.dll.
|
; Foreign loading globalvar.dll.
|
||||||
t
|
t
|
||||||
user> (load "globalvar.cl")
|
user> (load "globalvar.cl")
|
||||||
; Loading c:\mikel\src\swig\test\globalvar.cl
|
; Loading c:\mikel\src\swig\test\globalvar.cl
|
||||||
t
|
t
|
||||||
user>
|
user>
|
||||||
globalvar> (globalvar.nnn::global_var)
|
globalvar> (globalvar.nnn::global_var)
|
||||||
2
|
2
|
||||||
globalvar> (globalvar.nnn::glob_float)
|
globalvar> (globalvar.nnn::glob_float)
|
||||||
2.0
|
2.0
|
||||||
globalvar> (setf (globalvar.nnn::glob_float) 3.0)
|
globalvar> (setf (globalvar.nnn::glob_float) 3.0)
|
||||||
3.0
|
3.0
|
||||||
globalvar> (globalvar.nnn::glob_float)
|
globalvar> (globalvar.nnn::glob_float)
|
||||||
3.0
|
3.0
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1215,10 +1215,10 @@ class A {
|
||||||
|
|
||||||
typedef A Foo;
|
typedef A Foo;
|
||||||
|
|
||||||
A *xxx(int i); /* sets A->x = A->y = i */
|
A *xxx(int i); /* sets A->x = A->y = i */
|
||||||
Foo *yyy(int i); /* sets Foo->x = Foo->y = i */
|
Foo *yyy(int i); /* sets Foo->x = Foo->y = i */
|
||||||
|
|
||||||
int zzz(A *inst = 0); /* return inst->x + inst->y */
|
int zzz(A *inst = 0); /* return inst->x + inst->y */
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1258,22 +1258,22 @@ int zzz(A *inst = 0); /* return inst->x + inst->y */
|
||||||
</p>
|
</p>
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
<pre>
|
<pre>
|
||||||
CL-USER> (load "synonym.dll")
|
CL-USER> (load "synonym.dll")
|
||||||
; Foreign loading synonym.dll.
|
; Foreign loading synonym.dll.
|
||||||
t
|
t
|
||||||
CL-USER> (load "synonym.cl")
|
CL-USER> (load "synonym.cl")
|
||||||
; Loading c:\mikel\src\swig\test\synonym.cl
|
; Loading c:\mikel\src\swig\test\synonym.cl
|
||||||
t
|
t
|
||||||
CL-USER>
|
CL-USER>
|
||||||
synonym> (setf a (xxx 3))
|
synonym> (setf a (xxx 3))
|
||||||
#<A nil #x3261a0 @ #x207299da>
|
#<A nil #x3261a0 @ #x207299da>
|
||||||
synonym> (setf foo (yyy 10))
|
synonym> (setf foo (yyy 10))
|
||||||
#<A nil #x3291d0 @ #x2072e982>
|
#<A nil #x3291d0 @ #x2072e982>
|
||||||
synonym> (zzz a)
|
synonym> (zzz a)
|
||||||
6
|
6
|
||||||
synonym> (zzz foo)
|
synonym> (zzz foo)
|
||||||
20
|
20
|
||||||
synonym>
|
synonym>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1326,7 +1326,7 @@ class A {
|
||||||
};
|
};
|
||||||
|
|
||||||
float xxx(int i, int x = 0); /* return i * x */
|
float xxx(int i, int x = 0); /* return i * x */
|
||||||
float xxx(A *inst, int x); /* return x + A->x + A->y */
|
float xxx(A *inst, int x); /* return x + A->x + A->y */
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1443,21 +1443,21 @@ EXPORT float ACL___xxx__SWIG_2 (A *larg1, int larg2) {
|
||||||
</p>
|
</p>
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
<pre>
|
<pre>
|
||||||
overload> (setf a (new_A))
|
overload> (setf a (new_A))
|
||||||
#<A nil #x329268 @ #x206cf612>
|
#<A nil #x329268 @ #x206cf612>
|
||||||
overload> (setf (A_x a) 10)
|
overload> (setf (A_x a) 10)
|
||||||
10
|
10
|
||||||
overload> (setf (A_y a) 20)
|
overload> (setf (A_y a) 20)
|
||||||
20
|
20
|
||||||
overload> (xxx 1)
|
overload> (xxx 1)
|
||||||
0.0
|
0.0
|
||||||
overload> (xxx 3 10)
|
overload> (xxx 3 10)
|
||||||
30.0
|
30.0
|
||||||
overload> (xxx a 1)
|
overload> (xxx a 1)
|
||||||
31.0
|
31.0
|
||||||
overload> (xxx a 2)
|
overload> (xxx a 2)
|
||||||
32.0
|
32.0
|
||||||
overload>
|
overload>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1506,17 +1506,17 @@ overload>
|
||||||
%rename(__logand_assign__) *::operator&=;
|
%rename(__logand_assign__) *::operator&=;
|
||||||
%rename(__logior_assign__) *::operator|=;
|
%rename(__logior_assign__) *::operator|=;
|
||||||
|
|
||||||
%rename(__lshift__) *::operator<<;
|
%rename(__lshift__) *::operator<<;
|
||||||
%rename(__lshift_assign__) *::operator<<=;
|
%rename(__lshift_assign__) *::operator<<=;
|
||||||
%rename(__rshift__) *::operator>>;
|
%rename(__rshift__) *::operator>>;
|
||||||
%rename(__rshift_assign__) *::operator>>=;
|
%rename(__rshift_assign__) *::operator>>=;
|
||||||
|
|
||||||
%rename(__eq__) *::operator==;
|
%rename(__eq__) *::operator==;
|
||||||
%rename(__ne__) *::operator!=;
|
%rename(__ne__) *::operator!=;
|
||||||
%rename(__lt__) *::operator<;
|
%rename(__lt__) *::operator<;
|
||||||
%rename(__gt__) *::operator>;
|
%rename(__gt__) *::operator>;
|
||||||
%rename(__lte__) *::operator<=;
|
%rename(__lte__) *::operator<=;
|
||||||
%rename(__gte__) *::operator>=;
|
%rename(__gte__) *::operator>=;
|
||||||
|
|
||||||
%rename(__and__) *::operator&&;
|
%rename(__and__) *::operator&&;
|
||||||
%rename(__or__) *::operator||;
|
%rename(__or__) *::operator||;
|
||||||
|
|
@ -1529,8 +1529,8 @@ overload>
|
||||||
%rename(__comma__) *::operator,();
|
%rename(__comma__) *::operator,();
|
||||||
%rename(__comma__) *::operator,() const;
|
%rename(__comma__) *::operator,() const;
|
||||||
|
|
||||||
%rename(__member_ref__) *::operator->;
|
%rename(__member_ref__) *::operator->;
|
||||||
%rename(__member_func_ref__) *::operator->*;
|
%rename(__member_func_ref__) *::operator->*;
|
||||||
|
|
||||||
%rename(__funcall__) *::operator();
|
%rename(__funcall__) *::operator();
|
||||||
%rename(__aref__) *::operator[];
|
%rename(__aref__) *::operator[];
|
||||||
|
|
@ -1599,11 +1599,11 @@ bool B___eq__(B const *inst, int const x)
|
||||||
</p>
|
</p>
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
<pre>
|
<pre>
|
||||||
opoverload> (B___eq__ x1 x2)
|
opoverload> (B___eq__ x1 x2)
|
||||||
nil
|
nil
|
||||||
opoverload> (B___eq__ x1 3)
|
opoverload> (B___eq__ x1 3)
|
||||||
nil
|
nil
|
||||||
opoverload>
|
opoverload>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1485,7 +1485,7 @@ and usage from C++
|
||||||
Container container;
|
Container container;
|
||||||
Element element(20);
|
Element element(20);
|
||||||
container.setElement(&element);
|
container.setElement(&element);
|
||||||
cout << "element.value: " << container.getElement()->value << endl;
|
cout << "element.value: " << container.getElement()->value << endl;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2869,13 +2869,13 @@ functionWrapper : void delete_Shape(Shape *self)
|
||||||
action : delete arg1;
|
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;
|
action : if (arg1) (arg1)->x = arg2;
|
||||||
|
|
||||||
functionWrapper : double Shape_x_get(Shape *self)
|
functionWrapper : double Shape_x_get(Shape *self)
|
||||||
action : result = (double) ((arg1)->x);
|
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;
|
action : if (arg1) (arg1)->y = arg2;
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -2975,7 +2975,7 @@ virtual int functionWrapper(Node *n) {
|
||||||
....
|
....
|
||||||
|
|
||||||
/* write the wrapper function definition */
|
/* 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 */
|
/* if any additional local variable needed, add them now */
|
||||||
...
|
...
|
||||||
|
|
@ -3005,13 +3005,13 @@ virtual int functionWrapper(Node *n) {
|
||||||
....
|
....
|
||||||
|
|
||||||
/* Close the function(ok) */
|
/* Close the function(ok) */
|
||||||
Printv(wrapper->code, "return ALL_OK;\n", NIL);
|
Printv(wrapper->code, "return ALL_OK;\n", NIL);
|
||||||
|
|
||||||
/* add the failure cleanup code */
|
/* add the failure cleanup code */
|
||||||
...
|
...
|
||||||
|
|
||||||
/* Close the function(error) */
|
/* Close the function(error) */
|
||||||
Printv(wrapper->code, "return ERROR;\n", "}\n", NIL);
|
Printv(wrapper->code, "return ERROR;\n", "}\n", NIL);
|
||||||
|
|
||||||
/* final substititions if applicable */
|
/* final substititions if applicable */
|
||||||
...
|
...
|
||||||
|
|
|
||||||
|
|
@ -3936,7 +3936,7 @@ Let's consider an example:
|
||||||
int array[4];
|
int array[4];
|
||||||
void populate(int x[]) {
|
void populate(int x[]) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
x[i] = 100 + i;
|
x[i] = 100 + i;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
@ -4083,7 +4083,7 @@ In Java, you would use the functions like this:
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
SWIGTYPE_p_int array = example.new_intArray(10000000); // Array of 10-million integers
|
SWIGTYPE_p_int array = example.new_intArray(10000000); // Array of 10-million integers
|
||||||
for (int i=0; i<10000; i++) { // Set some values
|
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);
|
||||||
|
|
@ -4112,7 +4112,7 @@ For instance, you will be able to do this in Java:
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
intArray array = new intArray(10000000); // Array of 10-million integers
|
intArray array = new intArray(10000000); // Array of 10-million integers
|
||||||
for (int i=0; i<10000; i++) { // Set some values
|
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);
|
||||||
|
|
@ -6672,7 +6672,7 @@ and usage from C++
|
||||||
Container container;
|
Container container;
|
||||||
Element element(20);
|
Element element(20);
|
||||||
container.setElement(&element);
|
container.setElement(&element);
|
||||||
cout << "element.value: " << container.getElement()->value << endl;
|
cout << "element.value: " << container.getElement()->value << endl;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ As we mentioned earlier the ideal way to use SWIG is to use interface
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
#define y 5
|
#define y 5
|
||||||
#define x (y >> 1)
|
#define x (y >> 1)
|
||||||
|
|
||||||
typedef int days;
|
typedef int days;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ extern int Example_Init(LuaState* L); // declare the wrapped module
|
||||||
int main(int argc,char* argv[])
|
int main(int argc,char* argv[])
|
||||||
{
|
{
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
if (argc<2)
|
if (argc<2)
|
||||||
{
|
{
|
||||||
printf("%s: <filename.lua>\n",argv[0]);
|
printf("%s: <filename.lua>\n",argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -1247,8 +1247,8 @@ The following C++ operators are currently supported by the Perl module:
|
||||||
<li>operator== </li>
|
<li>operator== </li>
|
||||||
<li>operator!= </li>
|
<li>operator!= </li>
|
||||||
<li>operator% </li>
|
<li>operator% </li>
|
||||||
<li>operator> </li>
|
<li>operator> </li>
|
||||||
<li>operator< </li>
|
<li>operator< </li>
|
||||||
<li>operator and </li>
|
<li>operator and </li>
|
||||||
<li>operator or </li>
|
<li>operator or </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -2924,11 +2924,11 @@ sub set_transform
|
||||||
{
|
{
|
||||||
my ($im, $x) = @_;
|
my ($im, $x) = @_;
|
||||||
my $a = new_mat44();
|
my $a = new_mat44();
|
||||||
for (my $i = 0; $i < 4, $i++)
|
for (my $i = 0; $i < 4, $i++)
|
||||||
{
|
{
|
||||||
for (my $j = 0; $j < 4, $j++)
|
for (my $j = 0; $j < 4, $j++)
|
||||||
{
|
{
|
||||||
mat44_set($a, $i, $j, $x->[i][j])
|
mat44_set($a, $i, $j, $x->[i][j])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
example.set_transform($im, $a);
|
example.set_transform($im, $a);
|
||||||
|
|
|
||||||
|
|
@ -1971,7 +1971,7 @@ public:
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
A *a = new A();
|
A *a = new A();
|
||||||
a->ref(); // 'a' is ref here
|
a->ref(); // 'a' is ref here
|
||||||
|
|
||||||
B *b1 = new B(a); // 'a' is ref here
|
B *b1 = new B(a); // 'a' is ref here
|
||||||
if (1 + 1 == 2) {
|
if (1 + 1 == 2) {
|
||||||
|
|
@ -1980,7 +1980,7 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
delete b1; // 'a' is unref, but not deleted
|
delete b1; // 'a' is unref, but not deleted
|
||||||
a->unref(); // 'a' is unref and deleted
|
a->unref(); // 'a' is unref and deleted
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -2004,8 +2004,8 @@ counted objects, you use the "ref" and "unref" features, or
|
||||||
%module example
|
%module example
|
||||||
...
|
...
|
||||||
|
|
||||||
%feature("ref") RCObj "$this->ref();"
|
%feature("ref") RCObj "$this->ref();"
|
||||||
%feature("unref") RCObj "$this->unref();"
|
%feature("unref") RCObj "$this->unref();"
|
||||||
|
|
||||||
%include "rcobj.h"
|
%include "rcobj.h"
|
||||||
%include "A.h"
|
%include "A.h"
|
||||||
|
|
@ -2021,8 +2021,8 @@ or, using the directive form:
|
||||||
%module example
|
%module example
|
||||||
...
|
...
|
||||||
|
|
||||||
%ref RCObj "$this->ref();"
|
%ref RCObj "$this->ref();"
|
||||||
%unref RCObj "$this->unref();"
|
%unref RCObj "$this->unref();"
|
||||||
|
|
||||||
%include "rcobj.h"
|
%include "rcobj.h"
|
||||||
%include "A.h"
|
%include "A.h"
|
||||||
|
|
@ -2058,7 +2058,7 @@ exit # 'a' is released, SWIG unref 'a'
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Note that the user doesn't explicitly need to call 'a->ref()' nor 'a->unref()'
|
Note that the user doesn't explicitly need to call 'a->ref()' nor 'a->unref()'
|
||||||
(as neither 'delete a'). Instead, SWIG take cares of executing the "ref"
|
(as neither 'delete a'). Instead, SWIG take cares of executing the "ref"
|
||||||
and "unref" codes as needed. If the user doesn't specify the
|
and "unref" codes as needed. If the user doesn't specify the
|
||||||
"ref/unref" features, SWIG will produce a code equivalent to define
|
"ref/unref" features, SWIG will produce a code equivalent to define
|
||||||
|
|
|
||||||
|
|
@ -1302,7 +1302,7 @@ irb(main):003:0> <b>puts foo.value</b></pre>
|
||||||
<pre>foo = Foo.new
|
<pre>foo = Foo.new
|
||||||
begin
|
begin
|
||||||
foo.test()
|
foo.test()
|
||||||
rescue CustomError => e
|
rescue CustomError => e
|
||||||
puts "Caught custom error"
|
puts "Caught custom error"
|
||||||
end </pre>
|
end </pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue