cvs: smarty /docs configure.in /docs/scripts file-entities.php.in

"Nuno Lopes" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsnlopess1112891075@cvsserver>
nlopess		Thu Apr  7 12:24:35 2005 EDT

  Modified files:              
    /smarty/docs	configure.in 
    /smarty/docs/scripts	file-entities.php.in 
  Log:
  sync configure and file-entities scripts with phpdoc, for better windows/cygwin support
  
http://cvs.php.net/diff.php/smarty/docs/configure.in?r1=1.13&r2=1.14&ty=u
Index: smarty/docs/configure.in
diff -u smarty/docs/configure.in:1.13 smarty/docs/configure.in:1.14
--- smarty/docs/configure.in:1.13	Thu Aug 12 10:52:36 2004
+++ smarty/docs/configure.in	Thu Apr  7 12:24:35 2005
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.13 2004/08/12 14:52:36 nlopess Exp $
+dnl $Id: configure.in,v 1.14 2005/04/07 16:24:35 nlopess Exp $
 
 dnl autoconf initialisation
 AC_INIT()
@@ -117,7 +117,15 @@
 if test $JADE = "no"; then
   AC_MSG_ERROR([can't find jade or openjade])
 fi
+
+if test ${JADE:0:18} = "../../phpdoc-tools"; then
+  WINJADE=1
+else
+  WINJADE=0
+fi 
+
 AC_SUBST(JADE)
+AC_SUBST(WINJADE)
 
 dnl }}}
 
http://cvs.php.net/diff.php/smarty/docs/scripts/file-entities.php.in?r1=1.5&r2=1.6&ty=u
Index: smarty/docs/scripts/file-entities.php.in
diff -u smarty/docs/scripts/file-entities.php.in:1.5 smarty/docs/scripts/file-entities.php.in:1.6
--- smarty/docs/scripts/file-entities.php.in:1.5	Tue Apr 13 08:19:16 2004
+++ smarty/docs/scripts/file-entities.php.in	Thu Apr  7 12:24:35 2005
@@ -17,7 +17,7 @@
   |             Gabor Hojtsy <[email protected]>                              |
   +----------------------------------------------------------------------+
   
-  $Id: file-entities.php.in,v 1.5 2004/04/13 12:19:16 didou Exp $
+  $Id: file-entities.php.in,v 1.6 2005/04/07 16:24:35 nlopess Exp $
 */
 
 /**
@@ -39,39 +39,22 @@
 
 // ......:ARGUMENT PARSING:.....................................................
 
-// when php complied on cygwin, the working path have to be /cygdrive..
-// the below preg_replace have to be done only using binary php complied on MSVC.
-// let's find if php was complied by cygwin:
-$cygwin_complied = eregi("CYGWIN",php_uname()) ? true : false;
-	
-// 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 = $cygwin_complied ? "@WORKDIR@" : $out_dir;
-
-// The source directory is passed in the 5th argument counting from backwards.
-$srcdir = abs_path("@SRCDIR@");
-
-// The translation dir is passed as the 6th argument, counting
-// from the end of the argument list
-$trans_dir = "$srcdir/@LANG@";
+$not_windows = !eregi('WIN',PHP_OS);
+
+// 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 original directory is in the base directory, and named "en"
-$orig_dir = "$srcdir/en";
 
 // ......:ENTITY CREATION:......................................................
 
 // Put all the file entitites info $entities
 $entities = array();
-file_entities($orig_dir, $trans_dir, $orig_dir, $entities);
+file_entities("$out_dir/en", "$out_dir/@LANG@", "$out_dir/en", $entities);
 
 // 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 entities/file-entities.ent...\n";
@@ -276,7 +259,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));
     }
 }
 
@@ -284,7 +267,24 @@
  * Return windows style path for cygwin.
  * 
  * @param string $path Orginal path
+ * @return string windows style path
  */
 function strip_cygdrive($path){
-	return preg_replace("!^/cygdrive/(\\w)/!", "\\1:/", $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);
+    }
+}
+
+?>

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.