PageRenderTime 28ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
PHP | 47 lines | 21 code | 13 blank | 13 comment | 0 complexity | c0000be03107731b3ca0a9d18bbe0f07 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. <?php
  2. require "example.php";
  3. # First create some objects using the pointer library.
  4. print "Testing the pointer library\n";
  5. $a = example::new_intp();
  6. $b = example::new_intp();
  7. $c = example::new_intp();
  8. example::intp_assign($a,37);
  9. example::intp_assign($b,42);
  10. print " a = $a\n";
  11. print " b = $b\n";
  12. print " c = $c\n";
  13. # Call the add() function wuth some pointers
  14. example::add($a,$b,$c);
  15. # Now get the result
  16. $r = example::intp_value($c);
  17. print " 37 + 42 = $r\n";
  18. # Clean up the pointers
  19. example::delete_intp($a);
  20. example::delete_intp($b);
  21. example::delete_intp($c);
  22. # Now try the typemap library
  23. # This should be much easier. Now how it is no longer
  24. # necessary to manufacture pointers.
  25. print "Trying the typemap library\n";
  26. $r = example::sub(37,42);
  27. print " 37 - 42 = $r\n";
  28. # Now try the version with multiple return values
  29. # print "Testing multiple return values\n";
  30. # $a = example::divide(42,37);
  31. # $q = $a[0]
  32. # $r = $a[1]
  33. # print " 42/37 = $q remainder $r\n";
  34. ?>