stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r453570 [3/3] - /incubator/stdcxx/trunk/etc/config/windows/
Date Fri, 06 Oct 2006 12:16:33 GMT
Added: incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf?view=auto&rev=453570
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf (added)
+++ incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf Fri Oct  6 05:16:32 2006
@@ -0,0 +1,596 @@
+<?xml version="1.0" ?><!-- -*- SGML -*- -->
+<package>
+    <comment>
+        Licensed to the Apache Software Foundation (ASF) under one
+        or more contributor license agreements.  See the NOTICE file
+        distributed with this work for additional information
+        regarding copyright ownership.  The ASF licenses this file
+        to you under the Apache License, Version 2.0 (the
+        "License"); you may not use this file except in compliance
+        with the License.  You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing,
+        software distributed under the License is distributed on an
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+        KIND, either express or implied.  See the License for the
+        specific language governing permissions and limitations
+        under the License.
+    </comment>
+    <job id="run_locale_utils" prompt="no">
+        <?job error="false" debug="false" ?>
+        <runtime>
+            <description>
+Checks locale utilities:
+    1. Locale utilities sanity: location, output, etc;
+    2. Functionality:
+        - (re)generation  of databases;
+            </description>
+            <named helpstring="Debug output" name="d"/>
+            <named helpstring="Perform sanity check" name="s"/>
+            <named helpstring="Perform functionality check" name="f"/>
+            <named helpstring="Path to the locale source files"
+                name="i" type="string"/>
+            <named helpstring="Locale name" name="l" type="string"/>
+            <named helpstring="Output file" name="O" type="string"/>
+            <example>cscript run_locale_utils.wsf /s /b:..\..\..\bin\11s"
+            </example>
+            <usage>
+Usage: cscript run_locale_utils.wsf [/d] [/s] [/f [/i:@NlsDir /l:@LocaleName]] [/b:@BinDir] [/O:@Out],
+where
+- "/d" debug;
+- "/s" tests location, output;
+- "/f" tests functionality; is followed by:
+    - "/i:@NlsDir>"
+    - "/l:@LocaleName>";
+- "/b:@BinDir";
+- "/O:@OutFile"
+            </usage>
+        </runtime>
+        <object id="fso" progid="Scripting.FileSystemObject"/>
+        <object id="WshShell" progid="WScript.Shell"/>
+        <script id="run_locale_utils" language="JScript">
+<![CDATA[
+//
+// run_locale_utils script for Stdcxx library
+//
+
+var dbgout     = false;
+var chk_sanity = false;
+var chk_func   = false;
+var nlsdir     = "";
+var locale_db  = "";
+var bindir     = "";
+var outstrm    = WScript.StdOut;
+
+var locale     = "locale.exe";
+var localedef  = "localedef.exe";
+
+// assertions
+var assertions       = 0;
+var failedassertions = 0;
+
+var run_stdout;
+var run_stderr;
+
+var WEnv = WshShell.Environment("PROCESS");
+
+// printf the message line to the stderr
+function DebugOutLine(msg)
+{
+    if (dbgout)
+        WScript.StdErr.WriteLine(msg);
+}
+
+// printf the message to the stderr
+function DebugOut(msg)
+{
+    if (dbgout)
+        WScript.StdErr.Write(msg);
+}
+
+// execute command and set run_stdout to the cmd stdout content;
+// set run_stderr to the cmd stderr content
+function Run(cmd)
+{
+    var exec = WshShell.Exec(cmd);
+    run_stdout = "";
+    run_stderr = "";
+    while (0 == exec.Status) {
+        WScript.Sleep(100);
+        run_stdout += exec.StdOut.ReadAll();
+        run_stderr += exec.StdErr.ReadAll();
+    }
+
+    run_stdout += exec.StdOut.ReadAll();
+    run_stderr += exec.StdErr.ReadAll();
+
+    return exec;
+}
+
+// convert number num to string with specified width
+function FormatNumber(num, width)
+{
+    var s = num.toString();
+    var spaces = width - s.length;
+    for (var i = 0; i < spaces; ++i)
+        s = " " + s;
+    return s;
+}
+
+var description = new run_locale_utils; // run
+
+//////////////////////////////////////////////////////////////////////////////
+//	Function definitions - checking sanity
+//////////////////////////////////////////////////////////////////////////////
+
+function check_locale_help()
+{
+    DebugOut("Checking \"locale --help\" output...");
+
+    var cmd = locale + " --help";
+    var exec = Run(cmd);
+
+    var xout = new Array("NAME", "SYNOPSIS", "DESCRIPTION");
+
+    for (var i = 0; i < xout.length; ++i)
+    {
+        ++assertions;
+
+        if (0 > run_stdout.search(xout[i]))
+        {
+            DebugOutLine(" incorrect.");
+            DebugOutLine("ERROR: \"locale --help\" gives wrong output ("
+                   + xout[i] + ").");
+
+            ++failedassertions;
+
+            return;
+        }
+    }
+
+    DebugOutLine(" correct.");
+}
+
+function check_locale_all()
+{
+    DebugOut("Checking \"locale -a\" output...");
+
+    var cmd = locale + " -a";
+    var exec = Run(cmd);
+    var aout = run_stdout.split("\n");
+
+    for (var i = 0; i < aout.length; ++i)
+    {
+        ++assertions;
+
+        var line = aout[i].replace("\r", "").replace("\n", "");
+        
+        if (0 == line.length || "C" == line)
+            continue;
+
+        if (0 > line.search(new RegExp("[a-z]\{2\}_[A-Z]\{2\}")))
+        {
+            DebugOutLine(" incorrect.");
+            DebugOutLine("    Warning: Locale name " + line
+                   + " not matching pattern.");
+
+            ++failedassertions;
+
+            return;
+        }
+    }
+
+    DebugOutLine("check completed.");
+}
+
+function check_locale_m()
+{
+    DebugOut("Checking \"locale -m\" output...");
+
+    var cmd = locale + " -m";
+    var exec = Run(cmd);
+    var aout = run_stdout.split("\n");
+
+    for (var i = 0; i < aout.length; ++i)
+    {
+        ++assertions;
+
+        var line = aout[i].replace("\r", "").replace("\n", "");
+        
+        if (0 > line.search(new RegExp(".cm")))
+        {
+            DebugOutLine(" incorrect.");
+            DebugOutLine("ERROR: \"locale -m\" failed.");
+
+            ++failedassertions;
+
+            return;
+        }
+    }
+
+    DebugOutLine(" correct.");
+}
+
+function check_locale_k()
+{
+    DebugOut("Checking \"locale -k LC_ALL\" output...")
+
+    var cmd = locale + " -k LC_ALL";
+    var exec = Run(cmd);
+
+    var xout = new Array("upper", "lower", "space", "print", "cntrl",
+        "alpha", "digit", "punct", "graph", "xdigit", "toupper",
+        "tolower", "abday", "day", "abmon", "", "mon", "am_pm",
+        "d_t_fmt", "d_fmt", "t_fmt", "t_fmt_ampm", "int_curr_symbol",
+        "currency_symbol", "mon_decimal_point", "mon_thousands_sep",
+        "mon_grouping", "positive_sign", "negative_sign", "int_frac_digits",
+        "frac_digits", "p_cs_precedes", "p_sep_by_space", "n_cs_precedes",
+        "n_sep_by_space", "p_sign_posn", "n_sign_posn", "decimal_point",
+        "thousands_sep", "grouping");
+
+    var any_failed = false;
+
+    for (var i = 0; i < xout.length; ++i)
+    {
+        ++assertions;
+
+        if (0 > run_stdout.search(xout[i]))
+        {
+            // output text only for the first failure
+            if (!any_failed)
+                DebugOutLine(" incorrect.");
+
+            DebugOutLine("ERROR: \"locale -k\" gives wrong output (" +
+                         + xout[i] +").");
+
+            ++failedassertions;
+
+            any_failed = true;
+
+        }
+    }
+
+    if (!any_failed)
+        DebugOutLine(" correct.");
+}
+
+function check_localedef_help()
+{
+    DebugOut("Checking \"localedef --help\" output...");
+
+    var cmd = localedef + " --help";
+    var exec = Run(cmd);
+
+    var xout = new Array("NAME", "SYNOPSIS", "DESCRIPTION");
+
+    for (var i = 0; i < xout.length; ++i)
+    {
+        ++assertions;
+
+        if (0 > run_stdout.search(xout[i]))
+        {
+            DebugOutLine(" incorrect.");
+            DebugOutLine("ERROR: \"localedef --help\" gives wrong output ("
+                   + xout[i] + ").");
+
+            ++failedassertions;
+
+            return;
+        }
+    }
+
+    DebugOutLine(" correct.");
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//	Function definitions - checking functionality
+//////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Generates one specified locale
+//
+function generate_locale(charmap, src, locname)
+{
+    var err = "Cannot generate locale database - ";
+
+    // charmap - character map file used in generating the locale database
+    // src     - source/locale definition file
+    // locname - locale database name
+
+    if (charmap == "")
+    {
+        outstrm.WriteLine(err + "character maps file not specified.");
+        WScript.Quit(1);
+    }
+
+    if (src == "")
+    {
+        outstrm.WriteLine(err  + "source input file not specified.");
+        WScript.Quit(1);
+    }
+
+    if (locname == "")
+    {
+        outstrm.WriteLine(err + "output locale name not specified.");
+        WScript.Quit(1);
+    }
+
+    ++assertions;
+
+    // Generating the database
+    var cmd = localedef + " -w -c -f " + charmap
+            + " -i " + src + " " + locname;
+    DebugOutLine(cmd);
+
+    var retcode = Run(cmd).ExitCode;
+    if (retcode)
+    {
+        outstrm.WriteLine("Error - localedef returned code: " + retcode);
+        ++failedassertions;
+    }
+}
+
+//
+// Dumps one locale database
+//
+function dump_locale(dumpfile)
+{
+    var err = "Cannot dump locale database - ";
+
+    // dumpfile - current locale dump file
+
+    if (dumpfile == "")
+    {
+        outstrm.WriteLine(err + " - no output file specified.");
+        WScript.Quit(1);
+    }
+
+    ++assertions;
+
+    // Dumping locale database
+    var cmd = locale + " -ck -h LC_ALL > " + dumpfile;
+    DebugOutLine(cmd);
+
+    var exec = Run(cmd);
+
+    var dmpfile = fso.CreateTextFile(dumpfile, true);
+    if (dmpfile)
+    {
+        dmpfile.Write(run_stdout);
+        dmpfile.Close();
+    }
+
+    var retcode = exec.ExitCode;
+    if (retcode)
+    {
+        outstrm.WriteLine("Error - locale returned code: " + retcode);
+        ++failedassertions;
+    }
+}
+
+//
+// Test one locale
+//
+function test_locale(nlsdir, testdir, locname)
+{
+    var err = "Cannot test locale - ";
+
+    // nlsdir  - nlsdir
+    // testdir - test directory
+    // locname - name of the locale database
+    
+    if (nlsdir == "")
+    {
+        outstrm.WriteLine(err+ " - nls directory not specified.");
+        WScript.Quit(1);
+    }
+
+    if (testdir == "")
+    {
+        outstrm.WriteLine(err + " - test directory not specified.");
+        WScript.Quit(1);
+    }
+
+    if (locname == "")
+    {
+        outstrm.WriteLine(err+ " - locale database name not specified.");
+        WScript.Quit(1);
+    }
+
+    // get locale's name and encoding
+    var locale_src = locname.replace(
+            new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$1$3")
+        .replace("@", ".");
+
+    var locale_encoding = locname.replace(
+            new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$2")
+        .replace("@", ".");
+
+    DebugOutLine("locale_src = " + locale_src);
+    DebugOutLine("locale_encoding = " + locale_encoding);
+
+    var charmap = nlsdir + "\\charmaps\\" + locale_encoding;
+    var src = nlsdir + "\\src\\" + locale_src;
+    var locdir = testdir + "\\" + locname;
+
+    // generate the first locale database
+    generate_locale(charmap, src, locdir);
+
+    // set necessary environment variables
+    DebugOutLine("LC_ALL=" + locname);
+    WEnv("LC_ALL") = locname;
+    DebugOutLine("LANG=" + locname);
+    WEnv("LANG") = locname;
+
+    // adjust the locale root
+    DebugOutLine("RWSTD_LOCALE_ROOT=" + testdir);
+    WEnv("RWSTD_LOCALE_ROOT") = testdir;
+
+    var test1 = testdir + "\\out.1";
+
+    // dump the locale database content to temporary location
+    dump_locale(test1);
+    DebugOutLine("");
+
+    // remove stage one database
+    if (fso.FolderExists(locdir))
+        fso.DeleteFolder(locdir, true);
+    
+    // generate stage two database
+    generate_locale(charmap, test1, locdir);
+
+    var test2 = testdir + "\\out.2";
+
+    // dump stage two database to file
+    dump_locale(test2);
+
+    // remove stage two database
+    if (fso.FolderExists(locdir))
+        fso.DeleteFolder(locdir, true);
+
+    // generate stage three database
+    generate_locale(charmap, test2, locdir);
+
+    var test3 = testdir + "\\out.3";
+
+    // and finally dump it to file
+    dump_locale(test3);
+
+    ++assertions;
+
+    // compare
+
+    var params = test2 +" " + test3;
+    var cmd = "fc.exe " + params;
+    var retcode = Run(cmd).ExitCode;
+    if (retcode)
+    {
+        DebugOutLine("ERROR: " + params +" differ.");
+        ++failedassertions;
+    }
+
+    // and remove database
+    if (fso.FolderExists(locdir))
+        fso.DeleteFolder(locdir);
+
+    // remove dump files
+    if (fso.FileExists(test1))
+        fso.DeleteFile(test1);
+    if (fso.FileExists(test2))
+        fso.DeleteFile(test2);
+    if (fso.FileExists(test3))
+        fso.DeleteFile(test3);
+
+    // and finally remove the tmp directory
+    if (fso.FolderExists(testdir))
+        fso.DeleteFolder(testdir);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//  Main code
+//////////////////////////////////////////////////////////////////////////////
+
+function run_locale_utils()
+{
+    if (WScript.Arguments.Named.Exists("d"))
+        dbgout = true;
+
+    if (WScript.Arguments.Named.Exists("s"))
+        chk_sanity = true;
+
+    if (WScript.Arguments.Named.Exists("f"))
+        chk_func = true;
+
+    if (WScript.Arguments.Named.Exists("i"))
+        nlsdir = WScript.Arguments.Named("i");
+
+    if (WScript.Arguments.Named.Exists("l"))
+        locale_db = WScript.Arguments.Named("l");
+
+    if (WScript.Arguments.Named.Exists("b"))
+    {
+        bindir = WScript.Arguments.Named("b");
+        locale = bindir + "\\" + locale;
+        localedef = bindir + "\\" + localedef;
+    }
+
+    if (WScript.Arguments.Named.Exists("O"))
+    {
+        var outfile = WScript.Arguments.Named("O");
+        outstrm = fso.CreateTextFile(outfile, true);
+        if (!outstrm)
+        {
+            WScript.StdErr.WriteLine("Unable to create " + outfile + ", aborting");
+            WScript.Quit(2);
+        }
+    }
+
+    if (chk_sanity)
+    {
+        // checking locale sanity
+        check_locale_help();
+        check_locale_all();
+        check_locale_m();
+        check_locale_k();
+        check_localedef_help();
+    
+    }
+    else if (chk_func)
+    {
+        // set the temp dir
+        var TemporaryFolder = 2;
+        var tmpdir = fso.GetSpecialFolder(TemporaryFolder)
+                     + "\\" + fso.GetTempName();
+
+        if (!fso.CreateFolder(tmpdir))
+        {
+            WScript.StdErr.WriteLine("Unable to create " + tmpdir
+                                     + ", aborting");
+            WScript.Quit(1);
+        }
+    
+        // checking locale functionality
+        DebugOutLine("RWSTD_SRC_ROOT=" + nlsdir);
+        WEnv("RWSTD_SRC_ROOT") = nlsdir;
+        DebugOutLine("RWSTD_LOCALE_ROOT=" + tmpdir);
+        WEnv("RWSTD_LOCALE_ROOT") = tmpdir;
+        
+        // test only one locale
+        test_locale(nlsdir, tmpdir, locale_db);
+
+        if (fso.FolderExists(tmpdir))
+            fso.DeleteFolder(tmpdir, true);
+    }
+    else
+    {
+        // Invocation is wrong
+        WScript.Arguments.ShowUsage();
+        WScript.Quit(2);
+    }
+
+    if (assertions)
+    {
+        var pcnt = 100 * (assertions - failedassertions) / assertions;
+        pcnt = Math.floor(pcnt + 0.5);
+        outstrm.WriteLine("# +-----------------------+--------+--------+--------+");
+        outstrm.WriteLine("# | DIAGNOSTIC            | ACTIVE |  TOTAL |INACTIVE|");
+        outstrm.WriteLine("# +-----------------------+--------+--------+--------+");
+        outstrm.WriteLine("# | (S7) ASSERTION        | " + FormatNumber(failedassertions, 6)
+            + " | " + FormatNumber(assertions, 6) + " | " + FormatNumber(pcnt, 5) + "% |");
+        outstrm.WriteLine("# +-----------------------+--------+--------+--------+");
+        outstrm.WriteLine();
+    }
+    outstrm.WriteLine("## Assertions = " + assertions);
+    outstrm.WriteLine("## FailedAssertions = " + failedassertions);
+    outstrm.WriteLine();
+
+    WScript.Quit(failedassertions);
+}
+
+]]>
+        </script>
+    </job>
+</package>

Propchange: incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/stdcxx/trunk/etc/config/windows/runall.wsf
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/runall.wsf?view=diff&rev=453570&r1=453569&r2=453570
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/runall.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/runall.wsf Fri Oct  6 05:16:32 2006
@@ -1,7 +1,22 @@
 <?xml version="1.0" ?>
 <package>
     <comment>
-    PrimalCode wizard generated file.
+        Licensed to the Apache Software Foundation (ASF) under one
+        or more contributor license agreements.  See the NOTICE file
+        distributed with this work for additional information
+        regarding copyright ownership.  The ASF licenses this file
+        to you under the Apache License, Version 2.0 (the
+        "License"); you may not use this file except in compliance
+        with the License.  You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing,
+        software distributed under the License is distributed on an
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+        KIND, either express or implied.  See the License for the
+        specific language governing permissions and limitations
+        under the License.
     </comment>
     <job id="runexamples" prompt="no">
         <?job error="false" debug="false" ?>
@@ -19,6 +34,8 @@
                 required="false" type="string"/>
             <named helpstring="The copy lib dll to exe option" name="COPYDLL" 
                 required="false" type="string"/>
+            <named helpstring="The copy lib dll to exe option" name="COPYRWTESTDLL" 
+                required="false" type="string"/>
             <named helpstring="The lib dll folder" name="LIBDIR" 
                 required="false" type="string"/>
             <example>
@@ -29,6 +46,7 @@
 Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR /INOUTDIR:@INOUTDIR 
 /BUILDTYPE:@BUILDTYPE 
 [/LOGFILE:@LOGFILE] [/COPYDLL:@COPYDLL] [/LIBDIR:@LIBDIR]
+[/COPYRWTESTDLL:@COPYRWTESTDLL]
 where
 @EXEDIR is the root directory with executables ro be run and checked,
 @TOPDIR is the root directory with .in and .out files 
@@ -37,6 +55,7 @@
 @LOGFILE is the log file name.
 @COPYDLL is the option for copy dll to executables
 @LIBDIR is the library dll folder (specify when COPYDLL is true)
+@COPYRWTESTDLL is the option for copy rwtest.dll to executables
             </usage>
         </runtime>
         <object id="fso" progid="Scripting.FileSystemObject"/>
@@ -58,6 +77,7 @@
 var logFileName = ""; // the log file name
 var logFileDefault = "runexamples.log"; // the default log file name
 var copyDll = false;
+var copyRwtestDll = false;
 var libdllFolder = "";
 
 var varIn = "in";
@@ -69,21 +89,28 @@
 var exRunTimedOut = 0;
 var exBadCode = 0;
 
-var runTimeout = 10000; //30000
-var runSleepStep = 100;
+var runTimeout = 10; //30
 
 var buildlogFile = "BuildLog.htm";
 var summaryFileName = "Summary.htm";
 var htmFolderName = "temphtm";
 var libFileName = "stdlib";
+
+var utlExec = "exec.exe";
+var unicodeLog = false;
     
 var description = new runexamples; // run
 
+// the main function of the script
 function runexamples()
 {
     readAndCheckArguments();
     
-    var buildOutDir = examplesDir + "\\" + buildType;
+    getCompilerOpts(currentCfg);
+
+    unicodeLog = UNICODELOG;
+
+    var buildOutDir = examplesDir;
     if (! fso.FolderExists(buildOutDir))
         fso.CreateFolder(buildOutDir);
         
@@ -110,6 +137,7 @@
     WScript.Quit(0);
 }
 
+// performs checking of the script parameters
 function readAndCheckArguments()
 {
     if (!WScript.Arguments.Named.Exists("EXEDIR"))
@@ -139,6 +167,8 @@
     examplesDir =  WScript.Arguments.Named("EXEDIR");
     inoutDir =  WScript.Arguments.Named("INOUTDIR");
     buildType = WScript.Arguments.Named("BUILDTYPE");
+
+    utlExec = examplesDir + "\\..\\bin\\" + utlExec;
     
     if (WScript.Arguments.Named.Exists("CONFIG"))
         currentCfg = WScript.Arguments.Named("CONFIG");
@@ -155,6 +185,13 @@
             copyDll = true;
     }
     
+    if (WScript.Arguments.Named.Exists("COPYRWTESTDLL"))
+    {
+        var copyOption = WScript.Arguments.Named("COPYRWTESTDLL");
+        if ("true" == copyOption)
+            copyRwtestDll = true;
+    }
+    
     if (WScript.Arguments.Named.Exists("LIBDIR"))
         libdllFolder = WScript.Arguments.Named("LIBDIR");
     
@@ -175,6 +212,11 @@
     }
 }
 
+// run all executables starting from exeDir
+// exeDir - starting folder to search executables in
+// srcDir - starting folder to search .in and .out files for the executable
+// fileLog - filename of the logfile
+// fileSimmary - filename of the summary file
 function runAllExamples(exeDir, srcDir, fileLog, fileSummary)
 {
     var exeFolder = fso.GetFolder(exeDir);
@@ -186,37 +228,44 @@
     {
         var exeFolderName = enumExeSubFolders.item().Name;
         
-        var newSrc = srcDir;
-        if (exeFolderName != buildType)
-            newSrc += "\\" + exeFolderName;
+        var newSrc = srcDir + "\\" + exeFolderName;
             
         runAllExamples(exeDir + "\\" + exeFolderName, 
             newSrc, fileLog, fileSummary);
     }
     
-    if (exeFolder.Name != buildType)
-        return;
-    
     var dllCopied = false;
+    var rwtdllCopied = false;
     var rx = new RegExp("^.+\\.(?:exe)$", "i");
     var enumExeFiles = new Enumerator(exeFolder.Files);
     for (; !enumExeFiles.atEnd(); enumExeFiles.moveNext())
     {
+        var exeFileName = enumExeFiles.item().Name;
+        if (! rx.test(exeFileName))
+            continue;
+            
         // temporary copy the dll to the executable
         if (copyDll && !dllCopied)
         {
             var dllName = libFileName + buildType + ".dll";
-            var copyDllCmd = "cmd /c \"copy /Y " + libdllFolder + dllName +
+            var copyDllCmd = "cmd /c \"copy /Y " + libdllFolder + "\\" + dllName +
                              " " + exeDir + "\\" + dllName + "\"";
                              
             WshShell.Run(copyDllCmd, 7, true);
             dllCopied = true;
         }
          
-        var exeFileName = enumExeFiles.item().Name;
-        if (! rx.test(exeFileName))
-            continue;
-            
+        // temporary copy the rwtest.dll to the executable
+        if (copyRwtestDll && !rwtdllCopied)
+        {
+            var rwtdllName = "rwtest.dll";
+            var copyDllCmd = "cmd /c \"copy /Y " + examplesDir + "\\" + rwtdllName +
+                             " " + exeDir + "\\" + rwtdllName + "\"";
+                             
+            WshShell.Run(copyDllCmd, 7, true);
+            rwtdllCopied = true;
+        }
+         
         var htmDir = exeDir + "\\" + htmFolderName;
         if (! fso.FolderExists(htmDir))
             fso.CreateFolder(htmDir);
@@ -232,16 +281,14 @@
         var runCmd = exeDir + "\\" + exeFileName;
         WScript.Echo("running " + exeFileName);
         fileLog.WriteLine("running " + exeFileName);
-            
+
         exRun++;
         
         if (inData != "" || outData != "")
-            runWithChecks(runCmd, itemInfo, inData, outData, fileLog);
+            runWithChecks(runCmd, exeFileName, itemInfo, outData, fileLog);
         else
             runNoChecks(runCmd, exeFileName, itemInfo, fileLog); 
             
-        var unicodeLog = 
-            currentCfg == "msvc-8.0" || currentCfg == "icc-9.1" ? true : false;
         readBuildLog(exeDir, itemInfo, unicodeLog);
         saveBuildInfo(itemInfo, htmDir, "htm"); 
         saveBuildSummary(itemInfo, fileSummary);
@@ -260,87 +307,72 @@
                 exeFolder.Path + "\\" + dllName);
         }
     }
-}
 
