various updates
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@969 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9ff3cf2abf
commit
40a17a664e
8 changed files with 29 additions and 22 deletions
|
|
@ -22,10 +22,8 @@ print "\nA total of $example::Shape_nshapes shapes were created\n";
|
||||||
|
|
||||||
# Set the location of the object
|
# Set the location of the object
|
||||||
|
|
||||||
# Notice how we can do this using functions specific to
|
example::Shape_x_set($c, 20);
|
||||||
# the 'Circle' class.
|
example::Shape_y_set($c, 30);
|
||||||
example::Circle_x_set($c, 20);
|
|
||||||
example::Circle_y_set($c, 30);
|
|
||||||
|
|
||||||
# Now use the same functions in the base class
|
# Now use the same functions in the base class
|
||||||
example::Shape_x_set($s,-10);
|
example::Shape_x_set($s,-10);
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ extern Point pt;
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%readonly
|
%readonly {
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
%readwrite
|
}
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,9 @@ print "\nA total of", example.cvar.Shape_nshapes,"shapes were created"
|
||||||
|
|
||||||
# Set the location of the object
|
# Set the location of the object
|
||||||
|
|
||||||
# Notice how we can do this using functions specific to
|
|
||||||
# the 'Circle' class.
|
|
||||||
example.Circle_x_set(c, 20)
|
|
||||||
example.Circle_y_set(c, 30)
|
|
||||||
|
|
||||||
# Now use the same functions in the base class
|
example.Shape_x_set(c, 20)
|
||||||
|
example.Shape_y_set(c, 30)
|
||||||
example.Shape_x_set(s,-10)
|
example.Shape_x_set(s,-10)
|
||||||
example.Shape_y_set(s,5)
|
example.Shape_y_set(s,5)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,15 @@
|
||||||
const int iconst = 37;
|
const int iconst = 37;
|
||||||
const double fconst = 3.14;
|
const double fconst = 3.14;
|
||||||
|
|
||||||
|
%constant(double) PI = 3.14159;
|
||||||
|
|
||||||
|
/* Test address of operator */
|
||||||
|
|
||||||
|
%{
|
||||||
|
static double blah = 1.2345;
|
||||||
|
%}
|
||||||
|
|
||||||
|
%constant(double *) blahptr = &blah;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ print "SCONST2 =", example.SCONST2, "(should be '\"Hello World\"')"
|
||||||
print "EXPR =", example.EXPR, "(should be 48.5484)"
|
print "EXPR =", example.EXPR, "(should be 48.5484)"
|
||||||
print "iconst =", example.iconst, "(should be 37)"
|
print "iconst =", example.iconst, "(should be 37)"
|
||||||
print "fconst =", example.fconst, "(should be 3.14)"
|
print "fconst =", example.fconst, "(should be 3.14)"
|
||||||
|
print "PI =", example.PI, "(should be 3.14159)"
|
||||||
try:
|
try:
|
||||||
print "EXTERN = ", example.EXTERN, "(Arg! This shouldn't print anything)"
|
print "EXTERN = ", example.EXTERN, "(Arg! This shouldn't print anything)"
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ extern Point pt;
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%readonly
|
%readonly {
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
%readwrite
|
}
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,8 @@ puts "\nA total of $Shape_nshapes shapes were created"
|
||||||
|
|
||||||
# Set the location of the object
|
# Set the location of the object
|
||||||
|
|
||||||
# Notice how we can do this using functions specific to
|
Shape_x_set $c 20
|
||||||
# the 'Circle' class.
|
Shape_y_set $c 30
|
||||||
Circle_x_set $c 20
|
|
||||||
Circle_y_set $c 30
|
|
||||||
|
|
||||||
# Now use the same functions in the base class
|
# Now use the same functions in the base class
|
||||||
Shape_x_set $s -10
|
Shape_x_set $s -10
|
||||||
|
|
@ -71,3 +69,6 @@ delete_Shape $s
|
||||||
puts "$Shape_nshapes shapes remain"
|
puts "$Shape_nshapes shapes remain"
|
||||||
puts "Goodbye"
|
puts "Goodbye"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ extern Point pt;
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%readonly
|
%readonly {
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
%readwrite
|
}
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue