Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / php / cpointer / runme.php
1 <?php
2
3         require "example.php";
4
5         # First create some objects using the pointer library.
6
7         print "Testing the pointer library\n";
8
9         $a = new_intp();
10         $b = new_intp();
11         $c = new_intp();
12         intp_assign($a,37);
13         intp_assign($b,42);
14
15         print " a = $a\n";
16         print " b = $b\n";
17         print " c = $c\n";
18
19         # Call the add() function wuth some pointers
20         add($a,$b,$c);
21
22         # Now get the result
23         $r = intp_value($c);
24
25         print " 38 + 42 = $r\n";
26
27         # Clean up the pointers
28         delete_intp($a);
29         delete_intp($b);
30         delete_intp($c);
31
32         # Now try the typemap library
33         # This should be much easier. Now how it is no longer
34         # necessary to manufacture pointers.
35
36         print "Trying the typemap library\n";
37         $r = sub(37,42);
38         print " 37 - 42 = $r\n";
39
40         # Now try the version with multiple return values
41         # print "Testing multiple return values\n";
42         # ($q,$r) = divide(42,37);
43         # print "       42/37 = $q remainder $r\n";
44
45 ?>