Thanks Bill. We'll try to get those in next week. For the OS/2 specific
files, can you just send them as is, as attachements? I'll stick them in
for you.
----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]
Bill Schindler <[EMAIL PROTECTED]> on 03/17/2000 03:52:26 PM
Please respond to [EMAIL PROTECTED]
To: Xerces-Dev <[EMAIL PROTECTED]>
cc:
Subject: [Xerces-C] Patches for OS/2 port
Now that 1.1.0 is out, I'm re-synchronizing my patches for the OS/2 port.
The following patches are for existing files in the CVS tree. This doesn't
include any new files, so there's more to follow. I wanted to get patches
for
existing files in so that I don't have to keep hand-merging updates. (If my
email program scrags the indenting, let me know and I'll resend these
patches as
an attachment.)
Index: OS2PlatformUtils.cpp
===================================================================
RCS file:
/home/cvspublic/xml-xerces/c/src/util/Platforms/OS2/OS2PlatformUtils.cpp,v
retrieving revision 1.4
diff -u -r1.4 OS2PlatformUtils.cpp
--- OS2PlatformUtils.cpp 2000/03/02 21:10:37 1.4
+++ OS2PlatformUtils.cpp 2000/03/17 22:43:40
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
+ *
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -86,29 +86,39 @@
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#define INCL_DOSMISC
+#define INCL_DOSFILEMGR
#include <util/PlatformUtils.hpp>
#include <util/RuntimeException.hpp>
#include <util/Janitor.hpp>
+#include <util/XMLString.hpp>
#include <util/XercesDefs.hpp>
#include <stdio.h>
#include <stdlib.h>
-#include <IO.h>
-#include <OS2.h>
+#include <io.h>
+#if defined(XML_USE_ICU_TRANSCODER)
+ #include <util/Transcoders/ICU/ICUTransService.hpp>
+#elif defined(XML_USE_ICONV_TRANSCODER)
+ #include <util/Transcoders/Iconv/IconvTransService.hpp>
+#else
+ #error A transcoding service must be chosen
+#endif
+#if defined(XML_USE_INMEMORY_MSGLOADER)
+ #include <util/MsgLoaders/InMemory/InMemMsgLoader.hpp>
+#else
+ #error A message loading service must be chosen
+#endif
+#if defined(__IBMCPP__)
+#include <builtin.h>
+#endif
+#include <OS2.h>
-//
---------------------------------------------------------------------------
-// Local Methods
-//
---------------------------------------------------------------------------
-static void WriteCharStr( FILE* stream, const char* const toWrite)
-{
- if (!fputs(toWrite, stream))
- {
- throw XMLPlatformUtilsException("Could not write to
standard
out/err");
- }
-}
+// -----------------------------------------------------------------------
+// File methods
+// -----------------------------------------------------------------------
static void WriteUStrStdErr( const XMLCh* const toWrite)
{
char* tmpVal = XMLString::transcode(toWrite);
@@ -247,7 +257,7 @@
// Get the current position
int curPos = ftell( (FILE*)theFile);
if (curPos == -1)
- throw XMLPlatformUtilsException("XMLPlatformUtils::curFilePos -
Could
not get current pos");
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::File_CouldNotGetCurPos);
return (unsigned int)curPos;
}
@@ -255,32 +265,24 @@
void XMLPlatformUtils::closeFile(FileHandle theFile)
{
if (fclose((FILE*)theFile))
- throw XMLPlatformUtilsException("XMLPlatformUtils::closeFile -
Could
not close the file handle");
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::File_CouldNotCloseFile);
}
unsigned int XMLPlatformUtils::fileSize(FileHandle theFile)
{
- // Get the current position
- long int curPos = ftell((FILE*)theFile);
- if (curPos == -1)
- throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize -
Could
not get current pos");
-
- // Seek to the end and save that value for return
- if (fseek( (FILE*)theFile, 0, SEEK_END) )
- throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize -
Could
not seek to end");
-
- long int retVal = ftell( (FILE*)theFile);
- if (retVal == -1)
- throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize -
Could
not get the file size");
+ return (unsigned int)filelength(fileno((FILE *)theFile));
+}
- // And put the pointer back
- if (fseek( (FILE*)theFile, curPos, SEEK_SET) )
- throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize -
Could
not seek back to original pos");
+FileHandle XMLPlatformUtils::openFile(const char* const fileName)
+{
+ FileHandle retVal = (FILE*)fopen( fileName , "rb" );
- return (unsigned int)retVal;
+ if (retVal == NULL)
+ return 0;
+ return retVal;
}
-FileHandle XMLPlatformUtils::openFile(const unsigned short* const
fileName)
+FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
const char* tmpFileName = XMLString::transcode(fileName);
ArrayJanitor<char> janText((char*)tmpFileName);
@@ -290,284 +292,394 @@
return 0;
return retVal;
}
+
+FileHandle XMLPlatformUtils::openStdInHandle()
+{
+ return (FileHandle)fdopen(dup(0), "rb");
+}
-unsigned int
-XMLPlatformUtils::readFileBuffer( FileHandle theFile
- , const unsigned int toRead
- , XMLByte* const toFill)
-// TBT
+unsigned int XMLPlatformUtils::readFileBuffer ( FileHandle theFile
+ , const unsigned int toRead
+ , XMLByte* const toFill )
{
size_t noOfItemsRead = fread( (void*) toFill, 1, toRead,
(FILE*)theFile);
if(ferror((FILE*)theFile))
{
- throw XMLPlatformUtilsException("XMLPlatformUtils::readFileBuffer
-
Read failed");
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::File_CouldNotReadFromFile);
}
return (unsigned int)noOfItemsRead;
}
-
void XMLPlatformUtils::resetFile(FileHandle theFile)
-// TBT
{
// Seek to the start of the file
if (fseek((FILE*)theFile, 0, SEEK_SET) )
- throw XMLPlatformUtilsException("XMLPlatformUtils::resetFile -
Could
not seek to beginning");
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::File_CouldNotResetFile);
}
-//
---------------------------------------------------------------------------
-// XMLPlatformUtils: Timing Methods
-//
---------------------------------------------------------------------------
-unsigned long XMLPlatformUtils::getCurrentMillis()
-// TBT
+// -----------------------------------------------------------------------
+// File system methods
+// -----------------------------------------------------------------------
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
{
- APIRET retr;
- ULONG timerBuf = 0;
-
- retr = DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID) &timerBuf,
- sizeof( ULONG ) );
- if ( retr != NO_ERROR )
- return (timerBuf);
+ // Transcode the incoming string
+ char* tmpSrcPath = XMLString::transcode(srcPath);
+ ArrayJanitor<char> janSrcPath(tmpSrcPath);
+ char tmpPath[CCHMAXPATH];
+ _fullpath(tmpPath, tmpSrcPath, CCHMAXPATH);
- return (timerBuf);
+ return XMLString::transcode(tmpPath);
}
-
-/* Function dirname (used in XMLPlatformUtils::getBasePath)
-*
-* Description:
-* Function returns directoryname
-*
-* In:
-* Path and file: e.gG.: "d:\TestDir\testfile.txt
-*
-* return:
-* "": ERROR
-* Path: Path is returned in the Format: "[drive]:\[path]\"
-* e.g.: "d:\TestDir\"
-*
-*/
-char* dirname(char* PathName)
-// TBT
-// new function
+bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
{
- APIRET rc = NO_ERROR;
- ULONG MaxPathLength = 0;
- ULONG aulSysInfo[QSV_MAX];
-
- // variables for path information
- char drive[2 + 1]; // eg: drive = "d:\n";
-
- // get system information
- rc = DosQuerySysInfo(1L,
- QSV_MAX,
- (PVOID)aulSysInfo,
- sizeof(ULONG)*QSV_MAX);
- if(rc != NO_ERROR) return("");
-
- // Get Maximum Path Length
- MaxPathLength = aulSysInfo[QSV_MAX_PATH_LENGTH - 1];
-
- // allocate space for pathinformation
- char* dir = new char[MaxPathLength + 1];
- char* fname = new char[MaxPathLength + 1];
- char* ext = new char[MaxPathLength + 1];
- char* returnPath = new char[MaxPathLength + 1];
+ // Check for pathological case of an empty path
+ if (!toCheck[0])
+ return false;
- // extract pathinformation
- _splitpath(PathName, drive, dir, fname, ext) ;
+ //
+ // If it starts with a drive, then it cannot be relative. Note that
+ // we checked the drive not being empty above, so worst case it's one
+ // char long and the check of the 1st char will fail because it's
really
+ // a null character.
+ //
+ if (toCheck[1] == chColon)
+ {
+ if (((toCheck[0] >= chLatin_A) && (toCheck[0] <= chLatin_Z))
+ || ((toCheck[0] >= chLatin_a) && (toCheck[0] <= chLatin_z)))
+ {
+ return false;
+ }
+ }
- strcpy(returnPath,drive);
- strcat(returnPath,dir);
+ //
+ // If it starts with a double slash, then it cannot be relative since
+ // its a remote file.
+ //
+ if ((toCheck[0] == chBackSlash) && (toCheck[1] == chBackSlash))
+ return false;
- return((char*) returnPath);
+ // Else assume its a relative path
+ return true;
}
-XMLCh* XMLPlatformUtils::getBasePath(const XMLCh* const srcPath)
-// TBT
-// So please check if it works correct.
+XMLCh* XMLPlatformUtils::weavePaths( const XMLCh* const basePath
+ , const XMLCh* const relativePath )
{
+ // Create a buffer as large as both parts and empty it
+ XMLCh* tmpBuf = new XMLCh[XMLString::stringLen(basePath)
+ + XMLString::stringLen(relativePath)
+ + 2];
+ *tmpBuf = 0;
//
- // NOTE: THe path provided has always already been opened
successfully,
- // so we know that its not some pathological freaky path. It comes in
- // in native format, and goes out as Unicode always
+ // If we have no base path, then just take the relative path as
+ // is.
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ if (!basePath || !*basePath)
+ {
+ XMLString::copyString(tmpBuf, relativePath);
+ return tmpBuf;
+ }
- // Use a local buffer that is big enough for the largest legal path
- char* tmpPath = dirname((char*)newSrc);
- if (strlen(tmpPath) == 0)
+ const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) -
1);
+ if ((*basePtr != chForwardSlash)
+ && (*basePtr != chBackSlash))
{
- throw XMLPlatformUtilsException("XMLPlatformUtils::resetFile -
Could
not get the base path name");
+ while ((basePtr >= basePath)
+ && ((*basePtr != chForwardSlash) && (*basePtr !=
chBackSlash)))
+ {
+ basePtr--;
+ }
}
- char* newXMLString = new char [strlen(tmpPath) +2];
- ArrayJanitor<char> newJanitor(newXMLString);
- strcpy(newXMLString, tmpPath);
- // TBT
+ // There is no relevant base path, so just take the relative part
+ if (basePtr < basePath)
+ {
+ XMLString::copyString(tmpBuf, relativePath);
+ return tmpBuf;
+ }
- // Return a copy of the path, in Unicode format
- return XMLString::transcode(newXMLString);
-}
+ // After this, make sure the buffer gets handled if we exit early
+ ArrayJanitor<XMLCh> janBuf(tmpBuf);
-bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
-{
- // Check for pathological case of empty path
- if (!toCheck[0])
- return false;
-
//
- // If it starts with a slash, then it cannot be relative. This covers
- // both something like "\Test\File.xml" and an NT Lan type remote
path
- // that starts with a node like "\\MyNode\Test\File.xml".
+ // We have some path part, so we need to check to see if we ahve to
+ // weave any of the parts together.
//
- if (toCheck[0] == XMLCh('/'))
- return false;
+ const XMLCh* pathPtr = relativePath;
+ while (true)
+ {
+ // If it does not start with some period, then we are done
+ if (*pathPtr != chPeriod)
+ break;
- // Else assume its a relative path
- return true;
+ unsigned int periodCount = 1;
+ pathPtr++;
+ if (*pathPtr == chPeriod)
+ {
+ pathPtr++;
+ periodCount++;
+ }
+
+ // Has to be followed by a \ or / or the null to mean anything
+ if ((*pathPtr != chForwardSlash) && (*pathPtr != chBackSlash)
+ && *pathPtr)
+ {
+ break;
+ }
+ if (*pathPtr)
+ pathPtr++;
+
+ // If its one period, just eat it, else move backwards in the base
+ if (periodCount == 2)
+ {
+ basePtr--;
+ while ((basePtr >= basePath)
+ && ((*basePtr != chForwardSlash) && (*basePtr !=
chBackSlash)))
+ {
+ basePtr--;
+ }
+
+ if (basePtr < basePath)
+ {
+ // The base cannot provide enough levels, so its in error
+ // <TBD>
+ }
+ }
+ }
+
+ // Copy the base part up to the base pointer
+ XMLCh* bufPtr = tmpBuf;
+ const XMLCh* tmpPtr = basePath;
+ while (tmpPtr <= basePtr)
+ *bufPtr++ = *tmpPtr++;
+
+ // And then copy on the rest of our path
+ XMLString::copyString(bufPtr, pathPtr);
+
+ // Orphan the buffer and return it
+ janBuf.orphan();
+ return tmpBuf;
}
+
+
// -----------------------------------------------------------------------
-// Standard out/error support
+// Timing methods
// -----------------------------------------------------------------------
-
-void XMLPlatformUtils::writeToStdErr(const char* const toWrite)
-{
- WriteCharStr(stderr, toWrite);
-}
-void XMLPlatformUtils::writeToStdErr(const XMLCh* const toWrite)
-{
- WriteUStrStdErr(toWrite);
-}
-void XMLPlatformUtils::writeToStdOut(const XMLCh* const toWrite)
-{
- WriteUStrStdOut(toWrite);
-}
-void XMLPlatformUtils::writeToStdOut(const char* const toWrite)
+unsigned long XMLPlatformUtils::getCurrentMillis()
{
- WriteCharStr(stdout, toWrite);
+ APIRET retr;
+ ULONG timerBuf = 0;
+
+ retr = DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID)
&timerBuf,
+ sizeof( ULONG ) );
+// if ( retr != NO_ERROR )
+// return (timerBuf);
+
+
+ return (timerBuf);
}
+
// -----------------------------------------------------------------------
// Mutex methods
-// Base of Mutex handling is copied from Win32PlatformUtil.cpp and
-// patially from AIXPlatformUtil.cpp
-// (depended on which code was easier to understand)
// -----------------------------------------------------------------------
-#ifndef APP_NO_THREADS
-
-
void XMLPlatformUtils::closeMutex(void* const mtxHandle)
-// TBT
{
- if (mtxHandle == NULL)
- return;
+#if defined(__MT__)
+ if (mtxHandle == NULL)
+ return;
- if (DosCloseMutexSem( (HMTX)mtxHandle))
- {
- throw XMLPlatformUtilsException("Could not destroy a mutex");
- }
+ if (DosCloseMutexSem( (HMTX)mtxHandle))
+ {
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::Mutex_CouldNotDestroy);
+ }
+#endif
}
-
void XMLPlatformUtils::lockMutex(void* const mtxHandle)
-//
{
- if (mtxHandle == NULL)
- return;
+#if defined(__MT__)
+ if (mtxHandle == NULL)
+ return;
- if (DosRequestMutexSem( (HMTX)mtxHandle,(ULONG) SEM_INDEFINITE_WAIT) )
- {
- throw XMLPlatformUtilsException("Could not lock a mutex");
- }
+ if (DosRequestMutexSem( (HMTX)mtxHandle,(ULONG) SEM_INDEFINITE_WAIT) )
+ {
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::Mutex_CouldNotLock);
+ }
+#endif
}
-
void* XMLPlatformUtils::makeMutex()
-//
{
+#if defined(__MT__)
HMTX hRet; // Mutex Handle
if (DosCreateMutexSem(NULL, &hRet, 0, FALSE))
- throw XMLPlatformUtilsException("XMLPlatformUtils::makeMutex -
Could
not create mutex");
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::Mutex_CouldNotCreate);
return (void*)hRet;
+#else
+ return 0;
+#endif
}
-
void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
-//
{
- if (mtxHandle == NULL)
- return;
+#if defined(__MT__)
+ if (mtxHandle == NULL)
+ return;
- if (DosReleaseMutexSem( (HMTX)mtxHandle))
- {
- throw XMLPlatformUtilsException("Could not unlock a mutex");
- }
+ if (DosReleaseMutexSem( (HMTX)mtxHandle))
+ {
+ ThrowXML(XMLPlatformUtilsException,
XML4CExcepts::Mutex_CouldNotUnlock);
+ }
+#endif
}
-#else // #ifndef APP_NO_THREADS
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
-{
+
+// -----------------------------------------------------------------------
+// Miscellaneous synchronization methods
+// -----------------------------------------------------------------------
+void* XMLPlatformUtils::compareAndSwap ( void** toFill
+ , const void* const newValue
+ , const void* const toCompare )
+{
+#if defined(__IBMCPP__)
+ return (void *)__smp_cmpxchg4((unsigned int *)toFill,
+ (unsigned int)newValue,
+ (unsigned int)toCompare);
+#elif defined(__GNUG__)
+ char ret;
+ long int readval;
+ long int * p = (long **)toFill;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %3, %1\n\tsete %0"
+ : "=q" (ret), "=m" (*p), "=a" (readval)
+ : "r" (newValue), "m" (*p), "a" (toCompare)
+ : "memory");
+ return (void *)(long)ret;
+#else
+ void * retVal = *toFill;
+ if (*toFill == toCompare)
+ *toFill = (void *)newValue;
+ return
+#endif
}
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+
+
+// -----------------------------------------------------------------------
+// Atomic Increment and Decrement
+//
+// The function return value is positive if the result of the operation
+// was positive. Zero if the result of the operation was zero. Negative
+// if the result of the operation was negative. Except for the zero
+// case, the value returned may differ from the actual result of the
+// operation - only the sign and zero/nonzero state is guaranteed to be
+// correct.
+// -----------------------------------------------------------------------
+int XMLPlatformUtils::atomicIncrement(int& location)
{
+#if defined(__IBMCPP__)
+ return __smp_inc4(&location);
+#elif defined(__GNUG__)
+ __asm__ __volatile__ ("lock; incl %0" : "=m" (location) : );
+ return location;
+#else
+ return ++location;
+#endif
}
-void* XMLPlatformUtils::makeMutex()
+int XMLPlatformUtils::atomicDecrement(int& location)
{
- return 0;
+#if defined(__IBMCPP__)
+ return __smp_dec4(&location);
+#elif defined(__GNUG__)
+ __asm__ __volatile__ ("lock; decl %0" : "=m" (location) : );
+ return location;
+#else
+ return --location;
+#endif
}
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+
+//
---------------------------------------------------------------------------
+// XMLPlatformUtils: The panic method
+//
---------------------------------------------------------------------------
+void XMLPlatformUtils::panic(const PanicReasons reason)
{
+ const char* reasonStr = "Unknown reason";
+ switch (reason)
+ {
+ case Panic_NoTransService:
+ reasonStr = "Could not load a transcoding service";
+ break;
+ case Panic_NoDefTranscoder:
+ reasonStr = "Could not load a local code page transcoder";
+ break;
+ case Panic_CantFindLib:
+ reasonStr = "Could not find the xerces-c DLL";
+ break;
+ case Panic_UnknownMsgDomain:
+ reasonStr = "Unknown message domain";
+ break;
+ case Panic_CantLoadMsgDomain:
+ reasonStr = "Cannot load message domain";
+ break;
+ case Panic_SynchronizationErr:
+ reasonStr = "Cannot synchronize system or mutex";
+ break;
+ case Panic_SystemInit:
+ reasonStr = "Cannot initialize the system or mutex";
+ break;
+ }
+
+ fprintf(stderr, "%s\n", reasonStr);
+
+ exit(-1);
}
-#endif // APP_NO_THREADS
// -----------------------------------------------------------------------
-// Miscellaneous synchronization methods
+// Private static methods. These are provided by the per-platform
+// implementation files.
// -----------------------------------------------------------------------
-void* XMLPlatformUtils::compareAndSwap ( void** toFill ,
- const void* const newValue ,
- const void* const toCompare)
-// TBT
-//
+XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain)
{
- void *retVal = *toFill;
- if (*toFill == toCompare)
- *toFill = (void *)newValue;
- return retVal;
+#if defined(XML_USE_INMEMORY_MSGLOADER)
+ return new InMemMsgLoader(msgDomain);
+#else
+ return 0;
+#endif
}
-int XMLPlatformUtils::atomicIncrement(int &location)
-// TBT
-//
-{
- return ++location;
-}
-int XMLPlatformUtils::atomicDecrement(int &location)
-// TBT
-//
+XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
{
- return --location;
+ return 0;
}
+XMLTransService* XMLPlatformUtils::makeTransService()
+{
+#if defined(XML_USE_ICU_TRANSCODER)
+ return new ICUTransService;
+#elif defined(XML_USE_ICONV_TRANSCODER)
+ return new IconvTransService;
+#else
+ return 0;
+#endif
+}
-FileHandle XMLPlatformUtils::openStdInHandle()
-// TBT
+void XMLPlatformUtils::platformInit()
{
- return (FileHandle)fdopen(dup(0), "rb");
}
void XMLPlatformUtils::platformTerm()
Index: IconvTransService.cpp
===================================================================
RCS file:
/home/cvspublic/xml-xerces/c/src/util/Transcoders/Iconv/IconvTransService.cpp,v
retrieving revision 1.16
diff -u -r1.16 IconvTransService.cpp
--- IconvTransService.cpp 2000/03/13 21:48:04 1.16
+++ IconvTransService.cpp 2000/03/17 22:57:16
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
+ *
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -134,7 +134,7 @@
#include <util/XMLUni.hpp>
#include "IconvTransService.hpp"
#include <wchar.h>
-#if defined (XML_GCC)
+#if defined (XML_GCC) || defined (XML_IBMVAOS2)
#include <wctype.h>
#endif
#include <string.h>
@@ -196,7 +196,7 @@
wint_t wch2 = towupper(*cptr2);
if (wch1 != wch2)
break;
-
+
cptr1++;
cptr2++;
}
@@ -218,7 +218,7 @@
wint_t wch2 = towupper(*cptr2);
if (wch1 != wch2)
break;
-
+
cptr1++;
cptr2++;
n++;
Index: IBMVAOS2Defs.hpp
===================================================================
RCS file:
/home/cvspublic/xml-xerces/c/src/util/Compilers/IBMVAOS2Defs.hpp,v
retrieving revision 1.5
diff -u -r1.5 IBMVAOS2Defs.hpp
--- IBMVAOS2Defs.hpp 2000/03/02 19:55:08 1.5
+++ IBMVAOS2Defs.hpp 2000/03/17 23:01:43
@@ -86,6 +86,13 @@
#define PLATFORM_IMPORT
#define XERCES_EXPORT
+//
---------------------------------------------------------------------------
+// Supports L"" prefixed constants. There are places
+// where it is advantageous to use the L"" where it supported, to avoid
+// unnecessary transcoding.
+// If your compiler does not support it, don't define this.
+//
---------------------------------------------------------------------------
+#define XML_LSTRSUPPORT
//
---------------------------------------------------------------------------
// Indicate that we support native bools
@@ -95,8 +102,15 @@
//
---------------------------------------------------------------------------
// Define our version of the XMLCh.
+//
---------------------------------------------------------------------------
+//typedef unsigned short XMLCh;
+typedef wchar_t XMLCh;
+
+//
---------------------------------------------------------------------------
+// Define unsigned 16 and 32 bits integers
//
---------------------------------------------------------------------------
-typedef unsigned short XMLCh;
+typedef unsigned short XMLUInt16;
+typedef unsigned int XMLUInt32;
//
---------------------------------------------------------------------------
@@ -109,11 +123,9 @@
//
---------------------------------------------------------------------------
// The name of the DLL that is built by the Visual Age C++ version of the
-// system. We append a previously defined token which holds the DLL
-// versioning string. This is defined in XercesDefs.hpp which is what
this
-// file is included into.
+// system. OS/2 supports only 8.3 names for DLLs.
//
---------------------------------------------------------------------------
-const char* const Xercse_DLLName = "VAOXERCESC" Xerces_DLLVersionStr;
+const char* const Xerces_DLLName = "xerces-c";
//
---------------------------------------------------------------------------
--Bill