PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/php/cpointer/runme.php

#
PHP | 47 lines | 21 code | 13 blank | 13 comment | 0 complexity | c0000be03107731b3ca0a9d18bbe0f07 MD5 | raw file
 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 = example::new_intp();
10	$b = example::new_intp();
11	$c = example::new_intp();
12	example::intp_assign($a,37);
13	example::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	example::add($a,$b,$c);
21
22	# Now get the result
23	$r = example::intp_value($c);
24
25	print "	37 + 42 = $r\n";
26
27	# Clean up the pointers
28	example::delete_intp($a);
29	example::delete_intp($b);
30	example::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 = example::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	# $a = example::divide(42,37);
43	# $q = $a[0]
44	# $r = $a[1]
45	# print "	42/37 = $q remainder $r\n";
46
47?>