dbertoni    2002/08/30 16:58:30

  Modified:    c/Tests/Compare compare.cpp
               c/Tests/Conf conf.cpp
               c/Tests/Dom2Dom dom2dom.cpp
               c/Tests/Errortests Errortests.cpp
               c/Tests/Extensions extensions.cpp
               c/Tests/InputSource inputsource.cpp
               c/Tests/Memory Stressmem.cpp
               c/Tests/Params Params.cpp
               c/Tests/PerfT perft.cpp
               c/Tests/Threads ThreadTest.cpp
               c/Tests/Transformer TestXalanTransformer.cpp
  Log:
  Fixes for initialization and termination.
  
  Revision  Changes    Path
  1.15      +132 -112  xml-xalan/c/Tests/Compare/compare.cpp
  
  Index: compare.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Compare/compare.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- compare.cpp       16 Apr 2002 05:44:31 -0000      1.14
  +++ compare.cpp       30 Aug 2002 23:58:29 -0000      1.15
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,22 +57,16 @@
   
   #include <iostream>
   #include <strstream>
  -#include <stdio.h>
  +#include <cstdio>
   #include <direct.h>
   
   #if !defined(XALAN_NO_NAMESPACES)
        using std::cerr;
  -     using std::cout;
  -     using std::cin;
        using std::endl;
  -     using std::ifstream;
  -     using std::ios_base;
  -     using std::ostrstream;
  -     using std::string;
   #endif
   
   // XERCES HEADERS...
  -//   Are included by HarnessInit.hpp
  +#include <xercesc/util/PlatformUtils.hpp>
   
   // XALAN HEADERS...
   #include <XalanSourceTree/FormatterToSourceTree.hpp>
  @@ -114,129 +108,155 @@
                 << endl;
   }
   
  +
  +
   int
  -main(int                     argc,
  -      const char*    argv[])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  -
        HarnessInit xmlPlatformUtils;
   
  +     FileUtility             h;
  +
  +     bool setGold = true;
  +
  +     // Set the program help string,  then get the command line parameters.
  +     //
  +     setHelp(h);
  +
  +     if (h.getParams(argc, argv, "DOMCOM-RESULTS", setGold) == true)
        {
  -             FileUtility             h;
  +             //
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XalanTransformer xalan;
  +
  +             XalanSourceTreeDOMSupport domSupport;
  +             XalanSourceTreeParserLiaison parserLiaison(domSupport);
  +             domSupport.setParserLiaison(&parserLiaison);
  +
   
  -             int transResult = 0;
  -             bool setGold = true;
  -             XalanDOMString fileName;
  +             // Generate Unique Run id and processor info
  +             const XalanDOMString UniqRunid = h.generateUniqRunid();
  +             const XalanDOMString  resultFilePrefix("cpp");
  +             const XalanDOMString  resultsFile(h.args.output + 
resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +
  +             XMLFileReporter logFile(resultsFile);
  +             logFile.logTestFileInit("Comparison Testing:");
  +                                     
  +             // Specify the "test" directory for both input and output.
  +             //
  +             const XalanDOMString  currentDir("domcomtests");
  +             const XalanDOMString  theOutputDir = h.args.output + currentDir;
  +             h.checkAndCreateDir(theOutputDir);
   
  -             // Set the program help string,  then get the command line 
parameters.
  +             // Get the files found in the test directory
                //
  -             setHelp(h);
  +             logFile.logTestCaseInit(currentDir);
  +             const FileNameVectorType files = 
h.getTestFileNames(h.args.base, currentDir, true);
   
  -             if (h.getParams(argc, argv, "DOMCOM-RESULTS", setGold) == true)
  +             for(FileNameVectorType::size_type i = 0; i < files.size(); i++)
                {
  -                     XalanTransformer::initialize();
  +                     const XalanDOMString&   fileName = files[i];
  +                     h.data.reset();
  +                     h.data.testOrFile = fileName;
  +
  +                     const XalanDOMString  theXSLFile= h.args.base + 
currentDir + FileUtility::s_pathSep + fileName;
  +                     const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
  +                     XalanDOMString  theGoldFile = h.args.gold + currentDir 
+ FileUtility::s_pathSep + fileName;
  +                     theGoldFile = h.generateFileName(theGoldFile, "out");
  +
  +                     const XalanDOMString  outbase =  h.args.output + 
currentDir + FileUtility::s_pathSep + fileName; 
  +                     const XalanDOMString  theOutputFile = 
h.generateFileName(outbase, "out");
  +
  +                     const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  +                     const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  +                     const XSLTInputSource   
goldInputSource(c_wstr(theGoldFile));
  +
  +                     // Use a XalanSourceTreeDocument to create the 
XSLTResultTarget. 
  +                     //
  +                     XalanSourceTreeDocument* dom = 
parserLiaison.createXalanSourceTreeDocument();
  +                     FormatterToSourceTree domOut(dom); 
  +                     XSLTResultTarget domResultTarget;
  +                     domResultTarget.setDocumentHandler(&domOut);
  +
  +                     // Parsing(compile) the XSL stylesheet and report the 
results..
  +                     //
  +                     const XalanCompiledStylesheet*  compiledSS = 0;
  +                     xalan.compileStylesheet(xslInputSource, compiledSS);
  +                     if (compiledSS == 0 )
  +                     {  
  +                             continue;
  +                     }
   
  +                     // Parsing the input XML and report the results..
  +                     //
  +                     const XalanParsedSource*  parsedSource = 0;
  +                     xalan.parseSource(xmlInputSource, parsedSource);
  +                     if (parsedSource == 0)
                        {
  -                             //
  -                             // Call the static initializers for xerces and 
xalan, and create a transformer
  -                             //
  -                             XalanTransformer xalan;
  +                             continue;
  +                     }
  +
  +                     // Perform One transform using parsed stylesheet and 
unparsed xml source, report results...
  +                     // 
  +                     xalan.transform(*parsedSource, compiledSS, 
domResultTarget);
  +                     h.checkDOMResults(theOutputFile, compiledSS, dom, 
goldInputSource, logFile);
  +
  +                     parserLiaison.reset();
  +                     xalan.destroyParsedSource(parsedSource);
  +                     xalan.destroyStylesheet(compiledSS);
  +             }
  +
  +             logFile.logTestCaseClose("Done", "Pass");
  +             h.reportPassFail(logFile, UniqRunid);
  +             logFile.logTestFileClose("DomCom ", "Done");
  +             logFile.close();
   
  -                             XalanSourceTreeDOMSupport domSupport;
  -                             XalanSourceTreeParserLiaison 
parserLiaison(domSupport);
  -                             domSupport.setParserLiaison(&parserLiaison);
  +             h.analyzeResults(xalan, resultsFile);
  +     }
   
  +     return 0;
  +}
   
  -                             // Generate Unique Run id and processor info
  -                             const XalanDOMString UniqRunid = 
