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; } |