You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(116) |
Sep
(17) |
Oct
|
Nov
(6) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
(3) |
Dec
(2) |
2007 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(1) |
Sep
(9) |
Oct
(8) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(6) |
Aug
(4) |
Sep
(3) |
Oct
(1) |
Nov
(2) |
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rha...@us...> - 2003-08-12 21:41:43
|
Update of /cvsroot/binaryphp/binaryphp/functions/math In directory sc8-pr-cvs1:/tmp/cvs-serv25554/math Log Message: Directory /cvsroot/binaryphp/binaryphp/functions/math added to the repository |
From: <sja...@us...> - 2003-08-12 08:51:26
|
Update of /cvsroot/binaryphp/binaryphp/tests/string In directory sc8-pr-cvs1:/tmp/cvs-serv24272/tests/string Added Files: chr.php Log Message: Added function: chr() --- NEW FILE: chr.php --- <?php echo chr(65), chr(66), chr(67); ?> |
From: <sja...@us...> - 2003-08-12 08:42:49
|
Update of /cvsroot/binaryphp/binaryphp/tests/string In directory sc8-pr-cvs1:/tmp/cvs-serv24027/string Log Message: Directory /cvsroot/binaryphp/binaryphp/tests/string added to the repository |
From: <sja...@us...> - 2003-08-12 08:40:41
|
Update of /cvsroot/binaryphp/binaryphp/functions/string In directory sc8-pr-cvs1:/tmp/cvs-serv25822/functions/string Added Files: ord.cpp Log Message: Added function: ord() --- NEW FILE: ord.cpp --- php_var ord(php_var ch) { const char *str = (const char *)ch; return php_var( (int)*str ); } |
From: <sja...@us...> - 2003-08-12 08:40:18
|
Update of /cvsroot/binaryphp/binaryphp/tests/string In directory sc8-pr-cvs1:/tmp/cvs-serv25822/tests/string Added Files: ord.php Log Message: Added function: ord() --- NEW FILE: ord.php --- <?php echo ord('a'), ' ', ord('b'), ' ', ord('c'), "\n"; ?> |
From: <sja...@us...> - 2003-08-12 08:39:54
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv25822 Modified Files: functions.php Log Message: Added function: ord() Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** functions.php 12 Aug 2003 08:28:42 -0000 1.39 --- functions.php 12 Aug 2003 08:39:07 -0000 1.40 *************** *** 65,68 **** --- 65,69 ---- 'glutCreateMenu' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutCreateMenu.cpp'), 'chr' => array(null, 'string/chr.cpp'), + 'ord' => array(null, 'string/ord.cpp'), null ); |
From: <sja...@us...> - 2003-08-12 08:37:27
|
Update of /cvsroot/binaryphp/binaryphp/functions/string In directory sc8-pr-cvs1:/tmp/cvs-serv24272/functions/string Added Files: chr.cpp Log Message: Added function: chr() --- NEW FILE: chr.cpp --- php_var chr(php_var num) { int i = (int)num; char c[2] = {0, 0}; sprintf( c, "%c", (char)i ); return php_var(c); } |
From: <sja...@us...> - 2003-08-12 08:36:52
|
Update of /cvsroot/binaryphp/binaryphp/tests/arrays In directory sc8-pr-cvs1:/tmp/cvs-serv23986/tests/arrays Added Files: array_reverse.php Log Message: Added test for array_reverse(). --- NEW FILE: array_reverse.php --- <?php echo "array_reverse tests:\n\n"; echo "test with numericly indexed array\n"; echo "original array:\n"; $array1 = array( 'a', 'b', 'c', 'd' ); var_dump( $array1 ); echo "reversed array:\n"; $array1 = array_reverse( $array1 ); var_dump( $array1 ); echo "test with textual index array\n"; $array2 = array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 ); echo "original array:\n"; $array1 = array( 'a', 'b', 'c', 'd' ); var_dump( $array1 ); echo "reversed array:\n"; $array1 = array_reverse( $array1 ); var_dump( $array1 ); ?> |
From: <sja...@us...> - 2003-08-12 08:30:36
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv24272 Modified Files: functions.php Log Message: Added function: chr() Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** functions.php 5 Aug 2003 23:25:55 -0000 1.38 --- functions.php 12 Aug 2003 08:28:42 -0000 1.39 *************** *** 64,67 **** --- 64,68 ---- 'glutKeyboardFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutKeyboardFunc.cpp'), 'glutCreateMenu' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutCreateMenu.cpp'), + 'chr' => array(null, 'string/chr.cpp'), null ); |
Update of /cvsroot/binaryphp/binaryphp/tests/base In directory sc8-pr-cvs1:/tmp/cvs-serv5374/tests/base Added Files: is_array.php is_bool.php is_int.php is_null.php is_resource.php is_string.php var_dump.php Log Message: Added more tests. Now have all tests for the 'arrays' and 'base' section done. --- NEW FILE: is_array.php --- <?php $array = array(1, 2, 3, 4); if(is_array($array)) echo 'Thats right!', "\n"; ?> --- NEW FILE: is_bool.php --- <?php $bool = false; if(is_bool($bool)) echo 'Thats right!', "\n"; ?> --- NEW FILE: is_int.php --- <?php $int = 4; if(is_int($int)) echo 'Thats right!', "\n"; ?> --- NEW FILE: is_null.php --- <?php $null = null; if(is_null($null)) echo 'Thats right!', "\n"; ?> --- NEW FILE: is_resource.php --- <?php $resource = socket_create(AF_INET, SOCK_STREAM, 0); if(is_resource($resource)) echo 'Thats right!', "\n"; ?> --- NEW FILE: is_string.php --- <?php $string = 'Text'; if(is_string($string)) echo 'Thats right!', "\n"; ?> --- NEW FILE: var_dump.php --- <?php $array = array(1, 'str' => 'test', 'int' => 2); var_dump($array); ?> |
From: <ama...@us...> - 2003-08-11 11:21:36
|
Update of /cvsroot/binaryphp/binaryphp/tests/arrays In directory sc8-pr-cvs1:/tmp/cvs-serv5374/tests/arrays Added Files: count.php implode.php in_array.php ksort.php Log Message: Added more tests. Now have all tests for the 'arrays' and 'base' section done. --- NEW FILE: count.php --- <?php $array = array(1, 2, 3, 4); echo count($array); ?> --- NEW FILE: implode.php --- <?php $array = array('This', 'is', 'a', 'test.'); echo implode(' ', $array); ?> --- NEW FILE: in_array.php --- <?php $array = array(1, 2, 3, 4); if(in_array(1, $array)) echo 'Element found.'; ?> --- NEW FILE: ksort.php --- <?php $fruits = array('d' => 'lemon', 'a' => 'orange', 'b' => 'banana', 'c' => 'apple'); ksort ($fruits); echo implode("\n", $fruits); ?> |
From: <ama...@us...> - 2003-08-11 11:21:36
|
Update of /cvsroot/binaryphp/binaryphp/tests In directory sc8-pr-cvs1:/tmp/cvs-serv5374/tests Removed Files: count.php implode.php in_array.php ksort.php Log Message: Added more tests. Now have all tests for the 'arrays' and 'base' section done. --- count.php DELETED --- --- implode.php DELETED --- --- in_array.php DELETED --- --- ksort.php DELETED --- |
From: <ama...@us...> - 2003-08-11 11:20:34
|
Update of /cvsroot/binaryphp/binaryphp/tests/base In directory sc8-pr-cvs1:/tmp/cvs-serv5331/tests/base Log Message: Directory /cvsroot/binaryphp/binaryphp/tests/base added to the repository |
From: <ama...@us...> - 2003-08-11 11:20:32
|
Update of /cvsroot/binaryphp/binaryphp/functions/string In directory sc8-pr-cvs1:/tmp/cvs-serv4644/functions/string Modified Files: str_repeat.cpp str_replace.cpp strlen.cpp strtolower.cpp substr.cpp Log Message: Added support for header(). Index: str_repeat.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/string/str_repeat.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** str_repeat.cpp 3 Aug 2003 06:36:03 -0000 1.1 --- str_repeat.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,15 **** ! php_var str_repeat(php_var input, php_var multiplier) { ! char *out; ! php_var retval; ! int i=(int)multiplier; ! if(i == 0) ! return (php_var)""; ! out=(char*)malloc(i*strlen(input)+1); ! memset(out,0,i*strlen(input)+1); ! ! for(;i>=1;i--) ! sprintf(out,"%s%s",out,(const char*)input); ! retval=out; ! free(out); ! return retval; ! } --- 1,15 ---- ! php_var str_repeat(php_var input, php_var multiplier) { ! char *out; ! php_var retval; ! int i=(int)multiplier; ! if(i == 0) ! return (php_var)""; ! out=(char*)malloc(i*strlen(input)+1); ! memset(out,0,i*strlen(input)+1); ! ! for(;i>=1;i--) ! sprintf(out,"%s%s",out,(const char*)input); ! retval=out; ! free(out); ! return retval; ! } Index: str_replace.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/string/str_replace.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** str_replace.cpp 3 Aug 2003 06:36:03 -0000 1.1 --- str_replace.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,31 **** ! /* NO LIMIT SUPPORT */ ! php_var str_replace(php_var search, php_var replace, php_var subject) { ! php_var retval=subject; ! int i; ! if(search.type == PHP_STRING) { ! char *tmp1; ! char *tmp2; ! char *ptr; ! tmp1=(char*)malloc(strlen(subject)+1); ! memset(tmp1,0,strlen(subject)); ! strcpy(tmp1,subject); ! while(ptr = strstr(tmp1, (const char *)search)) ! { ! *ptr = '\0'; ! i=strlen(tmp1)+(int)(strlen(replace))+(int)(strlen(search))+1; ! tmp2=(char*)malloc(i); ! memset(tmp2,0,i); ! sprintf(tmp2,"%s%s%s",tmp1,(const char*)replace,(const char*)(ptr+(int)(strlen(search)))); ! sprintf(tmp1,"%s",tmp2); ! free(tmp2); ! } ! retval=(char*)tmp1; ! free(tmp1); ! } else if (search.type == PHP_ARRAY) { ! for(i = 0;i < search.data.size(); ++i) ! { ! retval=str_replace(search.data[i],replace.data[i],retval); ! } ! } ! return retval; } --- 1,31 ---- ! /* NO LIMIT SUPPORT */ ! php_var str_replace(php_var search, php_var replace, php_var subject) { ! php_var retval=subject; ! int i; ! if(search.type == PHP_STRING) { ! char *tmp1; ! char *tmp2; ! char *ptr; ! tmp1=(char*)malloc(strlen(subject)+1); ! memset(tmp1,0,strlen(subject)); ! strcpy(tmp1,subject); ! while(ptr = strstr(tmp1, (const char *)search)) ! { ! *ptr = '\0'; ! i=strlen(tmp1)+(int)(strlen(replace))+(int)(strlen(search))+1; ! tmp2=(char*)malloc(i); ! memset(tmp2,0,i); ! sprintf(tmp2,"%s%s%s",tmp1,(const char*)replace,(const char*)(ptr+(int)(strlen(search)))); ! sprintf(tmp1,"%s",tmp2); ! free(tmp2); ! } ! retval=(char*)tmp1; ! free(tmp1); ! } else if (search.type == PHP_ARRAY) { ! for(i = 0;i < search.data.size(); ++i) ! { ! retval=str_replace(search.data[i],replace.data[i],retval); ! } ! } ! return retval; } Index: strlen.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/string/strlen.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** strlen.cpp 3 Aug 2003 06:36:03 -0000 1.1 --- strlen.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,8 **** ! php_var strlen(php_var str) ! { ! return (php_var) str.container.length(); ! } ! php_var strlen(string str) ! { ! return (php_var) str.length(); } --- 1,8 ---- ! php_var strlen(php_var str) ! { ! return (php_var) str.container.length(); ! } ! php_var strlen(string str) ! { ! return (php_var) str.length(); } Index: strtolower.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/string/strtolower.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** strtolower.cpp 3 Aug 2003 06:36:03 -0000 1.1 --- strtolower.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,7 **** ! php_var strtolower(php_var str) ! { ! for(int i = 0; i < str.container.length(); i++) ! str.container[i] = tolower(str.container[i]); ! ! return (php_var) str; ! } --- 1,7 ---- ! php_var strtolower(php_var str) ! { ! for(int i = 0; i < str.container.length(); i++) ! str.container[i] = tolower(str.container[i]); ! ! return (php_var) str; ! } Index: substr.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/string/substr.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** substr.cpp 5 Aug 2003 06:19:29 -0000 1.1 --- substr.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,12 **** ! php_var substr(php_var str, php_var pos, php_var len) ! { ! if(len == 0) ! len = str.container.length() - pos; ! return (php_var) str.container.substr(pos, len); ! } ! php_var substr(php_var str, long pos, long len) ! { ! if(len == 0) ! len = str.container.length() - pos; ! return (php_var) str.container.substr(pos, len); } --- 1,12 ---- ! php_var substr(php_var str, php_var pos, php_var len) ! { ! if(len == 0) ! len = str.container.length() - pos; ! return (php_var) str.container.substr(pos, len); ! } ! php_var substr(php_var str, long pos, long len) ! { ! if(len == 0) ! len = str.container.length() - pos; ! return (php_var) str.container.substr(pos, len); } |
From: <ama...@us...> - 2003-08-11 11:20:31
|
Update of /cvsroot/binaryphp/binaryphp/functions/errors In directory sc8-pr-cvs1:/tmp/cvs-serv4644/functions/errors Modified Files: error_reporting.cpp Log Message: Added support for header(). Index: error_reporting.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/errors/error_reporting.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** error_reporting.cpp 5 Aug 2003 06:19:29 -0000 1.1 --- error_reporting.cpp 11 Aug 2003 11:17:22 -0000 1.2 *************** *** 1,4 **** ! void error_reporting(php_var error_level) ! { ! return; ! } --- 1,4 ---- ! void error_reporting(php_var error_level) ! { ! return; ! } |
From: <ama...@us...> - 2003-08-11 11:20:31
|
Update of /cvsroot/binaryphp/binaryphp/functions/arrays In directory sc8-pr-cvs1:/tmp/cvs-serv4644/functions/arrays Modified Files: count.cpp implode.cpp Log Message: Added support for header(). Index: count.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/arrays/count.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** count.cpp 5 Aug 2003 06:19:29 -0000 1.1 --- count.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define count(var) ((php_var) (var).keys.size()) --- 1 ---- ! #define count(var) ((php_var) (var).keys.size()) Index: implode.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/arrays/implode.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** implode.cpp 5 Aug 2003 06:19:29 -0000 1.1 --- implode.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1,12 **** ! php_var implode(php_var delim, php_var arr) ! { ! php_var str; ! int i; ! for(i = 0; i < (arr.keys.size() - 1); ++i) ! { ! str += arr[i]; ! str += delim; ! } ! str += arr[i]; ! return str; ! } --- 1,12 ---- ! php_var implode(php_var delim, php_var arr) ! { ! php_var str; ! int i; ! for(i = 0; i < (arr.keys.size() - 1); ++i) ! { ! str += arr[i]; ! str += delim; ! } ! str += arr[i]; ! return str; ! } |
From: <ama...@us...> - 2003-08-11 11:20:17
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv4644 Modified Files: testfile.php tokenflow.php Log Message: Added support for header(). Index: testfile.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/testfile.php,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** testfile.php 8 Aug 2003 05:10:53 -0000 1.46 --- testfile.php 11 Aug 2003 11:17:21 -0000 1.47 *************** *** 1,3 **** <?php ! echo 'Bleh!'; ! ?> \ No newline at end of file --- 1,5 ---- <?php ! header('Location: http://google.com'); ! header('Location: http://feetman.com'); ! echo 'Test', "\n"; ! ?> Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** tokenflow.php 10 Aug 2003 05:18:31 -0000 1.56 --- tokenflow.php 11 Aug 2003 11:17:21 -0000 1.57 *************** *** 301,305 **** $this->AddLib($lib); } ! $code = $function . '(' . implode(', ', $parameters); if($add) $this->AddCode($code); --- 301,309 ---- $this->AddLib($lib); } ! ! if($function == 'header') ! $code = $this->B_header($parameters); ! else ! $code = $function . '(' . implode(', ', $parameters); if($add) $this->AddCode($code); *************** *** 336,339 **** --- 340,367 ---- if($add) $this->AddCode($code); + return $code; + } + /** + * Code generator for headers + * + * @param array $parameters Parameters to the function. + * @return string + * @access private + */ + function B_header($parameters) + { + $header_count = 0; + $this->current_header += 1; + foreach($this->tokens as $token) + { + if((array_search('header', $token)) != false) + $header_count += 1; + } + + $code = 'cout << ' . substr($parameters[0], 0, -1); + if($this->current_header == $header_count) + $code .= " << endl << endl;"; + else + $code .= " << endl;"; return $code; } |
From: <ama...@us...> - 2003-08-11 11:20:17
|
Update of /cvsroot/binaryphp/binaryphp/functions/base In directory sc8-pr-cvs1:/tmp/cvs-serv4644/functions/base Modified Files: is_array.cpp is_bool.cpp is_int.cpp is_null.cpp is_resource.cpp is_string.cpp Log Message: Added support for header(). Index: is_array.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_array.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_array.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_array.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_array(var) ((var).type == PHP_ARRAY ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_array(var) ((var).type == PHP_ARRAY ? (php_var)true : (php_var)false) Index: is_bool.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_bool.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_bool.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_bool.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_bool(var) ((var).type == PHP_BOOL ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_bool(var) ((var).type == PHP_BOOL ? (php_var)true : (php_var)false) Index: is_int.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_int.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_int.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_int.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_int(var) ((var).type == PHP_INT ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_int(var) ((var).type == PHP_INT ? (php_var)true : (php_var)false) Index: is_null.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_null.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_null.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_null.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_null(var) ((var).type == PHP_NULL ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_null(var) ((var).type == PHP_NULL ? (php_var)true : (php_var)false) Index: is_resource.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_resource.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_resource.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_resource.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_resource(var) ((var).type == PHP_RESOURCE ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_resource(var) ((var).type == PHP_RESOURCE ? (php_var)true : (php_var)false) Index: is_string.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/is_string.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** is_string.cpp 5 Aug 2003 06:14:13 -0000 1.1 --- is_string.cpp 11 Aug 2003 11:17:21 -0000 1.2 *************** *** 1 **** ! #define is_string(var) ((var).type == PHP_STRING ? (php_var)true : (php_var)false) --- 1 ---- ! #define is_string(var) ((var).type == PHP_STRING ? (php_var)true : (php_var)false) |
From: <ama...@us...> - 2003-08-11 11:19:59
|
Update of /cvsroot/binaryphp/binaryphp/tests/arrays In directory sc8-pr-cvs1:/tmp/cvs-serv5199/tests/arrays Log Message: Directory /cvsroot/binaryphp/binaryphp/tests/arrays added to the repository |
From: <da...@us...> - 2003-08-10 05:18:34
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv9138 Modified Files: tokenflow.php Added Files: php_var.hpp Log Message: Added php_var header file. --- NEW FILE: php_var.hpp --- #include <iostream> #include <string> #include <vector> #include <stdio.h> #include <iostream> #define PHP_NULL 0 #define PHP_STRING 1 #define PHP_INT 2 #define PHP_BOOL 3 #define PHP_ARRAY 4 #define PHP_RESOURCE 5 #define PHP_OBJECT 6 using namespace std; char* intstring(long i); char* doublestring(double i); class php_var { public: php_var(); // Constructor php_var(const char* str); php_var(double i); php_var(int i); php_var(unsigned int i); php_var(long i); php_var(const php_var &temp); php_var(char * str); php_var(string str); php_var(bool b); operator const char*(); operator string(); operator bool(); operator double(); operator float(); operator int(); operator unsigned int(); operator long(); php_var &operator[](int subscript); php_var &operator[](unsigned int subscript); php_var &operator[](const char* subscript); php_var &operator[](char* subscript); php_var &operator[](string subscript); php_var &operator[](php_var subscript); bool operator<(int i); bool operator>(int i); bool operator<(php_var i); bool operator>(php_var i); bool operator!=(const char* cmp); bool operator!=(int i); bool operator!=(php_var var); bool operator==(const char* cmp); bool operator==(int i); bool operator==(php_var var); int operator++(int i); int operator++(); int operator--(int i); int operator--(); void operator+=(int inc); void operator+=(php_var str); void operator+=(string str); void operator+=(const char* str); void operator+=(char* str); void operator-=(int dec); void operator-=(php_var i); friend ostream &operator<<( ostream &out, const php_var &var ); void to_array(); string container; // Contains value. vector<php_var> keys; vector<php_var> data; void *res; void *obj_type; int res_type; int type; // Contains current type. }; Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** tokenflow.php 10 Aug 2003 01:42:54 -0000 1.55 --- tokenflow.php 10 Aug 2003 05:18:31 -0000 1.56 *************** *** 223,226 **** --- 223,230 ---- $code .= $data; break; + case '{': + case '}': + $this->AddCode($data); + break; } } |
From: <da...@us...> - 2003-08-10 01:42:57
|
Update of /cvsroot/binaryphp/binaryphp/examples In directory sc8-pr-cvs1:/tmp/cvs-serv21173/examples Modified Files: helloworld.php Log Message: For and If support. Index: helloworld.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/examples/helloworld.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** helloworld.php 9 Aug 2003 05:57:13 -0000 1.4 --- helloworld.php 10 Aug 2003 01:42:54 -0000 1.5 *************** *** 1,3 **** <?php ! echo strlen('bleh!'); ?> --- 1,4 ---- <?php ! for($i = 0; $i < 50; ++$i) ! echo $i, "\n"; ?> |
From: <da...@us...> - 2003-08-10 01:42:57
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv21173 Modified Files: tokenflow.php Log Message: For and If support. Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** tokenflow.php 9 Aug 2003 05:57:12 -0000 1.54 --- tokenflow.php 10 Aug 2003 01:42:54 -0000 1.55 *************** *** 78,81 **** --- 78,93 ---- var $includes = array(); /** + * An array of C++ includes. + * @param array + * @access public + */ + var $cppincludes = array(); + /** + * An array of libraries. + * @param array + * @access public + */ + var $libs = array(); + /** * Variable scope * @param array *************** *** 94,100 **** $this->curfunction = 0; $this->tokens = $tokenizer->tokens; - $this->Parse_Tokenstream(); $this->functions[0] = array('main', 'int', array(array('int', 'argc'), array('char**', 'argv'))); - $this->scope[0] = array(); /* * First element of each array in the functions array is the name of the function. --- 106,110 ---- *************** *** 102,105 **** --- 112,117 ---- * The third argument is an array of arguments in the form array(type, name). */ + $this->scope[0] = array(); + $this->Parse_Tokenstream(); } /** *************** *** 141,145 **** case T_ECHO: ++$this->token; ! if($begin == null && $end == null) $this->B_echo($this->Parse_Tokenstream(',', ';'), true); else --- 153,157 ---- case T_ECHO: ++$this->token; ! if($break == null && $end == null) $this->B_echo($this->Parse_Tokenstream(',', ';'), true); else *************** *** 156,172 **** break; case T_VARIABLE: ! if($break == null && $end == null) ! { ! if($begin == null && $end == null) ! $this->B_variable($this->Parse_Tokenstream('=', ';'), true); ! else ! $code .= $this->B_variable($this->Parse_Tokenstream('=', ';')); ! } ! else ! { ! if($this->Define($data)) ! $code .= 'php_var '; ! $code .= '_' . substr($data, 1); ! } break; case T_LNUMBER: --- 168,174 ---- break; case T_VARIABLE: ! if($this->Define($data)) ! $code .= 'php_var '; ! $code .= '_' . substr($data, 1); break; case T_LNUMBER: *************** *** 178,189 **** { ++$this->token; ! if($begin == null && $end == null) ! $this->B_function($data, $this->Parse_Tokenstream(',', ')'), true); else ! $code .= $this->B_function($data, $this->Parse_Tokenstream(',', ')')); } else $code .= $data; break; case '-': case '+': --- 180,205 ---- { ++$this->token; ! if($break == null && $end == null) ! $this->B_function_call($data, $this->Parse_Tokenstream(',', ')'), true); else ! $code .= $this->B_function_call($data, $this->Parse_Tokenstream(',', ')')); } else $code .= $data; break; + case T_IF: + ++$this->token; + if($break == null && $end == null) + $this->B_if($this->Parse_Tokenstream(null, ')'), true); + else + $code .= $this->B_if($this->Parse_Tokenstream(null, ')')); + break; + case T_FOR: + ++$this->token; + if($break == null && $end == null) + $this->B_for($this->Parse_Tokenstream(';', ')'), true); + else + $code .= $this->B_for($this->Parse_Tokenstream(';', ')')); + break; case '-': case '+': *************** *** 193,202 **** --- 209,226 ---- case '&': case '|': + case '%': + case '<': + case '=': $code .= ' ' . $token . ' '; break; case T_BOOLEAN_AND: case T_BOOLEAN_OR: + case T_IS_EQUAL: $code .= ' ' . $data . ' '; break; + case T_INC: + case T_DEC: + $code .= $data; + break; } } *************** *** 248,252 **** * Code generator for functions * ! * @param string $function Name of the function. * @param array $parameters Parameters to the function. * @param bool $add Set to true to add the code to the source. --- 272,276 ---- * Code generator for functions * ! * @param string $function Name of the function calls. * @param array $parameters Parameters to the function. * @param bool $add Set to true to add the code to the source. *************** *** 254,263 **** * @access private */ ! function B_function($function, $parameters, $add = false) { $code = $function . '(' . implode(', ', $parameters); if($add) $this->AddCode($code); ! echo 'Bleh?', "\n"; return $code; } --- 278,335 ---- * @access private */ ! function B_function_call($function, $parameters, $add = false) { + global $funcs; + if(isset($funcs[$function])) + { + if(count($funcs[$function]) == 2) + { + list($inc, $cppinc) = $funcs[$function]; + $lib = null; + } + else + list($inc, $cppinc, $lib) = $funcs[$function]; + if($inc != null) + $this->AddInclude($inc); + if($cppinc != null) + $this->AddCPPInclude($cppinc); + if($lib != null) + $this->AddLib($lib); + } $code = $function . '(' . implode(', ', $parameters); if($add) $this->AddCode($code); ! return $code; ! } ! /** ! * Code generator for IFs ! * ! * @param array $parameters Statement(s). ! * @param bool $add Set to true to add the code to the source. ! * @return string ! * @access private ! */ ! function B_if($parameters, $add = false) ! { ! $code = 'if(' . $parameters[0]; ! if($add) ! $this->AddCode($code); ! return $code; ! } ! /** ! * Code generator for FOR loops ! * ! * @param array $parameters Statement(s). ! * @param bool $add Set to true to add the code to the source. ! * @return string ! * @access private ! */ ! function B_for($parameters, $add = false) ! { ! $code = 'for(' . $parameters[0] . '; ' . $parameters[1] . '; ' . $parameters[2]; ! if(count($parameters) > 3) ! $code .= ')'; ! if($add) ! $this->AddCode($code); return $code; } *************** *** 283,288 **** function AddInclude($inc) { ! if(!in_array($inc, $this->includes)) ! $this->includes[] = $inc; } /** --- 355,406 ---- function AddInclude($inc) { ! if(is_array($inc)) ! { ! foreach($inc as $in) ! { ! if(!in_array($in, $this->includes)) ! $this->includes[] = $in; ! } ! } ! elseif(!in_array($inc, $this->includes)) ! $this->includes[] = $inc; ! } ! /** ! * Add a C++ include. ! * ! * @param string $inc Name of file to include. ! * @access public ! */ ! function AddCPPInclude($inc) ! { ! if(is_array($inc)) ! { ! foreach($inc as $in) ! { ! if(!in_array($in, $this->cppincludes)) ! $this->cppincludes[] = $in; ! } ! } ! elseif(!in_array($inc, $this->cppincludes)) ! $this->cppincludes[] = $inc; ! } ! /** ! * Add an include. ! * ! * @param string $inc Name of file to include. ! * @access public ! */ ! function AddLib($inc) ! { ! if(is_array($inc)) ! { ! foreach($inc as $in) ! { ! if(!in_array($in, $this->libs)) ! $this->libs[] = $in; ! } ! } ! elseif(!in_array($inc, $this->libs)) ! $this->libs[] = $inc; } /** *************** *** 331,334 **** --- 449,454 ---- $code .= 'using namespace ' . $this->namespace . ';' . "\n"; $code .= '#include "php_var.hpp"' . "\n"; + foreach($this->cppincludes as $cpp) + $code .= implode(null, file('functions/' . $cpp)) . "\n\n"; foreach($this->code as $func => $arr) { *************** *** 344,348 **** $code .= '}' . "\n"; } ! return array($code, (string) null); } } --- 464,471 ---- $code .= '}' . "\n"; } ! $flags = (string) null; ! foreach($this->libs as $lib) ! $flags .= '-l' . $lib . ' '; ! return array($code, $flags); } } |
From: <da...@us...> - 2003-08-09 05:57:15
|
Update of /cvsroot/binaryphp/binaryphp/examples In directory sc8-pr-cvs1:/tmp/cvs-serv8334/examples Modified Files: helloworld.php Log Message: Functions work\! Index: helloworld.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/examples/helloworld.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** helloworld.php 9 Aug 2003 03:58:34 -0000 1.3 --- helloworld.php 9 Aug 2003 05:57:13 -0000 1.4 *************** *** 1,5 **** <?php ! $var = 'bleh'; ! $var = 'foo'; ! echo $var; ?> --- 1,3 ---- <?php ! echo strlen('bleh!'); ?> |
From: <da...@us...> - 2003-08-09 05:57:15
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv8334 Modified Files: tokenflow.php Log Message: Functions work\! Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** tokenflow.php 9 Aug 2003 03:58:34 -0000 1.53 --- tokenflow.php 9 Aug 2003 05:57:12 -0000 1.54 *************** *** 141,145 **** case T_ECHO: ++$this->token; ! $this->B_echo($this->Parse_Tokenstream(',', ';')); break; case ',': --- 141,148 ---- case T_ECHO: ++$this->token; ! if($begin == null && $end == null) ! $this->B_echo($this->Parse_Tokenstream(',', ';'), true); ! else ! $code .= $this->B_echo($this->Parse_Tokenstream(',', ';')); break; case ',': *************** *** 154,158 **** case T_VARIABLE: if($break == null && $end == null) ! $this->B_Variable($this->Parse_Tokenstream('=', ';')); else { --- 157,166 ---- case T_VARIABLE: if($break == null && $end == null) ! { ! if($begin == null && $end == null) ! $this->B_variable($this->Parse_Tokenstream('=', ';'), true); ! else ! $code .= $this->B_variable($this->Parse_Tokenstream('=', ';')); ! } else { *************** *** 162,165 **** --- 170,189 ---- } break; + case T_LNUMBER: + case T_DNUMBER: + $code .= $data; + break; + case T_STRING: + if($this->tokens[$this->token + 1][0] == '(') + { + ++$this->token; + if($begin == null && $end == null) + $this->B_function($data, $this->Parse_Tokenstream(',', ')'), true); + else + $code .= $this->B_function($data, $this->Parse_Tokenstream(',', ')')); + } + else + $code .= $data; + break; case '-': case '+': *************** *** 185,192 **** * * @param array $parameters Things to echo. * @return string * @access private */ ! function B_echo($parameters) { $this->namespace = 'std'; --- 209,217 ---- * * @param array $parameters Things to echo. + * @param bool $add Set to true to add the code to the source. * @return string * @access private */ ! function B_echo($parameters, $add = false) { $this->namespace = 'std'; *************** *** 201,205 **** } $code .= ';'; ! $this->AddCode($code); return $code; } --- 226,231 ---- } $code .= ';'; ! if($add) ! $this->AddCode($code); return $code; } *************** *** 208,218 **** * * @param array $parameters Things to echo. * @return string * @access private */ ! function B_variable($parameters) { $code = implode(' = ', $parameters); ! $this->AddCode($code); return $code; } --- 234,263 ---- * * @param array $parameters Things to echo. + * @param bool $add Set to true to add the code to the source. * @return string * @access private */ ! function B_variable($parameters, $add = false) { $code = implode(' = ', $parameters); ! if($add) ! $this->AddCode($code); ! return $code; ! } ! /** ! * Code generator for functions ! * ! * @param string $function Name of the function. ! * @param array $parameters Parameters to the function. ! * @param bool $add Set to true to add the code to the source. ! * @return string ! * @access private ! */ ! function B_function($function, $parameters, $add = false) ! { ! $code = $function . '(' . implode(', ', $parameters); ! if($add) ! $this->AddCode($code); ! echo 'Bleh?', "\n"; return $code; } |
From: <da...@us...> - 2003-08-09 03:58:37
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv24741 Modified Files: convert.php php_var.cpp tokenflow.php Log Message: Added variable support. Index: convert.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/convert.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** convert.php 5 Aug 2003 23:25:55 -0000 1.23 --- convert.php 9 Aug 2003 03:58:34 -0000 1.24 *************** *** 63,67 **** list($code, $flags) = $gen->Convert(); if(DEBUG) ! $flags .= ' -g'; $lines = explode("\n", $code); if(DEBUG == true) { --- 63,69 ---- list($code, $flags) = $gen->Convert(); if(DEBUG) ! $flag = ' -g'; ! else ! $flag = (string) null; $lines = explode("\n", $code); if(DEBUG == true) { *************** *** 86,91 **** shell_exec($comp); } else { ! $comp = 'g++ -o ' . $output . ' ' .$outputfile. ' '. $flags . ' >> log 2>> log'; ! echo $comp, "\n\n"; shell_exec($comp); } --- 88,99 ---- shell_exec($comp); } else { ! if(!file_exists('php_var.lo')) ! { ! $comp = 'g++ -c -o php_var.lo php_var.cpp ' . $flag . ' >> log 2>> log'; ! `echo $comp >> log`; ! shell_exec($comp); ! } ! $comp = 'g++ -o ' . $output . ' ' .$outputfile. ' php_var.lo '. $flags . $flag . ' >> log 2>> log'; ! `echo $comp >> log`; shell_exec($comp); } Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** php_var.cpp 6 Aug 2003 14:09:55 -0000 1.25 --- php_var.cpp 9 Aug 2003 03:58:34 -0000 1.26 *************** *** 1,14 **** ! #include <iostream> ! #include <string> ! #include <vector> ! #include <stdio.h> ! #include <iostream> ! #define PHP_NULL 0 ! #define PHP_STRING 1 ! #define PHP_INT 2 ! #define PHP_BOOL 3 ! #define PHP_ARRAY 4 ! #define PHP_RESOURCE 5 ! #define PHP_OBJECT 6 char* intstring(long i) --- 1,3 ---- ! #include "php_var.hpp" char* intstring(long i) *************** *** 24,422 **** return buf; } ! class php_var { ! public: ! php_var() // Constructor ! { ! type = PHP_NULL; // Make the var, but make it null. ! container = ""; ! } ! php_var(const char* str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var(double i) ! { ! type = PHP_INT; ! container = doublestring(i); ! } ! php_var(int i) ! { ! type = PHP_INT; ! container = intstring(i); ! } ! php_var(unsigned int i) ! { ! container = intstring(i); ! type = PHP_INT; ! } ! php_var(long i) ! { ! container = intstring(i); ! type = PHP_INT; ! } ! php_var(const php_var &temp) ! { ! type = temp.type; ! container = temp.container; ! keys = temp.keys; ! data = temp.data; ! res = temp.res; ! } ! php_var(char * str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var(string str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var(bool b) ! { ! if(b) ! container = "1"; ! else ! container = "0"; ! type = PHP_BOOL; ! } ! operator const char*() ! { ! if(type == PHP_STRING || type == PHP_INT) ! return container.c_str(); ! else ! return "Array"; ! } ! operator string() ! { ! if(type == PHP_STRING || type == PHP_INT) ! return container; ! else ! return string("Array"); ! } ! operator bool() ! { ! if(type != PHP_BOOL || (type == PHP_BOOL && container.compare("1") == 0)) ! return true; ! return false; ! } ! operator double() ! { ! return atof(container.c_str()); ! } ! operator float() ! { ! return atof(container.c_str()); ! } ! operator int() ! { ! return atoi(container.c_str()); ! } ! operator unsigned int() ! { ! return atoi(container.c_str()); ! } ! operator long() ! { ! return atol(container.c_str()); ! } ! php_var &operator[](int subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](unsigned int subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](long subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](const char* subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](char* subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](string subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! php_var &operator[](php_var subscript) { ! if(type == PHP_STRING) ! { ! // return (char *)&container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) ! { ! if(key.container.compare(keys[i].container) == 0) ! return data[i]; ! } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); return data[i]; - } - } - bool operator<(int i) - { - if(atol(container.c_str()) < i) - return true; - return false; - } - bool operator>(int i) - { - if(atol(container.c_str()) > i) - return true; - return false; - } - bool operator<(php_var i) - { - if(atol(container.c_str()) < atol(i.container.c_str())) - return true; - return false; } ! bool operator>(php_var i) ! { ! if(atol(container.c_str()) > atol(i.container.c_str())) ! return true; ! return false; ! } ! bool operator!=(const char* cmp) ! { ! if(container.compare(cmp)) ! return true; ! return false; ! } ! bool operator!=(int i) ! { ! if(atol(container.c_str()) == i) ! return false; ! return true; ! } ! bool operator!=(php_var var) ! { ! if(!container.compare(var.container)) ! return false; ! return true; ! } ! bool operator==(const char* cmp) ! { ! if(container.compare(cmp) == 0) ! return true; ! return false; ! } ! bool operator==(int i) ! { ! if(atol(container.c_str()) == i) ! return true; ! return false; ! } ! bool operator==(const php_var& var) ! { ! if(this->container.compare(var.container) == 0) ! return true; ! return false; ! } ! bool operator==(string cmp) ! { ! return container == cmp; ! } ! int operator++(int i) ! { ! int ret = atol(container.c_str()); ! container = intstring(ret + i); ! return ret; ! } ! int operator++() ! { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; ! } ! int operator--(int i) ! { ! int ret = atol(container.c_str()); ! container = intstring(ret); ! return ret; ! } ! int operator--() ! { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; ! } ! void operator+=(int inc) ! { ! if(type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) + inc); ! } ! } ! void operator+=(php_var str) ! { ! if(str.type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) + atoi(str.container.c_str())); ! if(type != PHP_INT && type != PHP_STRING) ! type = PHP_INT; ! } ! else ! { ! container += str.container; ! if(type != PHP_STRING) ! type = PHP_STRING; ! } ! } ! void operator+=(string str) ! { ! container += str; ! } ! void operator+=(const char* str) ! { ! container += str; ! } ! void operator+=(char* str) ! { ! container += str; ! } ! void operator-=(int dec) ! { ! if(type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) - dec); ! } ! } ! php_var operator-(php_var i) ! { type = PHP_INT; ! i.type = PHP_INT; ! *this -= i; ! return *this; ! } ! friend ostream &operator<<( ostream &out, const php_var &var ); ! void to_array() ! { ! type = PHP_ARRAY; ! } ! string container; // Contains value. ! vector<php_var> keys; ! vector<php_var> data; ! void *res; ! void *obj_type; ! int res_type; ! int type; // Contains current type. ! }; template<typename T> inline T * OBJ(php_var obj) { return (reinterpret_cast<T *>(obj.res)); } ostream &operator<<( ostream &out, const php_var &var ) --- 13,288 ---- return buf; } ! ! php_var::php_var() // Constructor { ! type = PHP_NULL; // Make the var, but make it null. ! container = ""; ! } ! php_var::php_var(const char* str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var::php_var(double i) ! { ! type = PHP_INT; ! container = doublestring(i); ! } ! php_var::php_var(int i) ! { ! type = PHP_INT; ! container = intstring(i); ! } ! php_var::php_var(unsigned int i) ! { ! container = intstring(i); ! type = PHP_INT; ! } ! php_var::php_var(long i) ! { ! container = intstring(i); ! type = PHP_INT; ! } ! php_var::php_var(const php_var &temp) ! { ! type = temp.type; ! container = temp.container; ! keys = temp.keys; ! data = temp.data; ! res = temp.res; ! } ! php_var::php_var(char * str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var::php_var(string str) ! { ! container = str; ! type = PHP_STRING; ! } ! php_var::php_var(bool b) ! { ! if(b) ! container = "1"; ! else ! container = "0"; ! type = PHP_BOOL; ! } ! php_var::operator const char*() ! { ! if(type == PHP_STRING || type == PHP_INT) ! return container.c_str(); ! else ! return "Array"; ! } ! php_var::operator string() ! { ! if(type == PHP_STRING || type == PHP_INT) ! return container; ! else ! return string("Array"); ! } ! php_var::operator bool() ! { ! if(type != PHP_BOOL || (type == PHP_BOOL && container.compare("1") == 0)) ! return true; ! return false; ! } ! php_var::operator double() ! { ! return atof(container.c_str()); ! } ! php_var::operator float() ! { ! return atof(container.c_str()); ! } ! php_var::operator int() ! { ! return atoi(container.c_str()); ! } ! php_var::operator unsigned int() ! { ! return atoi(container.c_str()); ! } ! php_var::operator long() ! { ! return atol(container.c_str()); ! } ! php_var &php_var::operator[](int subscript) ! { ! return (*this)[(php_var)subscript]; ! } ! php_var &php_var::operator[](unsigned int subscript) ! { ! return (*this)[(php_var)subscript]; ! } ! php_var &php_var::operator[](const char* subscript) ! { ! return (*this)[(php_var)subscript]; ! } ! php_var &php_var::operator[](char* subscript) ! { ! return (*this)[(php_var)subscript]; ! } ! php_var &php_var::operator[](string subscript) ! { ! return (*this)[(php_var)subscript]; ! } ! php_var &php_var::operator[](php_var subscript) ! { ! if(type == PHP_STRING) ! { ! // return &container[subscript]; ! } ! else if(type == PHP_ARRAY) ! { ! php_var key = subscript; ! int i = 0; ! for(i = 0;i < keys.size(); ++i) { ! if(key.container.compare(keys[i].container) == 0) return data[i]; } ! php_var temp; ! keys.push_back(key); ! data.push_back(temp); ! return data[i]; ! } ! } ! bool php_var::operator<(int i) ! { ! if(atol(container.c_str()) < i) ! return true; ! return false; ! } ! bool php_var::operator>(int i) ! { ! if(atol(container.c_str()) > i) ! return true; ! return false; ! } ! bool php_var::operator<(php_var i) ! { ! if(atol(container.c_str()) < atol(i.container.c_str())) ! return true; ! return false; ! } ! bool php_var::operator>(php_var i) ! { ! if(atol(container.c_str()) > atol(i.container.c_str())) ! return true; ! return false; ! } ! bool php_var::operator!=(const char* cmp) ! { ! if(container.compare(cmp)) ! return true; ! return false; ! } ! bool php_var::operator!=(int i) ! { ! if(atol(container.c_str()) == i) ! return false; ! return true; ! } ! bool php_var::operator!=(php_var var) ! { ! if(!container.compare(var.container)) ! return false; ! return true; ! } ! bool php_var::operator==(const char* cmp) ! { ! if(container.compare(cmp) == 0) ! return true; ! return false; ! } ! bool php_var::operator==(int i) ! { ! if(atol(container.c_str()) == i) ! return true; ! return false; ! } ! bool php_var::operator==(php_var var) ! { ! if(container.compare(var.container) == 0) ! return true; ! return false; ! } ! int php_var::operator++(int i) ! { ! int ret = atol(container.c_str()); ! container = intstring(ret + i); ! return ret; ! } ! int php_var::operator++() ! { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; ! } ! int php_var::operator--(int i) ! { ! int ret = atol(container.c_str()); ! container = intstring(ret); ! return ret; ! } ! int php_var::operator--() ! { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; ! } ! void php_var::operator+=(int inc) ! { ! if(type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) + inc); ! } ! } ! void php_var::operator+=(php_var str) ! { ! if(str.type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) + atoi(str.container.c_str())); ! if(type != PHP_INT && type != PHP_STRING) type = PHP_INT; ! } ! else ! { ! container += str.container; ! if(type != PHP_STRING) ! type = PHP_STRING; ! } ! } ! void php_var::operator+=(string str) ! { ! container += str; ! } ! void php_var::operator+=(const char* str) ! { ! container += str; ! } ! void php_var::operator+=(char* str) ! { ! container += str; ! } ! void php_var::operator-=(int dec) ! { ! if(type == PHP_INT) ! { ! container = intstring(atol(container.c_str()) - dec); ! } ! } ! void php_var::operator-=(php_var i) ! { ! if(type == PHP_INT) ! container = doublestring(atof(container.c_str()) - atof(i.container.c_str())); ! } ! void php_var::to_array() ! { ! type = PHP_ARRAY; ! } template<typename T> inline T * OBJ(php_var obj) { return (reinterpret_cast<T *>(obj.res)); } ostream &operator<<( ostream &out, const php_var &var ) *************** *** 435,438 **** --- 301,308 ---- { return(v < i); + } + php_var operator-(php_var l, php_var r) + { + return (php_var)((int) l - (int) r); } float operator/(php_var &l, php_var &r) Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** tokenflow.php 8 Aug 2003 06:59:06 -0000 1.52 --- tokenflow.php 9 Aug 2003 03:58:34 -0000 1.53 *************** *** 77,80 **** --- 77,86 ---- */ var $includes = array(); + /** + * Variable scope + * @param array + * @access private + */ + var $scope = array(); /** *************** *** 90,93 **** --- 96,100 ---- $this->Parse_Tokenstream(); $this->functions[0] = array('main', 'int', array(array('int', 'argc'), array('char**', 'argv'))); + $this->scope[0] = array(); /* * First element of each array in the functions array is the name of the function. *************** *** 115,119 **** if($end != null && $token == $end) { ! ++$this->token; break; } --- 122,132 ---- if($end != null && $token == $end) { ! if($this->token < count($this->tokens) - 2) ! { ! if($data == null) ! $code .= $token; ! else ! $code .= $data; ! } break; } *************** *** 122,126 **** $params[] = $code; $code = (string) null; - // ++$this->token; continue; } --- 135,138 ---- *************** *** 140,143 **** --- 152,165 ---- $code .= '"' . str_replace(array('\\\'', '"'), array('\'', '\\"'), substr($data, 1, -1)) . '"'; break; + case T_VARIABLE: + if($break == null && $end == null) + $this->B_Variable($this->Parse_Tokenstream('=', ';')); + else + { + if($this->Define($data)) + $code .= 'php_var '; + $code .= '_' . substr($data, 1); + } + break; case '-': case '+': *************** *** 160,164 **** } /** ! * Code generator for the echo function * * @param array $parameters Things to echo. --- 182,186 ---- } /** ! * Code generator for echo * * @param array $parameters Things to echo. *************** *** 183,186 **** --- 205,221 ---- } /** + * Code generator for variables + * + * @param array $parameters Things to echo. + * @return string + * @access private + */ + function B_variable($parameters) + { + $code = implode(' = ', $parameters); + $this->AddCode($code); + return $code; + } + /** * Adds a line of code to the current function. * *************** *** 207,210 **** --- 242,276 ---- } /** + * Checks the variable scope to see if a given variable is declared in this scope or not. + * + * @param string $var Name of variable. + * @param int $function Function to search in. + * @return bool + * @access public + */ + function IsDefined($var, $function = null) + { + if($function == null) + $function = $this->curfunction; + return in_array($var, $this->scope[$function]); + } + /** + * Adds a variable to the current scope. + * + * @param string $var Name of variable. + * @param int $function Function to add to. + * @return bool + * @access public + */ + function Define($var, $function = null) + { + if($function == null) + $function = $this->curfunction; + if($this->IsDefined($var, $function)) + return false; + $this->scope[$function][] = $var; + return true; + } + /** * Organizes and outputs proper C++ code. * *************** *** 215,222 **** { $code = (string) null; - if(!empty($this->namespace)) - $code .= 'using namespace ' . $this->namespace . ';' . "\n"; foreach($this->includes as $include) $code .= '#include <' . $include . '>' . "\n"; foreach($this->code as $func => $arr) { --- 281,289 ---- { $code = (string) null; foreach($this->includes as $include) $code .= '#include <' . $include . '>' . "\n"; + if(!empty($this->namespace)) + $code .= 'using namespace ' . $this->namespace . ';' . "\n"; + $code .= '#include "php_var.hpp"' . "\n"; foreach($this->code as $func => $arr) { |