dbertoni    01/12/03 13:28:56

  Modified:    c/Tests/Harness XMLFileReporter.hpp XMLFileReporter.cpp
                        FileUtility.hpp FileUtility.cpp
  Log:
  Cross-platform fixes.
  
  Revision  Changes    Path
  1.8       +8 -4      xml-xalan/c/Tests/Harness/XMLFileReporter.hpp
  
  Index: XMLFileReporter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/XMLFileReporter.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLFileReporter.hpp       2001/09/26 13:12:23     1.7
  +++ XMLFileReporter.hpp       2001/12/03 21:28:55     1.8
  @@ -70,14 +70,18 @@
   /**
    * Reporter that saves output to a simple XML-format file.  
    * @author [EMAIL PROTECTED]
  - * @version $Id: XMLFileReporter.hpp,v 1.7 2001/09/26 13:12:23 pauldick Exp $
  + * @version $Id: XMLFileReporter.hpp,v 1.8 2001/12/03 21:28:55 dbertoni Exp $
    */
   
  -#if defined HARNESS_EXPORTS
  +#if !defined(WIN32)
  +#define HARNESS_API
  +#else
  +#if defined(HARNESS_EXPORTS)
   #define HARNESS_API __declspec(dllexport)
   #else
   #define HARNESS_API __declspec(dllimport)
   #endif
  +#endif
   
   
   #if defined(XALAN_NO_NAMESPACES)
  @@ -103,7 +107,7 @@
        XMLFileReporter(const XalanDOMString& fileName);
   
        // Construct and initialize this reporter with specified filename.
  -     XMLFileReporter::XMLFileReporter(const char* fileName);
  +     XMLFileReporter(const char* fileName);
   
        // Initialize this XMLFileReporter.  Must be called before attempting 
