From d7c33db97f7cd7bbf3b54d465d8fbf2fc7ad165d Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Tue, 20 Sep 2005 13:53:44 +0000 Subject: [PATCH] Change example so it builds Foo_get() and Foo_set() wrappers. Use these wrappers in the runme.php4. Added wrapped method print_Foo() just to make sure all is working. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7462 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/php4/simple/example.c | 4 ++++ SWIG/Examples/php4/simple/example.i | 4 +++- SWIG/Examples/php4/simple/runme.php4 | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SWIG/Examples/php4/simple/example.c b/SWIG/Examples/php4/simple/example.c index 1c2af789c..cdbdd4873 100644 --- a/SWIG/Examples/php4/simple/example.c +++ b/SWIG/Examples/php4/simple/example.c @@ -3,6 +3,10 @@ /* A global variable */ double Foo = 3.0; +void print_Foo() { + printf("In C, Foo = %f\n",Foo); +} + /* Compute the greatest common divisor of positive integers */ int gcd(int x, int y) { int g; diff --git a/SWIG/Examples/php4/simple/example.i b/SWIG/Examples/php4/simple/example.i index 55e1d46a2..af4ff08a7 100644 --- a/SWIG/Examples/php4/simple/example.i +++ b/SWIG/Examples/php4/simple/example.i @@ -2,7 +2,9 @@ %module example %{ -extern double Foo; + extern double Foo; %} +extern double Foo; +void print_Foo(); int gcd(int x, int y); diff --git a/SWIG/Examples/php4/simple/runme.php4 b/SWIG/Examples/php4/simple/runme.php4 index 9b9f32849..0e96fe800 100755 --- a/SWIG/Examples/php4/simple/runme.php4 +++ b/SWIG/Examples/php4/simple/runme.php4 @@ -12,13 +12,14 @@ print "The gcd of $x and $y is $g\n"; # Manipulate the Foo global variable # Output its current value -print "Foo = " . $Foo . "\n"; +print "Foo = " . Foo_get() . "\n"; # Change its value -$Foo = 3.1415926; +Foo_set(3.1415926); # See if the change took effect ( this isn't a good example for php, see # manual for why. ) -print "Foo = " . $Foo . "\n"; +print "Foo = " . Foo_get() . "\n"; +print_Foo(); ?>