h.generateUniqRunid();
  -                             const XalanDOMString  resultFilePrefix("cpp");
  -                             const XalanDOMString  resultsFile(h.args.output 
+ resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
   
   
  -                             XMLFileReporter logFile(resultsFile);
  -                             logFile.logTestFileInit("Comparison Testing:");
  -                                     
  -                             // Specify the "test" directory for both input 
and output.
  -                             //
  -                             const XalanDOMString  currentDir("domcomtests");
  -                             const XalanDOMString  theOutputDir = 
h.args.output + currentDir;
  -                             h.checkAndCreateDir(theOutputDir);
  -
  -                             // Get the files found in the test directory
  -                             //
  -                             logFile.logTestCaseInit(currentDir);
  -                             const FileNameVectorType files = 
h.getTestFileNames(h.args.base, currentDir, true);
  -
  -                             for(FileNameVectorType::size_type i = 0; i < 
files.size(); i++)
  -                             {
  -                                     fileName = files[i];
  -                                     h.data.reset();
  -                                     h.data.testOrFile = fileName;
  -
  -                                     const XalanDOMString  theXSLFile= 
h.args.base + currentDir + FileUtility::s_pathSep + fileName;
  -                                     const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
  -                                     XalanDOMString  theGoldFile = 
h.args.gold + currentDir + FileUtility::s_pathSep + fileName;
  -                                     theGoldFile = 
h.generateFileName(theGoldFile, "out");
  -
  -                                     const XalanDOMString  outbase =  
h.args.output + currentDir + FileUtility::s_pathSep + fileName; 
  -                                     const XalanDOMString  theOutputFile = 
h.generateFileName(outbase, "out");
  -
  -                                     const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  -                                     const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  -                                     const XSLTInputSource   
goldInputSource(c_wstr(theGoldFile));
  -
  -                                     // Use a XalanSourceTreeDocument to 
create the XSLTResultTarget. 
  -                                     //
  -                                     XalanSourceTreeDocument* dom = 
parserLiaison.createXalanSourceTreeDocument();
  -                                     FormatterToSourceTree domOut(dom); 
  -                                     XSLTResultTarget domResultTarget;
  -                                     
domResultTarget.setDocumentHandler(&domOut);
  -
  -                                     // Parsing(compile) the XSL stylesheet 
and report the results..
  -                                     //
  -                                     const XalanCompiledStylesheet*  
compiledSS = 0;
  -                                     xalan.compileStylesheet(xslInputSource, 
compiledSS);
  -                                     if (compiledSS == 0 )
  -                                     {  
  -                                             continue;
  -                                     }
  -
  -                                     // Parsing the input XML and report the 
results..
  -                                     //
  -                                     const XalanParsedSource*  parsedSource 
= 0;
  -                                     xalan.parseSource(xmlInputSource, 
parsedSource);
  -                                     if (parsedSource == 0)
  -                                     {
  -                                             continue;
  -                                     }
  -
  -                                     // Perform One transform using parsed 
stylesheet and unparsed xml source, report results...
  -                                     // 
  -                                     xalan.transform(*parsedSource, 
compiledSS, domResultTarget);
  -                                     h.checkDOMResults(theOutputFile, 
compiledSS, dom, goldInputSource, logFile);
  -
  -                                     parserLiaison.reset();
  -                                     xalan.destroyParsedSource(parsedSource);
  -                                     xalan.destroyStylesheet(compiledSS);
  -                             }
  -
  -                             logFile.logTestCaseClose("Done", "Pass");
  -                             h.reportPassFail(logFile, UniqRunid);
  -                             logFile.logTestFileClose("DomCom ", "Done");
  -                             logFile.close();
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
   
  -                             h.analyzeResults(xalan, resultsFile);
  -                     }
  +     int     theResult = 0;
   
  -                     XalanTransformer::terminate();
  -             }
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
  +
  +             XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
        }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
   
  +             theResult = -1;
  +     }
   
  -     return 0;
  +     return theResult;
   }
  
  
  
  1.28      +85 -58    xml-xalan/c/Tests/Conf/conf.cpp
  
  Index: conf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Conf/conf.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- conf.cpp  12 Aug 2002 03:53:12 -0000      1.27
  +++ conf.cpp  30 Aug 2002 23:58:29 -0000      1.28
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,13 +57,11 @@
   
   #if defined(XALAN_OLD_STREAM_HEADERS)
   #include <iostream.h>
  -#include <sstream>
   #else
   #include <iostream>
  -#include <sstream>
   #endif
   
  -#include <stdio.h>
  +#include <cstdio>
   
   #if !defined(XALAN_NO_NAMESPACES)
        using std::cerr;
  @@ -74,7 +72,8 @@
   #endif
   
   
  -#include <xercesc/util/XercesDefs.hpp>
  +
  +#include <xercesc/util/PlatformUtils.hpp>
   
   
   
  @@ -250,15 +249,13 @@
   }
   
   
  +
   int
  -main(int                     argc,
  -      const char*    argv[])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  +     int     theResult = 0;
   
        try
        {
  @@ -272,45 +269,37 @@
   
                if (h.getParams(argc, argv, "CONF-RESULTS") == true)
                {
  -                     // Call the static initializers for xerces and xalan, 
and create a transformer
  -                     //
  -                     XalanTransformer::initialize();
  +                     XalanTransformer        xalan;
   
  -                     {
  -                             XalanTransformer        xalan;
  +                     // Get drive designation for final analysis and 
generate Unique name for results log.
  +                     //
  +                     const XalanDOMString  drive(h.getDrive());              
        // This is used to get stylesheet for final analysis
  +                     const XalanDOMString  resultFilePrefix("conf");         
// This & UniqRunid used for log file name.
  +                     const XalanDOMString  UniqRunid = 
h.generateUniqRunid(); 
  +                     const XalanDOMString  resultsFile(drive + h.args.output 
+ resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
   
  -                             // Get drive designation for final analysis and 
generate Unique name for results log.
  -                             //
  -                             const XalanDOMString  drive(h.getDrive());      
                // This is used to get stylesheet for final analysis
  -                             const XalanDOMString  resultFilePrefix("conf"); 
        // This & UniqRunid used for log file name.
  -                             const XalanDOMString  UniqRunid = 
h.generateUniqRunid(); 
  -                             const XalanDOMString  resultsFile(drive + 
h.args.output + resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +                     // Open results log, and do some initialization of 
result data.
  +                     //
  +                     XMLFileReporter logFile(resultsFile);
  +                     logFile.logTestFileInit("Conformance Testing:");
  +                     h.data.xmlFormat = XalanDOMString("NotSet");
   
  -                             // Open results log, and do some initialization 
of result data.
  -                             //
  -                             XMLFileReporter logFile(resultsFile);
  -                             logFile.logTestFileInit("Conformance Testing:");
  -                             h.data.xmlFormat = XalanDOMString("NotSet");
  +                     // Get the list of Directories that are below conf and 
iterate through them
  +                     //
   
  -                             // Get the list of Directories that are below 
conf and iterate through them
  -                             //
  +                     // Flag indicates directory found. Used in conjunction 
with -sub cmd-line arg.
  +                     bool    foundDir = false;
   
  -                             // Flag indicates directory found. Used in 
conjunction with -sub cmd-line arg.
  -                             bool    foundDir = false;
  +                     const FileNameVectorType        dirs = 
h.getDirectoryNames(h.args.base);
   
  -                             const FileNameVectorType        dirs = 
h.getDirectoryNames(h.args.base);
  +                     for(FileNameVectorType::size_type       j = 0; j < 
dirs.size(); ++j)
  +                     {
  +                             // Skip all but the specified directory if the 
-sub cmd-line option was used.
  +                             //
  +                             const XalanDOMString&   currentDir = dirs[j];
   
  -                             for(FileNameVectorType::size_type       j = 0; 
j < dirs.size(); ++j)
  +                             if (length(h.args.sub) == 0 || 
equals(currentDir, h.args.sub) == true)
                                {
  -                                     // Skip all but the specified directory 
if the -sub cmd-line option was used.
  -                                     //
  -                                     const XalanDOMString    
currentDir(dirs[j]);
  -
  -                                     if (length(h.args.sub) > 0 && 
!equals(currentDir, h.args.sub))
  -                                     {
  -                                             continue;
  -                                     }                                       
  -
                                        // Check that output directory is there.
                                        //
                                        const XalanDOMString  theOutputDir = 
h.args.output + currentDir;
  @@ -328,7 +317,7 @@
                                        for(FileNameVectorType::size_type i = 
0; i < files.size(); i++)
                                        {
                                                Hashtable attrs;
  -                                             const XalanDOMString    
currentFile(files[i]);
  +                                             const XalanDOMString&   
currentFile = files[i];
                                                if 
(checkForExclusion(currentFile))
                                                        continue;
   
  @@ -391,29 +380,67 @@
   
                                        logFile.logTestCaseClose("Done", 
"Pass");
                                }
  +                     }
   
  -                             // Check to see if -sub cmd-line directory was 
processed correctly.
  -                             //
  -                             if (!foundDir)
  -                             {
  -                                     cout << "Specified test directory: \"" 
<< c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
  -                             }
  -
  -                             h.reportPassFail(logFile, UniqRunid);
  -                             logFile.logTestFileClose("Conformance ", 
"Done");
  -                             logFile.close();
  -
  -                             h.analyzeResults(xalan, resultsFile);
  +                     // Check to see if -sub cmd-line directory was 
processed correctly.
  +                     //
  +                     if (!foundDir)
  +                     {
  +                             cout << "Specified test directory: \"" << 
c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
                        }
   
  +                     h.reportPassFail(logFile, UniqRunid);
  +                     logFile.logTestFileClose("Conformance ", "Done");
  +                     logFile.close();
  +
  +                     h.analyzeResults(xalan, resultsFile);
                }
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization of testing harness failed!" << endl << 
endl;
  +     }
  +
  +     return theResult;
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
   
                XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
        }
        catch(...)
        {
  -             cerr << "Initialization failed!!!" << endl << endl;
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
        }
   
  -     return 0;
  +     return theResult;
   }
  
  
  
  1.6       +92 -67    xml-xalan/c/Tests/Dom2Dom/dom2dom.cpp
  
  Index: dom2dom.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Dom2Dom/dom2dom.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- dom2dom.cpp       12 Apr 2002 06:47:34 -0000      1.5
  +++ dom2dom.cpp       30 Aug 2002 23:58:29 -0000      1.6
  @@ -198,7 +198,6 @@
   getXMLFormatter(bool                                 shouldWriteXMLHeader,
                                bool                                    
stripCData,
                                bool                                    
escapeCData,
  -                             bool                                    
noIndent,
                                PrintWriter&                    resultWriter,
                                int                                             
indentAmount,
                                const XalanDOMString&   mimeEncoding,
  @@ -247,16 +246,10 @@
   
   
   int
  -main(
  +runTests(
                  int                   argc,
                  const char*   argv [])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
   
        HarnessInit             xmlPlatformUtils;
   
  @@ -285,93 +278,84 @@
   
                try
                {
  -                     // Call the static initializers...
  -                     XalanTransformer::initialize();
  -
  -                     {
  -                             XalanTransformer                transformEngine;
  +                     XalanTransformer                transformEngine;
                                                
  -                             XercesDOMSupport domSupport;
  -                             XercesParserLiaison parserLiaison(domSupport);
  +                     XercesDOMSupport domSupport;
  +                     XercesParserLiaison parserLiaison(domSupport);
                                        
  -                             // Specify the "test" directory for both input 
and output.
  -                             const XalanDOMString  xMan("dtod");
  -                             const XalanDOMString  theOutputDir = outputRoot 
+ xMan;
  -                             f.checkAndCreateDir(theOutputDir);
  +                     // Specify the "test" directory for both input and 
output.
  +                     const XalanDOMString  xMan("dtod");
  +                     const XalanDOMString  theOutputDir = outputRoot + xMan;
  +                     f.checkAndCreateDir(theOutputDir);
   
  -                             // Get the files found in the test directory
  -                             const FileNameVectorType        files = 
f.getTestFileNames(baseDir, xMan,true);
  +                     // Get the files found in the test directory
  +                     const FileNameVectorType        files = 
f.getTestFileNames(baseDir, xMan,true);
   
  -                             for(FileNameVectorType::size_type i = 0; i < 
files.size(); ++i)
  -                             {
  -                                     // Output file name to result log and 
console.
  -                                     logFile.logTestCaseInit(files[i]);
  -                                     cout << files[i] << endl;
  -
  -                                     // Set up the input/output files.
  -                                     const XalanDOMString  theXSLFile= 
baseDir + xMan + FileUtility::s_pathSep + files[i];
  -                                     const XalanDOMString  theXMLFile = 
f.generateFileName(theXSLFile,"xml");
  -                                     const XalanDOMString  theOutput =  
outputRoot + xMan + FileUtility::s_pathSep + files[i]; 
  -                                     const XalanDOMString  theOutputFile = 
f.generateFileName(theOutput, "out");
  -
  -                                     // Use a Xerces Dom document to create 
the XSLTResultTarget. 
  -                                     XalanDocument* domOut = 
parserLiaison.createDocument();
  -                                     const XSLTResultTarget 
domResultTarget(domOut);
  +                     for(FileNameVectorType::size_type i = 0; i < 
files.size(); ++i)
  +                     {
  +                             // Output file name to result log and console.
  +                             logFile.logTestCaseInit(files[i]);
  +                             cout << files[i] << endl;
  +
  +                             // Set up the input/output files.
  +                             const XalanDOMString  theXSLFile= baseDir + 
xMan + FileUtility::s_pathSep + files[i];
  +                             const XalanDOMString  theXMLFile = 
f.generateFileName(theXSLFile,"xml");
  +                             const XalanDOMString  theOutput =  outputRoot + 
xMan + FileUtility::s_pathSep + files[i]; 
  +                             const XalanDOMString  theOutputFile = 
f.generateFileName(theOutput, "out");
  +
  +                             // Use a Xerces Dom document to create the 
XSLTResultTarget. 
  +                             XalanDocument* domOut = 
parserLiaison.createDocument();
  +                             const XSLTResultTarget domResultTarget(domOut);
   
  -                                     const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  -                                     const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  +                             const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  +                             const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
                                        
  -                                     const XalanCompiledStylesheet*  
compiledSS = 0;
  +                             const XalanCompiledStylesheet*  compiledSS = 0;
   
  -                                     int     theResult = 
transformEngine.compileStylesheet(
  +                             int     theResult = 
transformEngine.compileStylesheet(
                                                xslInputSource,
                                                compiledSS);
   
  -                                     if (theResult != 0)
  +                             if (theResult != 0)
  +                             {
  +                                     logFile.logTestCaseClose("Done","Fail");
  +                                     cerr << "XalanError: \n" << 
transformEngine.getLastError();
  +                             }
  +                             else
  +                             {
  +                                     // Transform using compiled stylesheet.
  +                                     theResult =
  +                                                     
transformEngine.transform(xmlInputSource, compiledSS, domResultTarget);
  +
  +                                     if(theResult != 0)
                                        {
                                                
logFile.logTestCaseClose("Done","Fail");
                                                cerr << "XalanError: \n" << 
transformEngine.getLastError();
                                        }
                                        else
                                        {
  -                                             // Transform using compiled 
stylesheet.
  -                                             theResult =
  -                                                     
transformEngine.transform(xmlInputSource, compiledSS, domResultTarget);
  +                                             const XalanDOMString    
mimeEncoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
  +                                             const XalanDOMString    
encoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
   
  -                                             if(theResult != 0)
  -                                             {
  -                                                     
logFile.logTestCaseClose("Done","Fail");
  -                                                     cerr << "XalanError: 
\n" << transformEngine.getLastError();
  -                                             }
  -                                             else
  -                                             {
  -                                                     const XalanDOMString    
mimeEncoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
  -                                                     const XalanDOMString    
encoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
  -
  -                                                     XalanFileOutputStream 
myOutput(theOutputFile);
  -                                                     
XalanOutputStreamPrintWriter myResultWriter(myOutput);
  -                                                     FormatterListener* 
theFormatter = getXMLFormatter(true,true,true,false,
  +                                             XalanFileOutputStream 
myOutput(theOutputFile);
  +                                             XalanOutputStreamPrintWriter 
myResultWriter(myOutput);
  +                                             FormatterListener* theFormatter 
= getXMLFormatter(true,true,true,
                                                                                
                                                                
myResultWriter,0,
                                                                                
                                                                mimeEncoding,
                                                                                
                                                                
compiledSS->getStylesheetRoot());
   
  -                                                     FormatterTreeWalker 
theTreeWalker(*theFormatter);
  -                                                     
theTreeWalker.traverse(domOut);
  +                                             FormatterTreeWalker 
theTreeWalker(*theFormatter);
  +                                             theTreeWalker.traverse(domOut);
   
  -                                                     delete theFormatter;
  -                                                     
logFile.logTestCaseClose("Done","Pass");
  -                                             }       
  -                                     }
  +                                             delete theFormatter;
  +                                             
logFile.logTestCaseClose("Done","Pass");
  +                                     }       
                                }
                        }
   
  -                     XalanTransformer::terminate();
  -
                        logFile.logTestFileClose("Dom2Dom Testing: ", "Done");
                        logFile.close();
  -
                }
  -
                catch(...)
                {
                        cerr << "Exception caught!!!" << endl << endl;
  @@ -380,4 +364,45 @@
   
        return 0;
   
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
  +
  +             XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
  +     }
  +
  +     return theResult;
   }
  
  
  
  1.10      +145 -121  xml-xalan/c/Tests/Errortests/Errortests.cpp
  
  Index: Errortests.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Errortests/Errortests.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Errortests.cpp    22 Jan 2002 18:50:54 -0000      1.9
  +++ Errortests.cpp    30 Aug 2002 23:58:29 -0000      1.10
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -68,12 +68,16 @@
   #if !defined(XALAN_NO_NAMESPACES)
        using std::cerr;
        using std::cout;
  -//   using std::cin;
        using std::endl;
   #endif
   
   
   
  +// XERCES HEADERS...
  +#include <xercesc/util/PlatformUtils.hpp>
  +
  +
  +
   // XALAN HEADERS...
   #include <PlatformSupport/DOMStringHelper.hpp>
   
  @@ -148,16 +152,11 @@
   
   
   int
  -main(int                     argc,
  -      const char*    argv[])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  -
  -     HarnessInit xmlPlatformUtils;
  +     HarnessInit             xmlPlatformUtils;
   
        FileUtility             h;
   
  @@ -169,136 +168,124 @@
   
        if (h.getParams(argc, argv, "ERR-RESULTS", setGold) == true)
        {
  -             XalanTransformer::initialize();
  -
  -             {
  -                     //
  -                     // Call the static initializers for xerces and xalan, 
and create a transformer
  -                     //
  -                     XalanTransformer xalan;
  -
  -                     XalanSourceTreeDOMSupport domSupport;
  -                     XalanSourceTreeParserLiaison parserLiaison(domSupport);
  -                     domSupport.setParserLiaison(&parserLiaison);
  -
  +             XalanTransformer                                xalan;
   
  -                     // Generate Unique Run id and processor info
  -                     const XalanDOMString UniqRunid = h.generateUniqRunid();
  +             XalanSourceTreeDOMSupport               domSupport;
  +             XalanSourceTreeParserLiaison    parserLiaison(domSupport);
   
  +             domSupport.setParserLiaison(&parserLiaison);
   
  -                     // Defined basic constants for file manipulation and 
open results file
  -                     const XalanDOMString  resultFilePrefix("cpperr");
  -                     const XalanDOMString  resultsFile(h.args.output + 
resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +             // Generate Unique Run id and processor info
  +             const XalanDOMString UniqRunid = h.generateUniqRunid();
   
  +             // Defined basic constants for file manipulation and open 
results file
  +             const XalanDOMString  resultFilePrefix("cpperr");
  +             const XalanDOMString  resultsFile(h.args.output + 
resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
   
  -                     XMLFileReporter logFile(resultsFile);
  -                     logFile.logTestFileInit("Error Testing:");
  +             XMLFileReporter logFile(resultsFile);
  +             logFile.logTestFileInit("Error Testing:");
   
  -                     // Get the list of Directories that are below conf
  -                     bool foundDir = false;          // Flag indicates 
directory found. Used in conjunction with -sub cmd-line arg.
  -                     const FileNameVectorType        dirs = 
h.getDirectoryNames(h.args.base);
  +             // Get the list of Directories that are below conf
  +             bool foundDir = false;          // Flag indicates directory 
found. Used in conjunction with -sub cmd-line arg.
  +             const FileNameVectorType        dirs = 
h.getDirectoryNames(h.args.base);
   
  -                     for(FileNameVectorType::size_type       j = 0; j < 
dirs.size(); ++j)
  -                     {
  -                             // If conformance directory structure does not 
exist, it needs to be created.
  -                             const XalanDOMString  confSubdir = 
h.args.output + dirs[j];
  -                             h.checkAndCreateDir(confSubdir);
  +             for(FileNameVectorType::size_type       j = 0; j < dirs.size(); 
++j)
  +             {
  +                     // If conformance directory structure does not exist, 
it needs to be created.
  +                     const XalanDOMString  confSubdir = h.args.output + 
dirs[j];
  +                     h.checkAndCreateDir(confSubdir);
   
                                // Set up to get files from the associated 
error directories
  -                             const XalanDOMString currentDir(dirs[j]);
  -                             const XalanDOMString subErrDir(h.args.sub);
  +                             const XalanDOMString&   currentDir = dirs[j];
   
                                // Run specific category of files from given 
directory
  -                             if (length(h.args.sub) > 0 && 
!equals(currentDir, subErrDir))
  +                             if (length(h.args.sub) == 0 || 
equals(currentDir, h.args.sub) == true)
                                {
  -                                     continue;
  -                             }                                       
  +                                     // Check that output directory is there.
  +                                     const XalanDOMString  theOutputDir = 
h.args.output + currentDir;
  +                                     h.checkAndCreateDir(theOutputDir);
  +
                                        
  -                             // Check that output directory is there.
  -                             const XalanDOMString  theOutputDir = 
h.args.output + currentDir;
  -                             h.checkAndCreateDir(theOutputDir);
  -
  -                             
  -                             // Indicate that directory was processed and 
get test files from the directory
  -                             foundDir = true;
  -                             logFile.logTestCaseInit(currentDir);
  +                                     // Indicate that directory was 
processed and get test files from the directory
  +                                     foundDir = true;
  +                                     logFile.logTestCaseInit(currentDir);
   
  -                             const FileNameVectorType files = 
h.getTestFileNames(h.args.base, currentDir, false);
  -                             for(FileNameVectorType::size_type i = 0; i < 
files.size(); i++)
  -                             {
  -                                     Hashtable attrs;
  -                                     const XalanDOMString 
currentFile(files[i]);
  -                                     h.data.testOrFile = currentFile;
  -
  -                                     if (checkForExclusion(currentFile))
  -                                             continue;
  -
  -                                     const XalanDOMString  theXSLFile= 
h.args.base + currentDir + FileUtility::s_pathSep + currentFile;
  -                                     const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
  -                                     XalanDOMString  theGoldFile = 
h.args.gold + currentDir + FileUtility::s_pathSep + currentFile;
  -                                     theGoldFile = 
h.generateFileName(theGoldFile, "out");
  -
  -                                     const XalanDOMString  outbase =  
h.args.output + currentDir + FileUtility::s_pathSep + currentFile; 
  -                                     const XalanDOMString  theOutputFile = 
h.generateFileName(outbase, "out");
  -
  -                                     const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  -                                     const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  -                                     const XSLTInputSource   
goldInputSource(c_wstr(theGoldFile));
  -                                     const XSLTResultTarget  
resultFile(theOutputFile);
  -
  -                                     // Parsing(compile) the XSL stylesheet 
and report the results..
  -                                     //
  -                                     const XalanCompiledStylesheet*  
compiledSS = 0;
  -                                     try 
  +                                     const FileNameVectorType files = 
h.getTestFileNames(h.args.base, currentDir, false);
  +                                     for(FileNameVectorType::size_type i = 
0; i < files.size(); i++)
                                        {
  -                                             cout << endl << "PARSING 
STYLESHEET FOR: " << currentFile << endl;
  +                                             Hashtable attrs;
  +                                             const XalanDOMString 
currentFile(files[i]);
  +                                             h.data.testOrFile = currentFile;
  +
  +                                             if 
(checkForExclusion(currentFile))
  +                                                     continue;
   
  -                                             
xalan.compileStylesheet(xslInputSource, compiledSS);
  -                                             if (compiledSS == 0 )
  +                                             const XalanDOMString  
theXSLFile= h.args.base + currentDir + FileUtility::s_pathSep + currentFile;
  +                                             const XalanDOMString  
theXMLFile = h.generateFileName(theXSLFile,"xml");
  +                                             XalanDOMString  theGoldFile = 
h.args.gold + currentDir + FileUtility::s_pathSep + currentFile;
  +                                             theGoldFile = 
h.generateFileName(theGoldFile, "out");
  +
  +                                             const XalanDOMString  outbase = 
 h.args.output + currentDir + FileUtility::s_pathSep + currentFile; 
  +                                             const XalanDOMString  
theOutputFile = h.generateFileName(outbase, "out");
  +
  +                                             const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  +                                             const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  +                                             const XSLTInputSource   
goldInputSource(c_wstr(theGoldFile));
  +                                             const XSLTResultTarget  
resultFile(theOutputFile);
  +
  +                                             // Parsing(compile) the XSL 
stylesheet and report the results..
  +                                             //
  +                                             const XalanCompiledStylesheet*  
compiledSS = 0;
  +                                             try 
                                                {
  -                                                     cout << "FAILED to 
parse stylesheet for " << currentFile << endl;
  -                                                     cout << "Reason: " << 
xalan.getLastError() << endl;
  -                                                     
logFile.logErrorResult(currentFile, XalanDOMString(xalan.getLastError()));
  +                                                     cout << endl << 
"PARSING STYLESHEET FOR: " << currentFile << endl;
  +
  +                                                     
xalan.compileStylesheet(xslInputSource, compiledSS);
  +                                                     if (compiledSS == 0 )
  +                                                     {
  +                                                             cout << "FAILED 
to parse stylesheet for " << currentFile << endl;
  +                                                             cout << 
"Reason: " << xalan.getLastError() << endl;
  +                                                             
logFile.logErrorResult(currentFile, XalanDOMString(xalan.getLastError()));
  +                                                             continue;
  +                                                     }
  +                                             }
  +                                             catch(...)
  +                                             {
  +                                                     cerr << "Exception 
caught!!!" << endl << endl;
  +                                             }
  +
  +                                             // Parsing the input XML and 
report the results..
  +                                             //
  +                                             cout << "PARSING SOURCE XML 
FOR: " << currentFile << endl;
  +                                             const XalanParsedSource*        
parsedSource = 0;
  +                                             
xalan.parseSource(xmlInputSource, parsedSource);
  +                                             if (parsedSource == 0)
  +                                             {
  +                                                     cout << "Failed to 
PARSE source document for " << currentFile << endl;
                                                        continue;
                                                }
  -                                     }
  -                                     catch(...)
  -                                     {
  -                                             cerr << "Exception caught!!!" 
<< endl << endl;
  -                                     }
   
  -                                     // Parsing the input XML and report the 
results..
  -                                     //
  -                                     cout << "PARSING SOURCE XML FOR: " << 
currentFile << endl;
  -                                     const XalanParsedSource*        
parsedSource = 0;
  -                                     xalan.parseSource(xmlInputSource, 
parsedSource);
  -                                     if (parsedSource == 0)
  -                                     {
  -                                             cout << "Failed to PARSE source 
document for " << currentFile << endl;
  -                                             continue;
  -                                     }
  +                                             // Perform One transform using 
parsed stylesheet and parsed xml source, report results...
  +                                             // 
  +                                             cout << "TRANSFORMING: " << 
currentFile << endl;
   
  -                                     // Perform One transform using parsed 
stylesheet and parsed xml source, report results...
  -                                     // 
  -                                     cout << "TRANSFORMING: " << currentFile 
<< endl;
  +                                             const int       theResult = 
xalan.transform(*parsedSource, compiledSS, resultFile);
   
  -                                     const int       theResult = 
xalan.transform(*parsedSource, compiledSS, resultFile);
  +                                             if (theResult != 0)
  +                                             {
  +                                                     cout << "FAILED to 
transform stylesheet for " << currentFile << endl;
  +                                                     cout << "Reason: " << 
xalan.getLastError() << endl;
  +                                                     
logFile.logErrorResult(currentFile, XalanDOMString(xalan.getLastError()));
  +                                             }
  +                                             else
  +                                             {
  +                                                     
logFile.logCheckPass(currentFile);
  +                                             }
   
  -                                     if (theResult != 0)
  -                                     {
  -                                             cout << "FAILED to transform 
stylesheet for " << currentFile << endl;
  -                                             cout << "Reason: " << 
xalan.getLastError() << endl;
  -                                             
logFile.logErrorResult(currentFile, XalanDOMString(xalan.getLastError()));
  -                                     }
  -                                     else
  -                                     {
  -                                             
logFile.logCheckPass(currentFile);
  +                                             parserLiaison.reset();
  +                                             
xalan.destroyParsedSource(parsedSource);
  +                                             
xalan.destroyStylesheet(compiledSS);
                                        }
  -
  -                                     parserLiaison.reset();
  -                                     xalan.destroyParsedSource(parsedSource);
  -                                     xalan.destroyStylesheet(compiledSS);
  -
                                }
   
                                logFile.logTestCaseClose("Done", "Pass");
  @@ -312,14 +299,51 @@
                }
   
                h.reportPassFail(logFile, UniqRunid);
  +
                logFile.logTestFileClose("Conformance ", "Done");
                logFile.close();
  -
  -             }
        }
   
  -     XalanTransformer::terminate();
  +     return 0;
  +}
   
   
  -     return 0;
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
  +
  +             XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
  +     }
  +
  +     return theResult;
   }
  
  
  
  1.18      +104 -55   xml-xalan/c/Tests/Extensions/extensions.cpp
  
  Index: extensions.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Extensions/extensions.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- extensions.cpp    5 Aug 2002 04:51:22 -0000       1.17
  +++ extensions.cpp    30 Aug 2002 23:58:29 -0000      1.18
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -58,7 +58,7 @@
   
   #include <iostream>
   #include <strstream>
  -#include <stdio.h>
  +#include <cstdio>
   #include <direct.h>
   #include <vector>
   
  @@ -69,6 +69,10 @@
   
   
   
  +#include <xercesc/util/PlatformUtils.hpp>
  +
  +
  +
   // EXTENSION HEADERS...
   #include <XalanExtensions/FunctionDifference.hpp>
   #include <XalanExtensions/FunctionDistinct.hpp>
  @@ -91,6 +95,7 @@
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  +     using std::cerr;
        using std::cout;
        using std::endl;
   #endif
  @@ -342,15 +347,13 @@
   }
   
   
  +
   int
  -main(int                     argc,
  -      const char*    argv [])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  +     int                             theResult = 0;
   
        HarnessInit             xmlPlatformUtils;
   
  @@ -370,66 +373,112 @@
                {
                        cout << "Invalid base directory - " << 
c_str(TranscodeToLocalCodePage(extDir)) << endl;
                        cout << h.args.getHelpMessage();
  -                     return 0;
  +
  +                     theResult = -1;
                }
  +             else
  +             {
  +                     try
  +                     {
  +                             // Generate Unique Run id. (Only used to name 
the result logfile.)
  +                             const XalanDOMString    UniqRunid = 
h.generateUniqRunid();
  +
  +                             // Defined basic constants for file 
manipulation 
  +                             const XalanDOMString    drive(h.getDrive());
  +                             const XalanDOMString    resultsFile(drive + 
h.args.output + currentDir + UniqRunid + FileUtility::s_xmlSuffix);
  +                             
  +                             XMLFileReporter logFile(resultsFile);
  +                             logFile.logTestFileInit("C++ Extension Testing. 
");
  +                             logFile.logTestCaseInit(currentDir);
  +
  +                             cout << "Performing Extension testing ..." << 
endl;
  +
  +                             XalanTransformer        xalan;                  
        
  +                                             
  +                             // Check that output directory is there.
  +                             XalanDOMString          fileName;
  +                                             
  +                             const XalanDOMString    
theOutputDir(h.args.output + currentDir);
  +
  +                             h.checkAndCreateDir(theOutputDir);
  +
  +                             // Get the files found in the "cextension" 
directory
  +                             const FileNameVectorType        files = 
h.getTestFileNames(h.args.base, currentDir, true);
  +
  +                             // TestCase1 is used to verify correct 
functioning of the default extension functions
  +                             TestCase1(xalan, files[0], currentDir, logFile, 
h);     // Difference function
  +                             TestCase1(xalan, files[1], currentDir, logFile, 
h);     // Distinct 
  +                             TestCase1(xalan, files[2], currentDir, logFile, 
h);     // Evaluate 
  +                             TestCase1(xalan, files[3], currentDir, logFile, 
h);     // HasSameNodes 
  +                             TestCase1(xalan, files[4], currentDir, logFile, 
h);     // Intersection 
  +                             TestCase1(xalan, files[5], currentDir, logFile, 
h);     // NodeSet01 - basic testing
  +                             TestCase1(xalan, files[6], currentDir, logFile, 
h);     // NodeSet02 - extensive RTF testing. 
  +
  +                             const XalanDOMString    
theNamespace("http://xml.apache.org/xalan";);
  +
  +                             // These testcases are used to test the 
Install/Uninstall Function API's of the transformer.
  +                             TestCase2(xalan, files[5], currentDir, 
theNamespace, logFile, h);
  +                             TestCase3(xalan, files[5], currentDir, 
theNamespace, logFile, h);
  +                             TestCase4(xalan, files[5], currentDir, 
theNamespace, logFile, h);
   
  -             // Generate Unique Run id. (Only used to name the result 
logfile.)
  -             const XalanDOMString    UniqRunid = h.generateUniqRunid();
  +                             logFile.logTestCaseClose("Done", "Pass");
  +                             h.reportPassFail(logFile, UniqRunid);
  +                                     
  +                             logFile.logTestFileClose("C++ Extension 
Testing: ", "Done");
  +                             logFile.close();
   
  -             // Defined basic constants for file manipulation 
  -             const XalanDOMString drive(h.getDrive());
  -             const XalanDOMString  resultsFile(drive + h.args.output + 
currentDir + UniqRunid + FileUtility::s_xmlSuffix);
  -             
  -             XMLFileReporter logFile(resultsFile);
  -             logFile.logTestFileInit("C++ Extension Testing. ");
  -             logFile.logTestCaseInit(currentDir);
  +                             h.analyzeResults(xalan, resultsFile);
  +                     }
  +                     catch(...)
  +                     {
  +                             cerr << "Exception caught!!!" << endl << endl;
   
  -             cout << "Performing Extension testing ..." << endl;
  +                             theResult = -1;
  +                     }
  +             }
  +     }
   
  -             // Call the static initializers...
  -             XalanTransformer::initialize();
  +     return theResult;
   
  -             {
  -                     XalanTransformer        xalan;                          
  -                                     
  -                     // Check that output directory is there.
  -                     XalanDOMString          fileName;
  -                                     
  -                     const XalanDOMString    theOutputDir(h.args.output + 
currentDir);
  +}
   
  -                     h.checkAndCreateDir(theOutputDir);
   
  -                     // Get the files found in the "cextension" directory
  -                     const FileNameVectorType        files = 
h.getTestFileNames(h.args.base, currentDir, true);
   
  -                     // TestCase1 is used to verify correct functioning of 
the default extension functions
  -                     TestCase1(xalan, files[0], currentDir, logFile, h);     
// Difference function
  -                     TestCase1(xalan, files[1], currentDir, logFile, h);     
// Distinct 
  -                     TestCase1(xalan, files[2], currentDir, logFile, h);     
// Evaluate 
  -                     TestCase1(xalan, files[3], currentDir, logFile, h);     
// HasSameNodes 
  -                     TestCase1(xalan, files[4], currentDir, logFile, h);     
// Intersection 
  -                     TestCase1(xalan, files[5], currentDir, logFile, h);     
// NodeSet01 - basic testing
  -                     TestCase1(xalan, files[6], currentDir, logFile, h);     
// NodeSet02 - extensive RTF testing. 
  -
  -                     const XalanDOMString    
theNamespace("http://xml.apache.org/xalan";);
  -
  -                     // These testcases are used to test the 
Install/Uninstall Function API's of the transformer.
  -                     TestCase2(xalan, files[5], currentDir, theNamespace, 
logFile, h);
  -                     TestCase3(xalan, files[5], currentDir, theNamespace, 
logFile, h);
  -                     TestCase4(xalan, files[5], currentDir, theNamespace, 
logFile, h);
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
   
  -                     logFile.logTestCaseClose("Done", "Pass");
  -                     h.reportPassFail(logFile, UniqRunid);
  -                             
  -                     logFile.logTestFileClose("C++ Extension Testing: ", 
"Done");
  -                     logFile.close();
  +     int     theResult = 0;
   
  -                     h.analyzeResults(xalan, resultsFile);
  -             }
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
   
                XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
        }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
   
  -     return 0;
  +             theResult = -1;
  +     }
   
  +     return theResult;
   }
  
  
  
  1.17      +83 -51    xml-xalan/c/Tests/InputSource/inputsource.cpp
  
  Index: inputsource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/InputSource/inputsource.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- inputsource.cpp   26 Jul 2002 15:37:39 -0000      1.16
  +++ inputsource.cpp   30 Aug 2002 23:58:29 -0000      1.17
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -58,7 +58,7 @@
   
   #include <iostream>
   #include <strstream>
  -#include <stdio.h>
  +#include <cstdio>
   #include <direct.h>
   #include <vector>
   
  @@ -67,8 +67,10 @@
   #include <crtdbg.h>
   #endif
   
  +
  +
   // XERCES HEADERS...
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   
   
  @@ -356,15 +358,11 @@
   
   
   int
  -main(
  +runTests(
                        int                             argc,
                        const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  +     int                             theResult = 0;
   
        HarnessInit             xmlPlatformUtils;
   
  @@ -376,9 +374,6 @@
   
        if (h.getParams(argc, argv, "INPUTSOURCE-RESULTS") == true)
        {
  -             // Call the static initializers...
  -             XalanTransformer::initialize();
  -
                // Generate and Initialize Unique result logfile, and get drive 
designation
                //
                const XalanDOMString UniqRunid = h.generateUniqRunid();
  @@ -391,52 +386,48 @@
   
                try
                {
  -                     // Call the static initializers...
  -                     //
  -                     XalanTransformer xalan;
  +                     XalanTransformer        xalan;
   
  -                     {
  -                             XalanDOMString          fileName;
  +                     XalanDOMString          fileName;
                                        
  -                             // Get testfiles from the capi\smoke directory, 
create output directory, .
  -                             //
  -                             const XalanDOMString  currentDir("smoke");
  -                             const XalanDOMString  theOutputDir = 
h.args.output + currentDir;
  +                     // Get testfiles from the capi\smoke directory, create 
output directory, .
  +                     //
  +                     const XalanDOMString  currentDir("smoke");
  +                     const XalanDOMString  theOutputDir = h.args.output + 
currentDir;
                                
  -                             h.checkAndCreateDir(theOutputDir);
  +                     h.checkAndCreateDir(theOutputDir);
   
  -                             // Get the single file found in the "smoke" 
directory, and run tests.
  -                             //
  -                             const FileNameVectorType        files = 
h.getTestFileNames(h.args.base, currentDir, true);
  -                             logFile.logTestCaseInit(currentDir);
  +                     // Get the single file found in the "smoke" directory, 
and run tests.
  +                     //
  +                     const FileNameVectorType        files = 
h.getTestFileNames(h.args.base, currentDir, true);
  +                     logFile.logTestCaseInit(currentDir);
   
  -                             for(FileNameVectorType::size_type i = 0; i < 
files.size(); ++i)
  -                             {
  -                                     fileName = files[i];
  -                                     h.data.testOrFile = fileName;
  -
  -                                     // Set up the input/output files.
  -                                     const XalanDOMString  theXSLFile= 
h.args.base + currentDir + FileUtility::s_pathSep + fileName;
  -                                     const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
  -                                     h.data.xmlFileURL = theXMLFile;
  -                                     h.data.xslFileURL = theXSLFile;
  -
  -                                     // Set the gold file.
  -                                     XalanDOMString  theGoldFile = 
h.args.gold + currentDir + FileUtility::s_pathSep + fileName;
  -                                     theGoldFile = 
h.generateFileName(theGoldFile, "out");
  -                                             
  -                                     // Execute the test cases. 
  -                                     //
  -                                     testCase1(xalan, logFile, theXMLFile, 
theXSLFile, theOutputDir, theGoldFile, h);
  -                                     testCase2(xalan, logFile, theOutputDir, 
theGoldFile, h);
  -                                     testCase3(logFile, theOutputDir, 
theGoldFile, h);
  -                                     testCase4(xalan, logFile, theOutputDir, 
theGoldFile, h);
  -                                     testCase5(xalan, logFile, theXMLFile, 
theXSLFile, theOutputDir, theGoldFile, h);
  -                             }
  +                     for(FileNameVectorType::size_type i = 0; i < 
files.size(); ++i)
  +                     {
  +                             fileName = files[i];
  +                             h.data.testOrFile = fileName;
   
  -                             logFile.logTestCaseClose("Done", "Pass");       
  +                             // Set up the input/output files.
  +                             const XalanDOMString  theXSLFile= h.args.base + 
currentDir + FileUtility::s_pathSep + fileName;
  +                             const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
  +                             h.data.xmlFileURL = theXMLFile;
  +                             h.data.xslFileURL = theXSLFile;
  +
  +                             // Set the gold file.
  +                             XalanDOMString  theGoldFile = h.args.gold + 
currentDir + FileUtility::s_pathSep + fileName;
  +                             theGoldFile = h.generateFileName(theGoldFile, 
"out");
  +                                             
  +                             // Execute the test cases. 
  +                             //
  +                             testCase1(xalan, logFile, theXMLFile, 
theXSLFile, theOutputDir, theGoldFile, h);
  +                             testCase2(xalan, logFile, theOutputDir, 
theGoldFile, h);
  +                             testCase3(logFile, theOutputDir, theGoldFile, 
h);
  +                             testCase4(xalan, logFile, theOutputDir, 
theGoldFile, h);
  +                             testCase5(xalan, logFile, theXMLFile, 
theXSLFile, theOutputDir, theGoldFile, h);
                        }
   
  +                     logFile.logTestCaseClose("Done", "Pass");       
  +
                        h.reportPassFail(logFile, UniqRunid);
                        logFile.logTestFileClose("ISource Testing: ", "Done");
                        logFile.close();
  @@ -446,10 +437,51 @@
                catch(...)
                {
                        cerr << "Exception caught!!!" << endl << endl;
  +
  +                     theResult = -1;
                }
  +     }
  +
  +     return theResult;
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
   
                XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
        }
   
  -     return 0;
  +     return theResult;
   }
  
  
  
  1.21      +51 -14    xml-xalan/c/Tests/Memory/Stressmem.cpp
  
  Index: Stressmem.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Memory/Stressmem.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Stressmem.cpp     28 Feb 2002 06:08:57 -0000      1.20
  +++ Stressmem.cpp     30 Aug 2002 23:58:29 -0000      1.21
  @@ -130,17 +130,12 @@
   
   
   int
  -main(int                     argc,
  -      const char*    argv[])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  +     int     theResult = 0;
   
  -     // Set the program help string,  then get the command line parameters.
  -     //
        try
        {
                HarnessInit             xmlPlatformUtils;
  @@ -151,6 +146,8 @@
   
                bool setGold = false;
   
  +             // Set the program help string,  then get the command line 
parameters.
  +             //
                if (h.getParams(argc, argv, "MEM-RESULTS", setGold) == true)
                {
                        // Get the list of Directories that are below perf
  @@ -168,9 +165,6 @@
   
                        logFile.logTestFileInit("Memory Testing - Memory leaks 
detected during ConformanceTests. ");
   
  -                     // Call the static initializers...
  -                     XalanTransformer::initialize();
  -
                        try
                        {
                                bool foundDir = false;
  @@ -240,15 +234,58 @@
                        catch(...)
                        {
                                cerr << "Exception caught!!!" << endl << endl;
  +
  +                             theResult  = -1;
                        }
                }
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization of testing harness failed!" << endl << 
endl;
  +
  +             theResult  = -1;
  +     }
  +
  +     return theResult;
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
   
                XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
        }
        catch(...)
        {
  -             cerr << "Initialization failed!!!" << endl << endl;
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
        }
   
  -     return 0;
  +     return theResult;
   }
  
  
  
  1.20      +55 -18    xml-xalan/c/Tests/Params/Params.cpp
  
  Index: Params.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Params/Params.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Params.cpp        28 Feb 2002 06:08:57 -0000      1.19
  +++ Params.cpp        30 Aug 2002 23:58:29 -0000      1.20
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -115,15 +115,13 @@
   }
   
   
  +
   int
  -main(int                     argc,
  -      const char*    argv [])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  +     int                             theResult = 0;
   
        HarnessInit             xmlPlatformUtils;
   
  @@ -148,23 +146,23 @@
                {
                        cout << "Invalid base directory - " << 
c_str(TranscodeToLocalCodePage(extDir)) << endl;
                        cout << h.args.getHelpMessage();
  -                     return 0;
  -             }
   
  -             // Call the static initializers...
  -             XalanTransformer::initialize();
  +                     theResult = -1;
  +             }
  +             else
                {
                        XalanTransformer        xalan;
   
                        // Generate Unique Run id. (Only used to name the 
result logfile.)
  -                     const XalanDOMString UniqRunid = h.generateUniqRunid();
  +                     const XalanDOMString    UniqRunid = 
h.generateUniqRunid();
   
                        // Defined basic constants for file manipulation
  -                     const XalanDOMString  drive(h.getDrive());
  -                     const XalanDOMString  resultFilePrefix("params");
  -                     const XalanDOMString  resultsFile(drive + h.args.output 
+ resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +                     const XalanDOMString    drive(h.getDrive());
  +                     const XalanDOMString    resultFilePrefix("params");
  +                     const XalanDOMString    resultsFile(drive + 
h.args.output + resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
                        
                        XMLFileReporter logFile(resultsFile);
  +
                        logFile.logTestFileInit("Param Testing: Testing ability 
to pass parameters to stylesheets. ");
   
                        try
  @@ -272,10 +270,11 @@
                                                                
                                logFile.logTestCaseClose("Done", "Pass");
                        }
  -
                        catch(...)
                        {
                                cerr << "Exception caught!!!" << endl << endl;
  +
  +                             theResult = -1;
                        }
   
                        h.reportPassFail(logFile, UniqRunid);
  @@ -284,10 +283,48 @@
   
                        h.analyzeResults(xalan, resultsFile);
                }
  +     }
  +
  +     return theResult;
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
   
                XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
        }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
   
  -     return 0;
  +             theResult = -1;
  +     }
   
  +     return theResult;
   }
  
  
  
  1.16      +235 -209  xml-xalan/c/Tests/PerfT/perft.cpp
  
  Index: perft.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/PerfT/perft.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- perft.cpp 22 May 2002 16:02:16 -0000      1.15
  +++ perft.cpp 30 Aug 2002 23:58:29 -0000      1.16
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -149,16 +149,13 @@
                 << endl;
   }
   
  +
  +
   int
  -main(int                     argc,
  -      const char*    argv[])
  +runTests(
  +                     int                             argc,
  +                     const char*             argv[])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  -
        HarnessInit             xmlPlatformUtils;
   
        FileUtility             h;
  @@ -168,238 +165,267 @@
        setHelp(h);
   
        bool setGold = false;
  +
  +     const XalanDOMString    
processorType(XALAN_STATIC_UCODE_STRING("XalanC"));
  +     bool skip = true;               // Default will skip long tests
  +
  +     if (h.getParams(argc, argv, "PERFT-RESULTS", setGold) == true)
        {
  -             const XalanDOMString    
processorType(XALAN_STATIC_UCODE_STRING("XalanC"));
  -             bool skip = true;               // Default will skip long tests
  +             XalanTransformer xalan;
   
  -             if (h.getParams(argc, argv, "PERFT-RESULTS", setGold) == true)
  +             // Generate Unique Run id and processor info
  +             const XalanDOMString UniqRunid = h.generateUniqRunid();
  +
  +
  +             // Defined basic constants for file manipulation and open 
results file
  +             const XalanDOMString  resultFilePrefix("cpp");
  +             const XalanDOMString  resultsFile(h.args.output + 
resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +
  +
  +             XMLFileReporter logFile(resultsFile);
  +             logFile.logTestFileInit("Performance Testing - Reports various 
performance metrics using the Transformer");
  +
  +             // Get the list of sub-directories below "base" and iterate 
through them
  +             bool foundDir = false;          // Flag indicates directory 
found. Used in conjunction with -sub cmd-line arg.
  +             const FileNameVectorType dirs = 
h.getDirectoryNames(h.args.base);
  +
  +             for(FileNameVectorType::size_type       j = 0; j < dirs.size(); 
j++)
                {
  -                     //
  -                     // Call the static initializers for xerces and xalan, 
and create a transformer
  -                     //
  -                     XalanTransformer::initialize();
  +                     // Run specific category of files from given directory
  +                     if (length(h.args.sub) > 0 && !equals(dirs[j], 
h.args.sub))
                        {
  -                             XalanTransformer xalan;
  +                             continue;
  +                     }
  +
  +                     cout << "Processing files in Directory: " << dirs[j] << 
endl;
  +
  +                     // Check that output directory is there.
  +                     const XalanDOMString  theOutputDir = h.args.output + 
dirs[j];
  +                     h.checkAndCreateDir(theOutputDir);
  +
  +                                     
  +                     // Indicate that directory was processed and get test 
files from the directory
  +                     foundDir = true;
  +                     const FileNameVectorType files = 
h.getTestFileNames(h.args.base, dirs[j], false);
  +                     logFile.logTestCaseInit(XalanDOMString("Performance 
Directory: ") + dirs[j] ); 
   
  -                             // Generate Unique Run id and processor info
  -                             const XalanDOMString UniqRunid = 
h.generateUniqRunid();
  +                     const long      iterCount = h.args.iters;
   
  +                     for(FileNameVectorType::size_type i = 0; i < 
files.size(); i++)
  +                     {
  +                             // Define  variables used for timing and 
reporting ...
  +                             clock_t startTime, endTime, accmTime, avgEtoe;
  +                             double timeinMilliseconds = 0, theAverage =0;
  +                             int transformResult = 0;
  +                             Hashtable attrs;
  +
  +                             
attrs.insert(Hashtable::value_type(XalanDOMString("idref"), files[i]));
  +                             
attrs.insert(Hashtable::value_type(XalanDOMString("UniqRunid"),UniqRunid));
  +                             
attrs.insert(Hashtable::value_type(XalanDOMString("processor"),processorType));
  +                             
logFile.addMetricToAttrs("Iterations",iterCount, attrs);
  +                                                             
  +                             if (h.args.skip)
  +                             {
  +                                     if (checkForExclusion(files[i]))
  +                                             continue;
  +                             }
   
  -                             // Defined basic constants for file 
manipulation and open results file
  -                             const XalanDOMString  resultFilePrefix("cpp");
  -                             const XalanDOMString  resultsFile(h.args.output 
+ resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +                             const XalanDOMString  theXSLFile= h.args.base + 
dirs[j] + FileUtility::s_pathSep + files[i];
  +                             const XalanDOMString  theXMLFile = 
h.generateFileName(theXSLFile,"xml");
   
  +                             const XalanDOMString  outbase =  h.args.output 
+ dirs[j] + FileUtility::s_pathSep + files[i]; 
  +                             const XalanDOMString  theOutputFile = 
h.generateFileName(outbase, "out");
   
  -                             XMLFileReporter logFile(resultsFile);
  -                             logFile.logTestFileInit("Performance Testing - 
Reports various performance metrics using the Transformer");
  +                             const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  +                             const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  +                             const XSLTResultTarget  
theResultTarget(theOutputFile);
  +
  +                             
attrs.insert(Hashtable::value_type(XalanDOMString("href"), theXSLFile));
  +                             cout << endl << files[i] << endl;
  +
  +                             // Time the parsing(compile) of the XSL 
stylesheet and report the results..
  +                             //
  +                             startTime = clock();
  +                             const XalanCompiledStylesheet*  compiledSS = 0;
  +                             xalan.compileStylesheet(xslInputSource, 
compiledSS);
  +                             endTime = clock();
   
  +                             if (compiledSS == 0)
  +                             {
  +                                     continue;
  +                             }
   
  -                             // Get the list of sub-directories below "base" 
and iterate through them
  -                             bool foundDir = false;          // Flag 
indicates directory found. Used in conjunction with -sub cmd-line arg.
  -                             const FileNameVectorType dirs = 
h.getDirectoryNames(h.args.base);
  +                             timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  +                             cout << "   XSL: " << timeinMilliseconds << " 
milliseconds, Parse" << endl;
  +                             
logFile.addMetricToAttrs("parsexsl",timeinMilliseconds, attrs); 
  +
  +                             // Time the parsing of the input XML and report 
the results..
  +                             //
  +                             startTime = clock();
  +                             const XalanParsedSource*        parsedSource = 
0;
  +                             xalan.parseSource(xmlInputSource, parsedSource);
  +                             endTime = clock();
   
  -                             for(FileNameVectorType::size_type       j = 0; 
j < dirs.size(); j++)
  +                             if (parsedSource == 0)
                                {
  -                                     // Run specific category of files from 
given directory
  -                                     if (length(h.args.sub) > 0 && 
!equals(dirs[j], h.args.sub))
  -                                     {
  -                                             continue;
  -                                     }
  +                                     continue;
  +                             }
   
  -                                     cout << "Processing files in Directory: 
" << dirs[j] << endl;
  +                             timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  +                             cout << "   XML: " << timeinMilliseconds << " 
milliseconds, Parse" <<endl;
  +                             
logFile.addMetricToAttrs("parsexml",timeinMilliseconds, attrs);
  +
  +                             // Perform One transform using parsed 
stylesheet and unparsed xml source, report results...
  +                             // 
  +                             startTime = clock();
  +                                     transformResult = 
xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  +                             endTime = clock();
  +                             if(!transformResult)
  +                             {
  +                                     timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  +                                     cout << endl << "   One: " << 
timeinMilliseconds << " w/Parsed XSL." << endl;
  +                                     logFile.addMetricToAttrs("single", 
timeinMilliseconds, attrs);  
  +                             }
  +                             else
  +                             {
  +                                     cout << xalan.getLastError();
  +                                     return -1;
  +                             }
   
  -                                     // Check that output directory is there.
  -                                     const XalanDOMString  theOutputDir = 
h.args.output + dirs[j];
  -                                     h.checkAndCreateDir(theOutputDir);
  +                             // Do One eTOe transform with no pre parsing of 
either xsl or xml files.
  +                             // And output metrics to console and result log
  +                             startTime = clock();
  +                                     transformResult = 
xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  +                             endTime = clock();
  +                             if(!transformResult)
  +                             {
  +                                     timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  +                                     cout << "   One: " << 
timeinMilliseconds << " eTOe." << endl;
  +                                     logFile.addMetricToAttrs("etoe", 
timeinMilliseconds, attrs);    
  +                             }
  +                             else
  +                             {
  +                                     cout << xalan.getLastError();
  +                                     return -1;
  +                             }
   
  +
  +                             // Perform multiple transforms and calculate 
the average time ..
  +                             // These are done 3 different ways.
  +                             //
  +                             // FIRST: Parsed XSL Stylesheet and Parsed XML 
Source.
  +                             //
  +                             accmTime = 0;
  +                             for(int j = 0; j < iterCount; ++j)
  +                             {       
  +                                     startTime = clock();
  +                                             transformResult = 
xalan.transform(*parsedSource, compiledSS, theResultTarget);
  +                                     endTime = clock();
                                        
  -                                     // Indicate that directory was 
processed and get test files from the directory
  -                                     foundDir = true;
  -                                     const FileNameVectorType files = 
h.getTestFileNames(h.args.base, dirs[j], false);
  -                                     
logFile.logTestCaseInit(XalanDOMString("Performance Directory: ") + dirs[j] ); 
  -
  -                                     const long      iterCount = 
h.args.iters;
  -
  -                                     for(FileNameVectorType::size_type i = 
0; i < files.size(); i++)
  -                                     {
  -                                             // Define  variables used for 
timing and reporting ...
  -                                             clock_t startTime, endTime, 
accmTime, avgEtoe;
  -                                             double timeinMilliseconds = 0, 
theAverage =0;
  -                                             int transformResult = 0;
  -                                             Hashtable attrs;
  -
  -                                             
attrs.insert(Hashtable::value_type(XalanDOMString("idref"), files[i]));
  -                                             
attrs.insert(Hashtable::value_type(XalanDOMString("UniqRunid"),UniqRunid));
  -                                             
attrs.insert(Hashtable::value_type(XalanDOMString("processor"),processorType));
  -                                             
logFile.addMetricToAttrs("Iterations",iterCount, attrs);
  -                                                             
  -                                             if (h.args.skip)
  -                                             {
  -                                                     if 
(checkForExclusion(files[i]))
  -                                                             continue;
  -                                             }
  -
  -                                             const XalanDOMString  
theXSLFile= h.args.base + dirs[j] + FileUtility::s_pathSep + files[i];
  -                                             const XalanDOMString  
theXMLFile = h.generateFileName(theXSLFile,"xml");
  -
  -                                             const XalanDOMString  outbase = 
 h.args.output + dirs[j] + FileUtility::s_pathSep + files[i]; 
  -                                             const XalanDOMString  
theOutputFile = h.generateFileName(outbase, "out");
  -
  -                                             const XSLTInputSource   
xslInputSource(c_wstr(theXSLFile));
  -                                             const XSLTInputSource   
xmlInputSource(c_wstr(theXMLFile));
  -                                             const XSLTResultTarget  
theResultTarget(theOutputFile);
  -
  -                                             
attrs.insert(Hashtable::value_type(XalanDOMString("href"), theXSLFile));
  -                                             cout << endl << files[i] << 
endl;
  -
  -                                             // Time the parsing(compile) of 
the XSL stylesheet and report the results..
  -                                             //
  -                                             startTime = clock();
  -                                             const XalanCompiledStylesheet*  
compiledSS = 0;
  -                                             
xalan.compileStylesheet(xslInputSource, compiledSS);
  -                                             endTime = clock();
  -
  -                                             if (compiledSS == 0)
  -                                             {
  -                                                     continue;
  -                                             }
  -
  -                                             timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  -                                             cout << "   XSL: " << 
timeinMilliseconds << " milliseconds, Parse" << endl;
  -                                             
logFile.addMetricToAttrs("parsexsl",timeinMilliseconds, attrs); 
  -
  -                                             // Time the parsing of the 
input XML and report the results..
  -                                             //
  -                                             startTime = clock();
  -                                             const XalanParsedSource*        
parsedSource = 0;
  -                                             
xalan.parseSource(xmlInputSource, parsedSource);
  -                                             endTime = clock();
  -
  -                                             if (parsedSource == 0)
  -                                             {
  -                                                     continue;
  -                                             }
  -
  -                                             timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  -                                             cout << "   XML: " << 
timeinMilliseconds << " milliseconds, Parse" <<endl;
  -                                             
logFile.addMetricToAttrs("parsexml",timeinMilliseconds, attrs);
  -
  -                                             // Perform One transform using 
parsed stylesheet and unparsed xml source, report results...
  -                                             // 
  -                                             startTime = clock();
  -                                                     transformResult = 
xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  -                                             endTime = clock();
  -                                             if(!transformResult)
  -                                             {
  -                                                     timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  -                                                     cout << endl << "   
One: " << timeinMilliseconds << " w/Parsed XSL." << endl;
  -                                                     
logFile.addMetricToAttrs("single", timeinMilliseconds, attrs);  
  -                                             }
  -                                             else
  -                                             {
  -                                                     cout << 
xalan.getLastError();
  -                                                     return 0;
  -                                             }
  -
  -                                             // Do One eTOe transform with 
no pre parsing of either xsl or xml files.
  -                                             // And output metrics to 
console and result log
  -                                             //
  -                                             startTime = clock();
  -                                                     transformResult = 
xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  -                                             endTime = clock();
  -                                             if(!transformResult)
  -                                             {
  -                                                     timeinMilliseconds = 
calculateElapsedTime(startTime, endTime);
  -                                                     cout << "   One: " << 
timeinMilliseconds << " eTOe." << endl;
  -                                                     
logFile.addMetricToAttrs("etoe", timeinMilliseconds, attrs);    
  -                                             }
  -                                             else
  -                                             {
  -                                                     cout << 
xalan.getLastError();
  -                                                     return 0;
  -                                             }
  -
  -
  -                                             // Perform multiple transforms 
and calculate the average time ..
  -                                             // These are done 3 different 
ways.
  -                                             //
  -                                             // FIRST: Parsed XSL Stylesheet 
and Parsed XML Source.
  -                                             //
  -                                             accmTime = 0;
  -                                             for(int j = 0; j < iterCount; 
++j)
  -                                             {       
  -                                                     startTime = clock();
  -                                                             transformResult 
= xalan.transform(*parsedSource, compiledSS, theResultTarget);
  -                                                     endTime = clock();
  -                                     
  -                                                     accmTime += endTime - 
startTime;
  -                                             }
  +                                     accmTime += endTime - startTime;
  +                             }
   
  -                                             theAverage = 
calculateAvgTime(accmTime, iterCount); 
  -                                             cout << endl << "   Avg: " << 
theAverage << " for " << iterCount << " iter's w/Parsed files" << endl;
  -                                             
logFile.addMetricToAttrs("avgparsedxml",theAverage, attrs);
  +                             theAverage = calculateAvgTime(accmTime, 
iterCount); 
  +                             cout << endl << "   Avg: " << theAverage << " 
for " << iterCount << " iter's w/Parsed files" << endl;
  +                             
logFile.addMetricToAttrs("avgparsedxml",theAverage, attrs);
                                
   
  -                                             // SECOND: Parsed Stylesheet 
and UnParsed XML Source.
  -                                             // This is currently how the 
XalanJ 2.0 is performing transforms
  -                                             //
  -                                             accmTime = 0;
  -                                             for(int k = 0; k < iterCount; 
++k)
  -                                             {
  -                                                     startTime = clock();
  -                                                             transformResult 
= xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  -                                                     endTime = clock();
  -                                     
  -                                                     accmTime += endTime - 
startTime;                                                
  -                                             }
  -                                             theAverage = 
calculateAvgTime(accmTime, iterCount);
  -                                             cout << "   Avg: " << 
theAverage << " for " << iterCount << " iter's w/UnParsed XML" << endl;
  -                                             
logFile.addMetricToAttrs("avgunparsedxml",theAverage, attrs);
  -
  -
  -                                             // THIRD: Neither Stylesheet 
nor XML Source are parsed.
  -                                             // Perform multiple etoe 
transforms and calculate the average ...
  -                                             //
  -                                             avgEtoe = 0;
  -                                             for(int jj = 0; jj < iterCount; 
++jj)
  -                                             {       
  -                                                     startTime = clock();
  -                                                             transformResult 
= xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  -                                                     endTime = clock();
  +                             // SECOND: Parsed Stylesheet and UnParsed XML 
Source.
  +                             // This is currently how the XalanJ 2.0 is 
performing transforms
  +                             //
  +                             accmTime = 0;
  +                             for(int k = 0; k < iterCount; ++k)
  +                             {
  +                                     startTime = clock();
  +                                             transformResult = 
xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  +                                     endTime = clock();
                                        
  -                                                     avgEtoe += endTime - 
startTime;                                         
  -                                             }
  -                                             theAverage = 
calculateAvgTime(avgEtoe,iterCount);
  +                                     accmTime += endTime - startTime;        
                                        
  +                             }
  +                             theAverage = calculateAvgTime(accmTime, 
iterCount);
  +                             cout << "   Avg: " << theAverage << " for " << 
iterCount << " iter's w/UnParsed XML" << endl;
  +                             
logFile.addMetricToAttrs("avgunparsedxml",theAverage, attrs);
   
  -                                             // Output average transform 
time to console and result log
  -                                             cout << "   Avg: " << 
theAverage << " for " << iterCount << " iter's of eToe" << endl;
  -                                             
logFile.addMetricToAttrs("avgetoe",theAverage, attrs);
   
  -                                             logFile.logElementWAttrs(10, 
"perf", attrs, "xxx");
  +                             // THIRD: Neither Stylesheet nor XML Source are 
parsed.
  +                             // Perform multiple etoe transforms and 
calculate the average ...
  +                             //
  +                             avgEtoe = 0;
  +                             for(int jj = 0; jj < iterCount; ++jj)
  +                             {       
  +                                     startTime = clock();
  +                                             transformResult = 
xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  +                                     endTime = clock();
  +                                     
  +                                     avgEtoe += endTime - startTime;         
                                
  +                             }
  +                             theAverage = 
calculateAvgTime(avgEtoe,iterCount);
   
  -                                             
xalan.destroyParsedSource(parsedSource);
  -                                             
xalan.destroyStylesheet(compiledSS);
  +                             // Output average transform time to console and 
result log
  +                             cout << "   Avg: " << theAverage << " for " << 
iterCount << " iter's of eToe" << endl;
  +                             logFile.addMetricToAttrs("avgetoe",theAverage, 
attrs);
   
  -                                     }
  +                             logFile.logElementWAttrs(10, "perf", attrs, 
"xxx");
   
  -                             
logFile.logTestCaseClose(XalanDOMString("Performance Directory: ") + dirs[j], 
XalanDOMString("Done") );
  -                             }
  +                             xalan.destroyParsedSource(parsedSource);
  +                             xalan.destroyStylesheet(compiledSS);
   
  -                     // Check to see if -sub cmd-line directory was 
processed correctly.
  -                     if (!foundDir)
  -                     {
  -                             cout << "Specified test directory: \"" << 
c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
                        }
   
  -                     h.reportPassFail(logFile, UniqRunid);
  -                     logFile.logTestFileClose("Performance", "Done");
  -                     logFile.close();
  +                     logFile.logTestCaseClose(XalanDOMString("Performance 
Directory: ") + dirs[j], XalanDOMString("Done") );
  +             }
   
  -                     }
  +             // Check to see if -sub cmd-line directory was processed 
correctly.
  +             if (!foundDir)
  +             {
  +                     cout << "Specified test directory: \"" << 
c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
                }
  -     
  -             XalanTransformer::terminate();
  +
  +             h.reportPassFail(logFile, UniqRunid);
  +             logFile.logTestFileClose("Performance", "Done");
  +             logFile.close();
        }
   
        return 0;
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
  +
  +             XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
  +     }
  +
  +     return theResult;
   }
  
  
  
  1.22      +11 -1     xml-xalan/c/Tests/Threads/ThreadTest.cpp
  
  Index: ThreadTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Threads/ThreadTest.cpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ThreadTest.cpp    16 May 2002 18:42:03 -0000      1.21
  +++ ThreadTest.cpp    30 Aug 2002 23:58:29 -0000      1.22
  @@ -560,6 +560,7 @@
                                // Initialize Xalan...
                                XalanTransformer::initialize();
   
  +                             try
                                {
                                        // Create a XalanTransformer.  We won't 
actually use this to transform --
                                        // it's just acting as a factory for 
the compiled stylesheet and
  @@ -582,16 +583,25 @@
   
                                        doThreads(threadCount, fContinuous);
                                }
  +                             catch(...)
  +                             {
  +                                     cerr << "Exception caught!!!"
  +                                              << endl
  +                                              << endl;
  +                             }
   
                                // Terminate Xalan...
                                XalanTransformer::terminate();
   
                                // Terminate Xerces...
                                XMLPlatformUtils::Terminate();
  +
  +                             // Clean up the ICU, if it's integrated.
  +                             XalanTransformer::ICUCleanUp();
                        }
                        catch(...)
                        {
  -                             cerr << "Exception caught!!!"
  +                             cerr << "Initialization failed!!!"
                                         << endl
                                         << endl;
                        }
  
  
  
  1.7       +57 -28    xml-xalan/c/Tests/Transformer/TestXalanTransformer.cpp
  
  Index: TestXalanTransformer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Transformer/TestXalanTransformer.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestXalanTransformer.cpp  12 Apr 2002 06:47:34 -0000      1.6
  +++ TestXalanTransformer.cpp  30 Aug 2002 23:58:29 -0000      1.7
  @@ -83,8 +83,10 @@
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  -using std::ostrstream;
  -using std::cout;
  +     using std::cerr;
  +     using std::cout;
  +     using std::endl;
  +     using std::ostrstream;
   #endif
   
   #else
  @@ -120,17 +122,10 @@
   
   
   int
  -main(
  +runTests(
                        int                             /* argc */,
  -                     const char*             /* argv[] */)
  +                     const char*             /* argv*/ [])
   {
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  -
  -     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  -     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  -#endif
  -
        const char* const               theXMLFileName = 
"d:\\xslt\\xsl-test\\perf\\basic\\basic-all_well.xml";
        const char* const               theXSLFileName = 
"d:\\xslt\\xsl-test\\perf\\basic\\basic-all_well.xsl";
        const char* const               theOutFileName = 
"d:\\Transformer-Results\\basic-all_well.out";
  @@ -146,12 +141,6 @@
   
   #if defined(TEST_XALAN_CPP)
   
  -     // Call the static initializer for Xerces.
  -     XMLPlatformUtils::Initialize();
  -
  -    // Initialize Xalan.
  -    XalanTransformer::initialize();
  -
        XalanTransformer xalan;
   
        const XalanCompiledStylesheet*  css = 0;
  @@ -236,13 +225,9 @@
                }
        }
   
  -   // Terminate Xalan.
  -     XalanTransformer::terminate();
  -
  -     // Call the static terminator for Xerces.
  -     XMLPlatformUtils::Terminate();
  -
   #else
  +     // $$$ ToDo: This C code is broken, because it returns without
  +     // shutting things down!!!!
        XalanInitialize();
   
        XalanHandle xalan = CreateXalanTransformer();
  @@ -265,7 +250,7 @@
                return 0;       
        }
   
  -     for(int i=0; i<2; ++i)
  +     for(int i = 0; i < 2; ++i)
        {
                if(XalanTransformToFile(theXMLFileName, theXSLFileName, 
theOutFileName, xalan))
                {
  @@ -274,7 +259,7 @@
                        return 0;       
                }
   
  -             char*           theOutput;
  +             char*   theOutput;
   
                if(XalanTransformToData(theXMLFileName2, theXSLFileName2, 
&theOutput, xalan))
                {
  @@ -341,13 +326,57 @@
                puts(theOutput);
   
                XalanFreeData(theOutput);
  -
        }
   
        DeleteXalanTransformer(xalan);
   
  -     XalanTerminate();
  +     // Terminate Xerces and Xalan, and clean up the ICU...
  +     XalanTerminate(1);
   #endif
   
        return 0;
  -}
  \ No newline at end of file
  +}
  +
  +
  +
  +int
  +main(
  +                     int                             argc,
  +                     const char*             argv[])
  +{
  +#if !defined(NDEBUG) && defined(_MSC_VER)
  +     _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | 
_CRTDBG_LEAK_CHECK_DF);
  +     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  +     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  +#endif
  +
  +     int     theResult = 0;
  +
  +#if defined(TEST_XALAN_CPP)
  +     try
  +     {
  +             // Call the static initializers for xerces and xalan, and 
create a transformer
  +             //
  +             XMLPlatformUtils::Initialize();
  +
  +             XalanTransformer::initialize();
  +
  +             theResult = runTests(argc, argv);
  +
  +             // Terminate everything...
  +             XalanTransformer::terminate();
  +
  +             XMLPlatformUtils::Terminate();
  +
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "Initialization failed!" << endl << endl;
  +
  +             theResult = -1;
  +     }
  +#endif
  +
  +     return theResult;
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to