From: <rha...@us...> - 2003-08-05 00:36:14
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv23711 Modified Files: convert.php Log Message: Index: convert.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/convert.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** convert.php 4 Aug 2003 23:46:24 -0000 1.18 --- convert.php 5 Aug 2003 00:36:08 -0000 1.19 *************** *** 1,4 **** <?php ! if (substr(PHP_OS, 0, 3) == 'WIN') { define('BINARYPHP_OS', 'Windows'); } else { --- 1,43 ---- + #!/usr/bin/php <?php ! ! function showUsage() ! { ! echo 'Usage: convert.php --if <inputfile.php> --of <output> [-v | --verbose] [-h | --help]' , "\n"; ! } ! ! /* If there are arguments, cycle through em */ ! if ($_SERVER['argc'] > 4) { ! for($i = 1; $i <= $_SERVER['argc']; ++$i) { ! if(@$_SERVER['argv'][$i] == '-v' OR @$_SERVER['argv'][$i] == '--verbose') { ! define('DEBUG', true); ! } ! if(@$_SERVER['argv'][$i] == '--if') { ! $input = ''; ! $input = $_SERVER['argv'][$i + 1]; ! } ! if(@$_SERVER['argv'][$i] == '--of') { ! $output = ''; ! $output = $_SERVER['argv'][$i + 1]; ! } ! if(@$_SERVER['argv'][$i] == '--help' OR @$_SERVER['argv'][$i] == '-h') { ! showUsage(); ! } ! } ! } else { ! showUsage(); ! die ("Too Few Arguments\n"); ! } ! ! if(!(isset($input) && strlen(trim($input)) && is_file($input))) { ! showUsage(); ! die ($input . " isn't a file\n"); ! } ! if(!(isset($output) && strlen(trim($output)))) { ! showUsage(); ! die ($output . "isn't a valid output file\n"); ! } ! ! if (substr(PHP_OS, 0, 3) == 'WIN') { define('BINARYPHP_OS', 'Windows'); } else { *************** *** 16,20 **** require_once 'functions.php'; $tokenizer = new Tokenizer(); ! $tokenizer->Parse('testfile.php'); $tokenizer->Strip(); $gen = new Generator($tokenizer); --- 55,59 ---- require_once 'functions.php'; $tokenizer = new Tokenizer(); ! $tokenizer->Parse($input); $tokenizer->Strip(); $gen = new Generator($tokenizer); *************** *** 35,44 **** $opt='-debug'; else ! $opt='-release'; ! $comp = 'link test.obj -nologo '.$opt.' -incremental:no -opt:ref '.$flags.' -out:test.exe >> log'; echo $comp, "\n\n"; shell_exec($comp); } else { ! $comp = 'g++ -o test test.cpp ' . $flags . ' >> log 2>> log'; echo $comp, "\n\n"; shell_exec($comp); --- 74,83 ---- $opt='-debug'; else ! $opt='-$comp'; ! $release = 'link test.obj -nologo ' .$opt .' -incremental:no -opt:ref '.$flags.' -out:' . $output . ' >> log'; echo $comp, "\n\n"; shell_exec($comp); } else { ! $comp = 'g++ -o ' . $output . ' ' . $input. ' ' . $flags . ' >> log 2>> log'; echo $comp, "\n\n"; shell_exec($comp); *************** *** 57,65 **** } } else { ! passthru('./test'); if(!DEBUG) ! unlink('test'); } if(!DEBUG) ! unlink('test.cpp'); ?> --- 96,104 ---- } } else { ! passthru('./' . $output); if(!DEBUG) ! unlink($output); } if(!DEBUG) ! unlink($input); ?> |