peiyongz    2003/03/09 08:59:45

  Modified:    c/src/xercesc/util/Platforms/Solaris
                        SolarisPlatformUtils.cpp
  Log:
  PanicHandler
  
  Revision  Changes    Path
  1.10      +13 -31    
xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
  
  Index: SolarisPlatformUtils.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SolarisPlatformUtils.cpp  3 Jan 2003 16:02:12 -0000       1.9
  +++ SolarisPlatformUtils.cpp  9 Mar 2003 16:59:45 -0000       1.10
  @@ -89,6 +89,7 @@
   #include    <xercesc/util/XMLString.hpp>
   #include    <xercesc/util/XMLUniDefs.hpp>
   #include    <xercesc/util/XMLUni.hpp>
  +#include    <xercesc/util/PanicHandler.hpp>
   
   #if defined (XML_USE_ICU_TRANSCODER)
       #include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
  @@ -151,7 +152,7 @@
       }
       catch(...)
       {
  -        panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
  +        panic(PanicHandler::Panic_CantLoadMsgDomain);
       }
       return retVal;
   }
  @@ -184,28 +185,9 @@
   // ---------------------------------------------------------------------------
   //  XMLPlatformUtils: The panic method
   // ---------------------------------------------------------------------------
  -void XMLPlatformUtils::panic(const PanicReasons reason)
  +void XMLPlatformUtils::panic(const PanicHandler::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);    
   }
   
   // ---------------------------------------------------------------------------
  @@ -542,13 +524,13 @@
       if (pthread_mutex_init(gAtomicOpMutex, pthread_mutexattr_default)) {
        delete gAtomicOpMutex;
        gAtomicOpMutex = 0;
  -        panic( XMLPlatformUtils::Panic_SystemInit );
  +        panic( PanicHandler::Panic_SystemInit );
       }
   #else // XML_USE_DCE
       if (pthread_mutex_init(gAtomicOpMutex, NULL)) {
        delete gAtomicOpMutex;
        gAtomicOpMutex = 0;
  -        panic( XMLPlatformUtils::Panic_SystemInit );
  +        panic( PanicHandler::Panic_SystemInit );
       }
   #endif // XML_USE_DCE
   }
  @@ -679,14 +661,14 @@
       // Currently its supported only in the kernel mode
   
       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;
   }
  @@ -696,12 +678,12 @@
       //return (int)atomic_add_32_nv( (uint32_t*)&location, 1);
   
       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;
   }
  @@ -710,12 +692,12 @@
       //return (int)atomic_add_32_nv( (uint32_t*)&location, -1);
   
       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]

Reply via email to