cvs: phpdoc /scripts zendapi_protos.php

From: Date: Sun, 28 Aug 2005 16:09:52 +0000
Subject: cvs: phpdoc /scripts zendapi_protos.php
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969369742@lists.php.net to get a copy of this message
hholzgra Sun Aug 28 12:09:52 2005 EDT Modified files: /phpdoc/scripts zendapi_protos.php Log: whitespace fix http://cvs.php.net/diff.php/phpdoc/scripts/zendapi_protos.php?r1=1.4&r2=1.5&ty=u Index: phpdoc/scripts/zendapi_protos.php diff -u phpdoc/scripts/zendapi_protos.php:1.4 phpdoc/scripts/zendapi_protos.php:1.5 --- phpdoc/scripts/zendapi_protos.php:1.4 Sun Aug 28 12:09:19 2005 +++ phpdoc/scripts/zendapi_protos.php Sun Aug 28 12:09:51 2005 @@ -6,62 +6,62 @@ $functions_dir = "../en/internals/zendapi/functions/"; foreach ($zend_include_files as $infile) { - echo "processing $zend_include_dir/$infile\n"; + echo "processing $zend_include_dir/$infile\n"; - $in = fopen("$zend_include_dir/$infile", "r"); + $in = fopen("$zend_include_dir/$infile", "r"); - if (!$in) { - die("can't open $zend_include_dir/$infile"); - } - - // loop over all lines in the file - while (!feof($in)) { - // TODO a prototype may span more than one line? - $line = trim(fgets($in)); - - // we look for prototypes marked with ZEND_API - // TODO prototypes may be indented by whitespace? - if (!strncmp("ZEND_API", $line, 8)) { - - // parse prototypes, step #1 - if (preg_match('|^ZEND_API\s+(\S+)\s+(\S+)\((.*)\);$|', $line, $matches)) { - - $return_type = $matches[1]; - $function = $matches[2]; - - // the pointer '*' is usually next to the function name, not the type - // TODO what if there is whitespace on both sides of the '*'? - if ($function{0} == '*') { - $return_type.= "*"; - $function = substr($function, 1); - } - - echo " $function\n"; - - // the parameters are spearated by commas - // TODO find a better way to handle TSRMLS_D and TSRMLS_DC - // TODO handle ... - $params = array(); - foreach (explode(",", trim($matches[3])) as $param) { - $tokens = preg_split("/\s+/", trim($param)); - $type = array_shift($tokens); - $name = implode(" ", $tokens); - if (empty($name)) { - $params[] = $type; - } else { - if ($name{0} == '*') { - $type.= "*"; - $name = substr($name, 1); - } - $params[$type] = $name; - } - } - - - // now write the template file to phpdoc/en/internals/zendapi/functions - ob_start(); - - echo '<?xml version="1.0" encoding="iso-8859-1"?>'."\n"; + if (!$in) { + die("can't open $zend_include_dir/$infile"); + } + + // loop over all lines in the file + while (!feof($in)) { + // TODO a prototype may span more than one line? + $line = trim(fgets($in)); + + // we look for prototypes marked with ZEND_API + // TODO prototypes may be indented by whitespace? + if (!strncmp("ZEND_API", $line, 8)) { + + // parse prototypes, step #1 + if (preg_match('|^ZEND_API\s+(\S+)\s+(\S+)\((.*)\);$|', $line, $matches)) { + + $return_type = $matches[1]; + $function = $matches[2]; + + // the pointer '*' is usually next to the function name, not the type + // TODO what if there is whitespace on both sides of the '*'? + if ($function{0} == '*') { + $return_type.= "*"; + $function = substr($function, 1); + } + + echo " $function\n"; + + // the parameters are spearated by commas + // TODO find a better way to handle TSRMLS_D and TSRMLS_DC + // TODO handle ... + $params = array(); + foreach (explode(",", trim($matches[3])) as $param) { + $tokens = preg_split("/\s+/", trim($param)); + $type = array_shift($tokens); + $name = implode(" ", $tokens); + if (empty($name)) { + $params[] = $type; + } else { + if ($name{0} == '*') { + $type.= "*"; + $name = substr($name, 1); + } + $params[$type] = $name; + } + } + + + // now write the template file to phpdoc/en/internals/zendapi/functions + ob_start(); + + echo '<?xml version="1.0" encoding="iso-8859-1"?>'."\n"; echo "<!-- $"."Revision: 1.1 $ -->\n"; ?> @@ -78,8 +78,8 @@ <type><?php echo $return_type; ?></type><methodname><?php echo $function; ?></methodname> <?php foreach($params as $type => $name) { - if (is_numeric($type)) $type = ""; - echo " <methodparam><type>$type</type><parameter>$name</parameter></methodparam>\n"; + if (is_numeric($type)) $type = ""; + echo " <methodparam><type>$type</type><parameter>$name</parameter></methodparam>\n"; } ?> </methodsynopsis> @@ -94,7 +94,7 @@ <variablelist> <?php foreach($params as $type => $name) { - if (is_numeric($type)) $type = ""; + if (is_numeric($type)) $type = ""; ?> <varlistentry> <term><parameter><?php echo $name; ?></parameter></term> @@ -141,12 +141,12 @@ vi: ts=1 sw=1 --> <?php - - file_put_contents($functions_dir."/".$function.".xml", ob_get_clean()); - } - - } - - } + + file_put_contents($functions_dir."/".$function.".xml", ob_get_clean()); + } + + } + + } } ?> \ No newline at end of file

« previous php.doc (#969369742) next »