Salome HOME
Usage of CASCatch with old OCCT versions.
[modules/smesh.git] / src / StdMeshers / StdMeshers_NumberOfSegments.cxx
index 2cb4957ab72d62b2fe8a7cb6d2d1d2cd05854779..f4819f92c0fd0ec66996ad502700954cdc1c6ba9 100644 (file)
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+#define NO_CAS_CATCH
+#endif
+
 #include <Standard_Failure.hxx>
+
+#ifdef NO_CAS_CATCH
 #include <Standard_ErrorHandler.hxx>
+#else
+#include "CASCatch.hxx"
+#endif
 
 using namespace std;
 
@@ -219,12 +228,18 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
     double val = table[i*2+1];
     if( _convMode==0 )
     {
+#ifdef NO_CAS_CATCH
       try {
         OCC_CATCH_SIGNALS;
+#else
+      CASCatch_TRY {
+#endif
        val = pow( 10.0, val );
-      }
-      catch(Standard_Failure)
-      {
+#ifdef NO_CAS_CATCH
+      } catch(Standard_Failure) {
+#else
+      } CASCatch_CATCH(Standard_Failure) {
+#endif
        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
        throw SALOME_Exception( LOCALIZED( "invalid value"));
        return;
@@ -313,13 +328,19 @@ bool process( const TCollection_AsciiString& str, int convMode,
 {
   bool parsed_ok = true;
   Handle( ExprIntrp_GenExp ) myExpr;
+#ifdef NO_CAS_CATCH
   try {
     OCC_CATCH_SIGNALS;
+#else
+  CASCatch_TRY {
+#endif
     myExpr = ExprIntrp_GenExp::Create();
     myExpr->Process( str.ToCString() );
-  }
-  catch(Standard_Failure)
-  {
+#ifdef NO_CAS_CATCH
+  } catch(Standard_Failure) {
+#else
+  } CASCatch_CATCH(Standard_Failure) {
+#endif
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     parsed_ok = false;
   }