techtonik               Mon Apr  4 16:59:31 2005 EDT

  Modified files:              
    /phpdoc/scripts     genfunclist.php 
  Log:
  * get rid of PEAR File_Find dependency
  
http://cvs.php.net/diff.php/phpdoc/scripts/genfunclist.php?r1=1.2&r2=1.3&ty=u
Index: phpdoc/scripts/genfunclist.php
diff -u phpdoc/scripts/genfunclist.php:1.2 phpdoc/scripts/genfunclist.php:1.3
--- phpdoc/scripts/genfunclist.php:1.2  Sun Apr  3 05:56:18 2005
+++ phpdoc/scripts/genfunclist.php      Mon Apr  4 16:59:30 2005
@@ -19,7 +19,7 @@
   |             anatoly techtonik <[EMAIL PROTECTED]>      |
   +----------------------------------------------------------------------+
 
-  $Id: genfunclist.php,v 1.2 2005/04/03 09:56:18 techtonik Exp $
+  $Id: genfunclist.php,v 1.3 2005/04/04 20:59:30 techtonik Exp $
 */
 
 /**
@@ -72,10 +72,25 @@
                 ? $argv[1]."/language-scanner.lex"
                 : NULL;
 
-    require_once "File/Find.php";
-//    $parsefiles = File_Find::search('/\.(c|cpp|h|ec)$/i', $argv[1], 'perl');
-    $ff = &new File_Find();
-    $parsefiles = $ff->search('/\.(c|cpp|h|ec)$/i', $argv[1], 'perl');
+    // find all source files recursively - returns array with filenames
+    function get_parsefiles($srcpath) {
+       $parsefiles = array();
+       $srcdir = dir($srcpath);
+       while (false !== ($file = $srcdir->read())) {
+           $filepath = $srcpath."/".$file;
+           if (is_dir($filepath) && $file !== "." && $file !== "..") {
+               $parsefiles = array_merge($parsefiles, 
get_parsefiles($filepath));
+               continue;
+           }
+           if (preg_match('/\.(c|cpp|h|ec)$/i', $file)) {
+               $parsefiles[] = $filepath;
+           }
+       }
+       $srcdir->close();
+       return $parsefiles;
+    }
+
+    $parsefiles = get_parsefiles($argv[1]);
 
     // make unified directory separator - /
     if (DIRECTORY_SEPARATOR == '\\') {
@@ -115,7 +130,7 @@
 
     foreach ($parsefiles as $key => $file) {
         // output source file name
-        echo str_replace($argv[1], "# php-src", $file)."\n";
+        echo preg_replace("|^[./]+|", "# ", $file)."\n";
         foreach ($blocks[$key] as $bk => $bv) {
             // output function block title
             if ($show_block_names) {

Reply via email to