From 87462517ca9ae8ece9ef3f97d3f105c72e74a4d7 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 20 Oct 2013 14:25:24 -0700 Subject: long types have been replaced with int16, int32 and int64 types to make code more readable and easier portable between architectures longType and decimalType have been replace by numericType and floatType Many arithmetic operators have been added to the value class Solved various issues with copying and moving value objects --- tests/simple/simple.cpp | 97 ++++++++++++++++++++++++++++++++++++++++++------- tests/simple/simple.php | 59 +++++++++++++++++++++++------- 2 files changed, 128 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp index e90fe55..69cf9ce 100644 --- a/tests/simple/simple.cpp +++ b/tests/simple/simple.cpp @@ -15,6 +15,64 @@ */ using namespace std; + +Php::Value bubblesort(Php::Parameters ¶ms) +{ + cout << "start bubblesort" << endl; + + // the array that was passed + Php::Value array(params[0]); + + cout << "go return" << endl; + + return array; + + // size of the array + int size = array.size(); + + cout << "convert to native" << endl; + + int *x = new int[size]; + for (int i=0; i x(&MyCustomClass::myMethod); // define classes diff --git a/tests/simple/simple.php b/tests/simple/simple.php index 345c139..5f3bed7 100644 --- a/tests/simple/simple.php +++ b/tests/simple/simple.php @@ -31,26 +31,57 @@ //echo("g2: $g2\n"); //echo("g3: $g3\n"); - -if (class_exists("my_class")) echo("Warempel, de class bestaat\n"); - -class my_extended_class extends my_class +function slowsort($input) { - public function myMethod($val) + $size = count($input); + for ($i=0; $i<$size; $i++) { - echo($this->a."\n"); - echo($this->b."\n"); - echo("hoi\n"); - - parent::myMethod($val); + $left = $input[$i]; + for ($j=$i+1; $j<$size; $j++) + { + $right = $input[$j]; + + if ($left < $right) continue; + + // swap values + $input[$i] = $right; + $input[$j] = $left; + $left = $right; + } } - + return $input; } -$x = new my_extended_class(); -$x->myMethod(123); +//if (class_exists("my_class")) echo("Warempel, de class bestaat\n"); +// +//class my_extended_class extends my_class +//{ +// public function myMethod($val) +// { +// echo($this->a."\n"); +// echo($this->b."\n"); +// echo("hoi\n"); +// +// parent::myMethod($val); +// } +// +//} +// +//$x = new my_extended_class(); +//$x->myMethod(123); + +//echo(my_plus(1,2,3,4)."\n"); + +$array = array(); +for ($i=0; $i<10000; $i++) $array[] = rand(); + +//$array = array(1,2,3); + +//print_r($array); +bubblesort($array); + +print_r($array); -my_plus(1,2,3,4); //echo("my_class::a = ".$x->a."\n"); //echo("my_class::b = ".$x->b."\n"); -- cgit v1.2.3