From: jfa Date: Fri, 19 Aug 2005 09:11:52 +0000 (+0000) Subject: Fix crashes of Sketcher and Import/Export X-Git-Tag: T_3_0_2a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a8a220072be66fa1a086a9292345b06f3b7e6f3c;p=modules%2Fgeom.git Fix crashes of Sketcher and Import/Export --- diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index b977e80b9..f1c9e80c4 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -472,13 +472,13 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation * MakeSketcher */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand, - list theWorkingPlane) +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher + (const TCollection_AsciiString& theCommand, + list theWorkingPlane) { SetErrorCode(KO); - if (!theCommand) return NULL; - if (strcmp(theCommand, "") == 0) return NULL; + if (theCommand.IsEmpty()) return NULL; //Add a new Sketcher object Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER); @@ -493,8 +493,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom GEOMImpl_ISketcher aCI (aFunction); - TCollection_AsciiString aCommand ((char*) theCommand); - aCI.SetCommand(aCommand); + aCI.SetCommand(theCommand); int ind = 1; list::iterator it = theWorkingPlane.begin(); @@ -516,7 +515,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom //Make a Python command GEOM::TPythonDump pd (aFunction); - pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand << "\", ["; + pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand.ToCString() << "\", ["; it = theWorkingPlane.begin(); pd << (*it++); @@ -534,13 +533,13 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom * MakeSketcherOnPlane */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane (const char* theCommand, - Handle(GEOM_Object) theWorkingPlane) +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane + (const TCollection_AsciiString& theCommand, + Handle(GEOM_Object) theWorkingPlane) { SetErrorCode(KO); - if (!theCommand) return NULL; - if (strcmp(theCommand, "") == 0) return NULL; + if (theCommand.IsEmpty()) return NULL; //Add a new Sketcher object Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER); @@ -554,9 +553,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane (const char* if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL; GEOMImpl_ISketcher aCI (aFunction); - - TCollection_AsciiString aCommand ((char*) theCommand); - aCI.SetCommand(aCommand); + aCI.SetCommand(theCommand); Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction(); if (aRefPlane.IsNull()) return NULL; @@ -577,7 +574,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane (const char* //Make a Python command GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\"" - << theCommand << "\", " << theWorkingPlane << " )"; + << theCommand.ToCString() << "\", " << theWorkingPlane << " )"; SetErrorCode(OK); return aSketcher; diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index df281573b..5ba6afb53 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -1,10 +1,12 @@ -using namespace std; +using namespace std; #ifndef _GEOMImpl_ICurvesOperations_HXX_ #define _GEOMImpl_ICurvesOperations_HXX_ #include "GEOM_IOperations.hxx" +#include + #include class GEOM_Engine; @@ -18,25 +20,26 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePolyline (list thePoints); Standard_EXPORT Handle(GEOM_Object) MakeCircleThreePnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3); + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); Standard_EXPORT Handle(GEOM_Object) MakeCirclePntVecR (Handle(GEOM_Object) thePnt, - Handle(GEOM_Object) theVec, double theR); + Handle(GEOM_Object) theVec, double theR); Standard_EXPORT Handle(GEOM_Object) MakeEllipse (Handle(GEOM_Object) thePnt, - Handle(GEOM_Object) theVec, - double theRMajor, double theRMinor); + Handle(GEOM_Object) theVec, + double theRMajor, double theRMinor); Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3); + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list thePoints); Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints); - Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand, list theWorkingPlane); - Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand, - Handle(GEOM_Object) theWorkingPlane); + Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const TCollection_AsciiString& theCommand, + list theWorkingPlane); + Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const TCollection_AsciiString& theCommand, + Handle(GEOM_Object) theWorkingPlane); }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index 74a8c8302..3ef529498 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -103,9 +103,9 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) the */ //============================================================================= void GEOMImpl_IInsertOperations::Export - (const Handle(GEOM_Object) theOriginal, - const char* theFileName, - const char* theFormatName) + (const Handle(GEOM_Object) theOriginal, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) { SetErrorCode(KO); @@ -124,12 +124,10 @@ void GEOMImpl_IInsertOperations::Export //Set parameters GEOMImpl_IImportExport aCI (aFunction); aCI.SetOriginal(aRefFunction); - char* aFileName = (char*)theFileName; - aCI.SetFileName(aFileName); + aCI.SetFileName(theFileName); - char* aFormatName = (char*)theFormatName; Handle(TCollection_HAsciiString) aHLibName; - if (!IsSupported(Standard_False, aFormatName, aHLibName)) { + if (!IsSupported(Standard_False, theFormatName, aHLibName)) { return; } TCollection_AsciiString aLibName = aHLibName->String(); @@ -149,8 +147,8 @@ void GEOMImpl_IInsertOperations::Export } //Make a Python command - GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal - << ", \"" << theFileName << "\", \"" << theFormatName << "\")"; + GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal << ", \"" + << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; SetErrorCode(OK); } @@ -161,12 +159,12 @@ void GEOMImpl_IInsertOperations::Export */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import - (const char* theFileName, - const char* theFormatName) + (const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) { SetErrorCode(KO); - if (!theFileName || !theFormatName) return NULL; + if (theFileName.IsEmpty() || theFormatName.IsEmpty()) return NULL; //Add a new result object Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT); @@ -180,12 +178,10 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import //Set parameters GEOMImpl_IImportExport aCI (aFunction); - char* aFileName = (char*)theFileName; - aCI.SetFileName(aFileName); + aCI.SetFileName(theFileName); - char* aFormatName = (char*)theFormatName; Handle(TCollection_HAsciiString) aHLibName; - if (!IsSupported(Standard_True, aFormatName, aHLibName)) { + if (!IsSupported(Standard_True, theFormatName, aHLibName)) { return result; } TCollection_AsciiString aLibName = aHLibName->String(); @@ -206,7 +202,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import //Make a Python command GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\"" - << theFileName << "\", \"" << theFormatName << "\")"; + << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; SetErrorCode(OK); return result; @@ -317,19 +313,20 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators //============================================================================= Standard_Boolean GEOMImpl_IInsertOperations::IsSupported (const Standard_Boolean isImport, - const TCollection_AsciiString theFormat, + const TCollection_AsciiString& theFormat, Handle(TCollection_HAsciiString)& theLibName) { if (!InitResMgr()) return Standard_False; // Import/Export mode - Standard_CString aMode; + TCollection_AsciiString aMode; + //Standard_CString aMode; if (isImport) aMode = "Import"; else aMode = "Export"; // Read supported formats for the certain mode - if (myResMgr->Find(aMode)) { - TCollection_AsciiString aFormats (myResMgr->Value(aMode)); + if (myResMgr->Find(aMode.ToCString())) { + TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString())); if (aFormats.Search(theFormat) > -1) { // Read library name for the supported format TCollection_AsciiString aKey (theFormat); diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx index 6a61e36a6..543070d4c 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx @@ -18,22 +18,23 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeCopy (Handle(GEOM_Object) theOriginal); - - Standard_EXPORT Handle(GEOM_Object) Import (const char* theFileName, const char* theFormatType); - - Standard_EXPORT void Export (const Handle(GEOM_Object) theOriginal, - const char* theFileName, - const char* theFormatType); + + Standard_EXPORT Handle(GEOM_Object) Import (const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatType); + + Standard_EXPORT void Export (const Handle(GEOM_Object) theOriginal, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatType); Standard_EXPORT Standard_Boolean ImportTranslators (Handle(TColStd_HSequenceOfAsciiString)& theFormats, - Handle(TColStd_HSequenceOfAsciiString)& thePatterns); + Handle(TColStd_HSequenceOfAsciiString)& thePatterns); Standard_EXPORT Standard_Boolean ExportTranslators (Handle(TColStd_HSequenceOfAsciiString)& theFormats, - Handle(TColStd_HSequenceOfAsciiString)& thePatterns); + Handle(TColStd_HSequenceOfAsciiString)& thePatterns); Standard_EXPORT Standard_Boolean IsSupported (const Standard_Boolean isImport, - const TCollection_AsciiString theFormat, - Handle(TCollection_HAsciiString)& theLibName); + const TCollection_AsciiString& theFormat, + Handle(TCollection_HAsciiString)& theLibName); private: Standard_Boolean InitResMgr (); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 47433ca3d..84e8bf302 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -375,10 +375,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeCompound */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape - (list theShapes, - const Standard_Integer theObjectType, - const Standard_Integer theFunctionType, - const TCollection_AsciiString theMethodName) + (list theShapes, + const Standard_Integer theObjectType, + const Standard_Integer theFunctionType, + const TCollection_AsciiString& theMethodName) { SetErrorCode(KO); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 3424f6e07..46c0f8536 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -114,10 +114,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); private: - Handle(GEOM_Object) MakeShape (list theShapes, - const Standard_Integer theObjectType, - const Standard_Integer theFunctionType, - const TCollection_AsciiString theMethodName); + Handle(GEOM_Object) MakeShape (list theShapes, + const Standard_Integer theObjectType, + const Standard_Integer theFunctionType, + const TCollection_AsciiString& theMethodName); bool CheckTriangulation (const TopoDS_Shape& aShape); }; diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index 6ae20ca13..89b9de361 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -285,8 +285,6 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane) { - GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil(); - //Set a not done flag GetOperations()->SetNotDone(); @@ -298,9 +296,8 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher // Make Sketcher Handle(GEOM_Object) anObject = - GetOperations()->MakeSketcher(strdup(theCommand), aWorkingPlane); + GetOperations()->MakeSketcher((char*)theCommand, aWorkingPlane); if (!GetOperations()->IsDone() || anObject.IsNull()) - //return aGEOMObject._retn(); return GEOM::GEOM_Object::_nil(); return GetObject(anObject); @@ -315,8 +312,6 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane) { - GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil(); - //Set a not done flag GetOperations()->SetNotDone(); @@ -325,9 +320,9 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane // Make Sketcher Handle(GEOM_Object) anObject = - GetOperations()->MakeSketcherOnPlane(strdup(theCommand), aWorkingPlane); + GetOperations()->MakeSketcherOnPlane((char*)theCommand, aWorkingPlane); if (!GetOperations()->IsDone() || anObject.IsNull()) - return aGEOMObject._retn(); + return GEOM::GEOM_Object::_nil(); return GetObject(anObject); } diff --git a/src/SKETCHER/Sketcher_Profile.cxx b/src/SKETCHER/Sketcher_Profile.cxx index 3f320dd0c..ad436a67d 100644 --- a/src/SKETCHER/Sketcher_Profile.cxx +++ b/src/SKETCHER/Sketcher_Profile.cxx @@ -1,30 +1,30 @@ // GEOM SKETCHER : basic sketcher // // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // // File : Sketcher_Profile.cxx // Author : Damien COQUERET // Module : GEOM -// $Header: +// $Header: #include @@ -32,23 +32,23 @@ #include #include -#include -#include #include #include #include #include #include + +#include #include #include #include + #include -#include +#include +#include #include - -#include -#include CORBA_SERVER_HEADER(SALOMEDS) +#include #include "utilities.h" @@ -88,37 +88,37 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) myOK = Standard_False; - TCollection_AsciiString aCommand(CORBA::string_dup(aCmd)); + //TCollection_AsciiString aCommand(CORBA::string_dup(aCmd)); + TCollection_AsciiString aCommand ((char*)aCmd); TCollection_AsciiString aToken = aCommand.Token(":", 1); int n = 0; // porting to WNT - TCollection_AsciiString* aTab = 0; + TColStd_Array1OfAsciiString aTab (0, aCommand.Length() - 1); if ( aCommand.Length() ) { - aTab = new TCollection_AsciiString[ aCommand.Length() ]; while(aToken.Length() != 0) { if(aCommand.Token(":", n + 1).Length() > 0) - aTab[n] = aCommand.Token(":", n + 1); + aTab(n) = aCommand.Token(":", n + 1); aToken = aCommand.Token(":", ++n); } n = n - 1; } - if ( aTab && aTab[0].Length() ) + if ( aTab.Length() && aTab(0).Length() ) while(i < n) { Standard_Real length = 0, radius = 0, angle = 0; move = point; - + int n1 = 0; - TCollection_AsciiString* a = new TCollection_AsciiString[ aTab[0].Length() ]; - aToken = aTab[i].Token(" ", 1); - while(aToken.Length() != 0) { - if(aTab[i].Token(" ", n1 + 1).Length() > 0) - a[n1] = aTab[i].Token(" ", n1 + 1); - aToken = aTab[i].Token(" ", ++n1); + TColStd_Array1OfAsciiString a (0, aTab(0).Length()); + aToken = aTab(i).Token(" ", 1); + while (aToken.Length() != 0) { + if (aTab(i).Token(" ", n1 + 1).Length() > 0) + a(n1) = aTab(i).Token(" ", n1 + 1); + aToken = aTab(i).Token(" ", ++n1); } n1 = n1 - 1; - - switch(a[0].Value(1)) + + switch(a(0).Value(1)) { case 'F': { @@ -127,23 +127,23 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) MESSAGE("profile : The F instruction must precede all moves"); return; } - x0 = x = a[1].RealValue(); - y0 = y = a[2].RealValue(); + x0 = x = a(1).RealValue(); + y0 = y = a(2).RealValue(); stayfirst = Standard_True; break; } case 'O': { if (n1 != 4) goto badargs; - P.SetLocation(gp_Pnt(a[1].RealValue(), a[2].RealValue(), a[3].RealValue())); + P.SetLocation(gp_Pnt(a(1).RealValue(), a(2).RealValue(), a(3).RealValue())); stayfirst = Standard_True; break; } case 'P': { if (n1 != 7) goto badargs; - gp_Vec vn(a[1].RealValue(), a[2].RealValue(), a[3].RealValue()); - gp_Vec vx(a[4].RealValue(), a[5].RealValue(), a[6].RealValue()); + gp_Vec vn(a(1).RealValue(), a(2).RealValue(), a(3).RealValue()); + gp_Vec vx(a(4).RealValue(), a(5).RealValue(), a(6).RealValue()); if (vn.Magnitude() <= Precision::Confusion() || vx.Magnitude() <= Precision::Confusion()) { MESSAGE("profile : null direction"); return; @@ -156,8 +156,8 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'X': { if (n1 != 2) goto badargs; - length = a[1].RealValue(); - if (a[0] == "XX") + length = a(1).RealValue(); + if (a(0) == "XX") length -= x; dx = 1; dy = 0; move = line; @@ -166,8 +166,8 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'Y': { if (n1 != 2) goto badargs; - length = a[1].RealValue(); - if (a[0] == "YY") + length = a(1).RealValue(); + if (a(0) == "YY") length -= y; dx = 0; dy = 1; move = line; @@ -176,7 +176,7 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'L': { if (n1 != 2) goto badargs; - length = a[1].RealValue(); + length = a(1).RealValue(); if (Abs(length) > Precision::Confusion()) move = line; else @@ -186,9 +186,9 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'T': { if (n1 != 3) goto badargs; - Standard_Real vx = a[1].RealValue(); - Standard_Real vy = a[2].RealValue(); - if (a[0] == "TT") { + Standard_Real vx = a(1).RealValue(); + Standard_Real vy = a(2).RealValue(); + if (a(0) == "TT") { vx -= x; vy -= y; } @@ -205,8 +205,8 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'R': { if (n1 != 2) goto badargs; - angle = a[1].RealValue() * PI180; - if (a[0] == "RR") { + angle = a(1).RealValue() * PI180; + if (a(0) == "RR") { dx = Cos(angle); dy = Sin(angle); } @@ -222,8 +222,8 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'D': { if (n1 != 3) goto badargs; - Standard_Real vx = a[1].RealValue(); - Standard_Real vy = a[2].RealValue(); + Standard_Real vx = a(1).RealValue(); + Standard_Real vy = a(2).RealValue(); length = Sqrt(vx * vx + vy * vy); if (length > Precision::Confusion()) { dx = vx / length; @@ -236,9 +236,9 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'C': { if (n1 != 3) goto badargs; - radius = a[1].RealValue(); + radius = a(1).RealValue(); if (Abs(radius) > Precision::Confusion()) { - angle = a[2].RealValue() * PI180; + angle = a(2).RealValue() * PI180; move = circle; } else @@ -248,15 +248,15 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'I': { if (n1 != 2) goto badargs; - length = a[1].RealValue(); - if (a[0] == "IX") { + length = a(1).RealValue(); + if (a(0) == "IX") { if (Abs(dx) < Precision::Confusion()) { MESSAGE("profile : cannot intersect, arg "<