More merge fixes from doxygen branches

This commit is contained in:
William S Fulton 2018-05-25 23:36:24 +01:00
commit 0ae73a67ff
2 changed files with 0 additions and 159 deletions

View file

@ -1,79 +0,0 @@
<?php
# This file illustrates the manipulation of C++ references in Php.
# This uses the low-level interface. Proxy classes work differently.
require "example.php";
# ----- Object creation -----
print "Creating some objects:\n";
$a = new Vector(3,4,5);
$b = new Vector(10,11,12);
print " Created a: $a " . $a->print() . "\n";
print " Created b: $b " . $b->print() . "\n";
# ----- Call an overloaded operator -----
# This calls the wrapper we placed around
#
# operator+(const Vector &a, const Vector &)
#
# It returns a new allocated object.
print "Adding a+b\n";
$c = addv($a,$b);
print " a+b =". $c->print()."\n";
# Note: Unless we free the result, a memory leak will occur
$c = 0;
# ----- Create a vector array -----
# Note: Using the high-level interface here
print "Creating an array of vectors\n";
$va = new VectorArray(10);
print " va: $va size=".$va->size()."\n";
# ----- Set some values in the array -----
# These operators copy the value of $a and $b to the vector array
$va->set(0,$a);
$va->set(1,$b);
$va->get(0);
# This will work, but it will cause a memory leak!
$va->set(2,addv($a,$b));
# The non-leaky way to do it
$c = addv($a,$b);
$va->set(3,$c);
$c = NULL;
# Get some values from the array
print "Getting some array values\n";
for ($i = 0; $i < 5; $i++) {
print "do $i\n";
$v = $va->get($i);
print " va($i) = ". $v->print(). "\n";
}
# Watch under resource meter to check on this
#print "Making sure we don't leak memory.\n";
#for ($i = 0; $i < 1000000; $i++) {
# $c = VectorArray_get($va,$i % 10);
#}
# ----- Clean up -----
print "Cleaning up\n";
# wants fixing FIXME
#delete_VectorArray($va);
#delete_Vector($a);
#delete_Vector($b);
?>

View file

@ -1,80 +0,0 @@
<?php
### THIS VERSION was written for when php global vars fakingly mirrored
### the wrapped global vars, but it was very inefficient.
### For now we don't do this (pending some changes to php itself) so
### we use accessor functions instead; WE KEEP THIS version around ready
### for when those php changes are made and we can switch back.
### Specifically we want $_GLOBALS variable overloading like object
### property overloading
require "example.php";
/* Try to set the values of some global variables */
$ivar = 42;
$svar = -31000;
$lvar = 65537;
$uivar = 123456;
$usvar = 61000;
$ulvar = 654321;
$scvar = -13;
$ucvar = 251;
$cvar = "S";
$fvar = 3.14159;
$dvar = 2.1828;
$strvar = "Hello World";
$cstrvar = "Goodbye";
$iptrvar = new_int(37);
$ptptr = new_point(37,42);
$name = "Bill";
echo "Variables (values printed from PHP)\n";
echo "ivar = $ivar\n";
echo "svar = $svar\n";
echo "lvar = $lvar\n";
echo "uivar = $uivar\n";
echo "usvar = $usvar\n";
echo "ulvar = $ulvar\n";
echo "scvar = $scvar\n";
echo "ucvar = $ucvar\n";
echo "cvar = $cvar\n";
echo "fvar = $fvar\n";
echo "dvar = $dvar\n";
echo "strvar = $strvar\n";
echo "cstrvar = $cstrvar\n";
echo "iptrvar = $iptrvar\n";
echo "name = $name\n";
echo "ptptr = $ptptr" , point_print($ptptr) , "\n";
echo "pt = $pt" , point_print($pt) , "\n";
echo "\nVariables (values printed from C)\n";
print_vars();
echo "\nI'm going to try and update a structure variable.\n";
$pt = $ptptr;
echo "The new value is \n";
pt_print();
echo "You should see the value", point_print($ptptr), "\n";
echo "\nNow I'm going to try and modify some read only variables\n";
echo "Trying to set 'path'\n";
/* Sadly this works */
$path = "Whoa!";
echo "Path = $path\n";
echo "Trying to set 'status'\n";
/* And this */
$status = 0;
echo "Status = $status\n";
?>