<?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";

?>