+    // delete the rwtest.dll if it was copied
+    if (copyRwtestDll && rwtdllCopied)
+    {
+        try
+        {
+            fso.DeleteFile(exeFolder.Path + "\\" + rwtdllName);
+        }
+        catch(e)  // do nothing
+        {
+            fileLog.WriteLine("error: could not delete temporary file" + 
+                exeFolder.Path + "\\" + rwtdllName);
+        }
+    }
+}
 
+// run command without comparing the command output with expected output
+// cmd - full path to the running executable
+// exeFileName - filename of the running executable
+// itemInfo - ItemBuildInfo object to hold the information
+// fileLog - log filename
 function runNoChecks(cmd, exeFileName, itemInfo, fileLog)
 {
-    var scriptPath = WScript.ScriptFullName;
-    var pathIndex = scriptPath.lastIndexOf(WScript.ScriptName);
-    scriptPath = scriptPath.substr(0, pathIndex);
-        
-    var tempFileName = makeTempFile();
-    var runCmdTimeOut = 7000;
-    
-    var runCmd = "cscript /nologo \"" + scriptPath + "runexe.wsf" + "\"" +
-        " /RUNCMD:\"" + cmd + " < NUL: " + "\"" + 
-        " /OUTFILE:\"" + tempFileName + "\"";
+    var runCmd = utlExec + " -t " + runTimeout + " \"" + cmd + " < NUL:\"";
     
-    var tStartDate = new Date();
-    var tStartTime = tStartDate.getTime();
-    
-    var timeOutOccurred = false;
     var oExec = WshShell.Exec(runCmd);
+    if (!oExec)
+    {
+        WScript.Echo(itemInfo.name + " failed to run");
+        return;
+    }
+
     while (oExec.Status == 0)
-    {   
         WScript.Sleep(500);
-        
-        var tCurDate = new Date();
-        var tCurTime = tCurDate.getTime();
-        if (tCurTime - tStartTime > runCmdTimeOut)
-        {
-            timeOutOccurred = true;
-            //WScript.Echo("its time to terminate");
-            try
-            {
-                inspectProcesses(exeFileName, true);
-                //WScript.Echo(exeFileName + " terminated");
-                oExec.Terminate();
-                //WScript.Echo("terminated");
-            }
-            catch(e)
-            {
-                WScript.Echo("error during termination");
-            }
-            
-            break;
-        }
-    }
-    
-    if (timeOutOccurred == true)
-        itemInfo.exitCode = 5;
-    else
-        itemInfo.exitCode = oExec.ExitCode;
+
+    itemInfo.exitCode = oExec.ExitCode;
         
     itemInfo.runDiff = "";
     itemInfo.runOutput = "";
     
-    //WScript.Echo("run script finished with code " + itemInfo.exitCode);
-    
-    var tFinishDate = new Date();
-    var tFinishTime = tFinishDate.getTime();
-    
-    //WScript.Echo("time difference is " + (tFinishTime - tStartTime));
-    
+    var outFileName = cmd.replace(".exe", ".out");
+
     try
     {   
-        var tempFile = fso.OpenTextFile(tempFileName, 1);
+        var outFile = fso.OpenTextFile(outFileName, 1);
         
         var exeOutput = "";
-        if (! tempFile.AtEndOfStream)
-          exeOutput = tempFile.ReadAll();
+        if (!outFile.AtEndOfStream)
+          exeOutput = outFile.ReadAll();
             
         itemInfo.runOutput = exeOutput;
-        //WScript.Echo(itemInfo.runOutput);
         
-        tempFile.Close();
-        fso.DeleteFile(tempFileName);
+        outFile.Close();
+        fso.DeleteFile(outFileName);
     }
     catch(e)
     {
-        WScript.Echo("Could not delete temporary file " + tempFileName);
+        WScript.Echo("Could not delete temporary file " + outFileName);
     }
-      
+
+    var Status = oExec.StdOut.ReadAll();
+    WScript.Echo(Status);
+
+    if (itemInfo.exitCode == 0)
+        itemInfo.exitCode = parseStatus(exeFileName, Status);
+
     if (itemInfo.exitCode != 0)
         exBadCode++;
   
@@ -354,147 +386,87 @@
     fileLog.WriteLine(" ");
 }
 
-
-function inspectProcesses(exeName, bKill)
+// parse the exec utility output to get status of the running executable 
+// exename - filename of the executable
+// exeOut - stdout content of the exec utility
+function parseStatus(exeName, execOut)
 {
-    var e = new Enumerator(GetObject("winmgmts:").InstancesOf("Win32_process"))
-    
-    for (; !e.atEnd(); e.moveNext())
+    var res = 0;
+
+    var pos = execOut.indexOf(exeName);
+    if (0 <= pos)
     {
-        var Process = e.item();
-        //WScript.echo (Process.Name + "\t" + Process.processid)
-        
-        if (Process.Name == exeName)
+        var status = execOut.substr(pos + 26, 6);
+        res = parseInt(status);
+        if (isNaN(res))
         {
-            if (true == bKill)
+            switch (status)
             {
-                //WScript.Echo("find process to be killed: " + exeName);
-                Process.Terminate();
+            case "KILLED":
+                ++exRunTimedOut;
+                break;
             }
+            res = 0;
         }
     }
-}
 
-
-/*
-function runNoChecks(cmd, itemInfo, fileLog)
-{
-    // make no input
-    cmd += " < NUL:";
-    
-    var oExec = WshShell.Exec(cmd);
-    if (! oExec)
-    {
-        WScript.Echo(itemInfo.name + " failed to run");
-        return;
-    }
-    
-    var exeOutput = "";
-    var sleeping = 0;
-    while (oExec.Status == 0)
-    {
-        WScript.Sleep(runSleepStep);
-        sleeping += runSleepStep;
-            
-        if (sleeping >= runTimeout)
-        {                       
-            exRunTimedOut++;
-            oExec.Terminate();
-                
-            WScript.Echo("terminated because of timeout");
-            WScript.Echo("   ");
-                
-            fileLog.WriteLine(cmd + " terminated because of timeout");
-            fileLog.WriteLine(" ");
-                
-            itemInfo.exitCode = 5;
-            
-            return;
-        }
-    }
-  
-    var exeOutput = "";
-    if (sleeping < runTimeout)
-        exeOutput += oExec.StdOut.ReadAll();
-        
-    WScript.Echo(exeOutput);
-      
-    if (oExec.ExitCode != 0)
-        exBadCode++;
-      
-    exRunSucceeded++;
-      
-    itemInfo.runOutput = exeOutput;
-    itemInfo.exitCode = oExec.ExitCode;
-    itemInfo.runDiff = "";
-      
-    WScript.Echo("example succeeded! Exit code " + oExec.ExitCode);
-    fileLog.WriteLine(itemInfo.name + " completed successfully, exit code "
-        + oExec.ExitCode);
-       
-    WScript.Echo("   ");
-    fileLog.WriteLine(" ");
+    return res;
 }
-*/
 
-function runWithChecks(cmd, itemInfo, inData, outData, fileLog)
+// run command and compare the command output with expected output
+// cmd - full path to the running executable
+// exeFileName - filename of the running executable
+// itemInfo - ItemBuildInfo object to hold the information
+// outData - the expected output of the command
+// fileLog - log filename
+function runWithChecks(cmd, exeFileName, itemInfo, outData, fileLog)
 {
-    if (inData == "")
-        cmd += " < NUL:";
-    
-    var oExec = WshShell.Exec(cmd);
-    if (! oExec)
+    var runCmd = utlExec + " -t " + runTimeout + " -d " + inoutDir +
+                 " \"" + cmd + "\"";
+
+    var oExec = WshShell.Exec(runCmd);
+    if (!oExec)
     {
         WScript.Echo(itemInfo.name + " failed to run");
         return;
     }
             
-    if (inData != "")
-    {
-        WScript.Sleep(runSleepStep * 10);
-        oExec.StdIn.Write(inData + "\n" + String.fromCharCode(26) );
-    }
-        
-    var exeOutput = "";
-    var sleeping = 0;
     while (oExec.Status == 0)
-    {
-        WScript.Sleep(runSleepStep);
-        sleeping += runSleepStep;
+        WScript.Sleep(500);
+
+    var outFileName = cmd.replace(".exe", ".out");
+
+    try
+    {   
+        var outFile = fso.OpenTextFile(outFileName, 1);
         
-        if (sleeping >= runTimeout)
-        {                       
-            exRunTimedOut++;
-            oExec.Terminate();
-            
-            WScript.Echo("terminated because of timeout");
-            WScript.Echo("   ");
-            
-            fileLog.WriteLine(itemInfo.name + 
-                " terminated because of timeout");
-                
-            fileLog.WriteLine(" ");
+        var exeOutput = "";
+        if (!outFile.AtEndOfStream)
+          exeOutput = outFile.ReadAll();
             
-            itemInfo.exitCode = 3;
+        itemInfo.runOutput = exeOutput;
         
-            return;
-        }
+        outFile.Close();
+        fso.DeleteFile(outFileName);
     }
-            
-    if (sleeping < runTimeout)
-        exeOutput += oExec.StdOut.ReadAll();
-    
-    var errText = oExec.StdErr.ReadAll();
-    if (errText != "")
-        WScript.Echo(errText);
-    
-    if (oExec.ExitCode != 0)
-        exBadCode++;
-    
+    catch(e)
+    {
+        WScript.Echo("Could not delete temporary file " + outFileName);
+    }
+
+    var Status = oExec.StdOut.ReadAll();
+    WScript.Echo(Status);
+
     itemInfo.runOutput = exeOutput;
     itemInfo.exitCode = oExec.ExitCode;
     itemInfo.runReqOutput = outData;
   
+    if (itemInfo.exitCode == 0)
+        itemInfo.exitCode = parseStatus(exeFileName, Status);
+
+    if (itemInfo.exitCode != 0)
+        exBadCode++;
+
     if (exeOutput == outData)
     {
         itemInfo.runDiff = "";
@@ -503,7 +475,7 @@
         WScript.Echo("example succeeded! Exit code " + oExec.ExitCode);
         fileLog.WriteLine(itemInfo.name + 
             " completed successfully, exit code " +
-            oExec.ExitCode);
+            itemInfo.exitCode);
     }
     else
     {
@@ -514,13 +486,17 @@
         WScript.Echo("example failed! Exit code " + oExec.ExitCode);
         fileLog.WriteLine(itemInfo.name + 
             " completed with errors, exit code " +
-            oExec.ExitCode);
+            itemInfo.exitCode);
     }
     
     WScript.Echo("   ");
     fileLog.WriteLine(" ");
 }
 
+// returns the content of the .in or .out file for the specified executable
+// srcDir - folder containing subfolders with .in and .out files
+// exeFileName - filename of the executable
+// nameSuffix - one of varIn, varOut
 function readAllFromFile(srcDir, exeFileName, nameSuffix)
 {   
     if (! fso.FolderExists(srcDir))
@@ -543,11 +519,17 @@
     return (someFile.ReadAll());
 }
 
+// returns the content of the .in file for the specified executable
+// srcDir - folder containing .in files
+// exeFileName - filename of the executable
 function readInFile(srcDir, exeFileName)
 {
     return readAllFromFile(srcDir, exeFileName, varIn);
 }
 
+// returns the content of the .out file for the specified executable
+// srcDir - folder containing .out files
+// exeFileName - filename of the executable
 function readOutFile(srcDir, exeFileName)
 {
     var outData = readAllFromFile(srcDir, exeFileName, varOut);
@@ -571,6 +553,9 @@
     return (linkedFile.ReadAll());
 }
 
+// returns the filename without extension
+// fileName - source filename
+// fileExtension - extension of the file
 function getPureFileName(fileName, fileExtension)
 {   
     var pureName = fileName;

Modified: incubator/stdcxx/trunk/etc/config/windows/summary.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/summary.js?view=diff&rev=453570&r1=453569&r2=453570
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/summary.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/summary.js Fri Oct  6 05:16:32 2006
@@ -1,6 +1,26 @@
 //
 // $Id$
 //
+//////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software  Foundation (ASF) under one or more
+// contributor  license agreements.  See  the NOTICE  file distributed
+// with  this  work  for  additional information  regarding  copyright
+// ownership.   The ASF  licenses this  file to  you under  the Apache
+// License, Version  2.0 (the  "License"); you may  not use  this file
+// except in  compliance with the License.   You may obtain  a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the  License is distributed on an  "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+// implied.   See  the License  for  the  specific language  governing
+// permissions and limitations under the License.
+// 
+//////////////////////////////////////////////////////////////////////
+
 // BuildLog.htm file constants
 
 var cmdLineTag = "Command Lines";
@@ -19,8 +39,8 @@
 var hdrTests = "Test Summary";
 
 ////////////////////////////////////////////////////////////////////
-// read BuildLog.htm  
 
+// read BuildLog.htm  
 function readBuildLog(exeDir, itemInfo, useUnicode)
 {
     if (! fso.FolderExists(exeDir))
@@ -44,9 +64,7 @@
     posTmp = getBuildSummaryInfo(itemInfo, blogData, posTmp);
 }
 
-////////////////////////////////////////////////////////////////////
 // BuildLog.htm parsing methods 
-
 function getCommandLinesInfo(itemInfo, blogData, posStart)
 {
     //lookup for the command lines block
@@ -525,7 +543,7 @@
     
     // load information from local summary file 
     // and save it to general summary
-    var lsumFileName = exsDir + "\\" + buildType + "\\" + summaryFileName;
+    var lsumFileName = exsDir + "\\" + summaryFileName;
     if (fso.FileExists(lsumFileName))
     {
         var fileLSum = fso.OpenTextFile(lsumFileName);
@@ -544,32 +562,26 @@
 }
 
 
-function saveBuildSummaryMulti(fSum, htmDir, buildType)
+function saveBuildSummaryMulti(fSum, htmDir)
 {
-    var htmFolder = fso.GetFolder(htmDir);
-    if (! htmDir)
+    if (!fso.FolderExists(htmDir))
         return;
+    var htmFolder = fso.GetFolder(htmDir);
         
     var enumHtmSubFolders = new Enumerator(htmFolder.SubFolders);
     for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext())
     {
         var htmFName = enumHtmSubFolders.item().Name;
-        if (buildType == htmFName)
-        {
-            saveBuildSummariesFromFolder(fSum,
-                enumHtmSubFolders.item().Path, htmFolderName);
-        }
-        else
-        {
-            saveBuildSummaryMulti(fSum, htmDir + "\\" + htmFName, buildType);
-        }
+        saveBuildSummariesFromFolder(fSum,
+            enumHtmSubFolders.item().Path, htmFolderName);
+        saveBuildSummaryMulti(fSum, htmDir + "\\" + htmFName);
     }
 }
 
 function saveBuildSummariesFromFolder(fSum, testFolder, htmFName)
 {
     var htmFldName = testFolder + "\\" + htmFName;
-    if (! fso.FolderExists(htmFldName))
+    if (!fso.FolderExists(htmFldName))
         return;
         
     var htmFld = fso.GetFolder(htmFldName);
@@ -602,9 +614,9 @@
 function checkForFailures(testDir, bType, logHtm, sumHtm, htmTempDir, 
             seeHtm, useUnicode)
 {
-    var testFolder = fso.GetFolder(testDir);
-    if (! testFolder)
+    if (!fso.FolderExists(testDir))
         return;
+    var testFolder = fso.GetFolder(testDir);
         
     var seeHtmHere = seeHtm;
     if (false == seeHtmHere && testFolder.Name == bType)

Modified: incubator/stdcxx/trunk/etc/config/windows/utilities.js
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/utilities.js?view=diff&rev=453570&r1=453569&r2=453570
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/utilities.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/utilities.js Fri Oct  6 05:16:32 2006
@@ -2,6 +2,127 @@
 // $Id$
 //
 // defines different utility functions
+//
+//////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software  Foundation (ASF) under one or more
+// contributor  license agreements.  See  the NOTICE  file distributed
+// with  this  work  for  additional information  regarding  copyright
+// ownership.   The ASF  licenses this  file to  you under  the Apache
+// License, Version  2.0 (the  "License"); you may  not use  this file
+// except in  compliance with the License.   You may obtain  a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the  License is distributed on an  "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+// implied.   See  the License  for  the  specific language  governing
+// permissions and limitations under the License.
+// 
+//////////////////////////////////////////////////////////////////////
+
+var VERSION = "";
+var DEVENV = "";
+var DEVENVFLAGS = "";
+var CPPFLAGS = "";
+var LDFLAGS = "";
+var CONVERT = false;
+var CXX = "";
+var LD = "";
+var AR = "";
+var SLNVER="";
+var SLNCOMMENT="";
+var UNICODELOG = false;
+var NOSTCRT = false;
+var WINDIFF = "";
+var ICCCONVERT = "";
+
+// read and parse compiler configuration file
+// config - name of the compiler configuration
+function getCompilerOpts(config)
+{
+    var scriptDir = getParentFolder(WScript.ScriptFullName);
+    var configFileName = scriptDir + "\\" + config + ".config";
+    var ForReading = 1;
+    var configFile = null;
+
+    try
+    {
+        configFile = fso.OpenTextFile(configFileName, ForReading);
+    }
+    catch (e) {}
+
+    if (null == configFile)
+    {
+        WScript.StdErr.WriteLine("Cannot open configuration file: " + configFileName);
+        WScript.Quit(3);
+    }
+
+    while (!configFile.AtEndOfStream)
+    {
+        var line = configFile.ReadLine();
+        if (0 == line.indexOf("//"))
+            continue;
+        var inc = "#include ";
+        var pos = line.indexOf(inc);
+        if (0 == pos)
+            getCompilerOpts(line.substr(pos + inc.length));
+        var tokens = line.split("=");
+        if (2 == tokens.length)
+        {
+            switch (tokens[0])
+            {
+            case "VERSION":
+                VERSION = tokens[1];
+                break;
+            case "DEVENV":
+                DEVENV = tokens[1];
+                break;
+            case "DEVENVFLAGS":
+                DEVENVFLAGS = tokens[1];
+                break;
+            case "CPPFLAGS":
+                CPPFLAGS = tokens[1];
+                break;
+            case "LDFLAGS":
+                LDFLAGS = tokens[1];
+                break;
+            case "CONVERT":
+                CONVERT = (tokens[1] != "0");
+                break;
+            case "CXX":
+                CXX = tokens[1];
+                break;
+            case "LD":
+                LD = tokens[1];
+                break;
+            case "AR":
+                AR = tokens[1];
+                break;
+            case "SLNVER":
+                SLNVER = tokens[1];
+                break;
+            case "SLNCOMMENT":
+                SLNCOMMENT = tokens[1];
+                break;
+            case "UNICODELOG":
+                UNICODELOG = (tokens[1] != "0");
+                break;
+            case "NOSTCRT":
+                NOSTCRT = (tokens[1] != "0");
+                break;
+            case "WINDIFF":
+                WINDIFF = tokens[1];
+                break;
+            case "ICCCONVERT":
+                ICCCONVERT = tokens[1];
+                break;
+            }
+        }
+    }
+}
 
 // returns parent folder for a path
 function getParentFolder(path)
@@ -10,43 +131,41 @@
     return path.substr(0, idx);
 }
 
-var rxUUID = /[a-f0-9\-]+/i;
-// generates new UUID. uuidgen shall be runnable via PATH
-function createUUID()
+// returns filename from a path
+function getFileName(path)
 {
-    var exec = WshShell.Exec("uuidgen");
-    var time = 0;
-    while (exec.Status == 0)
-    {
-        WScript.Sleep(100); // wait for completion
-        time += 100;
-        if (time > 5000)
-        {
-            WScript.StdErr.WriteLine(
-                "createUUID: Fatal error: uuidgen" + 
-                " failed to complete in 5" + 
-                " seconds");
-            WScript.Quit(3);
-        }
-    }
-    var result = exec.ExitCode;
-    if (result != 0)
-    {
-        WScript.StdErr.WriteLine(
-            "createUUID: Fatal error: uuidgen"
-                + " failed");				
-        WScript.Quit(3);
-    }
-    var id = exec.StdOut.ReadAll();
-    return "{" + rxUUID.exec(id)[0].toUpperCase() +"}";
+    var idx = path.lastIndexOf('\\');
+    return path.substr(idx + 1);
 }
 
+// returns extension of the file name (with dot at first character)
+function getExtension(filename)
+{
+    var idx = filename.lastIndexOf('.');
+    return 0 <= idx ? filename.substr(idx) : ".";
+}
 
 /////////////////////////////////////////////////////////////////////////
 // get differences using WinDiff utility
 
 function getWinDiffDifferences(src1, src2, flags)
 {   
+    if (WINDIFF == "")
+    {
+        if (VERSION == "")
+            WINDIFF = "windiff";
+        else
+        {
+            var ver = "";
+            if (0 <= VERSION.indexOf("."))
+                ver = VERSION.replace(".", "");
+            WINDIFF = WshShell.Environment.Item("VS" + ver + "COMNTOOLS") +
+                      "\\bin\\windiff";
+            if (WINDIFF[0] != "\"")
+                WINDIFF = "\"" + WINDIFF + "\"";
+        }
+    }
+
     try
     {
         // first create two temporary files 
@@ -71,7 +190,7 @@
         var tResPath = tfolder.Path + "\\" + tResName;
   
         // second run windiff
-        var cmd = "windiff -F" + flags + " " + tResPath;
+        var cmd = WINDIFF + " -F" + flags + " " + tResPath;
         cmd += " " + tpath1;
         cmd += " " + tpath2;
 
@@ -80,7 +199,7 @@
         {
             WScript.StdErr.WriteLine(
                 "getWinDiffDifferences: Fatal error: windiff"
-                    + " failed");				
+                    + " failed");                
             return "unknown";
         }
     
@@ -88,7 +207,7 @@
         var tResFile = fso.OpenTextFile(tfolder.Path + "\\" + tResName);
         var res = tResFile.ReadAll();
         tResFile.Close();
-	
+    
         fso.DeleteFile(tpath1);
         fso.DeleteFile(tpath2);
         fso.DeleteFile(tResPath);
@@ -101,6 +220,7 @@
     }
 }
 
+// create temporary file and return path to this file
 function makeTempFile()
 {
     var tfolder, TemporaryFolder = 2;
@@ -113,6 +233,8 @@
     return tfolder.Path + "\\" + tname;
 }
 
+// encode symbols within string with escaped analog
+// srcString - source string
 function encodeHTML(srcString)
 {
     var res = srcString;
@@ -127,6 +249,9 @@
     return res;
 }
 
+// returns source string without first character if it equal to symbol
+// dotName - source string
+// symbol - symbol to remove
 function removeLeadingSymbol(dotName, symbol)
 {
     var index = dotName.indexOf(symbol);
@@ -137,6 +262,7 @@
     return resName;
 }
 
+// returns source string without first character is is a dot
 function removeLeadingDot(dotName)
 {
     var index = dotName.indexOf(".");
@@ -147,196 +273,131 @@
     return resName;
 }
 
-// icc specific - solution conversion
-function convertSolutionImpl(slnFileName, toICC, logStream)
-{   
-    var convertKey = toICC == true ? "/IC" : "/VC";
-    var cmdICConvert = iccConversionUtility + " \"" + slnFileName + 
-        "\" " + convertKey;
-    
-    var convertKeyFriendly = toICC == true ? "ICC" : "MSVC";
-    WScript.Echo("Converting solution to " + convertKeyFriendly + 
-            ". This may take several minutes.");
-    
-    var res = -1;
-    try
-    {
-        if (logStream)
-            logStream.WriteLine("Converting " + cmdICConvert);
-            
-        res = WshShell.Run(cmdICConvert, 7, true);
-        if (0 != res)
-            WScript.Echo("Conversion finished with code " + res);
-            
-        if (logStream)
-            logStream.WriteLine("Conversion to " + convertKeyFriendly + 
-                " finished with code " + res);
-    }
-    catch(e)
-    {
-        WScript.Echo("Conversion failed");
-        if (logStream)
-            logStream.WriteLine("Conversion failed");
-            
-        return -1;
-    }
-    
-    return res;
-}
-
-//////////////////////////////////////////////////////////////////////
-// compile environment
-var activeCompiler = null;
-var activeLinker = null;
-var activeLibrarian = null;
-
-var logFileName = "config.log";
-
-// Setup compiler and linker names and options
-function setCompileEnvironment(solutionName, configurationName
-                                , projectName, logFile)
-{
-    // obtain the solution. Check that there is no specail solution
-    // for configure script
-    var solution = configurations.get(solutionName);
-    if (null != configurations.get(solutionName + "_config"))
-        solution = configurations.get(solutionName + "_config");
-        
-    var solutionconfig = solution.configurations.get(configurationName);
-    var projectConfig = 
-        solutionconfig.projectConfigurations.get(projectName);
-    var project = solution.projects.get(projectConfig.projectName);
-    var platform = project.platforms.get(projectConfig.platform);
-    var configuration = 
-        platform.configurations.get(projectConfig.configuration);
-
-    activeCompiler = configuration.tools.get(compilerToolName);
-    activeLinker = configuration.tools.get(linkerToolName);
-    activeLibrarian = configuration.tools.get(librarianToolName);
-
-    logFileName = logFile;
+// returns the source filename with replaced extension to new one
+// filename - source filename
+// ext - new extension
+function changeFileExt(filename, ext)
+{
+    var arr = filename.split(".");
+    arr[arr.length - 1] = ext;
+    return arr.join(".");
 }
 
-// performs compilation using provided compiler
-function compile(compiler)
+// returns new UUID
+function createUUID()
 {
-    var command = compiler.getCommandLine();
-    var message = "Compiling with command \"" + command + "\"";
-    logLine(message);
-    return WshShell.Run("cmd /c \"" + command +"\" >> " + 
-        logFileName + " 2>&1", runWindowMode, true);
+    return WScript.CreateObject("scriptlet.typelib").guid;
 }
 
-// performs compilation using active compiler
-function compileFiles(srcs, defines)
+// returns index of value in array or -1
+function arrayIndexOf(array, value)
 {
-    var compiler = activeCompiler.clone();
-    var srcsArr = srcs.split(" ");
-    for (i in srcsArr)
-    {
-        compiler.inputFiles.add(srcsArr[i]);
-    }
-    if (typeof(defines) == "string")
-    {
-        defines = Array(defines);
-    }
-    if (defines instanceof Array)
-    {
-        for (i in defines)
+    for (var i = 0; i < array.length; ++i)
+        if (array[i] == value)
+            return i;
+
+    return -1;
+}
+
+// create MSVS solution file
+// projects - array of the projects
+// path - output folder
+// name - name of the solutuion file
+function generateSolution(projects, path, name)
+{
+    path += "\\";
+    var sln = fso.CreateTextFile(path + name, true, false);
+    // header
+    sln.WriteLine("Microsoft Visual Studio Solution File, Format Version " + SLNVER);
+    if (0 < SLNCOMMENT.length)
+        sln.WriteLine("# " + SLNCOMMENT);
+    for (var i = 0; i < projects.length; ++i)
+    {
+        // project section header
+        var Project = projects[i];
+        var VCProject = Project.VSProject;
+        sln.Write("Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ");
+        sln.Write("\"" + VCProject.Name + "\"");
+        var projectFile = VCProject.ProjectFile;
+        var pos = projectFile.indexOf(path);
+        if (0 == pos)
+            projectFile = projectFile.substr(path.length);
+        sln.Write(", \"" + projectFile + "\"");
+        sln.WriteLine(", \"" + VCProject.ProjectGUID + "\"");
+
+        if (SLNVER != "7.00")
         {
-            compiler.defines.add(defines[i]);
+            // project dependencies
+            sln.WriteLine(
+                "\tProjectSection(ProjectDependencies) = postProject");
+            var deps = Project.PrjRefs.concat(Project.PrjDeps);
+            for (var j = 0; j < deps.length; ++j)
+            {
+                var depGUID = deps[j].VSProject.ProjectGUID;
+                sln.WriteLine("\t\t" + depGUID + " = " + depGUID);
+            }
+            sln.WriteLine("\tEndProjectSection");
         }
+        // project section end
+        sln.WriteLine("EndProject");
     }
-    return compile(compiler);
-}
-
-// links using provided linker
-function link(linker)
-{
-     var command = linker.getCommandLine();
-     var message = "Linking with command \"" + command + "\"";
-     logLine(message);
-     return WshShell.Run("cmd /c \"" + command +"\" >> " 
-        + logFileName + " 2>&1", runWindowMode, true);
-}
-
-// links using active linker
-function linkFiles(srcs, outName, linker)
-{
-     if (!linker)
-     {
-        linker = activeLinker.clone();
-     }
-     linker.outputFile = outName;
-     var srcsArr = srcs.split(" ");
-     for (i in srcsArr)
-     {
-        linker.inputFiles.add(srcsArr[i]);
-     }
-     return link(linker);
-}
 
-// preprocesses using provided compiler
-function preprocess(compiler, preprocFile)
-{
-     var command = compiler.getPreprocessCommandLine();
-     var message = "Preprocessing with command \"" + command + "\"";
-     logLine(message);
-     return WshShell.Run("cmd /c \"" + command +"\" > " 
-        + preprocFile + " 2>> " + logFileName, runWindowMode, true);
-}
-
-// preprocesses using active compiler
-function preprocessFile(src, preprocFile)
-{
-     var compiler = activeCompiler.clone();
-     compiler.inputFiles.add(src);
-     return preprocess(compiler, preprocFile);
-}
-
-// links a library using provided librarian
-function buildLibrary(librarian)
-{
-     var command = librarian.getCommandLine();
-     var message = "Making library with command \"" + command + "\"";
-     logLine(message);
-     return WshShell.Run("cmd /c \"" + command +"\" >> " 
-        + logFileName + " 2>&1", runWindowMode, true);
-}
-
-// links a library using active librarian
-function makeLibrary(srcFiles, outDir, outFile, isShared)
-{
-    var ret = compileFiles(srcFiles);
-    if (ret != 0)
+    // Global section
+    sln.WriteLine("Global");
+    // solution configurations
+    sln.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
+    for (var i = 0; i < confNames.length; ++i)
     {
-        return ret;
+        var confName = confNames[i];
+        var confKey = (SLNVER == "7.00" ? "ConfigName." + i : confName);
+        sln.WriteLine("\t\t" + confKey + " = " + confName);
     }
-    var objNames = srcFiles.replace(/(?:[\S]+[/\\\\])?([^/\\\\]+\.)cpp/gi, 
-        outDir + "/$1obj");
-        
-    if (isShared)
+    sln.WriteLine("\tEndGlobalSection");
+
+    // project dependencies for MSVC 7.0
+    if (SLNVER == "7.00")
     {
-        // call linker to build a dll
-        var linker = activeLinker.clone();
-        linker.isDLL = true;
-        return linkFiles(objNames, outFile, linker);
+        sln.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
+        for (var i = 0; i < projects.length; ++i)
+        {
+            var Project = projects[i];
+            var VCProject = Project.VSProject;
+            var prjGUID = VCProject.ProjectGUID;
+            var deps = Project.PrjRefs.concat(Project.PrjDeps);
+            for (var j = 0; j < deps.length; ++j)
+            {
+                var depGUID = deps[j].VSProject.ProjectGUID;
+                sln.WriteLine("\t\t" + prjGUID + "." + j + " = " + depGUID);
+            }
+        }
+        sln.WriteLine("\tEndGlobalSection");
     }
-    // call librarian to build lib
-    var librarian = activeLibrarian.clone();
-    librarian.outputFile = outFile;
-    var objsArray = objNames.split(" ");
-    for (i in objsArray)
-    {
-        librarian.inputFiles.add(objsArray);
+
+    // project configurations
+    sln.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
+    for (var i = 0; i < projects.length; ++i)
+    {
+        var Project = projects[i];
+        var VCProject = Project.VSProject;
+        var prjGUID = VCProject.ProjectGUID;
+        var cfgs = VCProject.Configurations;
+        for (var j = 1; j <= cfgs.Count; ++j)
+        {
+            var cfg = cfgs.Item(j);
+            sln.WriteLine("\t\t" + prjGUID + "." + cfg.ConfigurationName +
+                          ".ActiveCfg = " + cfg.Name);
+            sln.WriteLine("\t\t" + prjGUID + "." + cfg.ConfigurationName +
+                          ".Build.0 = " + cfg.Name);
+        }
     }
-    return buildLibrary(librarian);
-}
+    sln.WriteLine("\tEndGlobalSection");
 
-// logs text line into a log file
-function logLine(line)
-{
-    var stream = fso.OpenTextFile(logFileName, 8, true, 0);
-    stream.WriteLine(line);
-    stream.Close();
+    // some unknown stuff
+    sln.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
+    sln.WriteLine("\tEndGlobalSection");
+    sln.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
+    sln.WriteLine("\tEndGlobalSection");
+
+    sln.WriteLine("EndGlobal");
+    sln.Close();
 }



Mime
View raw message