fixes for sub is a perl keyword
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9006 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
74ca46655d
commit
bc0f2a654b
4 changed files with 5 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ void add(int *x, int *y, int *result) {
|
|||
*result = *x + *y;
|
||||
}
|
||||
|
||||
void sub(int *x, int *y, int *result) {
|
||||
void subtract(int *x, int *y, int *result) {
|
||||
*result = *x - *y;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
%{
|
||||
extern void add(int *, int *, int *);
|
||||
extern void sub(int *, int *, int *);
|
||||
extern void subtract(int *, int *, int *);
|
||||
extern int divide(int, int, int *);
|
||||
%}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ extern void add(int *x, int *y, int *result);
|
|||
/* Next we'll use some typemaps */
|
||||
|
||||
%include typemaps.i
|
||||
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
||||
extern void subtract(int *INPUT, int *INPUT, int *OUTPUT);
|
||||
|
||||
/* Next we'll use typemaps and the %apply directive */
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ that behave as input or output parameters. For example:
|
|||
%apply int *OUTPUT {int *r};
|
||||
|
||||
void add(int *x, int *y, int *r);
|
||||
void sub(int *x, int *y, int *r);
|
||||
void subtract(int *x, int *y, int *r);
|
||||
void mul(int *x, int *y, int *r);
|
||||
... etc ...
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ example::delete_intp($c);
|
|||
# necessary to manufacture pointers.
|
||||
|
||||
print "Trying the typemap library\n";
|
||||
$r = example::sub(37,42);
|
||||
$r = example::subtract(37,42);
|
||||
print " 37 - 42 = $r\n";
|
||||
|
||||
# Now try the version with multiple return values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue