nlopess         Wed Apr  6 13:16:46 2005 EDT

  Modified files:              
    /phpdoc/scripts     file-entities.php.in 
  Log:
  finally put the cygwin's openjade working. I hope all setups will work.. :) 
Please test.
  
http://cvs.php.net/diff.php/phpdoc/scripts/file-entities.php.in?r1=1.36&r2=1.37&ty=u
Index: phpdoc/scripts/file-entities.php.in
diff -u phpdoc/scripts/file-entities.php.in:1.36 
phpdoc/scripts/file-entities.php.in:1.37
--- phpdoc/scripts/file-entities.php.in:1.36    Sun Apr  3 16:56:09 2005
+++ phpdoc/scripts/file-entities.php.in Wed Apr  6 13:16:45 2005
@@ -17,7 +17,7 @@
   |             Gabor Hojtsy <[EMAIL PROTECTED]>                              |
   +----------------------------------------------------------------------+
   
-  $Id: file-entities.php.in,v 1.36 2005/04/03 20:56:09 goba Exp $
+  $Id: file-entities.php.in,v 1.37 2005/04/06 17:16:45 nlopess Exp $
 */
 
 /**
@@ -50,30 +50,14 @@
 // Zend API integration info (either a path or "not found")
 $zendapi = ("@ZENDAPI@" == "not found" ? FALSE : "@ZENDAPI@");
 
-// If Jade is used on Windows outside Cygwin, it
-// needs Windows like path values later on
-$windows_jade = ((bool) @WINJADE@);
-    
-// The output directory, which we need to parse for windows specific
-// things, and correct all problems is needed.
-// Also use absolute path to have meaningful error messages
-$out_dir = abs_path(strip_cygdrive("@WORKDIR@"));
-
-// this path if used for saving the ent file:
-$script_out_dir = $windows_jade ? $out_dir : "@WORKDIR@";
+$not_windows = !eregi('WIN',PHP_OS);
 
-// The documentation source directory 
-$srcdir = abs_path("@SRCDIR@");
-
-// The translation subdir to use
-$trans_dir = "$srcdir/@LANGDIR@";
+// The dir for PHP. If the cygwin wasn't compiled on Cygwin, the path needs to 
be striped.
+$out_dir = ($not_windows || eregi('CYGWIN',php_uname()))? "@WORKDIR@" : 
abs_path(strip_cygdrive("@WORKDIR@"));
 
 // The language encoding to use
 $encoding = "@ENCODING@";
 
-// The original directory is in the base directory, and named "en"
-$orig_dir = "$srcdir/en";
-
 // PHP, PECL and additional extension source directories if given
 $php_source  = ("@PHP_SOURCE@"  === "no" ? false : abs_path("@PHP_SOURCE@"));
 $pecl_source = ("@PECL_SOURCE@" === "no" ? false : abs_path("@PECL_SOURCE@"));
@@ -88,9 +72,9 @@
 
 // Put all the file entitites into $entities
 $entities = array();
-file_entities($orig_dir, $trans_dir, $orig_dir, $entities);
+file_entities("$out_dir/en", "$out_dir/@LANGDIR@", "$out_dir/en", $entities);
 
-$refdir = "$orig_dir/reference";
+$refdir = "$out_dir/en/reference";
 $dh = opendir($refdir);
 while ($dir = readdir($dh)) {
        if ($dir{0} === ".") continue; // ignore system dir entries and hidden 
files
@@ -163,9 +147,9 @@
 
 
 // Open file for appending and write out all entitities
-$fp = fopen("$script_out_dir/entities/file-entities.ent", "w");
+$fp = fopen("$out_dir/entities/file-entities.ent", "w");
 if (!$fp) {
-    die("ERROR: Failed to open $script_out_dir/entities/file-entities.ent for 
writing\n");
+    die("ERROR: Failed to open $out_dir/entities/file-entities.ent for 
writing\n");
 }
 
 echo "\nCreating file: entities/file-entities.ent...\n";
@@ -262,13 +246,7 @@
  * @return boolean Success signal
  */
 function file_entities($work_dir, $trans_dir, $orig_dir, &$entities, 
$prefix=false) {
-    // Skip the function directory not under "reference". That
-    // folder is only kept for backward compatibility and only
-    // in the English version of the docs.
-    if (!$prefix && strpos($work_dir, "functions") && 
!preg_match("!reference/.*/functions!", $work_dir)) {
-        return;
-    }
-    
+
     // Compute translated version's path
     $trans_path = str_replace($orig_dir, $trans_dir, $work_dir);
     
@@ -418,7 +396,7 @@
     if ($filename == "") {
         return sprintf("<!ENTITY %-40s        ''>\n", $entname);
     } else {
-        return sprintf("<!ENTITY %-40s SYSTEM '%s'>\n", $entname, 
strip_cygdrive($filename));
+        return sprintf("<!ENTITY %-40s SYSTEM '%s'>\n", $entname, 
file2jade($filename));
     }
 }
 
@@ -429,13 +407,23 @@
  * @return string windows style path
  */
 function strip_cygdrive($path){
-    if (!$GLOBALS['windows_jade']) {
-        return $path;
-    }
     return preg_replace(array('!^/cygdrive/(\w)/!', '@^/home/.+$@'), 
array('\1:/', strtr(dirname(dirname(__FILE__)), '\\', '/')), $path);
 }
 
 
+/* Converts a path to the appropriate style for Jade */
+function file2jade($path) {
+
+    if ($GLOBALS['not_windows'])
+       return $path;
+
+    if ((bool)@WINJADE@) {
+        return strip_cygdrive($path);
+    } else {
+        return preg_replace('@^([a-zA-Z]):/@S', '/cygdrive/$1/', $path);
+    }
+}
+
 /** 
  * Create a reference <part>
  *

Reply via email to