peiyongz 2003/03/09 09:01:09 Modified: c/src/xercesc/util/Platforms/UnixWare UnixWarePlatformUtils.cpp Log: PanicHandler Revision Changes Path 1.6 +12 -27 xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp Index: UnixWarePlatformUtils.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- UnixWarePlatformUtils.cpp 7 Mar 2003 20:34:16 -0000 1.5 +++ UnixWarePlatformUtils.cpp 9 Mar 2003 17:01:08 -0000 1.6 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/03/09 17:01:08 peiyongz + * PanicHandler + * * Revision 1.5 2003/03/07 20:34:16 tng * [Bug 17774] Unixware platform utils not implemented . Patch from Peter Crozier. * @@ -200,7 +203,7 @@ } catch(...) { - panic(XMLPlatformUtils::Panic_CantLoadMsgDomain); + panic(PanicHandler::Panic_CantLoadMsgDomain); } return retVal; } @@ -235,25 +238,7 @@ // --------------------------------------------------------------------------- void XMLPlatformUtils::panic(const PanicReasons reason) { - const char* reasonStr = "Unknown reason"; - if (reason == Panic_NoTransService) - reasonStr = "Could not load a transcoding service"; - else if (reason == Panic_NoDefTranscoder) - reasonStr = "Could not load a local code page transcoder"; - else if (reason == Panic_CantFindLib) - reasonStr = "Could not find the xerces-c DLL"; - else if (reason == Panic_UnknownMsgDomain) - reasonStr = "Unknown message domain"; - else if (reason == Panic_CantLoadMsgDomain) - reasonStr = "Cannot load message domain"; - else if (reason == Panic_SynchronizationErr) - reasonStr = "Cannot synchronize system or mutex"; - else if (reason == Panic_SystemInit) - reasonStr = "Cannot initialize the system or mutex"; - - fprintf(stderr, "%s\n", reasonStr); - - exit(-1); + fgUserPanicHandler? fgUserPanicHandler->panic(reason) : fgDefaultPanicHandler->panic(reason); } // --------------------------------------------------------------------------- @@ -588,7 +573,7 @@ gAtomicOpMutex = new pthread_mutex_t; if (pthread_mutex_init(gAtomicOpMutex, NULL)) - panic( XMLPlatformUtils::Panic_SystemInit ); + panic( PanicHandler::Panic_SystemInit ); } class RecursiveMutex @@ -676,14 +661,14 @@ const void* const toCompare) { if (pthread_mutex_lock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); void *retVal = *toFill; if (*toFill == toCompare) *toFill = (void *)newValue; if (pthread_mutex_unlock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); return retVal; @@ -692,12 +677,12 @@ int XMLPlatformUtils::atomicIncrement(int &location) { if (pthread_mutex_lock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); int tmp = ++location; if (pthread_mutex_unlock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); return tmp; } @@ -705,12 +690,12 @@ int XMLPlatformUtils::atomicDecrement(int &location) { if (pthread_mutex_lock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); int tmp = --location; if (pthread_mutex_unlock( gAtomicOpMutex)) - panic(XMLPlatformUtils::Panic_SynchronizationErr); + panic(PanicHandler::Panic_SynchronizationErr); return tmp; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]