stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r574283 - /incubator/stdcxx/trunk/etc/config/windows/utilities.js
Date Mon, 10 Sep 2007 15:32:31 GMT
Author: faridz
Date: Mon Sep 10 08:32:30 2007
New Revision: 574283

URL: http://svn.apache.org/viewvc?rev=574283&view=rev
Log:
2007-09-10 Farid Zaripov <Farid_Zaripov@epam.com>

	* utilities.js (expandSysMacro): New function to expand
	system macros in string.
	(parseConfig): Expand system macros in config variables.

Modified:
    incubator/stdcxx/trunk/etc/config/windows/utilities.js

Modified: incubator/stdcxx/trunk/etc/config/windows/utilities.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/utilities.js?rev=574283&r1=574282&r2=574283&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/utilities.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/utilities.js Mon Sep 10 08:32:30 2007
@@ -45,6 +45,36 @@
 // timeout for exec utility in seconds
 var EXEC_TIMEOUT = 300;
 
+// expand system macros
+function expandSysMacro(str)
+{
+    var env = null;
+    var pos = 0;
+
+    while (true)
+    {
+        pos = str.indexOf("%", pos);
+        if (0 > pos)
+            break;
+
+        ++pos;
+        var pos2 = str.indexOf("%", pos);
+        if (0 > pos2)
+            break;
+
+        if (null == env)
+            env = WshShell.Environment("PROCESS");
+
+        var macro = str.substring(pos, pos2);
+        pos = pos2 + 1;
+        var value = env.Item(macro);
+        if ("undefined" != typeof(value) && "" != value)
+            str = str.replace("%" + macro + "%", value);
+    }
+
+    return str;
+}
+
 // read and parse compiler configuration file
 // config - name of the compiler configuration
 function parseConfig(config)
@@ -83,6 +113,8 @@
         var arr = rx.exec(line);
         if (null == arr || 0 == arr[2].length)
             continue;
+
+        arr[2] = expandSysMacro(arr[2]);
 
         switch (arr[1])
         {



Mime
View raw message