html validation mods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7629 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-10-08 23:12:15 +00:00
commit 5c467afffa

View file

@ -155,9 +155,9 @@ PyObject *wrap_factorial(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
if (!PyArg_ParseTuple("O:factorial", &obj1)) return NULL; if (!PyArg_ParseTuple("O:factorial", &obj1)) return NULL;
<b><font color="#0000ff">arg1 = PyInt_AsLong(obj1);</font></b> <b>arg1 = PyInt_AsLong(obj1);</b>
result = factorial(arg1); result = factorial(arg1);
<b><font color="#0000ff">resultobj = PyInt_FromLong(result);</font></b> <b>resultobj = PyInt_FromLong(result);</b>
return resultobj; return resultobj;
} }
</pre> </pre>
@ -261,23 +261,23 @@ PyObject *wrap_gcd(PyObject *self, PyObject *args) {
if (!PyArg_ParseTuple("OO:gcd", &amp;obj1, &amp;obj2)) return NULL; if (!PyArg_ParseTuple("OO:gcd", &amp;obj1, &amp;obj2)) return NULL;
/* "in" typemap, argument 1 */<b><font color="#0000ff"> /* "in" typemap, argument 1 */<b>
{ {
arg1 = PyInt_AsLong(obj1); arg1 = PyInt_AsLong(obj1);
} }
</font></b> </b>
/* "in" typemap, argument 2 */<b><font color="#0000ff"> /* "in" typemap, argument 2 */<b>
{ {
arg2 = PyInt_AsLong(obj2); arg2 = PyInt_AsLong(obj2);
} }
</font></b> </b>
result = gcd(arg1,arg2); result = gcd(arg1,arg2);
/* "out" typemap, return value */<b><font color="#0000ff"> /* "out" typemap, return value */<b>
{ {
resultobj = PyInt_FromLong(result); resultobj = PyInt_FromLong(result);
} }
</font></b> </b>
return resultobj; return resultobj;
} }
</pre> </pre>
@ -304,14 +304,14 @@ it is applied to all future occurrences of that type in the input file. For exa
<div class="code"> <div class="code">
<pre> <pre>
/* Convert from Perl --&gt; C */ /* Convert from Perl --&gt; C */
%typemap(in) <b><font color="#ff0000">int</font></b> { %typemap(in) <b>int</b> {
$1 = SvIV($input); $1 = SvIV($input);
} }
... ...
int factorial(<b><font color="#ff0000">int</font></b> n); int factorial(<b>int</b> n);
int gcd(<b><font color="#ff0000">int</font></b> x, <b><font color="#ff0000">int</font></b> y); int gcd(<b>int</b> x, <b>int</b> y);
int count(char *s, char *t, <b><font color="#ff0000">int</font></b> max); int count(char *s, char *t, <b>int</b> max);
</pre> </pre>
</div> </div>
@ -325,7 +325,7 @@ underlying type. For example, you could have code like this:
<div class="code"> <div class="code">
<pre> <pre>
/* Convert from Ruby--&gt; C */ /* Convert from Ruby--&gt; C */
%typemap(in) <b><font color="#ff0000">int</font></b> { %typemap(in) <b>int</b> {
$1 = NUM2INT($input); $1 = NUM2INT($input);
} }
... ...
@ -334,9 +334,9 @@ namespace foo {
typedef Integer Number; typedef Integer Number;
}; };
int foo(<b><font color="#ff0000">int</font></b> x); int foo(<b>int</b> x);
int bar(<b><font color="#ff0000">Integer</font></b> y); int bar(<b>Integer</b> y);
int spam(<b><font color="#ff0000">foo::Number</font></b> a, <b><font color="#ff0000">foo::Number</font></b> b); int spam(<b>foo::Number</b> a, <b>foo::Number</b> b);
</pre> </pre>
</div> </div>
@ -354,7 +354,7 @@ example, you could write a typemap like this:
<div class="code"> <div class="code">
<pre> <pre>
%typemap(in) <b><font color="#ff0000">double nonnegative</font></b> { %typemap(in) <b>double nonnegative</b> {
$1 = PyFloat_AsDouble($input); $1 = PyFloat_AsDouble($input);
if ($1 &lt; 0) { if ($1 &lt; 0) {
PyErr_SetString(PyExc_ValueError,"argument must be nonnegative."); PyErr_SetString(PyExc_ValueError,"argument must be nonnegative.");
@ -365,10 +365,10 @@ example, you could write a typemap like this:
... ...
double sin(double x); double sin(double x);
double cos(double x); double cos(double x);
double sqrt(<b><font color="#ff0000">double nonnegative</font></b>); double sqrt(<b>double nonnegative</b>);
typedef double Real; typedef double Real;
double log(<b><font color="#ff0000">Real nonnegative</font></b>); double log(<b>Real nonnegative</b>);
... ...
</pre> </pre>
</div> </div>
@ -380,12 +380,12 @@ consecutive arguments. For example:
<div class="code"> <div class="code">
<pre> <pre>
%typemap(in) (<b><font color="#ff0000">char *str, int len</font></b>) { %typemap(in) (<b>char *str, int len</b>) {
$1 = PyString_AsString($input); /* char *str */ $1 = PyString_AsString($input); /* char *str */
$2 = PyString_Size($input); /* int len */ $2 = PyString_Size($input); /* int len */
} }
... ...
int count(<b><font color="#ff0000">char *str, int len</font></b>, char c); int count(<b>char *str, int len</b>, char c);
</pre> </pre>
</div> </div>
@ -465,7 +465,7 @@ typemaps address:
<div class="code"> <div class="code">
<pre> <pre>
int foo(<b><font color="#ff0000">int x, double y, char *s</font></b>); int foo(<b>int x, double y, char *s</b>);
</pre> </pre>
</div> </div>
@ -485,7 +485,7 @@ int foo(<b><font color="#ff0000">int x, double y, char *s</font></b>);
<div class="code"> <div class="code">
<pre> <pre>
<b><font color="#ff0000">int</font></b> foo(int x, double y, char *s); <b>int</b> foo(int x, double y, char *s);
</pre> </pre>
</div> </div>
@ -501,7 +501,7 @@ int foo(<b><font color="#ff0000">int x, double y, char *s</font></b>);
<div class="code"> <div class="code">
<pre> <pre>
<b><font color="#ff0000">int</font></b> foo(int x, double y, char *s) throw(<b><font color="#ff0000">MemoryError, IndexError</font></b>); <b>int</b> foo(int x, double y, char *s) throw(<b>MemoryError, IndexError</b>);
</pre> </pre>
</div> </div>
@ -515,7 +515,7 @@ int foo(<b><font color="#ff0000">int x, double y, char *s</font></b>);
<div class="code"> <div class="code">
<pre> <pre>
<b><font color="#ff0000">int foo;</font></b> <b>int foo;</b>
</pre> </pre>
</div> </div>
@ -531,7 +531,7 @@ int foo(<b><font color="#ff0000">int x, double y, char *s</font></b>);
<div class="code"> <div class="code">
<pre> <pre>
struct Foo { struct Foo {
<b><font color="#ff0000">int x[20]</font></b>; <b>int x[20]</b>;
}; };
</pre> </pre>
</div> </div>