]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Restore more precise signal detection as in SALOME V2.2.7, connected to Bug PAL11170
authorapo <apo@opencascade.com>
Tue, 7 Mar 2006 09:29:04 +0000 (09:29 +0000)
committerapo <apo@opencascade.com>
Tue, 7 Mar 2006 09:29:04 +0000 (09:29 +0000)
src/CASCatch/CASCatch.hxx [new file with mode: 0644]
src/CASCatch/CASCatch_CatchSignals.cxx
src/CASCatch/CASCatch_CatchSignals.hxx
src/CASCatch/Makefile.in

diff --git a/src/CASCatch/CASCatch.hxx b/src/CASCatch/CASCatch.hxx
new file mode 100644 (file)
index 0000000..a5af66a
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+
+#ifndef _CASCatch_HeaderFile
+#define _CASCatch_HeaderFile
+
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+
+#ifdef try
+#  undef try
+#endif
+
+#ifdef catch
+#  undef catch
+#endif
+
+#ifdef NO_CXX_EXCEPTION
+#  if defined(DO_ABORT)
+#    define CASCatch_TRY \
+       Standard_ErrorHandler _Function; \
+       K_SETJMP = 1 ; \
+       if(DoesNotAbort(_Function))
+#   else  //If DO_ABORT is not defined
+#     define CASCatch_TRY \
+        Standard_ErrorHandler _Function; \
+        if(DoesNotAbort(_Function))
+#   endif //DO_ABORT
+#   define CASCatch_CATCH(Error)   \
+      else if(_Function.Catches(STANDARD_TYPE(Error)))
+#else
+#  define CASCatch_TRY try
+#  define CASCatch_CATCH catch
+#endif //NO_CXX_EXCEPTION
+
+
+#endif
index ef64144c6c8d595c1f6f016f3bf6e5f7da129cdd..9d4d5621abbea556d623e4482ac22f45205471a7 100644 (file)
@@ -19,6 +19,8 @@
 //
 #include "CASCatch_CatchSignals.hxx"
 
+#include "CASCatch_Failure.hxx"  
+#include "CASCatch_ErrorHandler.hxx"
 #include <TCollection_AsciiString.hxx>
 
 #define MAX_HANDLER_NUMBER 6
  * \brief creates a CASCatch_CatchSignals
  */
 //================================================================================ 
-CASCatch_CatchSignals::CASCatch_CatchSignals(Standard_Boolean theIsActivate):
-  myIsActivated(Standard_False)
+CASCatch_CatchSignals::CASCatch_CatchSignals(
+     :myIsActivated(Standard_False)
 {
+
   Standard_Integer i = 0;
   for(; i<=MAX_HANDLER_NUMBER; i++)
     mySigStates[i] = NULL;
-  
-  if(theIsActivate)
-    Activate();
 }
 
 #ifndef WNT
@@ -112,7 +112,7 @@ static void Handler(const OSD_Signals theSig, const OSD_Signals)
   TCollection_AsciiString aMessage(theSig);  
   aMessage+=" signal detected";
  
-  Standard_Failure::Raise(aMessage.ToCString());
+  CASCatch_Failure::Raise(aMessage.ToCString());
 }
 
 
@@ -129,7 +129,7 @@ static void SegvHandler(const OSD_Signals, const Standard_Address, const Standar
   sigaddset(&set, SIGSEGV);
   sigprocmask (SIG_UNBLOCK, &set, NULL); 
 
-  Standard_Failure::Raise("SIGSEGV detected");
+  CASCatch_Failure::Raise("SIGSEGV detected");
 }
 #endif
 
@@ -234,7 +234,7 @@ static Standard_Integer WntHandler(const Standard_Address theExceptionInfo)
   TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode);  
   aMessage+=" Exception code - unexpected exception";
 
-  Standard_Failure::Raise(aMessage.ToCString());
+  CASCatch_Failure::Raise(aMessage.ToCString());
 
   return EXCEPTION_EXECUTE_HANDLER;
 }
