Consistent formatting of example code in the docs
This commit is contained in:
parent
129ef8ea8f
commit
268b942865
25 changed files with 1705 additions and 1714 deletions
|
|
@ -1166,7 +1166,6 @@ SWIGEXPORT void SWIGSTDCALL CSharp_negativesonly(int jarg1) {
|
||||||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, e.what());
|
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, e.what());
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1233,7 +1232,6 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,8 @@ void foo(SomeClass arg) {
|
||||||
|
|
||||||
%newobject bar();
|
%newobject bar();
|
||||||
SomeClass *bar();
|
SomeClass *bar();
|
||||||
%}</pre></div>
|
%}
|
||||||
|
</pre></div>
|
||||||
<p>The code generated for <tt>foo()</tt> and <tt>bar()</tt> looks like this:</p>
|
<p>The code generated for <tt>foo()</tt> and <tt>bar()</tt> looks like this:</p>
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
SomeClass foo() {
|
SomeClass foo() {
|
||||||
|
|
|
||||||
|
|
@ -8315,7 +8315,7 @@ public class FooDerived extends Foo {
|
||||||
public static FooDerived downcastFooDerived(Foo foo_object)
|
public static FooDerived downcastFooDerived(Foo foo_object)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return (foo_object != null ? (FooDerived) Foo.downcastFoo(foo_object);
|
return foo_object != null ? (FooDerived) Foo.downcastFoo(foo_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (ClassCastException exc) {
|
catch (ClassCastException exc) {
|
||||||
|
|
@ -8366,10 +8366,8 @@ public abstract class UserVisibleFoo extends Foo {
|
||||||
public static UserVisibleFoo downcastUserVisibleFoo(Foo foo_object)
|
public static UserVisibleFoo downcastUserVisibleFoo(Foo foo_object)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return (foo_object != null ? (FooDerived) Foo.downcastFoo(foo_object) : null);
|
return foo_object != null ? (FooDerived) Foo.downcastFoo(foo_object) : null;
|
||||||
}
|
} catch (ClassCastException exc) {
|
||||||
|
|
||||||
catch (ClassCastException exc) {
|
|
||||||
// Wasn't a FooDerived object, some other subclass of Foo
|
// Wasn't a FooDerived object, some other subclass of Foo
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,6 @@ struct bar * my_struct;
|
||||||
struct foo {
|
struct foo {
|
||||||
int a;
|
int a;
|
||||||
struct foo * b[100];
|
struct foo * b[100];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int p);
|
int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int p);
|
||||||
|
|
@ -460,16 +459,13 @@ namespace OpenDemo {
|
||||||
static const Test zero;
|
static const Test zero;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline Test operator* (float s, const Test& v) {return v*s;}
|
inline Test operator* (float s, const Test& v) {return v*s;}
|
||||||
|
|
||||||
|
|
||||||
inline std::ostream& operator<< (std::ostream& o, const Test& v)
|
inline std::ostream& operator<< (std::ostream& o, const Test& v)
|
||||||
{
|
{
|
||||||
return o << "(" << v.x << ")";
|
return o << "(" << v.x << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Test RandomUnitVectorOnXZPlane (void)
|
inline Test RandomUnitVectorOnXZPlane (void)
|
||||||
{
|
{
|
||||||
return RandomVectorInUnitRadiusSphere().setYtoZero().normalize();
|
return RandomVectorInUnitRadiusSphere().setYtoZero().normalize();
|
||||||
|
|
|
||||||
|
|
@ -1095,8 +1095,9 @@ Now we extend it with some new code
|
||||||
sprintf(tmp,"Complex(%g,%g)", $self->re(),$self->im());
|
sprintf(tmp,"Complex(%g,%g)", $self->re(),$self->im());
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
bool operator==(const Complex& c)
|
bool operator==(const Complex& c) {
|
||||||
{ return ($self->re()==c.re() && $self->im()==c.im());}
|
return ($self->re()==c.re() && $self->im()==c.im());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -1527,7 +1527,6 @@ class Spam {
|
||||||
public:
|
public:
|
||||||
static void foo();
|
static void foo();
|
||||||
static int bar;
|
static int bar;
|
||||||
|
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -448,8 +448,9 @@ int divide(int n, int d, int q*, int *r) {
|
||||||
*q = n / d;
|
*q = n / d;
|
||||||
*r = n % d;
|
*r = n % d;
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else return 0;
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
|
||||||
|
|
@ -1304,7 +1304,6 @@ class Spam {
|
||||||
public:
|
public:
|
||||||
static void foo();
|
static void foo();
|
||||||
static int bar;
|
static int bar;
|
||||||
|
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -3032,7 +3031,6 @@ work)
|
||||||
int len;
|
int len;
|
||||||
$1 = Tcl_GetStringFromObj(interp, &len);
|
$1 = Tcl_GetStringFromObj(interp, &len);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2915,7 +2915,6 @@ try {
|
||||||
catch(char const *_e) {
|
catch(char const *_e) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, _e);
|
PyErr_SetString(PyExc_RuntimeError, _e);
|
||||||
SWIG_fail;
|
SWIG_fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue