From: <da...@us...> - 2003-08-04 23:46:31
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv16567 Modified Files: convert.php functions.php php_var.cpp tokenflow.php Log Message: Fixed for gcc/g++3 compatibility. Index: convert.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/convert.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** convert.php 4 Aug 2003 05:38:31 -0000 1.17 --- convert.php 4 Aug 2003 23:46:24 -0000 1.18 *************** *** 16,20 **** require_once 'functions.php'; $tokenizer = new Tokenizer(); ! $tokenizer->Parse('testfile2.php'); $tokenizer->Strip(); $gen = new Generator($tokenizer); --- 16,20 ---- require_once 'functions.php'; $tokenizer = new Tokenizer(); ! $tokenizer->Parse('testfile.php'); $tokenizer->Strip(); $gen = new Generator($tokenizer); *************** *** 63,65 **** if(!DEBUG) unlink('test.cpp'); ! ?> \ No newline at end of file --- 63,65 ---- if(!DEBUG) unlink('test.cpp'); ! ?> Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** functions.php 4 Aug 2003 05:38:31 -0000 1.35 --- functions.php 4 Aug 2003 23:46:24 -0000 1.36 *************** *** 56,60 **** 'glClear' => array(array('GL/gl.h', 'GL/glu.h'), null, array('GLU', 'GL')), 'glutWireCube' => array('GL/glut.h', null, array('GLU', 'GL', 'glut')), ! 'glLightfv' => array(array('GL/gl.h', 'GL/glu.h'), 'glLightfv'), null ); --- 56,66 ---- 'glClear' => array(array('GL/gl.h', 'GL/glu.h'), null, array('GLU', 'GL')), 'glutWireCube' => array('GL/glut.h', null, array('GLU', 'GL', 'glut')), ! 'glLightfv' => array(array('GL/gl.h', 'GL/glu.h'), 'glu/glLightfv.cpp'), ! 'glutInit' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutInit.cpp'), ! 'glutReshapeFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutReshapeFunc.cpp'), ! 'glutMouseFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutMouseFunc.cpp'), ! 'glutMotionFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutMotionFunc.cpp'), ! 'glutButtonBoxFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutButtonBoxFunc.cpp'), ! 'glutKeyboardFunc' => array(array('GL/gl.h', 'GL/glu.h', 'GL/glut.h'), 'glut/glutKeyboardFunc.cpp'), null ); Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** php_var.cpp 4 Aug 2003 00:48:37 -0000 1.20 --- php_var.cpp 4 Aug 2003 23:46:24 -0000 1.21 *************** *** 1,2 **** --- 1,3 ---- + #include <iostream> #include <string> #include <vector> *************** *** 432,434 **** return(v < i); } ! #define is_identical(var, varb) (((var) == (varb) && (var).type == (varb).type) ? (php_var)true : (php_var)false) \ No newline at end of file --- 433,443 ---- return(v < i); } ! php_var operator+(php_var l, php_var r) ! { ! return (php_var)((int) l + (int) r); ! } ! php_var operator-(php_var l, php_var r) ! { ! return (php_var)((int) l - (int) r); ! } ! #define is_identical(var, varb) (((var) == (varb) && (var).type == (varb).type) ? (php_var)true : (php_var)false) Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** tokenflow.php 4 Aug 2003 05:38:31 -0000 1.47 --- tokenflow.php 4 Aug 2003 23:46:24 -0000 1.48 *************** *** 28,32 **** global $funcs; $this->code = array('main' => array()); ! $this->prototypes = array('main' => array('int', array('int *_argc', 'char **_argv'))); $this->namespace = 'std'; $this->includes[] = 'sstream'; --- 28,32 ---- global $funcs; $this->code = array('main' => array()); ! $this->prototypes = array('main' => array('int', array('int _argc', 'char **_argv'))); $this->namespace = 'std'; $this->includes[] = 'sstream'; *************** *** 41,47 **** $this->globals[] = substr($tokenizer->tokens[$a + 1][1], 1); } - $this->globals[] = 'argc'; - $this->globals[] = 'argv'; $this->scope[] = $this->globals; for($a = 0; $a < count($tokenizer->tokens); ++$a) { --- 41,47 ---- $this->globals[] = substr($tokenizer->tokens[$a + 1][1], 1); } $this->scope[] = $this->globals; + $this->scope[0][] = 'argc'; + $this->scope[0][] = 'argv'; for($a = 0; $a < count($tokenizer->tokens); ++$a) { *************** *** 85,88 **** --- 85,90 ---- default: list($parameters[], $z) = $this->parse_statement($tokenizer, $z); + if($parameters[count($parameters) - 1] == '"\n"') + $parameters[count($parameters) - 1] = 'endl'; break; } *************** *** 98,103 **** case T_GLOBAL: $this->scope[$this->curfunction][] = substr($tokenizer->tokens[$a + 1][1], 1); ! echo $tokenizer->tokens[$a + 1][1], "\n"; ! $a += 3; break; case T_FUNCTION: --- 100,104 ---- case T_GLOBAL: $this->scope[$this->curfunction][] = substr($tokenizer->tokens[$a + 1][1], 1); ! $a += 2; break; case T_FUNCTION: *************** *** 444,447 **** --- 445,450 ---- if($tokenizer->tokens[$token_][0] == T_ARRAY) { + if(count($parameters) == 0) + return array('array()', $i); $params = array(); $params[-1] = count($parameters); *************** *** 495,498 **** --- 498,503 ---- $this->includes[] = $funcs[$funcname]; } + if($tokenizer->tokens[$token_][0] == T_ARRAY && count($parameters) == 2) + return array('array()', $i); if(strtolower($funcname) == 'define') { |