@@ -260,15 +260,15 @@ static void SIGWntHandler(const int signum , const int theCode)
     OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); 
 
     if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return;
-    Standard_Failure::Raise ("Floating point error"); 
+    CASCatch_Failure::Raise ("Floating point error"); 
     break;
   case SIGSEGV : 
     OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
-    Standard_Failure::Raise("Access violation"); 
+    CASCatch_Failure::Raise("Access violation"); 
     break; 
   case SIGILL : 
     OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
-    Standard_Failure::Raise("Illegal instruction" ); 
+    CASCatch_Failure::Raise("Illegal instruction" ); 
     break; 
   }
 }
index 1e56f54b56e40e42bef498e01f5992980726e36a..e2293f3e18e0323e5790d6adf3a8f01749213289 100644 (file)
@@ -22,8 +22,6 @@
 #define _CASCatch_CatchSignals_HeaderFile
 
 #include <Standard.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
 
 /*!
  * \class CASCatch_CatchSignals
@@ -36,7 +34,7 @@ public:
 
  // Methods PUBLIC
  // 
-Standard_EXPORT CASCatch_CatchSignals(Standard_Boolean theIsActivate = Standard_True);
+Standard_EXPORT CASCatch_CatchSignals();
 Standard_EXPORT void Destroy() ;
 ~CASCatch_CatchSignals() { Destroy(); }
 Standard_EXPORT void Activate() ;
@@ -62,31 +60,4 @@ Standard_Boolean myIsActivated;
 };
 
 
-#ifdef try
-#  undef try
-#endif
-
-#ifdef catch
-#  undef catch
-#endif
-
-#ifdef NO_CXX_EXCEPTION
-#  if defined(DO_ABORT)
-#    define CASCatch_TRY \
-       Standard_ErrorHandler _Function; \
-       K_SETJMP = 1 ; \
-       if(DoesNotAbort(_Function))
-#   else  //If DO_ABORT is not defined
-#     define CASCatch_TRY \
-        Standard_ErrorHandler _Function; \
-        if(DoesNotAbort(_Function))
-#   endif //DO_ABORT
-#   define CASCatch_CATCH(Error)   \
-      else if(_Function.Catches(STANDARD_TYPE(Error)))
-#else
-#  define CASCatch_TRY try
-#  define CASCatch_CATCH catch
-#endif //NO_CXX_EXCEPTION
-
-
 #endif
index 9e77d0caf9e99d1b84ccdc1b42649fe0c9eb29f1..583caa6a1c81e9893d7c4f14145830a90aa4b299 100644 (file)
@@ -11,19 +11,22 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl
 @COMMENCE@
 
 # header files  
-EXPORT_HEADERS= CASCatch_CatchSignals.hxx
-               # CASCatch_Failure.hxx \
-               # CASCatch_ErrorHandler.hxx
+EXPORT_HEADERS = \
+       CASCatch.hxx \
+       # CASCatch_Failure.hxx \
+       # CASCatch_ErrorHandler.hxx \
+       # CASCatch_CatchSignals.hxx
 
 # Libraries targets
-LIB = libCASCatch.la 
+LIB = libCASCatch.la 
 
-LIB_SRC = CASCatch_CatchSignals.cxx
-         # CASCatch_Failure.cxx \
-          # CASCatch_ErrorHandler.cxx
+LIB_SRC = \
+       # CASCatch_Failure.cxx \
+        # CASCatch_ErrorHandler.cxx \
+       # CASCatch_CatchSignals.cxx
 
 CPPFLAGS += $(OCC_INCLUDES)
 CXXFLAGS += $(OCC_CXXFLAGS)
-LDFLAGS+= $(CAS_KERNEL) $(CAS_MATH)
+LDFLAGS += $(CAS_KERNEL) $(CAS_MATH)
 
 @CONCLUDE@
\ No newline at end of file