to log anything.
        bool initialize();
  @@ -238,7 +242,7 @@
   
        void logElement(int level, const XalanDOMString& element, const 
XalanDOMString& msg);
   
  -     void XMLFileReporter::logElement(const XalanDOMString& element, const 
XalanDOMString& msg);
  +     void logElement(const XalanDOMString& element, const XalanDOMString& 
msg);
        /**
        * Report an arbitrary XalanDOMString to result file with specified 
severity.  
        * <P>Appends and prepends \\n newline characters at the start and 
  
  
  
  1.12      +2 -2      xml-xalan/c/Tests/Harness/XMLFileReporter.cpp
  
  Index: XMLFileReporter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/XMLFileReporter.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLFileReporter.cpp       2001/10/19 18:07:04     1.11
  +++ XMLFileReporter.cpp       2001/12/03 21:28:56     1.12
  @@ -336,10 +336,10 @@
                sprintf(tmp, "%d", level);
           printToFile(STATISTIC_HDR + tmp + "\" " + ATTR_DESC + "=\"" + 
escapestring(msg) + "\">");
                
  -             sprintf(tmp, "%d", lVal);
  +             sprintf(tmp, "%ld", lVal);
                printToFile("<" + ELEM_LONGVAL + ">" + tmp + "</" + 
ELEM_LONGVAL + ">");
                
  -             sprintf(tmp, "%d", dVal);
  +             sprintf(tmp, "%f", dVal);
           printToFile("<" + ELEM_DOUBLEVAL + ">" + tmp + "</" + ELEM_DOUBLEVAL 
+ ">");
           
                printToFile("</" + ELEM_STATISTIC + ">");
  
  
  
  1.21      +11 -2     xml-xalan/c/Tests/Harness/FileUtility.hpp
  
  Index: FileUtility.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/FileUtility.hpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- FileUtility.hpp   2001/11/30 23:55:39     1.20
  +++ FileUtility.hpp   2001/12/03 21:28:56     1.21
  @@ -99,14 +99,19 @@
   /**
    * Utility call that extracts test file names from testsuite.  
    * @author Paul [EMAIL PROTECTED]
  - * @version $Id: FileUtility.hpp,v 1.20 2001/11/30 23:55:39 dbertoni Exp $
  + * @version $Id: FileUtility.hpp,v 1.21 2001/12/03 21:28:56 dbertoni Exp $
    */
   
  -#if defined HARNESS_EXPORTS
  +#if !defined(WIN32)
  +#define HARNESS_API
  +#else
  +#if defined(HARNESS_EXPORTS)
   #define HARNESS_API __declspec(dllexport)
   #else
   #define HARNESS_API __declspec(dllimport)
   #endif
  +#endif
  +
   
   // Misc typedefs and Global variables.
   // These structures hold vectors of directory names and file names.
  @@ -120,7 +125,11 @@
   const XalanDOMString processorType(XALAN_STATIC_UCODE_STRING("XalanC"));
   const XalanDOMString XSLSuffix(XALAN_STATIC_UCODE_STRING(".xsl"));
   const XalanDOMString XMLSuffix(XALAN_STATIC_UCODE_STRING(".xml"));
  +#if defined(WIN32)
  +const XalanDOMString pathSep(XALAN_STATIC_UCODE_STRING("/"));
  +#else
   const XalanDOMString pathSep(XALAN_STATIC_UCODE_STRING("\\"));
  +#endif
   
   // This class is exported from the Harness.dll
   class HARNESS_API FileUtility 
  
  
  
  1.26      +31 -16    xml-xalan/c/Tests/Harness/FileUtility.cpp
  
  Index: FileUtility.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/FileUtility.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- FileUtility.cpp   2001/11/30 23:55:39     1.25
  +++ FileUtility.cpp   2001/12/03 21:28:56     1.26
  @@ -7,17 +7,23 @@
   * Rights for U.S. government users and applicable export regulations.
   */
   
  -#include <stdlib.h>
  +#include <cstdlib>
   #include <cstdio>
   #include <ctime>
   #include <vector>
  -#include <string.h>
  -#include <time.h>
  +#include <climits>
  +#include <cstring>
   
   // Added for directory creation 
   #include <strstream>
  -#include <stdio.h>
  +#if defined(WIN32)
   #include <direct.h>
  +#define PATH_MAX _MAX_PATH
  +#define chdir _chdir
  +#define getcwd _getcwd
  +#else
  +#include <unistd.h>
  +#endif
   
   
   #if defined(XALAN_OLD_STREAM_HEADERS)
  @@ -32,7 +38,7 @@
   
   // XERCES HEADERS...
   //   Are included by HarnessInit.hpp
  -#include <HarnessInit.hpp>
  +#include "HarnessInit.hpp"
   #include <sax/SAXException.hpp>
   
   // XALAN HEADERS...
  @@ -56,7 +62,15 @@
        "NOTATION_NODE"};
   
   
  -XalanDOMString FileUtility::getDrive()
  +#if !defined(WIN32)
  +XalanDOMString
  +FileUtility::getDrive()
  +{
  +     return XalanDOMString();
  +}
  +#else
  +XalanDOMString
  +FileUtility::getDrive()
   {
        char temp[2];
        
  @@ -70,6 +84,7 @@
        return(XalanDOMString(temp));
   
   }
  +#endif
   
   //   This routine retrieves test file names from specified directories.
   //   Inputs: baseDir:        typically "conf" or "perf"
  @@ -125,13 +140,13 @@
   
   bool FileUtility::checkDir(const XalanDOMString&     directory )
   {
  -char buffer[_MAX_PATH];
  +     char buffer[PATH_MAX];
   
  -     _getcwd( buffer, _MAX_PATH );
  +     getcwd(buffer, PATH_MAX);
   
  -     if ( _chdir(c_str(TranscodeToLocalCodePage(directory))) )
  +     if ( chdir(c_str(TranscodeToLocalCodePage(directory))) )
        {
  -             _chdir(buffer);
  +             chdir(buffer);
                return false;
        }
        else
  @@ -143,11 +158,11 @@
   
   void FileUtility::checkAndCreateDir(const XalanDOMString&    directory)
   {
  -     char buffer[_MAX_PATH];
  +     char buffer[PATH_MAX];
   
  -     _getcwd( buffer, _MAX_PATH );
  +     getcwd(buffer, PATH_MAX);
   
  -     if ( (_chdir(c_str(TranscodeToLocalCodePage(directory)))) )
  +     if ( (chdir(c_str(TranscodeToLocalCodePage(directory)))) )
        {
                //cout << "Couldn't change to " << directory << ", will create 
it." << endl;
                if ( !(_mkdir(c_str(TranscodeToLocalCodePage(directory)))))
  @@ -156,7 +171,7 @@
                }
        }
   
  -     _chdir(buffer);
  +     chdir(buffer);
   }
   
   /*   This routine generates file names based on the provide suffix
  @@ -1085,8 +1100,8 @@
   
        // Generate the input and output file names.
        const XalanDOMString  theHTMLFile = 
generateFileName(resultsFile,"html");
  -     const XalanDOMString  theStylesheet = data.testBase + 
XalanDOMString("\cconf.xsl");
  -     const XalanDOMString  theXMLSource = data.testBase + 
XalanDOMString("\cconf.xml");
  +     const XalanDOMString  theStylesheet = data.testBase + 
XalanDOMString("cconf.xsl");
  +     const XalanDOMString  theXMLSource = data.testBase + 
XalanDOMString("cconf.xml");
   
        // Create the InputSources and ResultTarget.
        const XSLTInputSource   xslInputSource(c_wstr(theStylesheet));
  
  
  

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

Reply via email to