hholzgra Sat Jan 14 14:23:41 2006 UTC
Modified files:
/phpdoc/scripts zendapi_protos.php
Log:
- ungreedy proto matching
- optionally allow overwrites, reuse Revision: line of existing file then
http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/zendapi_protos.php?r1=1.13&r2=1.14&diff_format=u
Index: phpdoc/scripts/zendapi_protos.php
diff -u phpdoc/scripts/zendapi_protos.php:1.13
phpdoc/scripts/zendapi_protos.php:1.14
--- phpdoc/scripts/zendapi_protos.php:1.13 Sat Jan 14 12:31:01 2006
+++ phpdoc/scripts/zendapi_protos.php Sat Jan 14 14:23:41 2006
@@ -1,4 +1,6 @@
<?php
+$overwrite = false;
+
$zend_include_dir = "../../php-src/Zend";
$zend_include_files = array("zend.h",
@@ -30,7 +32,7 @@
if (!strncmp("ZEND_API", $line, 8)) {
// parse prototypes, step #1
- if (preg_match('|^ZEND_API\s+(\S+)\s+(\S+)\((.*)\);$|', $line,
$matches)) {
+ if (preg_match('|^ZEND_API\s+(\S+)\s+(\S+)\((.*)\);$|U', $line,
$matches)) {
// extract return type and function name
$return_type = $matches[1];
@@ -48,12 +50,23 @@
// only proceed it fhe file doesn't exist yet (no overwrites)
// and do not expose functions staring with '_'
- if (($function[0] != '_') && !file_exists($filename)) {
+ if (($function[0] != '_') && ($overwrite ||
!file_exists($filename)) {
// 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.3 $ -->\n";
+
+ // take revision from existing file
+ if (!$overwrite || !file_exists($filename)) {
+ echo "<!-- $"."Revision: 1.1 $ -->\n";
+ } else {
+ foreach (file($filename) as $line) {
+ if (strstr($line, 'Revision: ')) {
+ echo $line;
+ break;
+ }
+ }
+ }
// the parameters are spearated by commas
// TODO find a better way to handle TSRMLS_D and TSRMLS_DC