Consistent formatting of example code in the docs

This commit is contained in:
William S Fulton 2016-10-21 19:14:32 +01:00
commit 268b942865
25 changed files with 1705 additions and 1714 deletions

View file

@ -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>

View file

@ -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() {

View file

@ -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;
} }

View file

@ -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&amp; v) {return v*s;} inline Test operator* (float s, const Test&amp; v) {return v*s;}
inline std::ostream&amp; operator&lt;&lt; (std::ostream&amp; o, const Test&amp; v) inline std::ostream&amp; operator&lt;&lt; (std::ostream&amp; o, const Test&amp; v)
{ {
return o &lt;&lt; "(" &lt;&lt; v.x &lt;&lt; ")"; return o &lt;&lt; "(" &lt;&lt; v.x &lt;&lt; ")";
} }
inline Test RandomUnitVectorOnXZPlane (void) inline Test RandomUnitVectorOnXZPlane (void)
{ {
return RandomVectorInUnitRadiusSphere().setYtoZero().normalize(); return RandomVectorInUnitRadiusSphere().setYtoZero().normalize();

View file

@ -1095,8 +1095,9 @@ Now we extend it with some new code
sprintf(tmp,"Complex(%g,%g)", $self-&gt;re(),$self-&gt;im()); sprintf(tmp,"Complex(%g,%g)", $self-&gt;re(),$self-&gt;im());
return tmp; return tmp;
} }
bool operator==(const Complex&amp; c) bool operator==(const Complex&amp; c) {
{ return ($self-&gt;re()==c.re() &amp;&amp; $self-&gt;im()==c.im());} return ($self-&gt;re()==c.re() &amp;&amp; $self-&gt;im()==c.im());
}
}; };
</pre></div> </pre></div>
<p> <p>

View file

@ -1527,7 +1527,6 @@ class Spam {
public: public:
static void foo(); static void foo();
static int bar; static int bar;
}; };
</pre> </pre>
</div> </div>

View file

@ -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>

View file

@ -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, &amp;len); $1 = Tcl_GetStringFromObj(interp, &amp;len);
} }
}
</pre> </pre>
</div> </div>

View file

@ -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>