cvs: phpdoc /scripts genPHP_INI_ENTRY.php
| From: | Jesus M. Castagnetto | Date: | Thu, 08 May 2003 18:23:16 +0000 |
| Subject: | cvs: phpdoc /scripts genPHP_INI_ENTRY.php | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969353279@lists.php.net to get a copy of this message | ||
jmcastagnetto Thu May 8 14:23:16 2003 EDT
Modified files:
/phpdoc/scripts genPHP_INI_ENTRY.php
Log:
improved regex for PHP_INI* parsing
ought to include philip's ideas later tomorrow (when I feel better from this nasty cold)
Index: phpdoc/scripts/genPHP_INI_ENTRY.php
diff -u phpdoc/scripts/genPHP_INI_ENTRY.php:1.6 phpdoc/scripts/genPHP_INI_ENTRY.php:1.7
--- phpdoc/scripts/genPHP_INI_ENTRY.php:1.6 Thu May 8 05:59:51 2003
+++ phpdoc/scripts/genPHP_INI_ENTRY.php Thu May 8 14:23:16 2003
@@ -4,11 +4,16 @@
* generate a list of PHP config options and where they
* can be set.
* Author: Jesus M. Castagnetto
- * $Id: genPHP_INI_ENTRY.php,v 1.6 2003/05/08 09:59:51 nicos Exp $
+ * $Id: genPHP_INI_ENTRY.php,v 1.7 2003/05/08 18:23:16 jmcastagnetto Exp $
*/
+$phpsrc_dir = '';
+// use command line parameter is available
+if ($argc == 2 && $argv[1] != '') {
+ $phpsrc_dir = $argv[1];
+}
+//$phpsrc_dir = '/cvs/php5';
// figure out the php4 source dir
-$phpsrc_dir = '/cvs/php5';
if ($phpsrc_dir == '') {
if (file_exists('../php4')) {
$phpsrc_dir = realpath('../php4');
@@ -43,7 +48,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Automatically generated using gen_PHP_INI_ENTRY.php -->
<!-- DO NOT EDIT. -->
-<!-- \$Revision: 1.6 $ -->
+<!-- \$Revision: 1.7 $ -->
<section id="##ID##.configuration">
&reftitle.runtime;
&extension.runtime;\n\n
@@ -142,8 +147,9 @@
function gentree($path, $remove_empty = false, $fileproc_cb = null) {/*{{{*/
$excludeitems = array ('CVS', 'tests', 'skeleton.c');
- if (!file_exists($path))
+ if (!file_exists($path)) {
die("BAD PATH $path\n");
+ }
$tree = array();
chdir($path);
$all = glob('*');
@@ -183,17 +189,21 @@
//$re =
'/PHP_INI_ENTRY\("([^"]+)",\s+"([^"]+)",\s+([A-Z_]),/';
$re = '/(PHP_INI_ENTRY|PHP_INI_ENTRY_EX|PHP_INI_BOOLEAN)\(([^)]+)/';
preg_match_all($re, $data, &$matches);
+ $re2 = '/"([^"]+)",\s*"([^"]+)",\s*([A-Z_]+)/';
+
foreach ($matches[2] as $match) {
- $match = str_replace('"','',$match);
- $entry = preg_split('/,\s*/', $match);
+ if(preg_match($re2, $match, $entry)) {
+ //$match = str_replace('"','',$match);
+ //$entry = preg_split('/,\s*/', $match);
// dummy settings seem to always have these values (ex. ncurses.c)
- if ($entry[1] == 42 || $entry[1] == 'foobar') {
- continue;
- }
- $found['INI'][$entry[0]] = array(
- 'def' => $entry[1],
- 'mod' => str_replace(array(' ',
"\n","\r","\t"),'',$entry[2])
- );
+ if ($entry[1] == 42 || $entry[1] == 'foobar') {
+ continue;
+ }
+ $found['INI'][$entry[1]] = array(
+ 'def' => $entry[2],
+ 'mod' => str_replace(array(' ',
"\n","\r","\t"),'',$entry[3])
+ );
+ }
}
if (!empty($found)) {
return $found;
@@ -215,6 +225,7 @@
}
$dtree = gentree($phpsrc_dir, true, 'findINI');
+print_r($dtree);
/*
$ser = serialize($dtree);