Salome HOME
fix compilation errors
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_DistrPreview.cxx
index e58be313b07e36bafe76793c031bc1e4c1465789..c9d1f5fb219dc4598cabda581b05bbb5ea62f3cf 100644 (file)
@@ -1,10 +1,44 @@
+// 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/ or email : webmaster.salome@opencascade.com
+//
 
 #include "StdMeshersGUI_DistrPreview.h"
-#include "CASCatch.hxx"
 
 #include <Expr_NamedUnknown.hxx>
 #include <Expr_GeneralExpression.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>
+#endif
+
+#ifdef WIN32
+# include <algorithm>
+#else
+ using namespace std;
+#endif
+
 StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
 : QwtPlot( p ),
   myPoints( 50 ),
@@ -221,12 +255,12 @@ void StdMeshersGUI_DistrPreview::update()
   delete[] y;
   x = y = 0;
 
-  CASCatch_TRY
-  {   
+  try {   
+#ifdef NO_CAS_CATCH
+    OCC_CATCH_SIGNALS;
+#endif
     replot();
-  }
-  CASCatch_CATCH(Standard_Failure)
-  {
+  } catch(Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
   }
 }
@@ -266,13 +300,13 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
 bool StdMeshersGUI_DistrPreview::init( const QString& str )
 {
   bool parsed_ok = true;
-  CASCatch_TRY
-  {
+  try {
+#ifdef NO_CAS_CATCH
+    OCC_CATCH_SIGNALS;
+#endif
     myExpr = ExprIntrp_GenExp::Create();
     myExpr->Process( ( Standard_CString ) str.latin1() );
-  }
-  CASCatch_CATCH(Standard_Failure)
-  {
+  } catch(Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     parsed_ok = false;
   }
@@ -308,10 +342,12 @@ double StdMeshersGUI_DistrPreview::calc( bool& ok )
   double res = 0.0;
 
   ok = true;
-  CASCatch_TRY {   
+  try {   
+#ifdef NO_CAS_CATCH
+    OCC_CATCH_SIGNALS;
+#endif
     res = myExpr->Expression()->Evaluate( myVars, myValues );
-  }
-  CASCatch_CATCH(Standard_Failure) {
+  } catch(Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     ok = false;
     res = 0.0;
@@ -332,16 +368,16 @@ bool StdMeshersGUI_DistrPreview::convert( double& v ) const
   {
   case EXPONENT:
     {
-      CASCatch_TRY
-      { 
+      try { 
+#ifdef NO_CAS_CATCH
+        OCC_CATCH_SIGNALS;
+#endif
        // in StdMeshers_NumberOfSegments.cc
        // const double PRECISION = 1e-7;
        //
        if(v < -7) v = -7.0;
        v = pow( 10.0, v );
-      }
-      CASCatch_CATCH(Standard_Failure)
-      {
+      } catch(Standard_Failure) {
        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
        v = 0.0;
        ok = false;