hholzgra Sat Jan 14 22:58:42 2006 UTC
Modified files: /phpdoc/scripts zendapi_macros.php zendapi_protos.php Log: made scripts TSRM aware http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/zendapi_macros.php?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/scripts/zendapi_macros.php diff -u phpdoc/scripts/zendapi_macros.php:1.5 phpdoc/scripts/zendapi_macros.php:1.6 --- phpdoc/scripts/zendapi_macros.php:1.5 Sat Jan 14 21:43:44 2006 +++ phpdoc/scripts/zendapi_macros.php Sat Jan 14 22:58:42 2006 @@ -12,11 +12,12 @@ "zend_unicode.h", "zend_operators.h", "zend_execute.h", - "zend_modules.h"); + "zend_modules.h", + "../TSRM/TSRM.h", + "../TSRM/tsrm_virtual_cwd.h"); -$macro_prefixes = array("ZEND_", "Z_", "RETURN_"); - -$output_dir = "../en/internals/zendapi/macros/"; +$output_dirs = array("../en/internals/zendapi/macros" => array("ZEND_", "Z_", "RETURN_"), + "../en/internals/tsrm/macros" => array("VCWD_")); foreach ($zend_include_files as $infile) { echo "processing $zend_include_dir/$infile\n"; @@ -32,6 +33,7 @@ $line = trim(fgets($in)); // now check for all known macro prefixes + foreach ($output_dirs as $output_dir => $macro_prefixes) { foreach ($macro_prefixes as $prefix) { // does this line match a macro definition? if (preg_match("|#define\\s*($prefix\\w+)\\((.*)\\)|U", $line, $matches)) { @@ -41,7 +43,7 @@ // path to output file $outfile = $output_dir."/".$macro.".xml"; - + // do not overwrite existing files unless specified if ($overwrite || !file_exists($outfile)) { // now write the template file to phpdoc/en/internals/zendapi/macros @@ -138,6 +140,7 @@ file_put_contents($outfile, ob_get_clean()); } } + } } } http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/zendapi_protos.php?r1=1.16&r2=1.17&diff_format=u Index: phpdoc/scripts/zendapi_protos.php diff -u phpdoc/scripts/zendapi_protos.php:1.16 phpdoc/scripts/zendapi_protos.php:1.17 --- phpdoc/scripts/zendapi_protos.php:1.16 Sat Jan 14 21:36:12 2006 +++ phpdoc/scripts/zendapi_protos.php Sat Jan 14 22:58:42 2006 @@ -10,9 +10,11 @@ "zend_list.h", "zend_variables.h", "zend_unicode.h", - "zend_modules.h"); + "zend_modules.h", + "../TSRM/TSRM.h"); -$functions_dir = "../en/internals/zendapi/functions/"; +$functions_dir = array("ZEND"=>"../en/internals/zendapi/functions", + "TSRM"=>"../en/internals/tsrm/functions"); foreach ($zend_include_files as $infile) { echo "processing $zend_include_dir/$infile\n"; @@ -30,14 +32,15 @@ // we look for prototypes marked with ZEND_API // TODO prototypes may be indented by whitespace? - if (!strncmp("ZEND_API", $line, 8)) { + if (preg_match("/^(ZEND|TSRM)_API/", $line)) { // parse prototypes, step #1 - if (preg_match('|^ZEND_API\s+(\S+)\s+(\S+)\((.*)\);$|U', $line, $matches)) { + if (preg_match('/^(ZEND|TSRM)_API\s+(\S+)\s+(\S+)\((.*)\);$/U', $line, $matches)) { // extract return type and function name - $return_type = $matches[1]; - $function = $matches[2]; + $api_type = $matches[1]; + $return_type = $matches[2]; + $function = $matches[3]; // the pointer '*' is usually next to the function name, not the type // TODO what if there is whitespace on both sides of the '*'? @@ -47,11 +50,13 @@ } // now generate the doc filename for this function - $filename = $functions_dir."/".$function.".xml"; + $filename = $functions_dir[$api_type]."/".$function.".xml"; // only proceed it fhe file doesn't exist yet (no overwrites) // and do not expose functions staring with '_' if (($function[0] != '_') && ($overwrite || !file_exists($filename))) { + echo "... writing $filename\n"; + // now write the template file to phpdoc/en/internals/zendapi/functions ob_start(); @@ -73,7 +78,7 @@ // TODO find a better way to handle TSRMLS_D and TSRMLS_DC // TODO handle ... $params = array(); - foreach (explode(",", trim($matches[3])) as $param) { + foreach (explode(",", trim($matches[4])) as $param) { $new_param = array(); $tokens = preg_split("/\s+/", trim($param));