From 91322f44fd202e671046b9ce1ba393a02dbaf756 Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 1 Feb 2013 18:41:16 +0400 Subject: [PATCH] 0022898: IGES import fails in german environment Added DRAW command dlocale to set and query current locale of the C subsystem Equivalents of C functions working with conversions of strings to/from reals added in Standard_CString, providing locale-independent behavior (using always "C" locale) In DRAW packages, calls to atof() and atoi() are replaced by direct calls to Draw::Atof() and Draw::Atoi(), respectively, instead of substituting by #define Use of atof(), strtod(), and *scanf() involving floating point conversions in OCCT code replaced by locale-independent Atof() and Strtod() Calls to sprintf() involving floating point in OCCT code are replaced by call to locale-independent Sprintf(), except a few places where converted strings are used immediately for display in the 3d viewer Changes of global locale are eliminated throughout OCCT code Proposed correction for GNU libC where v*printf_l functions are absent Added test case (bugs xde bug22898) for data exchange operations with non-standard locale Use xlocale on Mac OS X and within glibc Corrected strtod_l wrapper Generate error rather than warning Introduce Standard_CLocaleSentry replacement for removed OSD_Localizer Standard_CLocaleSentry - copy locale string Standard_CLocaleSentry - use _configthreadlocale on Windows Standard_CLocaleSentry::GetCLocale() - return locale_t rather than void* Corrected misprint in ~Standard_CLocaleSentry() Use French locale in bug22898 test case Mark test case as skipped if locale is unavailable on tested system. Use fr_FR locale for tests on Mac OS X --- src/Approx/Approx_SameParameter.cxx | 4 +- src/BOPTest/BOPTest_BOPCommands.cxx | 10 +- src/BOPTest/BOPTest_CurveCommands.cxx | 3 +- src/BOPTest/BOPTest_EFCommands.cxx | 7 +- src/BOPTest/BOPTest_LowCommands.cxx | 53 +-- src/BOPTest/BOPTest_MTestCommands.cxx | 15 +- src/BOPTest/BOPTest_TolerCommands.cxx | 3 +- src/BOPTools/BOPTools_Checker.cxx | 22 +- src/BRepTest/BRepTest_BasicCommands.cxx | 58 ++-- src/BRepTest/BRepTest_ChamferCommands.cxx | 11 +- src/BRepTest/BRepTest_CheckCommands.cxx | 60 ++-- src/BRepTest/BRepTest_CurveCommands.cxx | 106 +++--- src/BRepTest/BRepTest_DraftAngleCommands.cxx | 30 +- src/BRepTest/BRepTest_ExtremaCommands.cxx | 10 +- src/BRepTest/BRepTest_FeatureCommands.cxx | 118 +++---- src/BRepTest/BRepTest_Fillet2DCommands.cxx | 4 +- src/BRepTest/BRepTest_FilletCommands.cxx | 52 +-- src/BRepTest/BRepTest_FillingCommands.cxx | 68 ++-- src/BRepTest/BRepTest_GPropCommands.cxx | 10 +- src/BRepTest/BRepTest_OtherCommands.cxx | 17 +- src/BRepTest/BRepTest_PrimitiveCommands.cxx | 92 +++--- src/BRepTest/BRepTest_ProjectionCommands.cxx | 8 +- src/BRepTest/BRepTest_SurfaceCommands.cxx | 22 +- src/BRepTest/BRepTest_SweepCommands.cxx | 34 +- src/BRepTest/BRepTest_TopologyCommands.cxx | 2 +- src/DBRep/DBRep.cxx | 18 +- src/DDF/DDF_BrowserCommands.cxx | 2 +- src/DDF/DDF_IOStream.cxx | 4 + src/DDF/DDF_TransactionCommands.cxx | 4 +- src/DDataStd/DDataStd_BasicCommands.cxx | 90 ++--- src/DDataStd/DDataStd_ConstraintCommands.cxx | 4 +- src/DDataStd/DDataStd_DatumCommands.cxx | 26 +- src/DDataStd/DDataStd_DrawDisplayCommands.cxx | 6 +- src/DDataStd/DDataStd_TreeCommands.cxx | 8 +- src/DDocStd/DDocStd_DocumentCommands.cxx | 4 +- src/DDocStd/DDocStd_MTMCommands.cxx | 6 +- src/DNaming/DNaming_BasicCommands.cxx | 16 +- src/DNaming/DNaming_ModelingCommands.cxx | 88 ++--- src/DNaming/DNaming_SelectionCommands.cxx | 4 +- .../DPrsStd_AISPresentationCommands.cxx | 6 +- src/Draw/Draw.cdl | 10 +- src/Draw/Draw.cxx | 4 +- src/Draw/Draw_Appli.hxx | 3 - src/Draw/Draw_BasicCommands.cxx | 44 ++- src/Draw/Draw_GraphicCommands.cxx | 72 ++-- src/Draw/Draw_Interpretor.cxx | 6 +- src/Draw/Draw_ProgressIndicator.cxx | 18 +- src/Draw/Draw_UnitCommands.cxx | 8 +- src/Draw/Draw_VariableCommands.cxx | 21 +- .../DrawDim_PlanarDimensionCommands.cxx | 6 +- src/DrawTrSurf/DrawTrSurf.cxx | 44 +-- src/DrawTrSurf/DrawTrSurf_Triangulation.cxx | 4 +- .../Dynamic_FuzzyDefinitionsDictionary.cxx | 2 +- .../Dynamic_MethodDefinitionsDictionary.cxx | 2 +- src/Expr/Expr_NumericValue.cxx | 2 +- src/ExprIntrp/ExprIntrp_yaccintrf.cxx | 4 +- src/FSD/FSD_CmpFile.cdl | 6 +- src/FSD/FSD_CmpFile.cxx | 49 +-- src/FSD/FSD_File.cxx | 33 +- src/GeomProjLib/GeomProjLib.cxx | 4 +- .../GeometryTest_API2dCommands.cxx | 18 +- src/GeometryTest/GeometryTest_APICommands.cxx | 44 +-- .../GeometryTest_ConstraintCommands.cxx | 42 +-- .../GeometryTest_ContinuityCommands.cxx | 102 +++--- .../GeometryTest_CurveCommands.cxx | 76 ++--- .../GeometryTest_FairCurveCommands.cxx | 34 +- .../GeometryTest_PolyCommands.cxx | 16 +- .../GeometryTest_SurfaceCommands.cxx | 10 +- .../GeometryTest_TestProjCommands.cxx | 6 +- .../GeomliteTest_API2dCommands.cxx | 20 +- .../GeomliteTest_ApproxCommands.cxx | 10 +- .../GeomliteTest_CurveCommands.cxx | 308 +++++++++--------- .../GeomliteTest_ModificationCommands.cxx | 14 +- .../GeomliteTest_SurfaceCommands.cxx | 198 +++++------ src/HLRTest/HLRTest.cxx | 22 +- src/IGESData/IGESData_GlobalSection.cxx | 4 +- src/IGESData/IGESData_ParamReader.cxx | 14 +- src/IGESGeom/IGESGeom_ToolCircularArc.cxx | 2 +- src/IGESGeom/IGESGeom_ToolConicArc.cxx | 4 +- src/IGESGeom/IGESGeom_ToolPlane.cxx | 2 +- src/IGESSelect/IGESSelect_Activator.cxx | 4 +- src/IGESSelect/IGESSelect_Dumper.cxx | 8 +- src/IGESSelect/IGESSelect_FloatFormat.cxx | 6 +- src/IGESToBRep/IGESToBRep_Reader.cxx | 18 +- src/Interface/Interface_FileReaderData.cxx | 4 +- src/Interface/Interface_FloatWriter.cxx | 8 +- src/Interface/Interface_Static.cxx | 8 +- .../Materials_MaterialDefinition.cxx | 6 +- .../Materials_MaterialsDictionary.cxx | 4 +- src/MeshTest/MeshTest.cxx | 48 +-- src/MeshTest/MeshTest_PluginCommands.cxx | 9 +- src/Message/Message.cxx | 6 +- src/Message/Message_Msg.cxx | 6 +- src/MoniTool/MoniTool_Timer.cxx | 4 +- src/MoniTool/MoniTool_TypedValue.cxx | 20 +- src/OSD/FILES | 1 - src/OSD/OSD.cdl | 7 - src/OSD/OSD.cxx | 43 +-- src/OSD/OSD_Localizer.cdl | 60 ---- src/OSD/OSD_Localizer.cxx | 54 --- src/OSD/OSD_Real2String.cdl | 54 --- src/OSD/OSD_Real2String.cxx | 124 ------- src/OpenGl/OpenGl_GraphicDriver_Export.cxx | 12 +- src/PCDM/PCDM_RetrievalDriver.cxx | 15 +- src/PCDM/PCDM_StorageDriver.cxx | 14 +- src/PCollection/PCollection_HAsciiString.cxx | 2 +- src/Poly/Poly_CoherentNode.cxx | 4 +- src/QABugs/QABugs_1.cxx | 8 +- src/QABugs/QABugs_10.cxx | 29 +- src/QABugs/QABugs_11.cxx | 211 ++++++------ src/QABugs/QABugs_12.cxx | 9 +- src/QABugs/QABugs_13.cxx | 73 ++--- src/QABugs/QABugs_14.cxx | 36 +- src/QABugs/QABugs_15.cxx | 7 +- src/QABugs/QABugs_16.cxx | 39 ++- src/QABugs/QABugs_17.cxx | 55 ++-- src/QABugs/QABugs_18.cxx | 13 +- src/QABugs/QABugs_2.cxx | 19 +- src/QABugs/QABugs_3.cxx | 103 +++--- src/QABugs/QABugs_4.cxx | 4 +- src/QABugs/QABugs_5.cxx | 2 +- src/QABugs/QABugs_6.cxx | 9 +- src/QABugs/QABugs_8.cxx | 11 +- src/QABugs/QABugs_9.cxx | 9 +- src/QADNaming/QADNaming.cxx | 2 +- src/QADNaming/QADNaming_BasicCommands.cxx | 16 +- src/QADNaming/QADNaming_BuilderCommands.cxx | 2 +- src/QADNaming/QADNaming_IteratorsCommands.cxx | 4 +- src/QADNaming/QADNaming_SelectionCommands.cxx | 2 +- src/QADraw/QADraw.cxx | 23 +- src/QANCollection/QANCollection2.cxx | 21 +- src/QANCollection/QANCollection3.cxx | 8 +- src/QANewDBRepNaming/QANewDBRepNaming.cxx | 14 +- .../QANewDBRepNaming_FeatureCommands.cxx | 6 +- .../QANewDBRepNaming_PrimitiveCommands.cxx | 42 +-- src/RWStl/RWStl.cxx | 32 +- src/SWDRAW/SWDRAW.cxx | 9 +- src/SWDRAW/SWDRAW_ShapeAnalysis.cxx | 81 ++--- src/SWDRAW/SWDRAW_ShapeCustom.cxx | 12 +- src/SWDRAW/SWDRAW_ShapeFix.cxx | 40 +-- src/SWDRAW/SWDRAW_ShapeTool.cxx | 17 +- src/SWDRAW/SWDRAW_ShapeUpgrade.cxx | 83 ++--- src/Standard/FILES | 2 + src/Standard/Standard.cxx | 18 +- src/Standard/Standard_CLocaleSentry.cxx | 128 ++++++++ src/Standard/Standard_CLocaleSentry.hxx | 88 +++++ src/Standard/Standard_CString.cxx | 82 ++++- src/Standard/Standard_CString.hxx | 22 +- src/StepSelect/StepSelect_Activator.cxx | 4 +- src/StepSelect/StepSelect_FloatFormat.cxx | 6 +- src/Storage/Storage_Schema.cxx | 17 +- src/TCollection/TCollection_AsciiString.cxx | 12 +- .../TCollection_ExtendedString.cxx | 4 +- src/TObjDRAW/TObjDRAW.cxx | 6 +- src/TestTopOpe/TestTopOpe_BOOP.cxx | 2 +- src/TestTopOpe/TestTopOpe_BOOPCommands.cxx | 41 +-- src/TestTopOpe/TestTopOpe_CORCommands.cxx | 19 +- src/TestTopOpe/TestTopOpe_HDSCommands.cxx | 36 +- src/TestTopOpe/TestTopOpe_MesureCommands.cxx | 12 +- src/TestTopOpe/TestTopOpe_OtherCommands.cxx | 18 +- .../TestTopOpeDraw_OtherCommands.cxx | 24 +- .../TestTopOpeTools_TraceCommands.cxx | 2 +- src/TopOpeBRep/TopOpeBRep_traceALWL.cxx | 4 +- .../TopOpeBRepBuild_Griddump.cxx | 7 +- src/TopTools/TopTools_ShapeSet.cxx | 59 +--- src/Units/Units_UnitsDictionary.cxx | 16 - src/ViewerTest/ViewerTest.cxx | 118 +++---- src/ViewerTest/ViewerTest_FilletCommands.cxx | 10 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 238 +++++++------- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 144 ++++---- src/Voxel/Voxel_Reader.cxx | 14 +- src/VrmlData/VrmlData_Geometry.cxx | 12 +- src/VrmlData/VrmlData_Group.cxx | 10 +- src/VrmlData/VrmlData_IndexedFaceSet.cxx | 2 +- src/VrmlData/VrmlData_Material.cxx | 12 +- src/VrmlData/VrmlData_Scene.cxx | 30 +- src/VrmlData/VrmlData_WorldInfo.cxx | 4 +- src/WNT/WNT_GraphicDevice.cxx | 2 +- src/XDEDRAW/XDEDRAW.cxx | 24 +- src/XDEDRAW/XDEDRAW_Colors.cxx | 12 +- src/XDEDRAW/XDEDRAW_Common.cxx | 2 +- src/XDEDRAW/XDEDRAW_Layers.cxx | 7 +- src/XDEDRAW/XDEDRAW_Props.cxx | 47 +-- src/XDEDRAW/XDEDRAW_Shapes.cxx | 11 +- src/XSDRAW/XSDRAW.cxx | 4 +- src/XSDRAWIGES/XSDRAWIGES.cxx | 16 +- src/XSDRAWSTEP/XSDRAWSTEP.cxx | 6 +- src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx | 33 +- src/XmlLDrivers/XmlLDrivers.cxx | 5 - .../XmlLDrivers_DocumentRetrievalDriver.cxx | 8 +- .../XmlLDrivers_DocumentStorageDriver.cxx | 7 +- .../XmlMDataStd_NamedDataDriver.cxx | 2 +- .../XmlMDataStd_RealArrayDriver.cxx | 2 +- src/XmlMDataStd/XmlMDataStd_RealDriver.cxx | 2 +- src/XmlMNaming/XmlMNaming_Shape1.cxx | 8 +- src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx | 2 +- .../XmlMXCAFDoc_CentroidDriver.cxx | 2 +- src/XmlMXCAFDoc/XmlMXCAFDoc_DimTolDriver.cxx | 2 +- src/XmlObjMgt/XmlObjMgt.cxx | 10 +- src/XmlObjMgt/XmlObjMgt_GP.cxx | 14 +- tests/bugs/begin | 16 + tests/bugs/parse.rules | 1 + tests/bugs/xde/bug22898 | 53 +++ 203 files changed, 2707 insertions(+), 2807 deletions(-) delete mode 100755 src/OSD/OSD_Localizer.cdl delete mode 100755 src/OSD/OSD_Localizer.cxx delete mode 100755 src/OSD/OSD_Real2String.cdl delete mode 100755 src/OSD/OSD_Real2String.cxx create mode 100644 src/Standard/Standard_CLocaleSentry.cxx create mode 100644 src/Standard/Standard_CLocaleSentry.hxx mode change 100755 => 100644 src/Standard/Standard_CString.hxx create mode 100644 tests/bugs/xde/bug22898 diff --git a/src/Approx/Approx_SameParameter.cxx b/src/Approx/Approx_SameParameter.cxx index 7ff300b13e..6c9e58acfb 100755 --- a/src/Approx/Approx_SameParameter.cxx +++ b/src/Approx/Approx_SameParameter.cxx @@ -570,7 +570,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance) } Handle(Geom2d_BSplineCurve) DEBBS = new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1); - sprintf(Name,"DEBC2d_%d",++NbCurve); + Sprintf(Name,"DEBC2d_%d",++NbCurve); #ifdef DRAW DrawTrSurf::Set(Name,DEBBS); #endif @@ -651,7 +651,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance) Handle(Geom2d_BSplineCurve) DEBBS = new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1); - sprintf(Name,"DEBC2d_%d_%d",NbCurve,nbcoups ); + Sprintf(Name,"DEBC2d_%d_%d",NbCurve,nbcoups ); #ifdef DRAW DrawTrSurf::Set(Name,DEBBS); #endif diff --git a/src/BOPTest/BOPTest_BOPCommands.cxx b/src/BOPTest/BOPTest_BOPCommands.cxx index 83ccddd5ae..21986b340a 100755 --- a/src/BOPTest/BOPTest_BOPCommands.cxx +++ b/src/BOPTest/BOPTest_BOPCommands.cxx @@ -1496,8 +1496,8 @@ Standard_Integer bopsinf (Draw_Interpretor& di, const BooleanOperations_ShapesDataStructure& aDS=pDF->DS(); Standard_Integer nSp=0, nF1, nF2, anExistFlag=0; - nF1=atoi(a[1]); - nF2=atoi(a[2]); + nF1=Draw::Atoi(a[1]); + nF2=Draw::Atoi(a[2]); const TopoDS_Shape& aS1=aDS.GetShape(nF1); const TopoDS_Shape& aS2=aDS.GetShape(nF2); @@ -1558,8 +1558,8 @@ Standard_Integer bopsonf (Draw_Interpretor& di, const BooleanOperations_ShapesDataStructure& aDS=pDF->DS(); Standard_Integer nSp=0, nF1, nF2, anExistFlag=0; - nF1=atoi(a[1]); - nF2=atoi(a[2]); + nF1=Draw::Atoi(a[1]); + nF2=Draw::Atoi(a[2]); const TopoDS_Shape& aS1=aDS.GetShape(nF1); const TopoDS_Shape& aS2=aDS.GetShape(nF2); @@ -1621,7 +1621,7 @@ Standard_Integer bopwho (Draw_Interpretor& di, Standard_Boolean bIsNewShape; Standard_Integer iNum, i, aNbLines, aNbObj, aNewShape, aWhat, aWith; // - iNum=atoi(a[1]); + iNum=Draw::Atoi(a[1]); if (iNum<=0) { di << " Shape Index must be >0 .\n"; return 1; diff --git a/src/BOPTest/BOPTest_CurveCommands.cxx b/src/BOPTest/BOPTest_CurveCommands.cxx index 03da536ce2..9b92863299 100755 --- a/src/BOPTest/BOPTest_CurveCommands.cxx +++ b/src/BOPTest/BOPTest_CurveCommands.cxx @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -182,7 +183,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di, aTol=1.e-7; if (n>2) { - aTol=atof(a[2]); + aTol=Draw::Atof(a[2]); if (aTol<=0.) { aTol=1.e-7; } diff --git a/src/BOPTest/BOPTest_EFCommands.cxx b/src/BOPTest/BOPTest_EFCommands.cxx index 96211054de..3762f7f905 100755 --- a/src/BOPTest/BOPTest_EFCommands.cxx +++ b/src/BOPTest/BOPTest_EFCommands.cxx @@ -23,6 +23,7 @@ #include +#include #include #include @@ -70,15 +71,15 @@ static Standard_Integer bef (Draw_Interpretor& di, Standard_Real aTol=.0000001, aDeflection=.01, aFrom, aTo; if (n>=4) { - aDiscr=atoi (a[3]); + aDiscr=Draw::Atoi (a[3]); } if (n>=5) { - aTol=atof (a[4]); + aTol=Draw::Atof (a[4]); } if (n>=6) { - aDeflection=atof (a[5]); + aDeflection=Draw::Atof (a[5]); } di << " bef: ===Begin===\n"; diff --git a/src/BOPTest/BOPTest_LowCommands.cxx b/src/BOPTest/BOPTest_LowCommands.cxx index 83871d5c12..eafd9fa19d 100755 --- a/src/BOPTest/BOPTest_LowCommands.cxx +++ b/src/BOPTest/BOPTest_LowCommands.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -464,8 +465,8 @@ Standard_Integer baddve (Draw_Interpretor& di, Standard_Integer n, const char** Standard_Real p1, p2; - p1=atof(a[4]); - p2=atof(a[5]); + p1=Draw::Atof(a[4]); + p2=Draw::Atof(a[5]); TopoDS_Edge E=aE; E.EmptyCopy(); @@ -552,7 +553,7 @@ static Standard_Integer bexplode(Draw_Interpretor& di, TopoDS_Iterator itr(S); while (itr.More()) { i++; - sprintf(p,"%d",i); + Sprintf(p,"%d",i); DBRep::Set(newname,itr.Value()); di.AppendElement(newname); itr.Next(); @@ -610,7 +611,7 @@ static Standard_Integer bexplode(Draw_Interpretor& di, for (; ex.More(); ex.Next()) { const TopoDS_Shape& aS = ex.Current(); i++; - sprintf(p,"%d",i); + Sprintf(p,"%d",i); DBRep::Set(newname,aS); di.AppendElement(newname); } @@ -629,20 +630,20 @@ Standard_Integer bclassify (Draw_Interpretor& aDI, char sbf[512]; if (n < 3) { - sprintf(sbf, " Use >bclassify Solid Point [Tolerance=1.e-7]\n"); + Sprintf(sbf, " Use >bclassify Solid Point [Tolerance=1.e-7]\n"); aDI<bclassify Face Point2d [Tol2D=Tol(Face)]\n"); + Sprintf(sbf, " Use >bclassify Face Point2d [Tol2D=Tol(Face)]\n"); aDI< +#include #include #include #include @@ -67,10 +68,10 @@ static Standard_Integer bbedge (Draw_Interpretor& di, Standard_Real aTol=.0000001, aDeflection=.01; Standard_Real f1, l1, f2, l2; - f1=atof (a[3]); - l1=atof (a[4]); - f2=atof (a[5]); - l2=atof (a[6]); + f1=Draw::Atof (a[3]); + l1=Draw::Atof (a[4]); + f2=Draw::Atof (a[5]); + l2=Draw::Atof (a[6]); IntTools_Range aR1, aR2; aR1.SetFirst(f1); aR1.SetLast(l1); @@ -172,15 +173,15 @@ static Standard_Integer bedge (Draw_Interpretor& di, aR2.SetFirst(f2); aR2.SetLast(l2); if (n>=4) { - aDiscr=atoi (a[3]); + aDiscr=Draw::Atoi (a[3]); } if (n>=5) { - aTol=atof (a[4]); + aTol=Draw::Atof (a[4]); } if (n>=6) { - aDeflection=atof (a[5]); + aDeflection=Draw::Atof (a[5]); } di << " bedge: ===Begin===\n"; diff --git a/src/BOPTest/BOPTest_TolerCommands.cxx b/src/BOPTest/BOPTest_TolerCommands.cxx index b5ff0933af..c869ad9482 100755 --- a/src/BOPTest/BOPTest_TolerCommands.cxx +++ b/src/BOPTest/BOPTest_TolerCommands.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -124,7 +125,7 @@ Standard_Integer btolx(Draw_Interpretor& di, Standard_Integer n, const char** // Standard_Real aTolEMin=1.e-7; if (n==3) { - aTolEMin=atof(a[2]); + aTolEMin=Draw::Atof(a[2]); } // // Edge Tolerances diff --git a/src/BOPTools/BOPTools_Checker.cxx b/src/BOPTools/BOPTools_Checker.cxx index 2a9ae48e20..48b73382de 100755 --- a/src/BOPTools/BOPTools_Checker.cxx +++ b/src/BOPTools/BOPTools_Checker.cxx @@ -242,7 +242,7 @@ void BOPTools_Checker::PerformVV() if (!aFlag) { char buf[512]; - sprintf (buf, "VV: (%d, %d)", n1, n2); + Sprintf (buf, "VV: (%d, %d)", n1, n2); BOPTools_CheckResult aChRes; aChRes.AddShape(aV1); @@ -308,7 +308,7 @@ void BOPTools_Checker::PerformVE() // if (!aFlag) { char buf[512]; - sprintf (buf, "VE: (%d, %d)", aWhat, aWith); + Sprintf (buf, "VE: (%d, %d)", aWhat, aWith); BOPTools_CheckResult aChRes; aChRes.AddShape(aV1); @@ -369,7 +369,7 @@ void BOPTools_Checker::PerformVF() // if (!aFlag) { char buf[512]; - sprintf (buf, "VF: (%d, %d)", aWhat, aWith); + Sprintf (buf, "VF: (%d, %d)", aWhat, aWith); BOPTools_CheckResult aChRes; aChRes.AddShape(aV1); @@ -530,7 +530,7 @@ void BOPTools_Checker::PerformEE() } // char buf[512]; - sprintf (buf, "EE: (%d, %d), vertex at t1=%f, t2=%f", aWhat, aWith, aT1, aT2); + Sprintf (buf, "EE: (%d, %d), vertex at t1=%f, t2=%f", aWhat, aWith, aT1, aT2); // gp_Pnt aPnt; BOPTools_Tools::PointOnEdge(aEWhat, aT1, aPnt); @@ -570,7 +570,7 @@ void BOPTools_Checker::PerformEE() } // char buf[512]; - sprintf (buf, "EE: (%d, %d), common block ", aWhat, aWith); + Sprintf (buf, "EE: (%d, %d), common block ", aWhat, aWith); BOPTools_CheckResult aChRes; aChRes.AddShape(aE1); @@ -704,7 +704,7 @@ void BOPTools_Checker::PerformEF() } // char buf[512]; - sprintf (buf, "EF: (%d, %d), vertex at t=%f", nE, nF, aT); + Sprintf (buf, "EF: (%d, %d), vertex at t=%f", nE, nF, aT); // gp_Pnt aPnt; BOPTools_Tools::PointOnEdge(aE, aT, aPnt); @@ -734,7 +734,7 @@ void BOPTools_Checker::PerformEF() } // char buf[512]; - sprintf (buf, "EF: (%d, %d), common block ", nE, nF); + Sprintf (buf, "EF: (%d, %d), common block ", nE, nF); BOPTools_CheckResult aChRes; aChRes.AddShape(aE); @@ -846,7 +846,7 @@ void BOPTools_Checker::PerformEF() if (aNbPoints) { char buf[512]; - sprintf (buf, "FF: (%d, %d) ", nF1, nF2); + Sprintf (buf, "FF: (%d, %d) ", nF1, nF2); // const IntTools_PntOn2Faces& aPntOn2Faces=aPnts(1); const IntTools_PntOnFace& aPntOnFace=aPntOn2Faces.P1(); @@ -881,7 +881,7 @@ void BOPTools_Checker::PerformEF() // if (bValid) { char buf[512]; - sprintf (buf, "FF: (%d, %d) ", nF1, nF2); + Sprintf (buf, "FF: (%d, %d) ", nF1, nF2); // Handle (Geom_Curve) aC3D=aC.Curve(); Handle (Geom_TrimmedCurve) aTC3D=Handle (Geom_TrimmedCurve)::DownCast(aC3D); @@ -1036,7 +1036,7 @@ void BOPTools_Checker::PerformEF() char buf[512]; if (!aSR.IsDone()) { - sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); + Sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); BOPTools_CheckResult aChRes; aChRes.AddShape(aE); @@ -1048,7 +1048,7 @@ void BOPTools_Checker::PerformEF() } // if (anErrorStatus==6) { - sprintf(buf, + Sprintf(buf, "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); BOPTools_CheckResult aChRes; diff --git a/src/BRepTest/BRepTest_BasicCommands.cxx b/src/BRepTest/BRepTest_BasicCommands.cxx index b1472a4d7a..e7feabb1c9 100755 --- a/src/BRepTest/BRepTest_BasicCommands.cxx +++ b/src/BRepTest/BRepTest_BasicCommands.cxx @@ -77,7 +77,7 @@ static Standard_Integer addpcurve(Draw_Interpretor& , Standard_Integer n, const TopoDS_Shape F = DBRep::Get(a[3]); Standard_Real tol = 1.e-7; if (n > 4) { - tol = atof(a[4]); + tol = Draw::Atof(a[4]); } BRep_Builder BB; BB.UpdateEdge(TopoDS::Edge(E), PC, TopoDS::Face(F),tol); @@ -108,25 +108,25 @@ static Standard_Integer transform(Draw_Interpretor& di,Standard_Integer n,const } else if (!strcmp(a[0],"ttranslate")) { if (n < 5) return 1; - T.SetTranslation(gp_Vec(atof(a[n-3]),atof(a[n-2]),atof(a[n-1]))); + T.SetTranslation(gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1]))); last = n-3; } else if (!strcmp(a[0],"trotate")) { if (n < 9) return 1; - T.SetRotation(gp_Ax1(gp_Pnt(atof(a[n-7]),atof(a[n-6]),atof(a[n-5])), - gp_Vec(atof(a[n-4]),atof(a[n-3]),atof(a[n-2]))), - atof(a[n-1])* (M_PI / 180.0)); + T.SetRotation(gp_Ax1(gp_Pnt(Draw::Atof(a[n-7]),Draw::Atof(a[n-6]),Draw::Atof(a[n-5])), + gp_Vec(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2]))), + Draw::Atof(a[n-1])* (M_PI / 180.0)); last = n-7; } else if (!strcmp(a[0],"tmirror")) { if (n < 8) return 1; - T.SetMirror(gp_Ax2(gp_Pnt(atof(a[n-6]),atof(a[n-5]),atof(a[n-4])), - gp_Vec(atof(a[n-3]),atof(a[n-2]),atof(a[n-1])))); + T.SetMirror(gp_Ax2(gp_Pnt(Draw::Atof(a[n-6]),Draw::Atof(a[n-5]),Draw::Atof(a[n-4])), + gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1])))); last = n-6; } else if (!strcmp(a[0],"tscale")) { if (n < 6) return 1; - T.SetScale(gp_Pnt(atof(a[n-4]),atof(a[n-3]),atof(a[n-2])),atof(a[n-1])); + T.SetScale(gp_Pnt(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2])),Draw::Atof(a[n-1])); last = n-4; } @@ -180,8 +180,8 @@ static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const cha gp_Trsf T; gp_GTrsf GT(T); -// gp_Mat rot(atof(a[last-3]),0,0,0,atof(a[last-2]),0,0,0,atof(a[last-1])); - gp_Mat rot(atof(a[3]),0,0,0,atof(a[4]),0,0,0,atof(a[5])); +// gp_Mat rot(Draw::Atof(a[last-3]),0,0,0,Draw::Atof(a[last-2]),0,0,0,Draw::Atof(a[last-1])); + gp_Mat rot(Draw::Atof(a[3]),0,0,0,Draw::Atof(a[4]),0,0,0,Draw::Atof(a[5])); GT.SetVectorialPart(rot); last -= 3; BRepBuilderAPI_GTransform gtrf(GT); @@ -278,7 +278,7 @@ static Standard_Integer mkedgecurve (Draw_Interpretor& ,Standard_Integer n,const Standard_Boolean CurveDone ; if (n < 3) return 1; - Standard_Real Tolerance = atof(a[2]) ; + Standard_Real Tolerance = Draw::Atof(a[2]) ; TopoDS_Shape S = DBRep::Get(a[1]); @@ -301,7 +301,7 @@ static Standard_Integer sameparameter(Draw_Interpretor& ,Standard_Integer n,cons TopoDS_Shape S = DBRep::Get(a[1]); if (S.IsNull()) return 1; Standard_Boolean force = !strcmp(a[0],"fsameparameter"); - if (n == 3) tol = atof(a[2]); + if (n == 3) tol = Draw::Atof(a[2]); BRepLib::SameParameter(S,tol,force); @@ -390,12 +390,12 @@ static Standard_Integer bounding(Draw_Interpretor& di,Standard_Integer n,const c di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax; } else if (n == 7) { - axmin=atof(a[1]); - aymin=atof(a[2]); - azmin=atof(a[3]); - axmax=atof(a[4]); - aymax=atof(a[5]); - azmax=atof(a[6]); + axmin=Draw::Atof(a[1]); + aymin=Draw::Atof(a[2]); + azmin=Draw::Atof(a[3]); + axmax=Draw::Atof(a[4]); + aymax=Draw::Atof(a[5]); + azmax=Draw::Atof(a[6]); DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_orange); dout< arg) - MaxDistance = atof(a[arg++]); + MaxDistance = Draw::Atof(a[arg++]); OrtProj.SetMaxDistance(MaxDistance); } if(n > arg) { - Tol = Max(atof(a[arg++]),1.e-10); + Tol = Max(Draw::Atof(a[arg++]),1.e-10); } if(n > arg) { - if (atoi(a[arg]) == 0) Continuity = GeomAbs_C0; - else if (atoi(a[arg]) == 1) Continuity = GeomAbs_C1; + if (Draw::Atoi(a[arg]) == 0) Continuity = GeomAbs_C0; + else if (Draw::Atoi(a[arg]) == 1) Continuity = GeomAbs_C1; arg++; } if(n > arg) { - MaxDeg = atoi(a[arg++]); + MaxDeg = Draw::Atoi(a[arg++]); if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14; } - if(n > arg) MaxSeg = atoi(a[arg]); + if(n > arg) MaxSeg = Draw::Atoi(a[arg]); Tol2d = Pow(Tol, 2./3); @@ -766,7 +766,7 @@ static Standard_Integer wexplo (Draw_Interpretor&, Standard_Integer k = 1; while (we.More()) { TopoDS_Edge E = we.Current(); - sprintf(name,"WEDGE_%d",k); + Sprintf(name,"WEDGE_%d",k); DBRep::Set(name,E); we.Next(); k++; @@ -782,9 +782,9 @@ static Standard_Integer scalexyz(Draw_Interpretor& di, Standard_Integer n, const TopoDS_Shape aShapeBase = DBRep::Get(a[2]); if (aShapeBase.IsNull()) return 1; - Standard_Real aFactorX = atof(a[3]); - Standard_Real aFactorY = atof(a[4]); - Standard_Real aFactorZ = atof(a[5]); + Standard_Real aFactorX = Draw::Atof(a[3]); + Standard_Real aFactorY = Draw::Atof(a[4]); + Standard_Real aFactorZ = Draw::Atof(a[5]); gp_GTrsf aGTrsf; gp_Mat rot (aFactorX, 0, 0, diff --git a/src/BRepTest/BRepTest_ChamferCommands.cxx b/src/BRepTest/BRepTest_ChamferCommands.cxx index cc9920b8c9..b213238b61 100755 --- a/src/BRepTest/BRepTest_ChamferCommands.cxx +++ b/src/BRepTest/BRepTest_ChamferCommands.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -97,7 +98,7 @@ static Standard_Integer chamfer(Draw_Interpretor& di, // F = TopoDS::Face(DBRep::Get(a[i + 1], TopAbs_FACE)); if (Method == 0) { if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) { - d1 = atof(a[i + 3]); + d1 = Draw::Atof(a[i + 3]); if ( d1 > Precision::Confusion()) aMCh.Add(d1,E ,F); @@ -106,8 +107,8 @@ static Standard_Integer chamfer(Draw_Interpretor& di, } else if (Method == 1) { if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) { - d1 = atof(a[i + 2]); - d2 = atof(a[i + 3]); + d1 = Draw::Atof(a[i + 2]); + d2 = Draw::Atof(a[i + 3]); if ( (d1 > Precision::Confusion()) && (d2 > Precision::Confusion()) ) @@ -117,8 +118,8 @@ static Standard_Integer chamfer(Draw_Interpretor& di, } else { if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) { - d1 = atof(a[i + 3]); - angle = atof(a[i + 4]); + d1 = Draw::Atof(a[i + 3]); + angle = Draw::Atof(a[i + 4]); angle *= M_PI / 180.; if ( (d1 > Precision::Confusion()) diff --git a/src/BRepTest/BRepTest_CheckCommands.cxx b/src/BRepTest/BRepTest_CheckCommands.cxx index b6ea15b43c..6755056987 100755 --- a/src/BRepTest/BRepTest_CheckCommands.cxx +++ b/src/BRepTest/BRepTest_CheckCommands.cxx @@ -171,7 +171,7 @@ static void PrintSub(Standard_OStream& OS, if (!FindNamed(sub,Name)) { nbfaulty++; Name = (char*)malloc(18*sizeof(char)); - sprintf(Name,"%s%d",checkfaultyname,nbfaulty); + Sprintf(Name,"%s%d",checkfaultyname,nbfaulty); DBRep::Set(Name,sub); lfaulty.Append(Draw::Get((Standard_CString&)Name)); } @@ -179,7 +179,7 @@ static void PrintSub(Standard_OStream& OS, if (!FindNamed(S,Name)) { nbfaulty++; Name = (char*)malloc(18*sizeof(char)); - sprintf(Name,"%s%d",checkfaultyname,nbfaulty); + Sprintf(Name,"%s%d",checkfaultyname,nbfaulty); DBRep::Set(Name,S); lfaulty.Append(Draw::Get((Standard_CString&)Name)); } @@ -215,7 +215,7 @@ static void Print(Standard_OStream& OS, if (!FindNamed(S,Name)) { nbfaulty++; Name = (char*)malloc(18*sizeof(char)); - sprintf(Name,"%s%d",checkfaultyname,nbfaulty); + Sprintf(Name,"%s%d",checkfaultyname,nbfaulty); DBRep::Set(Name,S); lfaulty.Append(Draw::Get((Standard_CString&)Name)); } @@ -318,7 +318,7 @@ static Standard_Integer checksection(Draw_Interpretor& di, TopTools_MapIteratorOfMapOfShape itvx; for (itvx.Initialize(theVertices); itvx.More(); itvx.Next()) { ipp++; - sprintf(Name,"alone_%d",ipp); + Sprintf(Name,"alone_%d",ipp); DBRep::Set(Name, itvx.Key()); //cout << Name << " " ; di << Name << " " ; @@ -339,7 +339,7 @@ static Standard_Integer checkdiff(Draw_Interpretor& di, const char* syntaxe = "checkdiff arg1 [arg2..argn] result [closedSolid (0/1)] [geomCtrl (1/0)]"; if (narg < 3) { if (narg==2) { - Standard_Integer bcrtrace=atoi(a[narg-1]); + Standard_Integer bcrtrace=Draw::Atoi(a[narg-1]); bcrtrace=BRepCheck_Trace(bcrtrace); //cout << "BRepCheck_Trace : " << bcrtrace << endl; di << "BRepCheck_Trace : " << bcrtrace << "\n"; @@ -362,7 +362,7 @@ static Standard_Integer checkdiff(Draw_Interpretor& di, di << syntaxe << "\n"; return 1; } - closedSolid=atoi(a[narg-1]); + closedSolid=Draw::Atoi(a[narg-1]); resu = DBRep::Get(a[narg-2]); lastArg=narg-3; if (resu.IsNull()) { @@ -372,7 +372,7 @@ static Standard_Integer checkdiff(Draw_Interpretor& di, return 1; } geomCtrl=closedSolid; - closedSolid=atoi(a[narg-2]); + closedSolid=Draw::Atoi(a[narg-2]); resu = DBRep::Get(a[narg-3]); lastArg=narg-4; if (resu.IsNull()) { @@ -820,7 +820,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,slv->Value(i)); char aName[20]; - sprintf(aName,"%s_v",Pref); + Sprintf(aName,"%s_v",Pref); DBRep::Set(aName,comp); //cout<<"VERTEX"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -835,7 +835,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,sle->Value(i)); char aName[20]; - sprintf(aName,"%s_e",Pref); + Sprintf(aName,"%s_e",Pref); DBRep::Set(aName,comp); //cout<<"EDGE"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -850,7 +850,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,slw->Value(i)); char aName[20]; - sprintf(aName,"%s_w",Pref); + Sprintf(aName,"%s_w",Pref); DBRep::Set(aName,comp); //cout<<"WIRE"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -865,7 +865,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,slf->Value(i)); char aName[20]; - sprintf(aName,"%s_f",Pref); + Sprintf(aName,"%s_f",Pref); DBRep::Set(aName,comp); //cout<<"FACE"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -880,7 +880,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,sls->Value(i)); char aName[20]; - sprintf(aName,"%s_s",Pref); + Sprintf(aName,"%s_s",Pref); DBRep::Set(aName,comp); //cout<<"SHELL"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -895,7 +895,7 @@ void StructuralDump(Draw_Interpretor& theCommands, for(i=1; i<=nb; i++) B.Add(comp,slo->Value(i)); char aName[20]; - sprintf(aName,"%s_o",Pref); + Sprintf(aName,"%s_o",Pref); DBRep::Set(aName,comp); //cout<<"SOLID"<<" : "<<(nb > 9 ? "" : " ")< compound named "< 9) @@ -1105,12 +1105,12 @@ static Standard_Integer shapeG1continuity (Draw_Interpretor& di, Standard_Intege - nbeval = (Standard_Integer ) atof( a[3]); + nbeval = (Standard_Integer ) Draw::Atof( a[3]); switch(n) - { case 7 : epsG1 = atof(a[6]); - case 6 : epsC0 = atof(a[5]); - case 5 : epsnl = atof(a[4]); + { case 7 : epsG1 = Draw::Atof(a[6]); + case 6 : epsC0 = Draw::Atof(a[5]); + case 5 : epsnl = Draw::Atof(a[4]); case 4 : {} break; default : return 1; } @@ -1230,11 +1230,11 @@ static Standard_Integer shapeG0continuity (Draw_Interpretor& di, Standard_Intege - nbeval = (Standard_Integer ) atof( a[3]); + nbeval = (Standard_Integer ) Draw::Atof( a[3]); switch(n) - { case 6 : epsC0 = atof(a[5]); - case 5 : epsnl = atof(a[4]); + { case 6 : epsC0 = Draw::Atof(a[5]); + case 5 : epsnl = Draw::Atof(a[4]); case 4 : {} break; default : return 1; } @@ -1351,15 +1351,15 @@ static Standard_Integer shapeG2continuity (Draw_Interpretor& di, Standard_Intege - nbeval = (Standard_Integer ) atof( a[3]); + nbeval = (Standard_Integer ) Draw::Atof( a[3]); switch(n) { - case 9 : maxlen = atof(a[8]); - case 8 : percent = atof(a[7]); - case 7 : epsG1 = atof(a[6]); - case 6 : epsC0 = atof(a[5]); - case 5 : epsnl = atof(a[4]); + case 9 : maxlen = Draw::Atof(a[8]); + case 8 : percent = Draw::Atof(a[7]); + case 7 : epsG1 = Draw::Atof(a[6]); + case 6 : epsC0 = Draw::Atof(a[5]); + case 5 : epsnl = Draw::Atof(a[4]); case 4 : {} break; default : return 1; } @@ -1454,7 +1454,7 @@ static Standard_Integer clintedge(Draw_Interpretor& di, Standard_Integer i = 1; char* temp = newname; - sprintf(newname,"%s_%d",a[1],i); + Sprintf(newname,"%s_%d",a[1],i); DBRep::Set(temp,mypurgealgo.Shape()); //cout<= 5) { DBRep::Set(a[1], - BRepBuilderAPI_MakeVertex(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])))); + BRepBuilderAPI_MakeVertex(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])))); } else { TopoDS_Shape S = DBRep::Get(a[3]); @@ -96,7 +96,7 @@ static Standard_Integer vertex(Draw_Interpretor& , Standard_Integer n, const cha if (S.ShapeType() != TopAbs_EDGE) return 0; BRepAdaptor_Curve C(TopoDS::Edge(S)); gp_Pnt P; - C.D0(atof(a[2]),P); + C.D0(Draw::Atof(a[2]),P); DBRep::Set(a[1], BRepBuilderAPI_MakeVertex(P)); } return 0; @@ -113,8 +113,8 @@ static Standard_Integer range(Draw_Interpretor& , Standard_Integer n, const char TopoDS_Edge E = TopoDS::Edge(aLocalShape); // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE)); if (E.IsNull()) return 1; - Standard_Real f = atof(a[n-2]); - Standard_Real l = atof(a[n-1]); + Standard_Real f = Draw::Atof(a[n-2]); + Standard_Real l = Draw::Atof(a[n-1]); BRep_Builder B; if (n == 4) B.Range(E,f,l); @@ -188,7 +188,7 @@ static Standard_Integer polyline(Draw_Interpretor& , Standard_Integer n, const c BRepBuilderAPI_MakePolygon W; j = 2; for (i = 1; i <= np; i ++) { - W.Add(gp_Pnt(atof(a[j]),atof(a[j+1]),atof(a[j+2]))); + W.Add(gp_Pnt(Draw::Atof(a[j]),Draw::Atof(a[j+1]),Draw::Atof(a[j+2]))); j += 3; } DBRep::Set(a[1],W.Wire()); @@ -277,11 +277,11 @@ static Standard_Integer mkedge(Draw_Interpretor& di, Standard_Integer n, const c if (n == 5+i) { if (V1.IsNull()) { if (!C.IsNull()) - edge = BRepBuilderAPI_MakeEdge(C,atof(a[3]),atof(a[4])); + edge = BRepBuilderAPI_MakeEdge(C,Draw::Atof(a[3]),Draw::Atof(a[4])); else if (S.IsNull()) - edge = BRepBuilderAPI_MakeEdge2d(C2d,atof(a[3]),atof(a[4])); + edge = BRepBuilderAPI_MakeEdge2d(C2d,Draw::Atof(a[3]),Draw::Atof(a[4])); else - edge = BRepBuilderAPI_MakeEdge(C2d,S,atof(a[4]),atof(a[5])); + edge = BRepBuilderAPI_MakeEdge(C2d,S,Draw::Atof(a[4]),Draw::Atof(a[5])); } else { aLocalShape = DBRep::Get(a[4+i],TopAbs_VERTEX); @@ -300,11 +300,11 @@ static Standard_Integer mkedge(Draw_Interpretor& di, Standard_Integer n, const c TopoDS_Vertex V2 = TopoDS::Vertex(aLocalShape); // TopoDS_Vertex V2 = TopoDS::Vertex(DBRep::Get(a[5+i],TopAbs_VERTEX)); if (!C.IsNull()) - edge = BRepBuilderAPI_MakeEdge(C,V1,V2,atof(a[4]),atof(a[6])); + edge = BRepBuilderAPI_MakeEdge(C,V1,V2,Draw::Atof(a[4]),Draw::Atof(a[6])); else if (S.IsNull()) - edge = BRepBuilderAPI_MakeEdge2d(C2d,V1,V2,atof(a[4]),atof(a[6])); + edge = BRepBuilderAPI_MakeEdge2d(C2d,V1,V2,Draw::Atof(a[4]),Draw::Atof(a[6])); else - edge = BRepBuilderAPI_MakeEdge(C2d,S,V1,V2,atof(a[5]),atof(a[7])); + edge = BRepBuilderAPI_MakeEdge(C2d,S,V1,V2,Draw::Atof(a[5]),Draw::Atof(a[7])); } else return 1; @@ -442,9 +442,9 @@ static Standard_Integer isoedge(Draw_Interpretor& , Standard_Integer n, const ch if (n < 6) return 1; Standard_Boolean uiso = *a[0] == 'u'; - Standard_Real p = atof(a[3]); - Standard_Real p1 = atof(a[4]); - Standard_Real p2 = atof(a[5]); + Standard_Real p = Draw::Atof(a[3]); + Standard_Real p1 = Draw::Atof(a[4]); + Standard_Real p2 = Draw::Atof(a[5]); TopoDS_Shape Sh = DBRep::Get(a[2],TopAbs_FACE); if (Sh.IsNull()) return 1; TopLoc_Location Loc; @@ -603,8 +603,8 @@ static Standard_Integer profile(Draw_Interpretor& di, di << "profile: The F instruction must precede all moves"; return 1; } - x0 = x = atof(a[i-1]); - y0 = y = atof(a[i]); + x0 = x = Draw::Atof(a[i-1]); + y0 = y = Draw::Atof(a[i]); stayfirst = Standard_True; break; @@ -612,7 +612,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'o': i += 3; if (i >= n) goto badargs; - P.SetLocation(gp_Pnt(atof(a[i-2]),atof(a[i-1]),atof(a[i]))); + P.SetLocation(gp_Pnt(Draw::Atof(a[i-2]),Draw::Atof(a[i-1]),Draw::Atof(a[i]))); stayfirst = Standard_True; break; @@ -621,8 +621,8 @@ static Standard_Integer profile(Draw_Interpretor& di, i += 6; if (i >= n) goto badargs; { - gp_Vec vn(atof(a[i-5]),atof(a[i-4]),atof(a[i-3])); - gp_Vec vx(atof(a[i-2]),atof(a[i-1]),atof(a[i])); + gp_Vec vn(Draw::Atof(a[i-5]),Draw::Atof(a[i-4]),Draw::Atof(a[i-3])); + gp_Vec vx(Draw::Atof(a[i-2]),Draw::Atof(a[i-1]),Draw::Atof(a[i])); if (vn.Magnitude() <= Precision::Confusion()) { di << "profile : null direction"; return 1; @@ -664,7 +664,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'x': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) { length -= x; } @@ -676,7 +676,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'y': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) { length -= y; } @@ -688,7 +688,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'l': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); move = line; break; @@ -697,8 +697,8 @@ static Standard_Integer profile(Draw_Interpretor& di, i += 2; if (i >= n) goto badargs; { - Standard_Real vx = atof(a[i-1]); - Standard_Real vy = atof(a[i]); + Standard_Real vx = Draw::Atof(a[i-1]); + Standard_Real vy = Draw::Atof(a[i]); if ((a[i-2][1] == 'T') || (a[i-2][1] == 't')) { vx -= x; vy -= y; @@ -716,7 +716,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'r': i++; if (i >= n) goto badargs; - angle = atof(a[i]) * (M_PI / 180.0); + angle = Draw::Atof(a[i]) * (M_PI / 180.0); if ((a[i-1][1] == 'R') || (a[i-1][1] == 'r')) { dx = Cos(angle); dy = Sin(angle); @@ -735,8 +735,8 @@ static Standard_Integer profile(Draw_Interpretor& di, i += 2; if (i >= n) goto badargs; { - Standard_Real vx = atof(a[i-1]); - Standard_Real vy = atof(a[i]); + Standard_Real vx = Draw::Atof(a[i-1]); + Standard_Real vy = Draw::Atof(a[i]); length = Sqrt(vx*vx+vy*vy); if (length > Precision::Confusion()) { // move = line; DUB @@ -750,9 +750,9 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'c': i += 2; if (i >= n) goto badargs; - radius = atof(a[i-1]); + radius = Draw::Atof(a[i-1]); if (Abs(radius) > Precision::Confusion()) { - angle = atof(a[i]) * (M_PI / 180.0); + angle = Draw::Atof(a[i]) * (M_PI / 180.0); move = circle; } break; @@ -761,7 +761,7 @@ static Standard_Integer profile(Draw_Interpretor& di, case 'i': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) { if (Abs(dx) < Precision::Confusion()) { di << "Profile : cannot intersect, arg " << i-1; @@ -1242,8 +1242,8 @@ static Standard_Integer profile2d(Draw_Interpretor& di, di << "profile: The F instruction must precede all moves"; return 1; } - x0 = x = atof(a[i-1]); - y0 = y = atof(a[i]); + x0 = x = Draw::Atof(a[i-1]); + y0 = y = Draw::Atof(a[i]); stayfirst = Standard_True; break; @@ -1251,7 +1251,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'x': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) { length -= x; } @@ -1263,7 +1263,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'y': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'Y') || (a[i-1][1] == 'y')) { length -= y; } @@ -1275,7 +1275,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'l': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); move = line; break; @@ -1284,8 +1284,8 @@ static Standard_Integer profile2d(Draw_Interpretor& di, i += 2; if (i >= n) goto badargs; { - Standard_Real vx = atof(a[i-1]); - Standard_Real vy = atof(a[i]); + Standard_Real vx = Draw::Atof(a[i-1]); + Standard_Real vy = Draw::Atof(a[i]); if ((a[i-2][1] == 'T') || (a[i-2][1] == 't')) { vx -= x; vy -= y; @@ -1303,7 +1303,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'r': i++; if (i >= n) goto badargs; - angle = atof(a[i]) * (M_PI / 180.0); + angle = Draw::Atof(a[i]) * (M_PI / 180.0); if ((a[i-1][1] == 'R') || (a[i-1][1] == 'r')) { dx = Cos(angle); dy = Sin(angle); @@ -1322,8 +1322,8 @@ static Standard_Integer profile2d(Draw_Interpretor& di, i += 2; if (i >= n) goto badargs; { - Standard_Real vx = atof(a[i-1]); - Standard_Real vy = atof(a[i]); + Standard_Real vx = Draw::Atof(a[i-1]); + Standard_Real vy = Draw::Atof(a[i]); length = Sqrt(vx*vx+vy*vy); if (length > Precision::Confusion()) { // move = line; DUB @@ -1337,9 +1337,9 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'c': i += 2; if (i >= n) goto badargs; - radius = atof(a[i-1]); + radius = Draw::Atof(a[i-1]); if (Abs(radius) > Precision::Confusion()) { - angle = atof(a[i]) * (M_PI / 180.0); + angle = Draw::Atof(a[i]) * (M_PI / 180.0); move = circle; } break; @@ -1348,7 +1348,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, case 'i': i++; if (i >= n) goto badargs; - length = atof(a[i]); + length = Draw::Atof(a[i]); if ((a[i-1][1] == 'X') || (a[i-1][1] == 'x')) { if (Abs(dx) < Precision::Confusion()) { di << "Profile : cannot intersect, arg " << i-1; @@ -1394,7 +1394,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, Handle(Geom2d_TrimmedCurve) ct = new Geom2d_TrimmedCurve(l,0,length); NbCurves++; - sprintf(name,"%s_%d",a[1],NbCurves); + Sprintf(name,"%s_%d",a[1],NbCurves); DrawTrSurf::Set(name,ct); di.AppendElement(name); x += length*dx; @@ -1420,7 +1420,7 @@ static Standard_Integer profile2d(Draw_Interpretor& di, Handle(Geom2d_TrimmedCurve) ct = new Geom2d_TrimmedCurve(c,0,angle); NbCurves++; - sprintf(name,"%s_%d",a[1],NbCurves); + Sprintf(name,"%s_%d",a[1],NbCurves); DrawTrSurf::Set(name,ct); di.AppendElement(name); gp_Pnt2d p; @@ -1508,11 +1508,11 @@ Standard_Integer mkoffset(Draw_Interpretor& di, Standard_Real U, dU; Standard_Integer Nb; - dU = atof(a[4]); - Nb = atoi(a[3]); + dU = Draw::Atof(a[4]); + Nb = Draw::Atoi(a[3]); Standard_Real Alt = 0.; - if ( n == 6) Alt = atof(a[5]); + if ( n == 6) Alt = Draw::Atof(a[5]); Standard_Integer Compt = 1; for ( Standard_Integer i = 1; i <= Nb; i++) { @@ -1523,7 +1523,7 @@ Standard_Integer mkoffset(Draw_Interpretor& di, di << " Parali aux fraises" << "\n"; } else { - sprintf(name,"%s_%d", a[1], Compt++); + Sprintf(name,"%s_%d", a[1], Compt++); char* temp = name; // portage WNT DBRep::Set(temp,Paral.Shape()); } @@ -1545,7 +1545,7 @@ Standard_Integer pickface(Draw_Interpretor& di, if (S.IsNull()) return 1; char* name = new char[100]; - sprintf(name,"PickedFace %s",pick_name); + Sprintf(name,"PickedFace %s",pick_name); DBRep::Set(name,S); di.AppendElement(name); return 0; @@ -1578,7 +1578,7 @@ Standard_Integer edgeintersector(Draw_Interpretor& di, //----------------------------------------------------- EInter.SetFaces(F,F); Standard_Real TolInter = 1.e-7; - if (n == 6) TolInter = atof(a[5]); + if (n == 6) TolInter = Draw::Atof(a[5]); EInter.ForceTolerances(TolInter,TolInter); Standard_Boolean reducesegments = Standard_True; EInter.Perform (E[0],E[1],reducesegments); @@ -1601,7 +1601,7 @@ Standard_Integer edgeintersector(Draw_Interpretor& di, gp_Pnt P = P2D.Value(); TopoDS_Vertex V = BRepLib_MakeVertex(P); NbV ++; - sprintf(name,"%s_%d",a[1],NbV); + Sprintf(name,"%s_%d",a[1],NbV); DBRep::Set(name,V); for (Standard_Integer i = 1; i <= 2; i++) { //--------------------------------------------------------------- @@ -1687,7 +1687,7 @@ Standard_Integer build3d(Draw_Interpretor& di, if (S.IsNull()) return 1; if (n==2) { Ok = BRepLib::BuildCurves3d(S); } - else { Ok = BRepLib::BuildCurves3d(S,atof(a[2])); } + else { Ok = BRepLib::BuildCurves3d(S,Draw::Atof(a[2])); } //if (!Ok) {cout << " one of the computation failed" << endl;} if (!Ok) {di << " one of the computation failed" << "\n";} diff --git a/src/BRepTest/BRepTest_DraftAngleCommands.cxx b/src/BRepTest/BRepTest_DraftAngleCommands.cxx index 09e4032755..942dbc415a 100755 --- a/src/BRepTest/BRepTest_DraftAngleCommands.cxx +++ b/src/BRepTest/BRepTest_DraftAngleCommands.cxx @@ -64,7 +64,7 @@ static Standard_Integer DEP(Draw_Interpretor& theCommands, TopoDS_Shape V = DBRep::Get(a[2]); BRepOffsetAPI_DraftAngle drft(V); - gp_Dir Dirextract(atof(a[3]),atof(a[4]),atof(a[5])); + gp_Dir Dirextract(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); TopoDS_Face F; Standard_Real Angle; @@ -74,9 +74,9 @@ static Standard_Integer DEP(Draw_Interpretor& theCommands, TopoDS_Shape aLocalShape(DBRep::Get(a[8*ii+6],TopAbs_FACE)); F = TopoDS::Face(aLocalShape); // F = TopoDS::Face(DBRep::Get(a[8*ii+6],TopAbs_FACE)); - Angle = atof(a[8*ii+7])*M_PI/180.; - Pax.SetCoord(atof(a[8*ii+8]),atof(a[8*ii+9]),atof(a[8*ii+10])); - Dax.SetCoord(atof(a[8*ii+11]),atof(a[8*ii+12]),atof(a[8*ii+13])); + Angle = Draw::Atof(a[8*ii+7])*M_PI/180.; + Pax.SetCoord(Draw::Atof(a[8*ii+8]),Draw::Atof(a[8*ii+9]),Draw::Atof(a[8*ii+10])); + Dax.SetCoord(Draw::Atof(a[8*ii+11]),Draw::Atof(a[8*ii+12]),Draw::Atof(a[8*ii+13])); drft.Add(F,Dirextract,Angle,gp_Pln(Pax,Dax)); if (!drft.AddDone()) { break; @@ -115,7 +115,7 @@ static Standard_Integer NDEP(Draw_Interpretor& theCommands, BRepOffsetAPI_DraftAngle drft(V); - gp_Dir Dirextract(atof(a[3]),atof(a[4]),atof(a[5])); + gp_Dir Dirextract(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); TopoDS_Face F; Standard_Real Angle; @@ -134,13 +134,13 @@ static Standard_Integer NDEP(Draw_Interpretor& theCommands, } //#ifdef DEB -// Flag = atof(a[9*ii+7]); // BUG?? Real -> Boolean ??? +// Flag = Draw::Atof(a[9*ii+7]); // BUG?? Real -> Boolean ??? //#else - Flag = (Standard_Boolean ) atof(a[9*ii+7]); + Flag = (Standard_Boolean ) Draw::Atof(a[9*ii+7]); //#endif - Angle = atof(a[9*ii+8])*M_PI/180.; - Pax.SetCoord(atof(a[9*ii+9]),atof(a[9*ii+10]),atof(a[9*ii+11])); - Dax.SetCoord(atof(a[9*ii+12]),atof(a[9*ii+13]),atof(a[9*ii+14])); + Angle = Draw::Atof(a[9*ii+8])*M_PI/180.; + Pax.SetCoord(Draw::Atof(a[9*ii+9]),Draw::Atof(a[9*ii+10]),Draw::Atof(a[9*ii+11])); + Dax.SetCoord(Draw::Atof(a[9*ii+12]),Draw::Atof(a[9*ii+13]),Draw::Atof(a[9*ii+14])); drft.Add(F,Dirextract,Angle,gp_Pln(Pax,Dax), Flag); if (!drft.AddDone()) { break; @@ -175,10 +175,10 @@ static Standard_Integer draft (Draw_Interpretor& di, Standard_Real x, y ,z, teta; TopoDS_Shape SInit = DBRep::Get(a[2]);//shape d'arret - x = atof(a[3]); - y = atof(a[4]); // direction de depouille - z = atof(a[5]); - teta = atof(a[6]); //angle de depouille (teta) + x = Draw::Atof(a[3]); + y = Draw::Atof(a[4]); // direction de depouille + z = Draw::Atof(a[5]); + teta = Draw::Atof(a[6]); //angle de depouille (teta) gp_Dir D(x,y,z); @@ -238,7 +238,7 @@ static Standard_Integer draft (Draw_Interpretor& di, MkDraft.Perform(Surf, KeepInside); } else { // by Lenght - Standard_Real L = atof(a[7]); + Standard_Real L = Draw::Atof(a[7]); if (L > 1.e-7) { MkDraft.Perform(L); } diff --git a/src/BRepTest/BRepTest_ExtremaCommands.cxx b/src/BRepTest/BRepTest_ExtremaCommands.cxx index 5c394a73c2..347a04b405 100755 --- a/src/BRepTest/BRepTest_ExtremaCommands.cxx +++ b/src/BRepTest/BRepTest_ExtremaCommands.cxx @@ -84,7 +84,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const #endif char named[100]; - sprintf(named, "%s%s" ,ns0,"_val"); + Sprintf(named, "%s%s" ,ns0,"_val"); char* tempd = named; Draw::Set(tempd,dst.Value()); di << named << " "; @@ -99,8 +99,8 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const TopoDS_Vertex V =BRepLib_MakeVertex(P1); char namev[100]; if (i1==1) - sprintf(namev, "%s" ,ns0); - else sprintf(namev, "%s%d" ,ns0,i1); + Sprintf(namev, "%s" ,ns0); + else Sprintf(namev, "%s%d" ,ns0,i1); char* tempv = namev; DBRep::Set(tempv,V); di << namev << " "; @@ -109,8 +109,8 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const {char name[100]; TopoDS_Edge E = BRepLib_MakeEdge (P1, P2); if (i1==1) - {sprintf(name,"%s",ns0);} - else {sprintf(name,"%s%d",ns0,i1);} + {Sprintf(name,"%s",ns0);} + else {Sprintf(name,"%s%d",ns0,i1);} char* temp = name; DBRep::Set(temp,E); di << name << " " ; diff --git a/src/BRepTest/BRepTest_FeatureCommands.cxx b/src/BRepTest/BRepTest_FeatureCommands.cxx index 4ef4b3ce2b..a837eaa2ed 100755 --- a/src/BRepTest/BRepTest_FeatureCommands.cxx +++ b/src/BRepTest/BRepTest_FeatureCommands.cxx @@ -172,7 +172,7 @@ static Standard_Integer Loc(Draw_Interpretor& theCommands, i = 0; for (; its.More(); its.Next()) { i++; - sprintf(p,"%d",i); + Sprintf(p,"%d",i); DBRep::Set(newname,its.Value()); } if (i >= 2) { @@ -223,10 +223,10 @@ static Standard_Integer HOLE1(Draw_Interpretor& theCommands, if (narg<10 || narg == 11) return 1; TopoDS_Shape S = DBRep::Get(a[2]); - gp_Pnt Or(atof(a[3]),atof(a[4]),atof(a[5])); - gp_Dir Di(atof(a[6]),atof(a[7]),atof(a[8])); + gp_Pnt Or(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); + gp_Dir Di(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); - Standard_Real Radius = atof(a[9]); + Standard_Real Radius = Draw::Atof(a[9]); theHole.Init(S,gp_Ax1(Or,Di)); @@ -234,8 +234,8 @@ static Standard_Integer HOLE1(Draw_Interpretor& theCommands, theHole.Perform(Radius); } else { - Standard_Real pfrom = atof(a[10]); - Standard_Real pto = atof(a[11]); + Standard_Real pfrom = Draw::Atof(a[10]); + Standard_Real pto = Draw::Atof(a[11]); theHole.Perform(Radius,pfrom,pto,WithControl); } @@ -257,10 +257,10 @@ static Standard_Integer HOLE2(Draw_Interpretor& theCommands, if (narg<10) return 1; TopoDS_Shape S = DBRep::Get(a[2]); - gp_Pnt Or(atof(a[3]),atof(a[4]),atof(a[5])); - gp_Dir Di(atof(a[6]),atof(a[7]),atof(a[8])); + gp_Pnt Or(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); + gp_Dir Di(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); - Standard_Real Radius = atof(a[9]); + Standard_Real Radius = Draw::Atof(a[9]); theHole.Init(S,gp_Ax1(Or,Di)); theHole.PerformThruNext(Radius,WithControl); @@ -283,10 +283,10 @@ static Standard_Integer HOLE3(Draw_Interpretor& theCommands, if (narg<10) return 1; TopoDS_Shape S = DBRep::Get(a[2]); - gp_Pnt Or(atof(a[3]),atof(a[4]),atof(a[5])); - gp_Dir Di(atof(a[6]),atof(a[7]),atof(a[8])); + gp_Pnt Or(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); + gp_Dir Di(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); - Standard_Real Radius = atof(a[9]); + Standard_Real Radius = Draw::Atof(a[9]); theHole.Init(S,gp_Ax1(Or,Di)); theHole.PerformUntilEnd(Radius,WithControl); @@ -309,11 +309,11 @@ static Standard_Integer HOLE4(Draw_Interpretor& theCommands, if (narg<11) return 1; TopoDS_Shape S = DBRep::Get(a[2]); - gp_Pnt Or(atof(a[3]),atof(a[4]),atof(a[5])); - gp_Dir Di(atof(a[6]),atof(a[7]),atof(a[8])); + gp_Pnt Or(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); + gp_Dir Di(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); - Standard_Real Radius = atof(a[9]); - Standard_Real Length = atof(a[10]); + Standard_Real Radius = Draw::Atof(a[9]); + Standard_Real Length = Draw::Atof(a[10]); theHole.Init(S,gp_Ax1(Or,Di)); theHole.PerformBlind(Radius,Length,WithControl); @@ -378,19 +378,19 @@ static Standard_Integer PRW(Draw_Interpretor& theCommands, if (narg < 11) { return 1; } - V.SetCoord(atof(a[6]),atof(a[7]),atof(a[8])); + V.SetCoord(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); FFrom = DBRep::Get(a[4],TopAbs_SHAPE); FUntil = DBRep::Get(a[5],TopAbs_SHAPE); borne = 9; } else { - V.SetCoord(atof(a[5]),atof(a[6]),atof(a[7])); + V.SetCoord(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])); FUntil = DBRep::Get(a[4],TopAbs_SHAPE); borne = 8; } } else { - V.SetCoord(atof(a[4]),atof(a[5]),atof(a[6])); + V.SetCoord(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6])); borne = 7; } Standard_Real Length = V.Magnitude(); @@ -554,19 +554,19 @@ static Standard_Integer PRF(Draw_Interpretor& theCommands, return 1; } borne = 9; - V.SetCoord(atof(a[6]),atof(a[7]),atof(a[8])); + V.SetCoord(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); FFrom = DBRep::Get(a[4],TopAbs_SHAPE); FUntil = DBRep::Get(a[5],TopAbs_SHAPE); } else { borne = 8; - V.SetCoord(atof(a[5]),atof(a[6]),atof(a[7])); + V.SetCoord(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])); FUntil = DBRep::Get(a[4],TopAbs_SHAPE); } } else { borne = 7; - V.SetCoord(atof(a[4]),atof(a[5]),atof(a[6])); + V.SetCoord(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6])); } Standard_Real Length = V.Magnitude(); if (Length < Precision::Confusion()) { @@ -813,7 +813,7 @@ Standard_Integer thickshell(Draw_Interpretor& , TopoDS_Shape S = DBRep::Get(a[2]); if (S.IsNull()) return 1; - Standard_Real Of = atof(a[3]); + Standard_Real Of = Draw::Atof(a[3]); GeomAbs_JoinType JT= GeomAbs_Arc; if (n > 4) @@ -827,7 +827,7 @@ Standard_Integer thickshell(Draw_Interpretor& , Standard_Boolean Inter = Standard_False; //Standard_True; Standard_Real Tol = Precision::Confusion(); if (n > 5) - Tol = atof(a[5]); + Tol = Draw::Atof(a[5]); BRepOffset_MakeOffset B; B.Initialize(S,Of,Tol,BRepOffset_Skin,Inter,0,JT, Standard_True); @@ -859,7 +859,7 @@ Standard_Integer offsetshape(Draw_Interpretor& , TopoDS_Shape S = DBRep::Get(a[2]); if (S.IsNull()) return 1; - Standard_Real Of = atof(a[3]); + Standard_Real Of = Draw::Atof(a[3]); Standard_Boolean Inter = (!strcmp(a[0],"offsetcompshape")); GeomAbs_JoinType JT= GeomAbs_Arc; if (!strcmp(a[0],"offsetinter")) { @@ -874,7 +874,7 @@ Standard_Integer offsetshape(Draw_Interpretor& , TopoDS_Shape SF = DBRep::Get(a[4],TopAbs_FACE); if (SF.IsNull()) { IB = 5; - Tol = atof(a[4]); + Tol = Draw::Atof(a[4]); } } B.Initialize(S,Of,Tol,BRepOffset_Skin,Inter,0,JT); @@ -947,7 +947,7 @@ Standard_Integer offsetparameter(Draw_Interpretor& di, if ( n < 4 ) return 1; - TheTolerance = atof(a[1]); + TheTolerance = Draw::Atof(a[1]); TheInter = strcmp(a[2],"p"); if ( !strcmp(a[3],"a")) TheJoin = GeomAbs_Arc; @@ -970,7 +970,7 @@ Standard_Integer offsetload(Draw_Interpretor& , TopoDS_Shape S = DBRep::Get(a[1]); if (S.IsNull()) return 1; - Standard_Real Of = atof(a[2]); + Standard_Real Of = Draw::Atof(a[2]); TheRadius = Of; // Standard_Boolean Inter = Standard_True; @@ -1003,7 +1003,7 @@ Standard_Integer offsetonface(Draw_Interpretor&, Standard_Integer n, const char* for (Standard_Integer i = 1 ; i < n; i+=2) { TopoDS_Shape SF = DBRep::Get(a[i],TopAbs_FACE); if (!SF.IsNull()) { - Standard_Real Of = atof(a[i+1]); + Standard_Real Of = Draw::Atof(a[i+1]); TheOffset.SetOffsetOnFace(TopoDS::Face(SF),Of); } } @@ -1123,7 +1123,7 @@ static Standard_Integer ROW(Draw_Interpretor& theCommands, FFrom = DBRep::Get(a[4],TopAbs_SHAPE); if (FFrom.IsNull()) { - Angle = atof(a[4]); + Angle = Draw::Atof(a[4]); Angle *=M_PI/180.; i = 5; } @@ -1144,8 +1144,8 @@ static Standard_Integer ROW(Draw_Interpretor& theCommands, } borne = i+6; - Or.SetCoord(atof(a[i]),atof(a[i+1]),atof(a[i+2])); - D.SetCoord(atof(a[i+3]),atof(a[i+4]),atof(a[i+5])); + Or.SetCoord(Draw::Atof(a[i]),Draw::Atof(a[i+1]),Draw::Atof(a[i+2])); + D.SetCoord(Draw::Atof(a[i+3]),Draw::Atof(a[i+4]),Draw::Atof(a[i+5])); gp_Ax1 theAxis(Or,D); TopoDS_Shape aLocalShape(DBRep::Get(a[borne],TopAbs_FACE)); @@ -1284,7 +1284,7 @@ static Standard_Integer ROF(Draw_Interpretor& theCommands, FFrom = DBRep::Get(a[4],TopAbs_SHAPE); if (FFrom.IsNull()) { - Angle = atof(a[4]); + Angle = Draw::Atof(a[4]); Angle *=M_PI/180.; i = 5; } @@ -1305,8 +1305,8 @@ static Standard_Integer ROF(Draw_Interpretor& theCommands, } borne = i+6; - Or.SetCoord(atof(a[i]),atof(a[i+1]),atof(a[i+2])); - D.SetCoord(atof(a[i+3]),atof(a[i+4]),atof(a[i+5])); + Or.SetCoord(Draw::Atof(a[i]),Draw::Atof(a[i+1]),Draw::Atof(a[i+2])); + D.SetCoord(Draw::Atof(a[i+3]),Draw::Atof(a[i+4]),Draw::Atof(a[i+5])); gp_Ax1 theAxis(Or,D); TopoDS_Shape ToRotate; @@ -1501,8 +1501,8 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands, theCommands << "null basis shape"; return 1; } - Standard_Integer Ifuse = atoi(a[narg-2]); - Standard_Integer Imodif = atoi(a[narg-1]); + Standard_Integer Ifuse = Draw::Atoi(a[narg-2]); + Standard_Integer Imodif = Draw::Atoi(a[narg-1]); Standard_Integer Fuse = Ifuse; Standard_Boolean Modify = (Imodif!=0); @@ -1547,9 +1547,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands, if (narg == 9 || narg == 12 || narg == 14) { // Standard_Real X,Y,Z,X1,Y1,Z1; Standard_Real X,Y,Z; - X = atof(a[4]); - Y = atof(a[5]); - Z = atof(a[6]); + X = Draw::Atof(a[4]); + Y = Draw::Atof(a[5]); + Z = Draw::Atof(a[6]); if (narg == 9) { // prism prdef = Standard_True; @@ -1558,11 +1558,11 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands, else if(narg == 14) { rfdef = Standard_True; gp_Pnt Or(X, Y, Z); - X = atof(a[7]); - Y = atof(a[8]); - Z = atof(a[9]); - Standard_Real H1 = atof(a[10]); - Standard_Real H2 = atof(a[11]); + X = Draw::Atof(a[7]); + Y = Draw::Atof(a[8]); + Z = Draw::Atof(a[9]); + Standard_Real H1 = Draw::Atof(a[10]); + Standard_Real H2 = Draw::Atof(a[11]); gp_Ax1 ax1(Or, gp_Dir(X, Y, Z)); theRF.Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify); if (!theRF.IsDone()) { @@ -1577,18 +1577,18 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands, else if(narg == 12 && strcasecmp(a[0],"FEATLF")) { rvdef = Standard_True; gp_Pnt Or(X,Y,Z); - X = atof(a[7]); - Y = atof(a[8]); - Z = atof(a[9]); + X = Draw::Atof(a[7]); + Y = Draw::Atof(a[8]); + Z = Draw::Atof(a[9]); theRevol.Init(Sbase,Pbase,Skface,gp_Ax1(Or,gp_Dir(X,Y,Z)), Fuse,Modify); } else { lfdef = Standard_True; gp_Vec Direct(X,Y,Z); - X = atof(a[7]); - Y = atof(a[8]); - Z = atof(a[9]); + X = Draw::Atof(a[7]); + Y = Draw::Atof(a[8]); + Z = Draw::Atof(a[9]); theLF.Init(Sbase, W, P, Direct, gp_Vec(X,Y,Z), Fuse,Modify); if (!theLF.IsDone()) { se = theLF.CurrentStatusError(); @@ -1606,7 +1606,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands, theCommands << "Invalid DPrism base"; return 1; } - Standard_Real Angle = atof(a[4])*M_PI/360; + Standard_Real Angle = Draw::Atof(a[4])*M_PI/360; dprdef = Standard_True; theDPrism.Init(Sbase,TopoDS::Face(Pbase),Skface,Angle,Fuse,Modify); } @@ -1785,7 +1785,7 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands, return 1; } if (narg == 4) { - Standard_Real Val = atof(a[3]); + Standard_Real Val = Draw::Atof(a[3]); if (Kas == 1) { thePrism.Perform(Val); } @@ -1806,7 +1806,7 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands, } } else if(narg == 5) { - Standard_Real Val = atof(a[3]); + Standard_Real Val = Draw::Atof(a[3]); TopoDS_Shape FUntil = DBRep::Get(a[4],TopAbs_SHAPE); if (Kas == 1) { thePrism.PerformUntilHeight(FUntil, Val); @@ -2059,14 +2059,14 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands, Standard_Integer dprsig=0; if (!strcasecmp("ENDEDGES",a[0])) { Kas = 1; - dprsig = atoi(a[4]); + dprsig = Draw::Atoi(a[4]); } else if (!strcasecmp("FILLET",a[0])) { Kas = 2; } else if (!strcasecmp("BOSSAGE",a[0])) { Kas = 3; - dprsig = atoi(a[5]); + dprsig = Draw::Atoi(a[5]); } TopoDS_Shape theShapeTop; @@ -2137,7 +2137,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands, if (Kas == 2) { for (Standard_Integer ii = 1; ii < (narg-1)/2; ii++){ - Rad = atof(a[2*ii + 1]); + Rad = Draw::Atof(a[2*ii + 1]); if (Rad == 0.) continue; S = DBRep::Get(a[(2*ii+2)],TopAbs_SHAPE); TopExp_Explorer exp; @@ -2151,7 +2151,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands, } } else if (Kas == 3) { - Rad = atof(a[3]); + Rad = Draw::Atof(a[3]); if (Rad != 0.) { S = theShapeTop; TopExp_Explorer exp; @@ -2163,7 +2163,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands, } } } - Rad = atof(a[4]); + Rad = Draw::Atof(a[4]); if (Rad != 0.) { S = theShapeBottom; TopExp_Explorer exp; diff --git a/src/BRepTest/BRepTest_Fillet2DCommands.cxx b/src/BRepTest/BRepTest_Fillet2DCommands.cxx index 7d85ee2357..ecc97c75f5 100755 --- a/src/BRepTest/BRepTest_Fillet2DCommands.cxx +++ b/src/BRepTest/BRepTest_Fillet2DCommands.cxx @@ -103,7 +103,7 @@ static Standard_Integer chfi2d(Draw_Interpretor& di, Standard_Integer n, const c return 1; } - Standard_Real p1 = atof(a[i+1]); + Standard_Real p1 = Draw::Atof(a[i+1]); if (*a[i] == 'F') { MF.AddFillet(V,p1); } @@ -116,7 +116,7 @@ static Standard_Integer chfi2d(Draw_Interpretor& di, Standard_Integer n, const c } return 1; } - Standard_Real p2 = atof(a[i+2]); + Standard_Real p2 = Draw::Atof(a[i+2]); if (a[i][2] == 'D') { MF.AddChamfer(E1,E2,p1,p2); } diff --git a/src/BRepTest/BRepTest_FilletCommands.cxx b/src/BRepTest/BRepTest_FilletCommands.cxx index 51e42e070a..b7c12f951b 100755 --- a/src/BRepTest/BRepTest_FilletCommands.cxx +++ b/src/BRepTest/BRepTest_FilletCommands.cxx @@ -109,7 +109,7 @@ static Standard_Integer contblend(Draw_Interpretor& di, Standard_Integer narg, c } else { if (narg >3) return 1; - if (narg == 3) { tapp_angle = Abs(atof(a[2])); } + if (narg == 3) { tapp_angle = Abs(Draw::Atof(a[2])); } char c=a[1][1]; switch (c) { case '0': @@ -149,10 +149,10 @@ static Standard_Integer tolblend(Draw_Interpretor& di, Standard_Integer narg, co return 0; } else if(narg == 5){ - ta = atof(a[1]); - t3d = atof(a[2]); - t2d = atof(a[3]); - fl = atof(a[4]); + ta = Draw::Atof(a[1]); + t3d = Draw::Atof(a[2]); + t2d = Draw::Atof(a[3]); + fl = Draw::Atof(a[4]); return 0; } return 1; @@ -180,7 +180,7 @@ static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const TopoDS_Edge E; Standard_Integer nbedge = 0; for (Standard_Integer ii = 1; ii < (narg-1)/2; ii++){ - Rad = atof(a[2*ii + 1]); + Rad = Draw::Atof(a[2*ii + 1]); TopoDS_Shape aLocalEdge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE)); E = TopoDS::Edge(aLocalEdge); // E = TopoDS::Edge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE)); @@ -207,13 +207,13 @@ static void PrintHist(const TopoDS_Shape& S, B.Add(C,S); char localname[100]; if(nbgen<10){ - sprintf(localname,"generated_00%d", nbgen++); + Sprintf(localname,"generated_00%d", nbgen++); } else if(nbgen<100){ - sprintf(localname,"generated_0%d", nbgen++); + Sprintf(localname,"generated_0%d", nbgen++); } else { - sprintf(localname,"generated_%d", nbgen++); + Sprintf(localname,"generated_%d", nbgen++); } for(; It.More(); It.Next()){ B.Add(C,It.Value()); @@ -299,8 +299,8 @@ static Standard_Integer UPDATEVOL(Draw_Interpretor& di, TopoDS_Edge E = TopoDS::Edge(aLocalEdge); // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE)); for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){ - Par = atof(a[2*ii]); - Rad = atof(a[2*ii + 1]); + Par = Draw::Atof(a[2*ii]); + Rad = Draw::Atof(a[2*ii + 1]); uandr.ChangeValue(ii).SetCoord(Par,Rad); } Rake->Add(uandr,E); @@ -341,7 +341,7 @@ Standard_Integer topoblend(Draw_Interpretor& di, Standard_Integer narg, const ch Standard_Boolean fuse = !strcmp(a[0],"fubl"); TopoDS_Shape S1 = DBRep::Get(a[2]); TopoDS_Shape S2 = DBRep::Get(a[3]); - Standard_Real Rad = atof(a[4]); + Standard_Real Rad = Draw::Atof(a[4]); BRepAlgo_BooleanOperation* BC; if(fuse){ BC = new BRepAlgo_Fuse(S1,S2); @@ -402,7 +402,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const printf(" Null shapes are not allowed \n"); return 1; } - Standard_Real Rad = atof(a[4]); + Standard_Real Rad = Draw::Atof(a[4]); BOPTools_DSFiller theDSFiller; @@ -476,7 +476,7 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons Standard_Real Rad; Standard_Boolean simul=Standard_False; const char *ns0=(a[1]); - Rad = atof(a[3]); + Rad = Draw::Atof(a[3]); TopTools_ListOfShape E; for (i=4; i <=(narg-1) ; i++){ TopoDS_Shape edge= DBRep::Get(a[i],TopAbs_EDGE); @@ -559,47 +559,47 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons di<<"precision "<< i << "= "<SetValue(i,T); - NbPtsCur->SetValue(i,atoi(a[2])); + NbPtsCur->SetValue(i,Draw::Atoi(a[2])); Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface(); S->ChangeSurface().Initialize(F); Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d(); @@ -204,7 +204,7 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch B.UpdateVertex(TopExp::LastVertex(E), ErrG0); BRepLib::BuildCurve3d(E); char name[100]; - sprintf(name,"Edge_%d", i); + Sprintf(name,"Edge_%d", i); DBRep::Set(name, E); MW.Add(E); if (MW.IsDone()==Standard_False) { @@ -227,8 +227,8 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a) { if (n < 6 ) return 1; - Standard_Integer NbCurFront=atoi(a[2]), - NbPointConstraint=atoi(a[3]); + Standard_Integer NbCurFront=Draw::Atoi(a[2]), + NbPointConstraint=Draw::Atoi(a[3]); GeomPlate_BuildPlateSurface Henri(3,15,2); @@ -251,7 +251,7 @@ static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const cha TopoDS_Edge E = TopoDS::Edge(aLocalShape); // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[Indice++],TopAbs_EDGE)); if(E.IsNull()) return 1; - Conti=atoi(a[Indice++]); + Conti=Draw::Atoi(a[Indice++]); if ((Conti==0)||(Conti==-1)) { Handle(BRepAdaptor_HCurve) C = new BRepAdaptor_HCurve(); C->ChangeCurve().Initialize(E); @@ -289,10 +289,10 @@ static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const cha Indice++; } else - { Standard_Real u=atof(a[Indice++]), - v=atof(a[Indice++]); + { Standard_Real u=Draw::Atof(a[Indice++]), + v=Draw::Atof(a[Indice++]); - Conti=atoi(a[Indice++]); + Conti=Draw::Atoi(a[Indice++]); aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE); TopoDS_Face F = TopoDS::Face(aLocalFace); // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE)); @@ -339,8 +339,8 @@ static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const cha static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,const char** a) { if (n < 9 ) return 1; - Standard_Integer NbMedium=atoi(a[2]); - Standard_Integer NbCurFront=atoi(a[3]); + Standard_Integer NbMedium=Draw::Atoi(a[2]); + Standard_Integer NbCurFront=Draw::Atoi(a[3]); Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront); Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront); Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront); @@ -357,7 +357,7 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co TopoDS_Face F = TopoDS::Face(aLocalFace); // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE)); if(F.IsNull()) return 1; - Standard_Integer T = atoi(a[3*i+3]); + Standard_Integer T = Draw::Atoi(a[3*i+3]); Tang->SetValue(i,T); NbPtsCur->SetValue(i,NbMedium); Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface(); @@ -381,10 +381,10 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co //cout<<" dist. max = "< 2 && *a[2]=='c' || n > 3 && *a[3]=='c') onlyClosed = Standard_True; - if(n > 2 && *a[2]!='c' && n != 5) {eps = atof (a[2]); witheps = Standard_True;} + if(n > 2 && *a[2]!='c' && n != 5) {eps = Draw::Atof (a[2]); witheps = Standard_True;} if (witheps){ if (Abs(eps) < Precision::Angular()) return 2; @@ -177,13 +177,13 @@ Standard_Integer vpropsgk(Draw_Interpretor& di, Standard_Integer n, const char** //Standard_Real aDefaultTol = 1.e-3; Standard_Integer mode = 0; - eps = atof(a[2]); - mode = atoi(a[3]); + eps = Draw::Atof(a[2]); + mode = Draw::Atoi(a[3]); if(mode > 0) onlyClosed = Standard_True; - mode = atoi(a[4]); + mode = Draw::Atoi(a[4]); if(mode > 0) isUseSpan = Standard_True; - mode = atoi(a[5]); + mode = Draw::Atoi(a[5]); if(mode == 1 || mode == 3) CGFlag = Standard_True; if(mode == 2 || mode == 3) IFlag = Standard_True; diff --git a/src/BRepTest/BRepTest_OtherCommands.cxx b/src/BRepTest/BRepTest_OtherCommands.cxx index 9abac47b1c..2044f65209 100755 --- a/src/BRepTest/BRepTest_OtherCommands.cxx +++ b/src/BRepTest/BRepTest_OtherCommands.cxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -197,12 +198,12 @@ Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** p++; Standard_Integer i = 0; if (n == 3) { - Standard_Integer isub = atoi(a[2]); + Standard_Integer isub = Draw::Atoi(a[2]); TopoDS_Iterator itr(S); while (itr.More()) { i++; if ( i == isub ) { - sprintf(p,"%d",i); + Sprintf(p,"%d",i); DBRep::Set(newname,itr.Value()); di.AppendElement(newname); break; @@ -254,7 +255,7 @@ Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** return 1; } - Standard_Integer isub = atoi(a[3]); + Standard_Integer isub = Draw::Atoi(a[3]); TopTools_MapOfShape M; M.Add(S); TopExp_Explorer ex(S,typ); @@ -262,7 +263,7 @@ Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** if (M.Add(ex.Current())) { i++; if ( i == isub ) { - sprintf(p,"%d",i); + Sprintf(p,"%d",i); DBRep::Set(newname,ex.Current()); di.AppendElement(newname); break; @@ -298,7 +299,7 @@ Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const char** nbpi++; char name[64]; char* temp = name; // pour portage WNT - sprintf(temp, "%s_%d", "brics", nbpi); + Sprintf(temp, "%s_%d", "brics", nbpi); DrawTrSurf::Set(temp, curp); } } @@ -315,7 +316,7 @@ Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const char** nbpi++; char name[64]; char* temp = name; // pour portage WNT - sprintf(temp, "%s_%d", "brics", nbpi); + Sprintf(temp, "%s_%d", "brics", nbpi); DrawTrSurf::Set(temp, curp); } } @@ -369,7 +370,7 @@ Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a TopoDS_Face F = TopoDS::Face(InputShape); // TopoDS_Face F = TopoDS::Face(DBRep::Get( a[2] )); - Standard_Real Off = -atof( a[3] ); + Standard_Real Off = -Draw::Atof( a[3] ); BRepOffset_MakeOffset Offset; @@ -455,7 +456,7 @@ Standard_Integer xclassify (Draw_Interpretor& aDI, Standard_Integer n, const cha // aTol=1.e-7; if (n==3) { - aTol=atof(a[2]); + aTol=Draw::Atof(a[2]); } // BRepClass3d_SolidClassifier aSC(aS); diff --git a/src/BRepTest/BRepTest_PrimitiveCommands.cxx b/src/BRepTest/BRepTest_PrimitiveCommands.cxx index 84b45a3e22..fa9f9deea9 100755 --- a/src/BRepTest/BRepTest_PrimitiveCommands.cxx +++ b/src/BRepTest/BRepTest_PrimitiveCommands.cxx @@ -46,17 +46,17 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char** a) { if (n < 5) return 1; - Standard_Real dx = atof(a[n-3]); - Standard_Real dy = atof(a[n-2]); - Standard_Real dz = atof(a[n-1]); + Standard_Real dx = Draw::Atof(a[n-3]); + Standard_Real dy = Draw::Atof(a[n-2]); + Standard_Real dz = Draw::Atof(a[n-1]); TopoDS_Solid S; if (n > 5) { if (n < 8) return 1; - Standard_Real x = atof(a[2]); - Standard_Real y = atof(a[3]); - Standard_Real z = atof(a[4]); + Standard_Real x = Draw::Atof(a[2]); + Standard_Real y = Draw::Atof(a[3]); + Standard_Real z = Draw::Atof(a[4]); S = BRepPrimAPI_MakeBox(gp_Pnt(x,y,z),dx,dy,dz); } else { @@ -77,29 +77,29 @@ static Standard_Integer wedge(Draw_Interpretor& , Standard_Integer n, const char // Standard_Integer i = 0; if ( n == 15 || n == 18) { - gp_Pnt LocalP(atof(a[2]),atof(a[3]),atof(a[4])); - gp_Dir LocalN(atof(a[5]),atof(a[6]),atof(a[7])); - gp_Dir LocalVx(atof(a[8]),atof(a[9]),atof(a[10])); + gp_Pnt LocalP(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])); + gp_Dir LocalN(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])); + gp_Dir LocalVx(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10])); gp_Ax2 Axis(LocalP,LocalN,LocalVx); -// gp_Ax2 Axis(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), -// gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), -// gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))); +// gp_Ax2 Axis(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), +// gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), +// gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))); if ( n == 15) { S = BRepPrimAPI_MakeWedge(Axis, - atof(a[11]),atof(a[12]),atof(a[13]),atof(a[14])); + Draw::Atof(a[11]),Draw::Atof(a[12]),Draw::Atof(a[13]),Draw::Atof(a[14])); } else { S = BRepPrimAPI_MakeWedge(Axis, - atof(a[11]),atof(a[12]),atof(a[13]), - atof(a[14]),atof(a[15]),atof(a[16]),atof(a[17])); + Draw::Atof(a[11]),Draw::Atof(a[12]),Draw::Atof(a[13]), + Draw::Atof(a[14]),Draw::Atof(a[15]),Draw::Atof(a[16]),Draw::Atof(a[17])); } } else if (n == 6) { - S = BRepPrimAPI_MakeWedge(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); + S = BRepPrimAPI_MakeWedge(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); } else if (n == 9){ - S = BRepPrimAPI_MakeWedge(atof(a[2]),atof(a[3]),atof(a[4]), - atof(a[5]),atof(a[6]),atof(a[7]),atof(a[8])); + S = BRepPrimAPI_MakeWedge(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]), + Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); } else return 1; @@ -120,19 +120,19 @@ static Standard_Integer cylinder(Draw_Interpretor& , Standard_Integer n, const c Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2])); if (n == 4) { - S = BRepPrimAPI_MakeCylinder(atof(a[2]),atof(a[3])); + S = BRepPrimAPI_MakeCylinder(Draw::Atof(a[2]),Draw::Atof(a[3])); } else if (n == 5) { if (P.IsNull()) - S = BRepPrimAPI_MakeCylinder(atof(a[2]),atof(a[3]),atof(a[4]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeCylinder(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4])); + S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4])); } else if (n == 6) { if (P.IsNull()) return 1; else - S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]) * (M_PI / 180.0)); } else return 1; @@ -154,16 +154,16 @@ static Standard_Integer cone(Draw_Interpretor& , Standard_Integer n, const char* Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2])); if (n == 5) { - S = BRepPrimAPI_MakeCone(atof(a[2]),atof(a[3]),atof(a[4])); + S = BRepPrimAPI_MakeCone(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])); } else if (n == 6) { if (P.IsNull()) - S = BRepPrimAPI_MakeCone(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeCone(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5])); + S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); } else if (n == 7) { - S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6]) * (M_PI / 180.0)); } else return 1; @@ -185,28 +185,28 @@ static Standard_Integer sphere(Draw_Interpretor& , Standard_Integer n, const cha Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2])); if (n == 3) { - S = BRepPrimAPI_MakeSphere(atof(a[2])); + S = BRepPrimAPI_MakeSphere(Draw::Atof(a[2])); } else if (n == 4) { if (P.IsNull()) - S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(Draw::Atof(a[2]),Draw::Atof(a[3]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3])); + S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),Draw::Atof(a[3])); } else if (n == 5) { if (P.IsNull()) - S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * (M_PI / 180.0),atof(a[4]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(Draw::Atof(a[2]),Draw::Atof(a[3]) * (M_PI / 180.0),Draw::Atof(a[4]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]) * (M_PI / 180.0)); } else if (n == 6) { if (P.IsNull()) - S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * (M_PI / 180.0),atof(a[4]) * (M_PI / 180.0),atof(a[5]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(Draw::Atof(a[2]),Draw::Atof(a[3]) * (M_PI / 180.0),Draw::Atof(a[4]) * (M_PI / 180.0),Draw::Atof(a[5]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * (M_PI / 180.0),atof(a[5]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]) * (M_PI / 180.0),Draw::Atof(a[5]) * (M_PI / 180.0)); } else if (n == 7) { - S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * (M_PI / 180.0),atof(a[5]) * (M_PI / 180.0),atof(a[6]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]) * (M_PI / 180.0),Draw::Atof(a[5]) * (M_PI / 180.0),Draw::Atof(a[6]) * (M_PI / 180.0)); } else return 1; @@ -228,33 +228,33 @@ static Standard_Integer torus(Draw_Interpretor& , Standard_Integer n, const char Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2])); if (n == 4) { - S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3])); + S = BRepPrimAPI_MakeTorus(Draw::Atof(a[2]),Draw::Atof(a[3])); } else if (n == 5) { if (P.IsNull()) - S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]),atof(a[4]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeTorus(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4])); + S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4])); } else if (n == 6) { if (P.IsNull()) - S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]), - atof(a[4]) * (M_PI / 180.0),atof(a[5]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeTorus(Draw::Atof(a[2]),Draw::Atof(a[3]), + Draw::Atof(a[4]) * (M_PI / 180.0),Draw::Atof(a[5]) * (M_PI / 180.0)); else S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(), - atof(a[3]),atof(a[4]),atof(a[5]) * (M_PI / 180.0)); + Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5]) * (M_PI / 180.0)); } else if (n == 7) { if (P.IsNull()) - S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]), - atof(a[4]) * (M_PI / 180.0),atof(a[5]) * (M_PI / 180.0),atof(a[6]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeTorus(Draw::Atof(a[2]),Draw::Atof(a[3]), + Draw::Atof(a[4]) * (M_PI / 180.0),Draw::Atof(a[5]) * (M_PI / 180.0),Draw::Atof(a[6]) * (M_PI / 180.0)); else - S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]), - atof(a[4]),atof(a[5]) * (M_PI / 180.0),atof(a[6]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),Draw::Atof(a[3]), + Draw::Atof(a[4]),Draw::Atof(a[5]) * (M_PI / 180.0),Draw::Atof(a[6]) * (M_PI / 180.0)); } else if (n == 8) { - S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]), - atof(a[5]) * (M_PI / 180.0),atof(a[6]) * (M_PI / 180.0),atof(a[7]) * (M_PI / 180.0)); + S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),Draw::Atof(a[3]),Draw::Atof(a[4]), + Draw::Atof(a[5]) * (M_PI / 180.0),Draw::Atof(a[6]) * (M_PI / 180.0),Draw::Atof(a[7]) * (M_PI / 180.0)); } else return 1; diff --git a/src/BRepTest/BRepTest_ProjectionCommands.cxx b/src/BRepTest/BRepTest_ProjectionCommands.cxx index 5449f33889..62b871484e 100755 --- a/src/BRepTest/BRepTest_ProjectionCommands.cxx +++ b/src/BRepTest/BRepTest_ProjectionCommands.cxx @@ -39,7 +39,7 @@ static Standard_Integer prj(Draw_Interpretor& di, Standard_Integer n, const char if (n < 7) return 1; TopoDS_Shape InpLine = DBRep::Get(a[2]); TopoDS_Shape InpShape = DBRep::Get(a[3]); - Standard_Real DX=atof(a[4]),DY=atof(a[5]),DZ=atof(a[6]); + Standard_Real DX=Draw::Atof(a[4]),DY=Draw::Atof(a[5]),DZ=Draw::Atof(a[6]); gp_Dir TD(DX,DY,DZ); BRepProj_Projection Prj(InpLine,InpShape,TD); Standard_Integer i = 1; @@ -48,7 +48,7 @@ static Standard_Integer prj(Draw_Interpretor& di, Standard_Integer n, const char if (Prj.IsDone()) { while (Prj.More()) { - sprintf(newname,"%s_%d",a[1],i); + Sprintf(newname,"%s_%d",a[1],i); DBRep::Set(temp,Prj.Current()); //cout< 10; @@ -166,7 +166,7 @@ static Standard_Integer geompipe(Draw_Interpretor& , Handle(GeomAdaptor_HCurve) aAdaptCurve = new GeomAdaptor_HCurve(SpineCurve,aSpFirst,aSpLast); Standard_Boolean ByACR = Standard_False; Standard_Boolean rotate = Standard_False; - Standard_Real Radius = atof(a[4]); + Standard_Real Radius = Draw::Atof(a[4]); gp_Pnt ctr; gp_Vec norm; ProfileCurve->D1(aSpFirst,ctr,norm); @@ -175,9 +175,9 @@ static Standard_Integer geompipe(Draw_Interpretor& , Handle(Geom_Circle) cStart=new Geom_Circle(aAx2Start,Radius); Standard_Integer k =5; if(n > k) - ByACR = (atoi(a[k++]) ==1); + ByACR = (Draw::Atoi(a[k++]) ==1); if(n > k) - rotate = (atoi(a[k++])==1); + rotate = (Draw::Atoi(a[k++])==1); GeomFill_Pipe aPipe(ProfileCurve,aAdaptCurve,cStart,ByACR,rotate); aPipe.Perform(Standard_True); Handle(Geom_Surface) Sur=aPipe.Surface(); @@ -340,8 +340,8 @@ Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char* TopoDS_Shape Shape; - Standard_Boolean issolid = ( atoi(a[index]) == 1 ); - Standard_Boolean isruled = ( atoi(a[index+1]) == 1 ); + Standard_Boolean issolid = ( Draw::Atoi(a[index]) == 1 ); + Standard_Boolean isruled = ( Draw::Atoi(a[index+1]) == 1 ); BRepOffsetAPI_ThruSections Generator(issolid,isruled); @@ -471,7 +471,7 @@ static Standard_Integer setsweep(Draw_Interpretor& di, di << "bad arguments !" << "\n"; return 1; } - gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4])); + gp_Dir D(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4])); Sweep->SetMode(D);; } else if (!strcmp(a[1],"-FX")) { @@ -480,9 +480,9 @@ static Standard_Integer setsweep(Draw_Interpretor& di, di << "bad arguments !" << "\n"; return 1; } - gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4])); + gp_Dir D(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4])); if (n==8) { - gp_Dir DN(atof(a[5]), atof(a[6]), atof(a[7])); + gp_Dir DN(Draw::Atof(a[5]), Draw::Atof(a[6]), Draw::Atof(a[7])); gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D, DN); Sweep->SetMode(Axe); } @@ -502,7 +502,7 @@ static Standard_Integer setsweep(Draw_Interpretor& di, else { TopoDS_Shape Guide = DBRep::Get(a[2],TopAbs_WIRE); - Sweep->SetMode(TopoDS::Wire(Guide), atoi(a[3]), atoi(a[4])); + Sweep->SetMode(TopoDS::Wire(Guide), Draw::Atoi(a[3]), Draw::Atoi(a[4])); } } @@ -591,8 +591,8 @@ static Standard_Integer addsweep(Draw_Interpretor& di, Standard_Integer ii, L= nbreal/2; TColgp_Array1OfPnt2d ParAndRad(1, L); for (ii=1; ii<=L; ii++, cur+=2) { - ParAndRad(ii).SetX(atof(a[cur])); - ParAndRad(ii).SetY(atof(a[cur+1])); + ParAndRad(ii).SetX(Draw::Atof(a[cur])); + ParAndRad(ii).SetY(Draw::Atof(a[cur+1])); } thelaw = new (Law_Interpol) (); thelaw->Set(ParAndRad, @@ -749,7 +749,7 @@ static Standard_Integer simulsweep(Draw_Interpretor& di, TopTools_ListOfShape List; TopTools_ListIteratorOfListOfShape it; Standard_Integer N, ii; - N = atoi(a[2]); + N = Draw::Atoi(a[2]); if (n>3) { BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed; @@ -766,7 +766,7 @@ static Standard_Integer simulsweep(Draw_Interpretor& di, // Calculate the result Sweep->Simulate(N, List); for (ii=1, it.Initialize(List); it.More(); it.Next(), ii++) { - sprintf(name,"%s_%d",a[1],ii); + Sprintf(name,"%s_%d",a[1],ii); DBRep::Set(name, it.Value()); } diff --git a/src/BRepTest/BRepTest_TopologyCommands.cxx b/src/BRepTest/BRepTest_TopologyCommands.cxx index 3262638ef8..322f9e2c9d 100755 --- a/src/BRepTest/BRepTest_TopologyCommands.cxx +++ b/src/BRepTest/BRepTest_TopologyCommands.cxx @@ -196,7 +196,7 @@ static Standard_Integer halfspace(Draw_Interpretor& di, if (n < 6) return 1; // Le point indiquant le cote "matiere". - gp_Pnt RefPnt = gp_Pnt(atof(a[3]),atof(a[4]),atof(a[5])); + gp_Pnt RefPnt = gp_Pnt(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); TopoDS_Shape Face = DBRep::Get(a[2],TopAbs_FACE); if ( Face.IsNull()) { diff --git a/src/DBRep/DBRep.cxx b/src/DBRep/DBRep.cxx index 18883920e1..38d598c308 100755 --- a/src/DBRep/DBRep.cxx +++ b/src/DBRep/DBRep.cxx @@ -139,7 +139,7 @@ static Standard_Integer isos (Draw_Interpretor& di, Standard_Boolean Change = Standard_False ; if (!Characters (NbArg) && Float (NbArg)) return 1 ; if (!Characters (NbArg)) { - NbIsos = atoi (Arg[NbArg]) ; + NbIsos = Draw::Atoi (Arg[NbArg]) ; NbArg-- ; Change = Standard_True ; } @@ -233,7 +233,7 @@ static Standard_Integer hlr (Draw_Interpretor& di, if (n >= 3 && !strcasecmp(a[1],"ang" )) { nFirst = 3; if (n == 3) { - Standard_Real ang = atof(a[2]); + Standard_Real ang = Draw::Atof(a[2]); anglHLR = ang * M_PI / 180; if (anglHLR < HAngMin) anglHLR = HAngMin; if (anglHLR > HAngMax) anglHLR = HAngMax; @@ -279,7 +279,7 @@ static Standard_Integer hlr (Draw_Interpretor& di, localRgN = Standard_True; } else if (!strcasecmp(a[1],"ang" )) { - Standard_Real ang = atof(a[2]); + Standard_Real ang = Draw::Atof(a[2]); localAng = ang * M_PI / 180; } else return 1; @@ -332,7 +332,7 @@ static Standard_Integer discretisation(Draw_Interpretor& di, if (n <= 1) di << "Current number of points : "< 2) - l = atof(a[2]); + l = Draw::Atof(a[2]); TopoDS_Shape S = DBRep::Get(a[1]); if (S.IsNull()) return 1; diff --git a/src/DDF/DDF_BrowserCommands.cxx b/src/DDF/DDF_BrowserCommands.cxx index ac12a6d2b8..13356120e7 100755 --- a/src/DDF/DDF_BrowserCommands.cxx +++ b/src/DDF/DDF_BrowserCommands.cxx @@ -164,7 +164,7 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di, Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True)); - const Standard_Integer index = atoi(a[2]); + const Standard_Integer index = Draw::Atoi(a[2]); TCollection_AsciiString list = browser->OpenAttribute(index); di<precision(17); + myIStream->imbue (std::locale::classic()); // always use C locale SetOpenMode(aMode); } } @@ -91,6 +92,7 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor } else { myOStream->precision(17); + myOStream->imbue (std::locale::classic()); // make sure to always use C locale SetOpenMode(aMode); } } @@ -113,6 +115,7 @@ Storage_Error DDF_IOStream::Open(istream* anIStream) SetOpenMode(Storage_VSRead); myIStream = anIStream; myIStream->precision(17); + myIStream->imbue (std::locale::classic()); // use always C locale SetName("DDF_IOStream"); return Storage_VSOk; // ou Storage_VSAlreadyOpen ? } @@ -128,6 +131,7 @@ Storage_Error DDF_IOStream::Open(ostream* anOStream) SetOpenMode(Storage_VSWrite); myOStream = anOStream; myOStream->precision(17); + myOStream->imbue (std::locale::classic()); // use always C locale SetName("DDF_IOStream"); return Storage_VSOk; // ou Storage_VSAlreadyOpen ? } diff --git a/src/DDF/DDF_TransactionCommands.cxx b/src/DDF/DDF_TransactionCommands.cxx index 44ab85333f..8984fd5a3d 100755 --- a/src/DDF/DDF_TransactionCommands.cxx +++ b/src/DDF/DDF_TransactionCommands.cxx @@ -112,7 +112,7 @@ static Standard_Integer CommitTran (Draw_Interpretor& di, Handle(DDF_Transaction) tr = DDF_TStack.Top(); di<<"Commit transaction # "<Transaction()<<" # "<Transaction()<<"\n"; Standard_Boolean withDelta = Standard_False; - if (n > 2) withDelta = (atoi(a[2]) != 0); + if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0); DDF_LastDelta = tr->Commit(withDelta); DDF_TStack.Pop(); } @@ -169,7 +169,7 @@ static Standard_Integer Undo (Draw_Interpretor& di, Handle(TDF_Data) DF; if (DDF::GetDF (a[1], DF)) { Standard_Boolean withDelta = Standard_False; - if (n > 2) withDelta = (atoi(a[2]) != 0); + if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0); if (!DDF_LastDelta.IsNull()) { if (DF->IsApplicable(DDF_LastDelta)) { Handle(TDF_Delta) tmp = DF->Undo(DDF_LastDelta,withDelta); diff --git a/src/DDataStd/DDataStd_BasicCommands.cxx b/src/DDataStd/DDataStd_BasicCommands.cxx index 3eef78952e..8174246525 100755 --- a/src/DDataStd/DDataStd_BasicCommands.cxx +++ b/src/DDataStd/DDataStd_BasicCommands.cxx @@ -113,7 +113,7 @@ static Standard_Integer DDataStd_SetInteger (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label L; DDF::AddLabel(DF, arg[2], L); - TDataStd_Integer::Set(L,atoi(arg[3])); + TDataStd_Integer::Set(L,Draw::Atoi(arg[3])); return 0; } di << "DDataStd_SetInteger : Error" << "\n"; @@ -134,7 +134,7 @@ static Standard_Integer DDataStd_SetReal (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label L; DDF::AddLabel(DF, arg[2], L); - TDataStd_Real::Set(L,atof(arg[3])); + TDataStd_Real::Set(L,Draw::Atof(arg[3])); return 0; } di << "DDataStd_SetReal : Error" << "\n"; @@ -441,14 +441,14 @@ static Standard_Integer DDataStd_SetIntArray (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label label; DDF::AddLabel(DF, arg[2], label); - Standard_Integer isDelta = atoi(arg[3]); - Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j; + Standard_Integer isDelta = Draw::Atoi(arg[3]); + Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j; di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n"; Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta); j = 6; for(Standard_Integer i = From; i<=To; i++) { - A->SetValue(i, atoi(arg[j]) ); + A->SetValue(i, Draw::Atoi(arg[j]) ); j++; } @@ -510,8 +510,8 @@ static Standard_Integer DDataStd_ChangeIntArray (Draw_Interpretor& di, di << "There is no TDataStd_IntegerArray at label" << "\n"; return 1; } - Standard_Integer indx = atoi(arg[3]); - Standard_Integer val = atoi(arg[4]); + Standard_Integer indx = Draw::Atoi(arg[3]); + Standard_Integer val = Draw::Atoi(arg[4]); Standard_Integer low = A->Lower(), up = A->Upper(); if(low <= indx && indx <= up) A->SetValue(indx, val); @@ -559,8 +559,8 @@ static Standard_Integer DDataStd_SetIntArrayTest (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label label; DDF::AddLabel(DF, arg[2], label); - Standard_Integer isDelta = atoi(arg[3]); - Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j; + Standard_Integer isDelta = Draw::Atoi(arg[3]); + Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j; di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n"; Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta); @@ -587,15 +587,15 @@ static Standard_Integer DDataStd_SetRealArray (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label label; DDF::AddLabel(DF, arg[2], label); - Standard_Integer isDelta = atoi(arg[3]); + Standard_Integer isDelta = Draw::Atoi(arg[3]); - Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j; + Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j; di << " Array of Standard_Real with bounds from = " << From << " to = " << To << "\n"; Handle(TDataStd_RealArray) A = TDataStd_RealArray::Set(label, From, To, isDelta); j = 6; for(Standard_Integer i = From; i<=To; i++) { - A->SetValue(i, atof(arg[j]) ); + A->SetValue(i, Draw::Atof(arg[j]) ); j++; } @@ -658,8 +658,8 @@ static Standard_Integer DDataStd_ChangeRealArray (Draw_Interpretor& di, di << "There is no TDataStd_RealArray at label" << "\n"; return 1; } - Standard_Integer indx = atoi(arg[3]); - Standard_Real val = atof(arg[4]); + Standard_Integer indx = Draw::Atoi(arg[3]); + Standard_Real val = Draw::Atof(arg[4]); Standard_Integer low = A->Lower(), up = A->Upper(); if(low <= indx && indx <= up) A->SetValue(indx, val); @@ -712,7 +712,7 @@ static Standard_Integer DDataStd_SetVariable (Draw_Interpretor& di, const char* aUnits = arg[4]; aV->Unit(Standard_CString(aUnits)); - aV->Constant(Standard_Boolean(atoi(arg[3]))); + aV->Constant(Standard_Boolean(Draw::Atoi(arg[3]))); return 0; } @@ -854,7 +854,7 @@ static Standard_Integer DDataStd_SetFunction (Draw_Interpretor& di, Standard_GUID guid (arg[3]); Handle(TFunction_Function) aF = TFunction_Function::Set(label, guid); - int fail = atoi(arg[4]); + int fail = Draw::Atoi(arg[4]); aF->SetFailure(fail); return 0; @@ -914,9 +914,9 @@ static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label label; DDF::AddLabel(DF, arg[2], label); - Standard_Integer isDelta = atoi(arg[3]); + Standard_Integer isDelta = Draw::Atoi(arg[3]); - Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j; + Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j; di << "Array of ExtString with bounds from = " << From << " to = " << To << "\n"; Handle(TDataStd_ExtStringArray) A = TDataStd_ExtStringArray::Set(label, From, To, isDelta); @@ -988,7 +988,7 @@ static Standard_Integer DDataStd_ChangeExtStrArray (Draw_Interpretor& di, di << "There is no TDataStd_ExtStringArray at label" << "\n"; return 1; } - Standard_Integer indx = atoi(arg[3]); + Standard_Integer indx = Draw::Atoi(arg[3]); TCollection_ExtendedString val(arg[4]); Standard_Integer low = A->Lower(), up = A->Upper(); if(low <= indx && indx <= up) @@ -1122,7 +1122,7 @@ static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di, cout << "Error: problem with the file stream, rdstate = " < 255) { cout << "Bad value = " << ival<< endl; return 1; @@ -1224,8 +1224,8 @@ static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di, di << "There is no TDataStd_ByteArray at label" << "\n"; return 1; } - Standard_Integer indx = atoi(arg[3]); - Standard_Integer ival = atoi(arg[4]); + Standard_Integer indx = Draw::Atoi(arg[3]); + Standard_Integer ival = Draw::Atoi(arg[4]); if (ival > 255 || ival < 0) { di << "DDataStd_ChangeByteArray: Bad value = " <ChangeMap().Assign(aHMap->Map()); for(i=1; i<=aNum;i++) { - Standard_Integer val = atoi(arg[i+2]); + Standard_Integer val = Draw::Atoi(arg[i+2]); if(!ahMap->Map().Contains(val)) ahMap->ChangeMap().Add(val); } @@ -1404,7 +1404,7 @@ static Standard_Integer DDataStd_ChangeIntPackedMap_Rem (Draw_Interpretor& di, if(!aHMap.IsNull()) { ahMap->ChangeMap().Assign(aHMap->Map()); for(i=1; i<=aNum;i++) { - Standard_Integer val = atoi(arg[i+2]); + Standard_Integer val = Draw::Atoi(arg[i+2]); if(ahMap->Map().Contains(val)) ahMap->ChangeMap().Remove(val); } @@ -1447,7 +1447,7 @@ static Standard_Integer DDataStd_ChangeIntPackedMap_AddRem (Draw_Interpretor& di if(!aHMap.IsNull()) { ahMap->ChangeMap().Assign(aHMap->Map()); for(i=1; i<=aNum;i++) { - Standard_Integer val = atoi(arg[i+2]); + Standard_Integer val = Draw::Atoi(arg[i+2]); if(!ahMap->Map().Contains(val)) ahMap->ChangeMap().Add(val); else @@ -1476,8 +1476,8 @@ static Standard_Integer DDataStd_SetIntPHugeMap (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label aLabel; DDF::AddLabel(DF, arg[2], aLabel); - Standard_Integer isDelta = atoi(arg[3]); - Standard_Integer aNum = atoi(arg[4]); + Standard_Integer isDelta = Draw::Atoi(arg[3]); + Standard_Integer aNum = Draw::Atoi(arg[4]); Handle(TDataStd_IntPackedMap) anAtt; if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt)) anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta); @@ -1512,7 +1512,7 @@ static Standard_Integer DDataStd_SetNDataIntegers2 (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; TDF_Label aLabel; DDF::AddLabel(DF, arg[2], aLabel); - Standard_Integer aNumP = atoi(arg[3]), j; + Standard_Integer aNumP = Draw::Atoi(arg[3]), j; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) anAtt = TDataStd_NamedData::Set(aLabel); @@ -1551,7 +1551,7 @@ static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di, Standard_Integer j; TCollection_ExtendedString aKey(arg[3]); - Standard_Integer aNum = atoi(arg[4]); + Standard_Integer aNum = Draw::Atoi(arg[4]); if (aNum <= 0) return 1; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) @@ -1655,7 +1655,7 @@ static Standard_Integer DDataStd_SetNDataIntegers (Draw_Interpretor& di, // cout << "Value = |"<SetInteger(aKey, aVal); j +=2; } @@ -1765,7 +1765,7 @@ static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di, TDF_Label aLabel; DDF::AddLabel(DF, arg[2], aLabel); - Standard_Integer aNumP = atoi(arg[3]), j; + Standard_Integer aNumP = Draw::Atoi(arg[3]), j; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) anAtt = TDataStd_NamedData::Set(aLabel); @@ -1776,7 +1776,7 @@ static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di, j = 4; for(Standard_Integer i = 1; i<=aNumP; i++) { TCollection_ExtendedString aKey(arg[j]); - Standard_Real aVal = atof(arg[j+1]); + Standard_Real aVal = Draw::Atof(arg[j+1]); anAtt->SetReal(aKey, aVal); j +=2; } @@ -1873,7 +1873,7 @@ static Standard_Integer DDataStd_SetNDataStrings (Draw_Interpretor& di, TDF_Label aLabel; DDF::AddLabel(DF, arg[2], aLabel); - Standard_Integer aNumP = atoi(arg[3]), j; + Standard_Integer aNumP = Draw::Atoi(arg[3]), j; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) anAtt = TDataStd_NamedData::Set(aLabel); @@ -1983,7 +1983,7 @@ static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di, TDF_Label aLabel; DDF::AddLabel(DF, arg[2], aLabel); - Standard_Integer aNumP = atoi(arg[3]), j; + Standard_Integer aNumP = Draw::Atoi(arg[3]), j; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) anAtt = TDataStd_NamedData::Set(aLabel); @@ -1994,7 +1994,7 @@ static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di, j = 4; for(Standard_Integer i = 1; i<=aNumP; i++) { TCollection_ExtendedString aKey(arg[j]); - Standard_Byte aVal = (Standard_Byte)atoi(arg[j+1]); + Standard_Byte aVal = (Standard_Byte)Draw::Atoi(arg[j+1]); anAtt->SetByte(aKey, aVal); j +=2; } @@ -2092,7 +2092,7 @@ static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di, Standard_Integer j; TCollection_ExtendedString aKey(arg[3]); - Standard_Integer aNum = atoi(arg[4]); + Standard_Integer aNum = Draw::Atoi(arg[4]); if (aNum <= 0) return 1; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) @@ -2104,7 +2104,7 @@ static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di, j = 5; Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum); for(Standard_Integer i = 1; i<=aNum; i++) { - Standard_Integer aVal = atoi(arg[j]); + Standard_Integer aVal = Draw::Atoi(arg[j]); anArr->SetValue(i, aVal); j++; } @@ -2222,7 +2222,7 @@ static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di, Standard_Integer j; TCollection_ExtendedString aKey(arg[3]); - Standard_Integer aNum = atoi(arg[4]); + Standard_Integer aNum = Draw::Atoi(arg[4]); if (aNum <= 0) return 1; Handle(TDataStd_NamedData) anAtt; if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) @@ -2234,7 +2234,7 @@ static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di, j = 5; Handle(TColStd_HArray1OfReal) anArr = new TColStd_HArray1OfReal(1, aNum); for(Standard_Integer i = 1; i<=aNum; i++) { - Standard_Real aVal = atof(arg[j]); + Standard_Real aVal = Draw::Atof(arg[j]); anArr->SetValue(i, aVal); j++; } diff --git a/src/DDataStd/DDataStd_ConstraintCommands.cxx b/src/DDataStd/DDataStd_ConstraintCommands.cxx index 5906f59456..096a9b1755 100755 --- a/src/DDataStd/DDataStd_ConstraintCommands.cxx +++ b/src/DDataStd/DDataStd_ConstraintCommands.cxx @@ -218,7 +218,7 @@ static Standard_Integer DDataStd_SetPattern (Draw_Interpretor& di, Handle(TDataXtd_PatternStd) aP = TDataXtd_PatternStd::Set(L); // set signature - Standard_Integer signature = atoi(arg[3]); + Standard_Integer signature = Draw::Atoi(arg[3]); aP->Signature(signature); TDF_Label aLab; @@ -410,7 +410,7 @@ static Standard_Integer DDataStd_SetPosition (Draw_Interpretor& di, TDF_Label L; DDF::AddLabel(DF, arg[2], L); - Standard_Real X = atof(arg[3]), Y = atof(arg[4]), Z = atof(arg[5]); + Standard_Real X = Draw::Atof(arg[3]), Y = Draw::Atof(arg[4]), Z = Draw::Atof(arg[5]); gp_Pnt aPos (X, Y, Z); TDataXtd_Position::Set(L,aPos); diff --git a/src/DDataStd/DDataStd_DatumCommands.cxx b/src/DDataStd/DDataStd_DatumCommands.cxx index 3f2d3c3100..5b7144a5bc 100755 --- a/src/DDataStd/DDataStd_DatumCommands.cxx +++ b/src/DDataStd/DDataStd_DatumCommands.cxx @@ -62,12 +62,12 @@ static void Location (Standard_Integer nb, const char** arg, gp_Ax2& Loc) { if (nb == 9) { - Standard_Real X = atof(arg[3]); - Standard_Real Y = atof(arg[4]); - Standard_Real Z = atof(arg[5]); - Standard_Real DX = atof(arg[6]); - Standard_Real DY = atof(arg[7]); - Standard_Real DZ = atof(arg[8]); + Standard_Real X = Draw::Atof(arg[3]); + Standard_Real Y = Draw::Atof(arg[4]); + Standard_Real Z = Draw::Atof(arg[5]); + Standard_Real DX = Draw::Atof(arg[6]); + Standard_Real DY = Draw::Atof(arg[7]); + Standard_Real DZ = Draw::Atof(arg[8]); Loc = gp_Ax2 (gp_Pnt(X,Y,Z), gp_Dir(DX,DY,DZ)); } } @@ -193,9 +193,9 @@ static Standard_Integer DDataStd_SetPlane (Draw_Interpretor& di, // if (nb < 6) return 1; // gp_Trsf T; -// Standard_Real x = atof(arg[3]); -// Standard_Real y = atof(arg[4]); -// Standard_Real z = atof(arg[5]); +// Standard_Real x = Draw::Atof(arg[3]); +// Standard_Real y = Draw::Atof(arg[4]); +// Standard_Real z = Draw::Atof(arg[5]); // if (nb == 6) { // T.SetTranslation(gp_Vec(x,y,z)); @@ -203,10 +203,10 @@ static Standard_Integer DDataStd_SetPlane (Draw_Interpretor& di, // else if (nb < 10) // return 1; // else { -// Standard_Real dx = atof(arg[6]); -// Standard_Real dy = atof(arg[7]); -// Standard_Real dz = atof(arg[8]); -// Standard_Real ang = atof(arg[9]); +// Standard_Real dx = Draw::Atof(arg[6]); +// Standard_Real dy = Draw::Atof(arg[7]); +// Standard_Real dz = Draw::Atof(arg[8]); +// Standard_Real ang = Draw::Atof(arg[9]); // T.SetRotation(gp_Ax1(gp_Pnt(x,y,z), // gp_Vec(dx,dy,dz)), // ang * (M_PI / 180.0)); diff --git a/src/DDataStd/DDataStd_DrawDisplayCommands.cxx b/src/DDataStd/DDataStd_DrawDisplayCommands.cxx index f323120e41..4f67e0806e 100755 --- a/src/DDataStd/DDataStd_DrawDisplayCommands.cxx +++ b/src/DDataStd/DDataStd_DrawDisplayCommands.cxx @@ -76,9 +76,9 @@ static Standard_Integer DDataStd_PNT (Draw_Interpretor& di, if (!DDF::GetDF (arg[1], DF)) return 1; TDF_Label L; DDF::AddLabel (DF, arg[2], L); - Standard_Real x = atof(arg[3]); - Standard_Real y = atof(arg[4]); - Standard_Real z = atof(arg[5]); + Standard_Real x = Draw::Atof(arg[3]); + Standard_Real y = Draw::Atof(arg[4]); + Standard_Real z = Draw::Atof(arg[5]); TDataXtd_Point::Set (L,gp_Pnt(x,y,z)); return 0; } diff --git a/src/DDataStd/DDataStd_TreeCommands.cxx b/src/DDataStd/DDataStd_TreeCommands.cxx index 4870c20550..966b7dc914 100755 --- a/src/DDataStd/DDataStd_TreeCommands.cxx +++ b/src/DDataStd/DDataStd_TreeCommands.cxx @@ -334,8 +334,8 @@ static Standard_Integer DDataStd_TreeBrowse (Draw_Interpretor& di, Handle(DDataStd_TreeBrowser) NewTreeNode = new DDataStd_TreeBrowser (lab); char *name = new char[50]; - if (n == 4) sprintf(name,"treebrowser_%s",a[3]); - else sprintf(name,"treebrowser_%s",a[1]); + if (n == 4) Sprintf(name,"treebrowser_%s",a[3]); + else Sprintf(name,"treebrowser_%s",a[1]); Draw::Set(name, NewTreeNode); TCollection_AsciiString inst1("treebrowser "); @@ -387,7 +387,7 @@ static Standard_Integer DDataStd_ChildNodeIterate (Draw_Interpretor& di, if (n >= 4) { Handle(TDF_Data) DF; if (!DDF::GetDF(a[1],DF)) return 1; - const Standard_Boolean AllLevels(atoi(a[3])); + const Standard_Boolean AllLevels(Draw::Atoi(a[3])); Handle(TDataStd_TreeNode) TN, Value; Standard_GUID ID; @@ -450,7 +450,7 @@ static Standard_Integer DDataStd_InitChildNodeIterator (Draw_Interpretor& di, } if (!DDF::Find(DF, a[2], ID, TN)) return 1; - const Standard_Boolean AllLevels(atoi(a[3])); + const Standard_Boolean AllLevels(Draw::Atoi(a[3])); cni.Initialize(TN, AllLevels); return 0; } diff --git a/src/DDocStd/DDocStd_DocumentCommands.cxx b/src/DDocStd/DDocStd_DocumentCommands.cxx index e45f99edec..241c144d40 100755 --- a/src/DDocStd/DDocStd_DocumentCommands.cxx +++ b/src/DDocStd/DDocStd_DocumentCommands.cxx @@ -193,7 +193,7 @@ static Standard_Integer DDocStd_UndoLimit (Draw_Interpretor& di,Standard_Integer if (!DDocStd::GetDocument(a[1],D)) return 1; if (n > 2) { - Standard_Integer lim = atoi(a[2]); + Standard_Integer lim = Draw::Atoi(a[2]); D->SetUndoLimit(lim); } @@ -218,7 +218,7 @@ static Standard_Integer DDocStd_Undo (Draw_Interpretor& di,Standard_Integer n, c Standard_Integer i,step = 1; if (n > 2) { - step = atoi(a[2]); + step = Draw::Atoi(a[2]); } // test if the command was undo or redo diff --git a/src/DDocStd/DDocStd_MTMCommands.cxx b/src/DDocStd/DDocStd_MTMCommands.cxx index e3f941d4cb..5375d54165 100755 --- a/src/DDocStd/DDocStd_MTMCommands.cxx +++ b/src/DDocStd/DDocStd_MTMCommands.cxx @@ -56,7 +56,7 @@ static int mtmCreate (Draw_Interpretor& /*di*/, int n, const char** a) sMultiTransactionManager = new TDocStd_MultiTransactionManager(); if(n > 1) - sMultiTransactionManager->SetUndoLimit(atoi(a[1])); + sMultiTransactionManager->SetUndoLimit(Draw::Atoi(a[1])); return 0; } @@ -198,7 +198,7 @@ static int mtmNestedMode (Draw_Interpretor& di, int n, const char** a) } Standard_Boolean aMode = Standard_False; if(n > 1) { - aMode = atoi(a[1]) ? Standard_True : Standard_False; + aMode = Draw::Atoi(a[1]) ? Standard_True : Standard_False; } sMultiTransactionManager->SetNestedTransactionMode(aMode); return 0; @@ -220,7 +220,7 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer TDF_Tool::Label(browser->Data(),argv[2],lab); if ( lab.IsNull() ) { di << "ERROR: label is Null: " << argv[2] << "\n"; return 0; } - Standard_Integer num = atoi ( argv[3] ); + Standard_Integer num = Draw::Atoi ( argv[3] ); TDF_AttributeIterator itr(lab,Standard_False); for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next(); diff --git a/src/DNaming/DNaming_BasicCommands.cxx b/src/DNaming/DNaming_BasicCommands.cxx index 71fc4ae5e2..96d4ceee78 100755 --- a/src/DNaming/DNaming_BasicCommands.cxx +++ b/src/DNaming/DNaming_BasicCommands.cxx @@ -88,7 +88,7 @@ static Standard_Integer Ascendants (Draw_Interpretor& di, Standard_Integer n, co Standard_Integer T; - if (n > 3) T = atoi(a[3]); + if (n > 3) T = Draw::Atoi(a[3]); else T = ND->Transaction (); //TNaming_OldShapeIterator it (S, T, US); @@ -97,7 +97,7 @@ static Standard_Integer Ascendants (Draw_Interpretor& di, Standard_Integer n, co TCollection_AsciiString entry; for (;it.More (); it.Next ()) { S = it.Shape (); - sprintf (name,"%s_%s_%d",a[2],"old", i++); + Sprintf (name,"%s_%s_%d",a[2],"old", i++); DBRep::Set (name,it.Shape()); TDF_Label Label = it.Label (); TDF_Tool::Entry(Label,entry); @@ -128,7 +128,7 @@ static Standard_Integer Descendants (Draw_Interpretor& di, Standard_Integer n, c Standard_Integer T; - if (n > 3) T = atoi(a[3]); + if (n > 3) T = Draw::Atoi(a[3]); else T = ND->Transaction (); TNaming_NewShapeIterator it (S, T, ND->Root()); @@ -136,7 +136,7 @@ static Standard_Integer Descendants (Draw_Interpretor& di, Standard_Integer n, c TCollection_AsciiString entry; for (;it.More (); it.Next ()) { S = it.Shape (); - sprintf (name,"%s_%s_%d",a[2],"new", i++); + Sprintf (name,"%s_%s_%d",a[2],"new", i++); DBRep::Set (name,it.Shape ()); TDF_Label Label = it.Label (); TDF_Tool::Entry(Label,entry); @@ -281,7 +281,7 @@ static Standard_Integer Exploreshape (Draw_Interpretor& di, Standard_Integer n, // ND->Root().FindAttribute(TNaming_UsedShapes::GetID(),US); Standard_Integer Trans = ND->Transaction(); - if (n == 5) { Trans = (Standard_Integer ) atof(a[4]);} + if (n == 5) { Trans = (Standard_Integer ) Draw::Atof(a[4]);} TDF_Label Lab; DDF::FindLabel(ND,a[2],Lab); @@ -300,11 +300,11 @@ static Standard_Integer Exploreshape (Draw_Interpretor& di, Standard_Integer n, for (TNaming_Iterator itL(Lab,Trans) ; itL.More(); itL.Next()) { if (!itL.OldShape().IsNull()) { - sprintf(name,"%s%s_%d","old",a[3],NbShapes); + Sprintf(name,"%s%s_%d","old",a[3],NbShapes); DBRep::Set (name,itL.OldShape()); } if (!itL.NewShape().IsNull()) { - sprintf(name,"%s_%d",a[3],NbShapes); + Sprintf(name,"%s_%d",a[3],NbShapes); DBRep::Set (name,itL.NewShape()); } NbShapes++; @@ -388,7 +388,7 @@ static Standard_Integer Collect (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; if (!DDF::Find(DF,arg[2],TNaming_NamedShape::GetID(),A)) return 1; if (nb >= 4) { - OnlyModif = atoi(arg[3]); + OnlyModif = Draw::Atoi(arg[3]); } TNaming_Tool::Collect(A,MNS,OnlyModif); for (TNaming_MapIteratorOfMapOfNamedShape it(MNS); it.More(); it.Next()) { diff --git a/src/DNaming/DNaming_ModelingCommands.cxx b/src/DNaming/DNaming_ModelingCommands.cxx index 7f3a0fc3a1..f710a5f447 100644 --- a/src/DNaming/DNaming_ModelingCommands.cxx +++ b/src/DNaming/DNaming_ModelingCommands.cxx @@ -17,7 +17,7 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - +#include #include #include #include @@ -321,9 +321,9 @@ static Standard_Integer DNaming_AddBox (Draw_Interpretor& theDI, TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here Standard_Real dx,dy,dz; - dx = atof(theArg[2]); - dy = atof(theArg[3]); - dz = atof(theArg[4]); + dx = Draw::Atof(theArg[2]); + dy = Draw::Atof(theArg[3]); + dz = Draw::Atof(theArg[4]); DNaming::GetReal(aFun,BOX_DX)->Set(dx); DNaming::GetReal(aFun,BOX_DY)->Set(dy); @@ -378,7 +378,7 @@ static Standard_Integer DNaming_BoxDX (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,BOX_DX)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DX)->Label()); return 0; @@ -411,7 +411,7 @@ static Standard_Integer DNaming_BoxDY (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,BOX_DY)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DY)->Label()); return 0; @@ -444,7 +444,7 @@ static Standard_Integer DNaming_BoxDZ (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,BOX_DZ)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,BOX_DZ)->Label()); return 0; @@ -682,10 +682,10 @@ static Standard_Integer DNaming_AttachShape (Draw_Interpretor& di, aResultLabel.ForgetAllAttributes(Standard_True); Standard_Boolean aKeepOrientation(Standard_False); if (nb >= 6) - aKeepOrientation = (Standard_Boolean) atoi(a[5]); + aKeepOrientation = (Standard_Boolean) Draw::Atoi(a[5]); Standard_Boolean aGeometry(Standard_False); if (nb == 7) - aGeometry = (Standard_Boolean) atoi(a[6]); + aGeometry = (Standard_Boolean) Draw::Atoi(a[6]); Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext); #ifdef DEBUG if(aCont.IsNull() || aCont->IsEmpty()) @@ -758,10 +758,10 @@ static Standard_Integer DNaming_XAttachShape (Draw_Interpretor& di, aResultLabel.ForgetAllAttributes(Standard_True); Standard_Boolean aKeepOrientation(Standard_False); if (nb >= 5) - aKeepOrientation = (Standard_Boolean) atoi(a[4]); + aKeepOrientation = (Standard_Boolean) Draw::Atoi(a[4]); Standard_Boolean aGeometry(Standard_False); if (nb == 6) - aGeometry = (Standard_Boolean) atoi(a[5]); + aGeometry = (Standard_Boolean) Draw::Atoi(a[5]); Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext); if(aCont.IsNull() || aCont->IsEmpty()) @@ -815,8 +815,8 @@ static Standard_Integer DNaming_AddCylinder (Draw_Interpretor& theDI, TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here Standard_Real aR, aH; - aR = atof(theArg[2]); - aH = atof(theArg[3]); + aR = Draw::Atof(theArg[2]); + aH = Draw::Atof(theArg[3]); Handle(TDataStd_UAttribute) Axis; if (!DDocStd::Find(aDocument, theArg[4], GEOMOBJECT_GUID, Axis)) return 1; @@ -854,7 +854,7 @@ static Standard_Integer DNaming_CylRad (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,CYL_RADIUS)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,CYL_RADIUS)->Label()); return 0; @@ -991,7 +991,7 @@ static Standard_Integer DNaming_AddFillet (Draw_Interpretor& theDI, TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here - Standard_Real aRadius = atof(theArg[3]); + Standard_Real aRadius = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,FILLET_RADIUS)->Set(aRadius); Handle(TDataStd_UAttribute) aPath; @@ -1027,13 +1027,13 @@ static Standard_Integer DNaming_PTranslateDXYZ (Draw_Interpretor& di, TDataStd_Name::Set(aFun->Label(), "ParTranslation"); Standard_Real aDx=0., aDy=0., aDz=0.; - aDx = atof(a[3]); + aDx = Draw::Atof(a[3]); //cout << "DX = " << aDx< 4) { - aDy = atof(a[4]); + aDy = Draw::Atof(a[4]); //cout << "DY = " << aDy< 5) { - aDz = atof(a[5]); + aDz = Draw::Atof(a[5]); //cout << "DZ = " << aDz<Label(), "ParTranslationAlongLine"); Standard_Real anOff = 0.; - anOff = atof(a[4]); + anOff = Draw::Atof(a[4]); DNaming::GetReal(aFun,PTRANSF_OFF)->Set(anOff); DNaming::SetObjectArg(aFun, PTRANSF_LINE, aLine); @@ -1115,7 +1115,7 @@ static Standard_Integer DNaming_PRotateLine(Draw_Interpretor& di, TDF_Reference::Set(anObject->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); Standard_Real anAngle = 0.; - anAngle = atof(a[4]); + anAngle = Draw::Atof(a[4]); Standard_Real aK = 2*M_PI/360; anAngle = anAngle * aK; DNaming::GetReal(aFun,PTRANSF_ANG)->Set(anAngle); @@ -1189,9 +1189,9 @@ static Standard_Integer DNaming_AddPrism (Draw_Interpretor& theDI, Handle(TDataStd_UAttribute) aBasisObj; if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aBasisObj)) return 1; DNaming::SetObjectArg(aFun, PRISM_BASIS, aBasisObj); - Standard_Real height = atof(theArg[3]); + Standard_Real height = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,PRISM_HEIGHT)->Set(height); - Standard_Integer reverse = atoi(theArg[4]); + Standard_Integer reverse = Draw::Atoi(theArg[4]); DNaming::GetInteger(aFun,PRISM_DIR)->Set(reverse); DDF::ReturnLabel(theDI, anObj->Label()); return 0; @@ -1219,7 +1219,7 @@ static Standard_Integer DNaming_PrismHeight (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun, PRISM_HEIGHT)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,PRISM_HEIGHT)->Label()); return 0; @@ -1277,12 +1277,12 @@ static Standard_Integer DNaming_AddRevol (Draw_Interpretor& theDI, DNaming::SetObjectArg(aFun, REVOL_AXIS, anAxObj); if(theNb > 4 ) { - Standard_Real angle = atof(theArg[4]); + Standard_Real angle = Draw::Atof(theArg[4]); Standard_Real aK = 2*M_PI/360; angle = angle * aK; DNaming::GetReal(aFun,REVOL_ANGLE)->Set(angle); if( theNb == 6) { - Standard_Integer reverse = atoi(theArg[5]); + Standard_Integer reverse = Draw::Atoi(theArg[5]); DNaming::GetInteger(aFun, REVOL_REV)->Set(reverse); } } @@ -1312,7 +1312,7 @@ static Standard_Integer DNaming_RevolutionAngle (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun, REVOL_ANGLE)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun,REVOL_ANGLE)->Label()); return 0; @@ -1351,7 +1351,7 @@ static Standard_Integer DNaming_AddSphere (Draw_Interpretor& theDI, if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aCenterObj)) return 1; DNaming::SetObjectArg(aFun, SPHERE_CENTER, aCenterObj); - Standard_Real aRadius = atof(theArg[3]); + Standard_Real aRadius = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,SPHERE_RADIUS)->Set(aRadius); DDF::ReturnLabel(theDI, anObj->Label()); @@ -1380,7 +1380,7 @@ static Standard_Integer DNaming_SphereRadius (Draw_Interpretor& theDI, Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID); if(!aFun.IsNull()) { - Standard_Real value = atof(theArg[3]); + Standard_Real value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun, SPHERE_RADIUS)->Set(value); DDF::ReturnLabel(theDI, DNaming::GetReal(aFun, SPHERE_RADIUS)->Label()); return 0; @@ -1414,9 +1414,9 @@ static Standard_Integer DNaming_AddPoint (Draw_Interpretor& theDI, TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here Standard_Real x,y,z; - x = atof(theArg[2]); - y = atof(theArg[3]); - z = atof(theArg[4]); + x = Draw::Atof(theArg[2]); + y = Draw::Atof(theArg[3]); + z = Draw::Atof(theArg[4]); DNaming::GetReal(aFun,PNT_DX)->Set(x); DNaming::GetReal(aFun,PNT_DY)->Set(y); @@ -1457,9 +1457,9 @@ static Standard_Integer DNaming_AddPointRlt (Draw_Interpretor& theDI, if (!DDocStd::Find(aDocument, theArg[2], GEOMOBJECT_GUID, aRefPnt)) return 1; Standard_Real dx,dy,dz; - dx = atof(theArg[3]); - dy = atof(theArg[4]); - dz = atof(theArg[5]); + dx = Draw::Atof(theArg[3]); + dy = Draw::Atof(theArg[4]); + dz = Draw::Atof(theArg[5]); DNaming::GetReal(aFun,PNT_DX)->Set(dx); DNaming::GetReal(aFun,PNT_DY)->Set(dy); @@ -1504,17 +1504,17 @@ static Standard_Integer DNaming_PntOffset (Draw_Interpretor& theDI, Standard_Real value(0.0); Standard_Boolean isDX = (strcmp(theArg[3],"skip")); if(isDX) { - value = atof(theArg[3]); + value = Draw::Atof(theArg[3]); DNaming::GetReal(aFun,PNT_DX)->Set(value); } Standard_Boolean isDY = (strcmp(theArg[4],"skip")); if(isDY) { - value = atof(theArg[4]); + value = Draw::Atof(theArg[4]); DNaming::GetReal(aFun,PNT_DY)->Set(value); } Standard_Boolean isDZ = (strcmp(theArg[5],"skip")); if(isDZ) { - value = atof(theArg[5]); + value = Draw::Atof(theArg[5]); DNaming::GetReal(aFun,PNT_DZ)->Set(value); } if(isDX || isDY || isDZ) @@ -1554,7 +1554,7 @@ static Standard_Integer DNaming_Line3D (Draw_Interpretor& theDI, TDataStd_Name::Set(aFun->Label(), "Line3D_Function"); TDF_Reference::Set(anObj->Label(), aFun->Label().FindChild(FUNCTION_RESULT_LABEL)); //result is here - Standard_Integer aType = atoi(theArg[2]); + Standard_Integer aType = Draw::Atoi(theArg[2]); DNaming::GetInteger(aFun,LINE3D_TYPE)->Set(aType); //LINE3D_PNTNB @@ -1869,11 +1869,11 @@ static Standard_Integer DNaming_TestSingle (Draw_Interpretor& theDI, Standard_Boolean XSelection(Standard_False); Standard_Boolean Geometry(Standard_False); if(theNb == 4) - Orientation = (Standard_Boolean)atoi(theArg[3]); + Orientation = (Standard_Boolean)Draw::Atoi(theArg[3]); if(theNb == 5) - XSelection = (Standard_Boolean)atoi(theArg[4]); + XSelection = (Standard_Boolean)Draw::Atoi(theArg[4]); if (theNb == 6) - Geometry = (Standard_Boolean) atoi(theArg[5]); + Geometry = (Standard_Boolean) Draw::Atoi(theArg[5]); Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj); if(!aNS.IsNull() && !aNS->IsEmpty()) { @@ -2008,11 +2008,11 @@ static Standard_Integer DNaming_Multiple (Draw_Interpretor& theDI, Standard_Boolean XSelection(Standard_False); Standard_Boolean Geometry(Standard_False); if(theNb == 4) - Orientation = (Standard_Boolean)atoi(theArg[3]); + Orientation = (Standard_Boolean)Draw::Atoi(theArg[3]); if(theNb == 5) - XSelection = (Standard_Boolean)atoi(theArg[4]); + XSelection = (Standard_Boolean)Draw::Atoi(theArg[4]); if (theNb == 6) - Geometry = (Standard_Boolean) atoi(theArg[5]); + Geometry = (Standard_Boolean) Draw::Atoi(theArg[5]); Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj); if(!aNS.IsNull() && !aNS->IsEmpty()) { diff --git a/src/DNaming/DNaming_SelectionCommands.cxx b/src/DNaming/DNaming_SelectionCommands.cxx index 8a2039dadb..919e775323 100755 --- a/src/DNaming/DNaming_SelectionCommands.cxx +++ b/src/DNaming/DNaming_SelectionCommands.cxx @@ -129,7 +129,7 @@ static Standard_Integer DNaming_Select (Draw_Interpretor& di, Standard_Integer n } if (n > 4) { Standard_Boolean Orient(Standard_False); - if(n == 6) Orient = (Standard_Boolean)atoi(a[5]); + if(n == 6) Orient = (Standard_Boolean)Draw::Atoi(a[5]); TopoDS_Shape S = DBRep::Get(a[3], TopAbs_SHAPE); TopoDS_Shape C = DBRep::Get(a[4], TopAbs_SHAPE); SL.Select (S, C, geometry, Orient); @@ -223,7 +223,7 @@ static Standard_Integer DNaming_SolveSelection (Draw_Interpretor& di, Standard_I if(!isSolved) di << "!!! Solver is failed" <<"\n"; TopoDS_Shape Res = TNaming_Tool::CurrentShape(SL.NamedShape()); - sprintf (name,"%s_%s","new",a[2]); + Sprintf (name,"%s_%s","new",a[2]); Display (name,Res); return 0; } diff --git a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx index d9b6b60951..f31643168b 100755 --- a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx +++ b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx @@ -329,7 +329,7 @@ static Standard_Integer DPrsStd_AISTransparency (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetTransparency(atof(arg[3])); + prs->SetTransparency(Draw::Atof(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -396,7 +396,7 @@ static Standard_Integer DPrsStd_AISColor (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetColor((Quantity_NameOfColor)atoi(arg[3])); + prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else @@ -465,7 +465,7 @@ static Standard_Integer DPrsStd_AISMaterial (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3])); + prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else { diff --git a/src/Draw/Draw.cdl b/src/Draw/Draw.cdl index 886cfe253a..b943ad3f59 100755 --- a/src/Draw/Draw.cdl +++ b/src/Draw/Draw.cdl @@ -182,13 +182,13 @@ is ---Purpose: Sets a TCL sting variable Atof(Name : CString) returns Real; - ---Purpose: Search a numeric variable. If none found converts - -- the string to a real. + ---Purpose: Converts numeric expression, that can involve DRAW + -- variables, to real value. Atoi(Name : CString) returns Integer; - ---Purpose: Search a numeric variable. If none found converts - -- the string to an integer. - + ---Purpose: Converts numeric expression, that can involve DRAW + -- variables, to integer value. + -- Implemented as cast of Atof() to integer. LastPick(view,X,Y,button : out Integer); ---Purpose: Returns last graphic selection description. diff --git a/src/Draw/Draw.cxx b/src/Draw/Draw.cxx index 8e57404ce4..d654dd22e6 100755 --- a/src/Draw/Draw.cxx +++ b/src/Draw/Draw.cxx @@ -110,7 +110,7 @@ static void ReadInitFile (const TCollection_AsciiString& theFileName) try { aPath.ChangeAll ('\\', '/'); - sprintf(console_command, "source \"%.980s\"", aPath.ToCString()); + Sprintf(console_command, "source \"%.980s\"", aPath.ToCString()); console_semaphore = HAS_CONSOLE_COMMAND; while (console_semaphore == HAS_CONSOLE_COMMAND) Sleep(10); @@ -122,7 +122,7 @@ static void ReadInitFile (const TCollection_AsciiString& theFileName) } else { #endif char* com = new char [aPath.Length() + strlen ("source ") + 2]; - sprintf (com, "source %s", aPath.ToCString()); + Sprintf (com, "source %s", aPath.ToCString()); Draw_Interprete (com); delete [] com; #ifdef WNT diff --git a/src/Draw/Draw_Appli.hxx b/src/Draw/Draw_Appli.hxx index 3503c0917f..004a8c3079 100755 --- a/src/Draw/Draw_Appli.hxx +++ b/src/Draw/Draw_Appli.hxx @@ -64,9 +64,6 @@ extern Draw_Viewer dout; extern Standard_Boolean Draw_Batch; #endif -#define atof(X) Draw::Atof(X) -#define atoi(X) Draw::Atoi(X) - class Draw_SaveAndRestore { public : diff --git a/src/Draw/Draw_BasicCommands.cxx b/src/Draw/Draw_BasicCommands.cxx index d2db55a3c1..012af7f198 100755 --- a/src/Draw/Draw_BasicCommands.cxx +++ b/src/Draw/Draw_BasicCommands.cxx @@ -391,7 +391,7 @@ static Standard_Integer Draw_wait(Draw_Interpretor& , Standard_Integer n, const { Standard_Integer w = 10; if (n > 1) - w = atoi(a[1]); + w = Draw::Atoi(a[1]); time_t ct = time(NULL) + w; while (time(NULL) < ct) {}; return 0; @@ -443,7 +443,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const CPU_LIMIT = RLIM_INFINITY; else { - CPU_LIMIT = atoi (a[1]); + CPU_LIMIT = Draw::Atoi (a[1]); Standard_Real anUserSeconds, aSystemSeconds; OSD_Chronometer::GetProcessCPU (anUserSeconds, aSystemSeconds); CPU_CURRENT = clock_t(anUserSeconds + aSystemSeconds); @@ -464,7 +464,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const if (n <= 1) rlp.rlim_cur = RLIM_INFINITY; else - rlp.rlim_cur = atoi(a[1]); + rlp.rlim_cur = Draw::Atoi(a[1]); CPU_LIMIT = rlp.rlim_cur; int status; @@ -517,7 +517,7 @@ By default is \"mem-log.txt\", is \"mem-stat.txt\"" } if (strcmp(a[1], "set") == 0) { - int aType = (n > 2 ? atoi(a[2]) : 1); + int aType = (n > 2 ? Draw::Atoi(a[2]) : 1); if (aType < 0 || aType > 2) { di << "unknown op of the command set" << "\n"; @@ -581,7 +581,7 @@ By default is \"mem-log.txt\", is \"mem-stat.txt\"" const char* aOutFile = "mem-stat.txt"; if (n > 2) { - includeAlive = (atoi(a[2]) != 0); + includeAlive = (Draw::Atoi(a[2]) != 0); if (n > 3) { aLogFile = a[3]; @@ -608,6 +608,38 @@ By default is \"mem-log.txt\", is \"mem-stat.txt\"" return 0; } +//============================================================================== +//function : dlocale +//purpose : +//============================================================================== + +static int dlocale (Draw_Interpretor& di, Standard_Integer n, const char** argv) +{ + int category = LC_ALL; + if (n > 1) + { + const char *cat = argv[1]; + if ( ! strcmp (cat, "LC_ALL") ) category = LC_ALL; + else if ( ! strcmp (cat, "LC_COLLATE") ) category = LC_COLLATE; + else if ( ! strcmp (cat, "LC_CTYPE") ) category = LC_CTYPE; + else if ( ! strcmp (cat, "LC_MONETARY") ) category = LC_MONETARY; + else if ( ! strcmp (cat, "LC_NUMERIC") ) category = LC_NUMERIC; + else if ( ! strcmp (cat, "LC_TIME") ) category = LC_TIME; + else + { + cout << "Error: cannot recognize argument " << cat << " as one of LC_ macros" << endl; + return 1; + } + } + const char* locale = (n > 2 ? argv[2] : NULL); + const char* result = setlocale (category, locale); + if (result) + di << result; + else + cout << "Error: unsupported locale specification: " << locale << endl; + return 0; +} + //============================================================================== //function : dmeminfo //purpose : @@ -702,4 +734,6 @@ void Draw::BasicCommands(Draw_Interpretor& theCommands) __FILE__,dbreak,g); theCommands.Add("dversion", "provides information on OCCT build configuration (version, compiler, OS, C library, etc.)", __FILE__,dversion,g); + theCommands.Add("dlocale", "set and / or query locate of C subsystem (function setlocale())", + __FILE__,dlocale,g); } diff --git a/src/Draw/Draw_GraphicCommands.cxx b/src/Draw/Draw_GraphicCommands.cxx index f36ba2ca47..13d485b99b 100755 --- a/src/Draw/Draw_GraphicCommands.cxx +++ b/src/Draw/Draw_GraphicCommands.cxx @@ -74,7 +74,7 @@ static char Draw_fontsizedefault[FONTLENGTH]="150"; static Standard_Integer ViewId(const Standard_CString a) { - Standard_Integer id = atoi(a); + Standard_Integer id = Draw::Atoi(a); if ((id < 0) || (id >= MAXVIEW)) { cout << "Incorrect view-id, must be in 0.."< First is the view Standard_Boolean z2d = !strcasecmp(a[0],"2dzoom"); if (n == 2) { - Standard_Real z = atof(a[1]); + Standard_Real z = Draw::Atof(a[1]); for (Standard_Integer id = 0; id < MAXVIEW; id++) { if (dout.HasView(id)) { if ((z2d && !dout.Is3D(id)) || (!z2d && dout.Is3D(id))) { @@ -121,7 +121,7 @@ static Standard_Integer zoom(Draw_Interpretor& , Standard_Integer n, const char* else if (n >= 3) { Standard_Integer id = ViewId(a[1]); if (id < 0) return 1; - Standard_Real z = atof(a[2]); + Standard_Real z = Draw::Atof(a[2]); dout.SetZoom(id,z); dout.RepaintView(id); SetTitle(id); @@ -263,7 +263,7 @@ static Standard_Integer view(Draw_Interpretor& di, Standard_Integer n, const cha if (Draw_Batch) return 1; if ((n >= 3) && (n != 4)) { - Standard_Integer id = atoi(a[1]); + Standard_Integer id = Draw::Atoi(a[1]); if ((id < 0) || (id >= MAXVIEW)) { di <<"View-id must be in 0.."<= 4) - X = atoi(a[3]); + X = Draw::Atoi(a[3]); if (n >= 5) - Y = atoi(a[4]); + Y = Draw::Atoi(a[4]); if (n >= 6) - W = atoi(a[5]); + W = Draw::Atoi(a[5]); if (n >= 7) - H = atoi(a[6]); + H = Draw::Atoi(a[6]); dout.MakeView(id,a[2],X,Y,W,H); if (!dout.HasView(id)) { di << "View creation failed"<<"\n"; @@ -294,7 +294,7 @@ static Standard_Integer view(Draw_Interpretor& di, Standard_Integer n, const cha } else if (n == 4) { // create a view on a given window - Standard_Integer id = atoi(a[1]); + Standard_Integer id = Draw::Atoi(a[1]); if ((id < 0) || (id >= MAXVIEW)) { di <<"View-id must be in 0.."< 2) { - id = atoi(a[1]); + id = Draw::Atoi(a[1]); file = a[2]; } if (!dout.SaveView(id,file)) @@ -873,19 +873,19 @@ static Standard_Integer grid (Draw_Interpretor& , Standard_Integer NbArg, const StepZ = DefaultGridStep ; break ; case 2 : - StepX = Abs (atof (Arg[1])) ; - StepY = Abs (atof (Arg[1])) ; - StepZ = Abs (atof (Arg[1])) ; + StepX = Abs (Draw::Atof (Arg[1])) ; + StepY = Abs (Draw::Atof (Arg[1])) ; + StepZ = Abs (Draw::Atof (Arg[1])) ; break ; case 3 : - StepX = Abs (atof (Arg[1])) ; - StepY = Abs (atof (Arg[2])) ; - StepZ = Abs (atof (Arg[2])) ; + StepX = Abs (Draw::Atof (Arg[1])) ; + StepY = Abs (Draw::Atof (Arg[2])) ; + StepZ = Abs (Draw::Atof (Arg[2])) ; break ; case 4 : - StepX = Abs (atof (Arg[1])) ; - StepY = Abs (atof (Arg[2])) ; - StepZ = Abs (atof (Arg[3])) ; + StepX = Abs (Draw::Atof (Arg[1])) ; + StepY = Abs (Draw::Atof (Arg[2])) ; + StepZ = Abs (Draw::Atof (Arg[3])) ; break ; default : return 1 ; @@ -941,7 +941,7 @@ static Standard_Integer dtext(Draw_Interpretor& di, Standard_Integer n, const ch } else if (n >= 4) { is3d = n > 4; - P.SetCoord(atof(a[1]),atof(a[2]),is3d ? atof(a[3]) : 0); + P.SetCoord(Draw::Atof(a[1]),Draw::Atof(a[2]),is3d ? Draw::Atof(a[3]) : 0); } else return 0; diff --git a/src/Draw/Draw_Interpretor.cxx b/src/Draw/Draw_Interpretor.cxx index 7a9aac764e..41fa96e0e3 100755 --- a/src/Draw/Draw_Interpretor.cxx +++ b/src/Draw/Draw_Interpretor.cxx @@ -233,7 +233,7 @@ static Standard_Integer CommandCmd cout << "An exception was caught " << E << endl; - if (cc && atoi(cc)) { + if (cc && Draw::Atoi(cc)) { #ifdef WNT Tcl_Exit(0); #else @@ -497,7 +497,7 @@ Draw_Interpretor& Draw_Interpretor::Append(const TCollection_ExtendedString& the Draw_Interpretor& Draw_Interpretor::Append(const Standard_Integer i) { char c[100]; - sprintf(c,"%d",i); + Sprintf(c,"%d",i); Tcl_AppendResult(myInterp,c,(Standard_CString)0); return *this; } @@ -510,7 +510,7 @@ Draw_Interpretor& Draw_Interpretor::Append(const Standard_Integer i) Draw_Interpretor& Draw_Interpretor::Append(const Standard_Real r) { char s[100]; - sprintf(s,"%.17g",r); + Sprintf(s,"%.17g",r); Tcl_AppendResult(myInterp,s,(Standard_CString)0); return *this; } diff --git a/src/Draw/Draw_ProgressIndicator.cxx b/src/Draw/Draw_ProgressIndicator.cxx index 366c9ca723..bbfaa56ba0 100755 --- a/src/Draw/Draw_ProgressIndicator.cxx +++ b/src/Draw/Draw_ProgressIndicator.cxx @@ -87,7 +87,7 @@ Standard_Boolean Draw_ProgressIndicator::Show(const Standard_Boolean force) // Prepare textual progress info char text[2048]; Standard_Integer n = 0; - n += sprintf ( &text[n], "Progress: %.0f%%", 100. * GetPosition() ); + n += Sprintf ( &text[n], "Progress: %.0f%%", 100. * GetPosition() ); for ( Standard_Integer i=GetNbScopes(); i >=1; i-- ) { const Message_ProgressScale &scale = GetScope ( i ); if ( scale.GetName().IsNull() ) continue; // skip unnamed scopes @@ -95,16 +95,16 @@ Standard_Boolean Draw_ProgressIndicator::Show(const Standard_Boolean force) Standard_Real locPos = ( i >1 ? GetScope ( i-1 ).GetLast() : GetPosition() ); // print progress info differently for finite and infinite scopes if ( scale.GetInfinite() ) - n += sprintf ( &text[n], " %s: %.0f", scale.GetName()->ToCString(), + n += Sprintf ( &text[n], " %s: %.0f", scale.GetName()->ToCString(), scale.BaseToLocal ( locPos ) ); else - n += sprintf ( &text[n], " %s: %.0f / %.0f", scale.GetName()->ToCString(), + n += Sprintf ( &text[n], " %s: %.0f / %.0f", scale.GetName()->ToCString(), scale.BaseToLocal ( locPos ), scale.GetMax() ); } // In addition, write elapsed/estimated/remaining time if ( GetPosition() > 0.01 ) { - n += sprintf ( &text[n], "\nElapsed/estimated time: %ld/%.0f sec", + n += Sprintf ( &text[n], "\nElapsed/estimated time: %ld/%.0f sec", (long)(aTime - myStartTime), ( aTime - myStartTime ) / GetPosition() ); } @@ -112,7 +112,7 @@ Standard_Boolean Draw_ProgressIndicator::Show(const Standard_Boolean force) if ( myGraphMode ) { if ( ! myShown ) { char command[1024]; - sprintf ( command, "toplevel .xprogress -height 100 -width 410;" + Sprintf ( command, "toplevel .xprogress -height 100 -width 410;" "wm title .xprogress \"Progress\";" "set xprogress_stop 0;" "canvas .xprogress.bar -width 402 -height 22;" @@ -127,12 +127,12 @@ Standard_Boolean Draw_ProgressIndicator::Show(const Standard_Boolean force) } char command[1024]; Standard_Integer num = 0; - num += sprintf ( &command[num], ".xprogress.bar coords progress 2 2 %.0f 21;", + num += Sprintf ( &command[num], ".xprogress.bar coords progress 2 2 %.0f 21;", 1+400*GetPosition() ); - num += sprintf ( &command[num], ".xprogress.bar coords progress_next 2 2 %.0f 21;", + num += Sprintf ( &command[num], ".xprogress.bar coords progress_next 2 2 %.0f 21;", 1+400*GetScope(1).GetLast() ); - num += sprintf ( &command[num], ".xprogress.text configure -text \"%s\";", text ); - num += sprintf ( &command[num], "update" ); + num += Sprintf ( &command[num], ".xprogress.text configure -text \"%s\";", text ); + num += Sprintf ( &command[num], "update" ); ((Draw_Interpretor*)myDraw)->Eval ( command ); } diff --git a/src/Draw/Draw_UnitCommands.cxx b/src/Draw/Draw_UnitCommands.cxx index b0da355326..c67bc4793b 100755 --- a/src/Draw/Draw_UnitCommands.cxx +++ b/src/Draw/Draw_UnitCommands.cxx @@ -45,7 +45,7 @@ static Standard_Integer parsing TCollection_AsciiString aStrTok(argv[1]); Standard_Integer nbIter =1; if(argc >2) - nbIter = atoi(argv[2]); + nbIter = Draw::Atoi(argv[2]); UnitsAPI::SetLocalSystem(); Handle(Units_Token) atoken; Units_UnitSentence aUnitSent(aStrTok.ToCString()); @@ -93,7 +93,7 @@ static Standard_Integer converttoSI return 1; } - Standard_Real aData = atof(argv[1]); + Standard_Real aData = Draw::Atof(argv[1]); Standard_CString aUnit = argv[2]; Standard_Real res = UnitsAPI::AnyToSI(aData,aUnit); @@ -115,7 +115,7 @@ static Standard_Integer converttoMDTV return 1; } - Standard_Real aData = atof(argv[1]); + Standard_Real aData = Draw::Atof(argv[1]); Standard_CString aUnit = argv[2]; UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); @@ -134,7 +134,7 @@ static Standard_Integer converttoMDTV static Standard_Integer unit(Draw_Interpretor& , Standard_Integer n, const char** a) { if(n == 4) { - cout << Units::Convert(atof(a[1]), a[2], a[3]) << endl; + cout << Units::Convert(Draw::Atof(a[1]), a[2], a[3]) << endl; return 0; } else diff --git a/src/Draw/Draw_VariableCommands.cxx b/src/Draw/Draw_VariableCommands.cxx index 95728f73ce..da2144d751 100755 --- a/src/Draw/Draw_VariableCommands.cxx +++ b/src/Draw/Draw_VariableCommands.cxx @@ -400,12 +400,12 @@ static Standard_Integer erase(Draw_Interpretor& di, Standard_Integer n, const ch static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char** a) { if (n < 3) return 1; - Standard_Integer id = atoi(a[1]); + Standard_Integer id = Draw::Atoi(a[1]); if (!dout.HasView(id)) { cout << "bad view number in draw"<= '0' && c <= '9')); @@ -1028,7 +1025,7 @@ static Standard_Real ParseValue(char*& name) *p = '\0'; if (Numeric(*name)) // numeric litteral - x = atof(name); + x = Atof(name); else if (!Draw::Get((Standard_CString) name,x)) { // variable // search for a function ... @@ -1086,7 +1083,7 @@ static Standard_Real ParseValue(char*& name) x = 0; } else - x = atof(theCommands.Result()); + x = Atof(theCommands.Result()); theCommands.Reset(); if (sv) { theCommands << sv; diff --git a/src/DrawDim/DrawDim_PlanarDimensionCommands.cxx b/src/DrawDim/DrawDim_PlanarDimensionCommands.cxx index f00f919c2e..2db97e72fb 100755 --- a/src/DrawDim/DrawDim_PlanarDimensionCommands.cxx +++ b/src/DrawDim/DrawDim_PlanarDimensionCommands.cxx @@ -224,7 +224,7 @@ static Standard_Integer DrawDim_VARIABLES (Draw_Interpretor& di, if (M.Add(vf)) { i++; char* p = (char *)malloc(100); - sprintf(p,"%s_%dv",a[1],i); + Sprintf(p,"%s_%dv",a[1],i); DBRep::Set(p,vf); di.AppendElement(p); DrawDim::DrawShapeName (vf,p); @@ -232,14 +232,14 @@ static Standard_Integer DrawDim_VARIABLES (Draw_Interpretor& di, if (M.Add(vl)) { i++; char *p = (char *)malloc(100); - sprintf(p,"%s_%dv",a[1],i); + Sprintf(p,"%s_%dv",a[1],i); DBRep::Set(p,vl); di.AppendElement(p); DrawDim::DrawShapeName (vl,p); } i++; char *p = (char *)malloc(100); - sprintf(p,"%s_%de",a[1],i); + Sprintf(p,"%s_%de",a[1],i); DBRep::Set(p,ex.Current()); di.AppendElement(p); DrawDim::DrawShapeName (ex.Current(),p); diff --git a/src/DrawTrSurf/DrawTrSurf.cxx b/src/DrawTrSurf/DrawTrSurf.cxx index 47d68789b9..18e2cbac35 100755 --- a/src/DrawTrSurf/DrawTrSurf.cxx +++ b/src/DrawTrSurf/DrawTrSurf.cxx @@ -260,8 +260,8 @@ static Standard_Integer nbiso (Draw_Interpretor& di, Standard_Integer n, const c { if (n < 4) { if (n == 3) { - NbUIsos = atoi(a[1]); - NbVIsos = atoi(a[2]); + NbUIsos = Draw::Atoi(a[1]); + NbVIsos = Draw::Atoi(a[2]); } di << NbUIsos << " " << NbVIsos; } @@ -269,7 +269,7 @@ static Standard_Integer nbiso (Draw_Interpretor& di, Standard_Integer n, const c for (Standard_Integer i = 1; i < n - 2; i++) { Handle(DrawTrSurf_Surface) DS = GetSurface(a[i]); if (!DS.IsNull()) { - DS->ShowIsos(atoi(a[n-2]),atoi(a[n-1])); + DS->ShowIsos(Draw::Atoi(a[n-2]),Draw::Atoi(a[n-1])); Draw::Repaint(); } } @@ -424,13 +424,13 @@ static Standard_Integer draw (Draw_Interpretor& di, Standard_Integer n, const ch else if (!strcmp(a[0],"discr")) { if (n == 2) - Discret = atoi(a[n-1]); + Discret = Draw::Atoi(a[n-1]); di << Discret; } else if (!strcmp(a[0],"defle")) { if (n == 2) - Deflection = atof(a[n-1]); + Deflection = Draw::Atof(a[n-1]); di << Deflection; } } @@ -445,11 +445,11 @@ static Standard_Integer draw (Draw_Interpretor& di, Standard_Integer n, const ch } else if (!strcmp(a[0],"discr")) { - D->SetDiscretisation(atoi(a[n-1])); + D->SetDiscretisation(Draw::Atoi(a[n-1])); } else if (!strcmp(a[0],"defle")) { - D->SetDeflection(atof(a[n-1])); + D->SetDeflection(Draw::Atof(a[n-1])); } Draw::Repaint(); @@ -470,22 +470,22 @@ static Standard_Integer transform (Draw_Interpretor& di, Standard_Integer n, con gp_Trsf T; Standard_Integer i,last = n-1; if (!strcmp(a[0],"pscale")) { - Standard_Real s = atof(a[last]); + Standard_Real s = Draw::Atof(a[last]); last--; if (last < 4) return 1; - gp_Pnt P(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Pnt P(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); T.SetScale(P,s); } else if (!strcmp(a[0]+1,"mirror")) { if (last < 4) return 1; - gp_Pnt P(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Pnt P(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); if (*a[0] == 'p') { T.SetMirror(P); } else { last -= 3; if (last < 4) return 1; - gp_Pnt O(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Pnt O(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 3; gp_Dir D(P.X(),P.Y(),P.Z()); if (*a[0] == 'l') { @@ -500,18 +500,18 @@ static Standard_Integer transform (Draw_Interpretor& di, Standard_Integer n, con else if (!strcmp(a[0],"translate")) { if (last < 4) return 1; - gp_Vec V(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Vec V(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 3; T.SetTranslation(V); } else if (!strcmp(a[0],"rotate")) { if (last < 8) return 1; - Standard_Real ang = atof(a[last]) * (M_PI / 180.0); + Standard_Real ang = Draw::Atof(a[last]) * (M_PI / 180.0); last --; - gp_Dir D(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Dir D(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 3; - gp_Pnt P(atof(a[last-2]),atof(a[last-1]),atof(a[last])); + gp_Pnt P(Draw::Atof(a[last-2]),Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 3; T.SetRotation(gp_Ax1(P,D),ang); } @@ -545,23 +545,23 @@ static Standard_Integer d2transform (Draw_Interpretor& di, Standard_Integer n, c gp_Trsf2d T; Standard_Integer i,last = n-1; if (!strcmp(a[0],"2dpscale")) { - Standard_Real s = atof(a[last]); + Standard_Real s = Draw::Atof(a[last]); last--; if (last < 3) return 1; - gp_Pnt2d P(atof(a[last-1]),atof(a[last])); + gp_Pnt2d P(Draw::Atof(a[last-1]),Draw::Atof(a[last])); T.SetScale(P,s); } else if ( (!strcmp(a[0],"2dpmirror")) || (!strcmp(a[0],"2dlmirror")) ) { if (last < 3) return 1; - gp_Pnt2d P(atof(a[last-1]),atof(a[last])); + gp_Pnt2d P(Draw::Atof(a[last-1]),Draw::Atof(a[last])); if (!strcmp(a[0],"2dpmirror")) { T.SetMirror(P); } else { last -= 2; if (last < 3) return 1; - gp_Pnt2d O(atof(a[last-1]),atof(a[last])); + gp_Pnt2d O(Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 2; gp_Dir2d D(P.X(),P.Y()); T.SetMirror(gp_Ax2d(O,D)); @@ -570,16 +570,16 @@ static Standard_Integer d2transform (Draw_Interpretor& di, Standard_Integer n, c else if (!strcmp(a[0],"2dtranslate")) { if (last < 3) return 1; - gp_Vec2d V(atof(a[last-1]),atof(a[last])); + gp_Vec2d V(Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 2; T.SetTranslation(V); } else if (!strcmp(a[0],"2drotate")) { if (last < 4) return 1; - Standard_Real ang = atof(a[last]) * (M_PI / 180.0); + Standard_Real ang = Draw::Atof(a[last]) * (M_PI / 180.0); last --; - gp_Pnt2d P(atof(a[last-1]),atof(a[last])); + gp_Pnt2d P(Draw::Atof(a[last-1]),Draw::Atof(a[last])); last -= 2; T.SetRotation(P,ang); } diff --git a/src/DrawTrSurf/DrawTrSurf_Triangulation.cxx b/src/DrawTrSurf/DrawTrSurf_Triangulation.cxx index 4aff962989..983ba796c7 100755 --- a/src/DrawTrSurf/DrawTrSurf_Triangulation.cxx +++ b/src/DrawTrSurf/DrawTrSurf_Triangulation.cxx @@ -175,7 +175,7 @@ void DrawTrSurf_Triangulation::DrawOn(Draw_Display& dis) const dis.SetColor(Draw_jaune); n = myTriangulation->NbNodes(); for (i = 1; i <= n; i++) { - sprintf(text,"%d",i); + Sprintf(text,"%d",i); dis.DrawString(Nodes(i),text); } } @@ -193,7 +193,7 @@ void DrawTrSurf_Triangulation::DrawOn(Draw_Display& dis) const bary.Add(Nodes(t[j]).Coord()); bary.Multiply(1./3.); - sprintf(text,"%d",i); + Sprintf(text,"%d",i); dis.DrawString(P,text); } } diff --git a/src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx b/src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx index c8f3f04849..1f1ec0461c 100755 --- a/src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx +++ b/src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx @@ -164,7 +164,7 @@ void Dynamic_FuzzyDefinitionsDictionary::Creates(const Standard_CString afilenam fuzzydefinition->Parameter(new Dynamic_IntegerParameter(name,atoi(value))); else if(!strcasecmp(type,"Standard_Real")) - fuzzydefinition->Parameter(new Dynamic_RealParameter(name,atof(value))); + fuzzydefinition->Parameter(new Dynamic_RealParameter(name,Atof(value))); else if(!strcasecmp(type,"Standard_CString")) fuzzydefinition->Parameter(new Dynamic_StringParameter(name,value)); diff --git a/src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx b/src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx index 08dcd62ad8..5676bef4dd 100755 --- a/src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx +++ b/src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx @@ -175,7 +175,7 @@ void Dynamic_MethodDefinitionsDictionary::Creates(const Standard_CString afilena methoddefinition->AddVariable(new Dynamic_IntegerParameter(name,atoi(value)),Dynamic::Mode(mode),group); else if(!strcasecmp(type,"Standard_Real")) - methoddefinition->AddVariable(new Dynamic_RealParameter(name,atof(value)),Dynamic::Mode(mode),group); + methoddefinition->AddVariable(new Dynamic_RealParameter(name,Atof(value)),Dynamic::Mode(mode),group); else if(!strcasecmp(type,"Standard_CString")) methoddefinition->AddVariable(new Dynamic_StringParameter(name,value),Dynamic::Mode(mode),group); diff --git a/src/Expr/Expr_NumericValue.cxx b/src/Expr/Expr_NumericValue.cxx index 70666b7cb8..b51be99b61 100755 --- a/src/Expr/Expr_NumericValue.cxx +++ b/src/Expr/Expr_NumericValue.cxx @@ -116,6 +116,6 @@ Standard_Real Expr_NumericValue::Evaluate(const Expr_Array1OfNamedUnknown&, cons TCollection_AsciiString Expr_NumericValue::String() const { char val[100]; - sprintf(val,"%g",myValue); + Sprintf(val,"%g",myValue); return TCollection_AsciiString(val); } diff --git a/src/ExprIntrp/ExprIntrp_yaccintrf.cxx b/src/ExprIntrp/ExprIntrp_yaccintrf.cxx index 1ceb7f8f18..1c895a67fe 100755 --- a/src/ExprIntrp/ExprIntrp_yaccintrf.cxx +++ b/src/ExprIntrp/ExprIntrp_yaccintrf.cxx @@ -481,7 +481,7 @@ extern "C" void ExprIntrp_NumValue() char num[30]; int nbcar; nbcar = ExprIntrp_GetResult(num); - Standard_Real value = atof(num); + Standard_Real value = Atof(num); Handle(Expr_NumericValue) nval = new Expr_NumericValue(value); ExprIntrp_Recept.Push(nval); } @@ -621,7 +621,7 @@ extern "C" void ExprIntrp_ConstantDefinition() char num[30]; int nbcar; nbcar = ExprIntrp_GetResult(num); - Standard_Real val = atof(num); + Standard_Real val = Atof(num); Handle(Expr_NamedConstant) theconst = new Expr_NamedConstant(name,val); ExprIntrp_Recept.Use(theconst); ExprIntrp_Recept.Push(theconst); diff --git a/src/FSD/FSD_CmpFile.cdl b/src/FSD/FSD_CmpFile.cdl index 417d10d247..6288f80459 100755 --- a/src/FSD/FSD_CmpFile.cdl +++ b/src/FSD/FSD_CmpFile.cdl @@ -30,8 +30,7 @@ uses Position from Storage, SequenceOfAsciiString from TColStd, SequenceOfExtendedString from TColStd, ExtendedString from TCollection, - FStream from FSD, - Real2String from OSD + FStream from FSD raises StreamTypeMismatchError from Storage, StreamFormatError from Storage, @@ -331,6 +330,5 @@ is fields - myStream : FStream from FSD; - myRealConv : Real2String from OSD; + myStream : FStream from FSD; end; diff --git a/src/FSD/FSD_CmpFile.cxx b/src/FSD/FSD_CmpFile.cxx index e753323544..7dea71241d 100755 --- a/src/FSD/FSD_CmpFile.cxx +++ b/src/FSD/FSD_CmpFile.cxx @@ -19,8 +19,6 @@ #include #include -#include - #include #include #include @@ -122,6 +120,7 @@ Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName,const Stora } else { myStream.precision(17); + myStream.imbue (std::locale::classic()); // use always C locale SetOpenMode(aMode); } } @@ -529,29 +528,9 @@ Storage_BaseDriver& FSD_CmpFile::PutBoolean(const Standard_Boolean aValue) Storage_BaseDriver& FSD_CmpFile::PutReal(const Standard_Real aValue) { -#ifdef BUC60808 - char realbuffer[100]; - Standard_PCharacter pChar; - // - pChar=realbuffer; - realbuffer[0] = '\0'; - // - if (myRealConv.RealToCString(aValue,pChar)) { - myStream << realbuffer << " "; - } - else { - Storage_StreamWriteError::Raise(); - } - if (myStream.bad()) Storage_StreamWriteError::Raise(); - - return *this; - -#else myStream << ((Standard_Real)aValue) << " "; - if (myStream.bad()) Storage_StreamWriteError::Raise(); return *this; -#endif } //======================================================================= @@ -561,28 +540,9 @@ Storage_BaseDriver& FSD_CmpFile::PutReal(const Standard_Real aValue) Storage_BaseDriver& FSD_CmpFile::PutShortReal(const Standard_ShortReal aValue) { -#ifdef BUC60808 - char realbuffer[100]; - Standard_PCharacter pStr; - // - pStr=realbuffer; - realbuffer[0] = '\0'; - // - if (myRealConv.RealToCString(aValue,pStr)) { - myStream << realbuffer << " "; - } - else { - Storage_StreamWriteError::Raise(); - } - if (myStream.bad()) Storage_StreamWriteError::Raise(); - - return *this; -#else myStream << aValue << " "; - if (myStream.bad()) Storage_StreamWriteError::Raise(); return *this; -#endif } //======================================================================= @@ -669,10 +629,9 @@ Storage_BaseDriver& FSD_CmpFile::GetReal(Standard_Real& aValue) cerr << "\t buffer is" << realbuffer<< endl; Storage_StreamTypeMismatchError::Raise(); } - if (!myRealConv.CStringToReal(realbuffer,aValue)) { + if (!OSD::CStringToReal(realbuffer,aValue)) { cerr << "%%%ERROR: read error of double at offset " << myStream.tellg() << endl; cerr << "\t buffer is" << realbuffer<< endl; - //if (!OSD::CStringToReal(realbuffer,aValue)) Storage_StreamTypeMismatchError::Raise(); } @@ -697,8 +656,8 @@ Storage_BaseDriver& FSD_CmpFile::GetShortReal(Standard_ShortReal& aValue) realbuffer[0] = '\0'; if (!(myStream >> realbuffer)) Storage_StreamTypeMismatchError::Raise(); - // if (!OSD::CStringToReal(realbuffer,r)) - if (!myRealConv.CStringToReal(realbuffer,r)) Storage_StreamTypeMismatchError::Raise(); + if (!OSD::CStringToReal(realbuffer,r)) + Storage_StreamTypeMismatchError::Raise(); aValue = (Standard_ShortReal)r; diff --git a/src/FSD/FSD_File.cxx b/src/FSD/FSD_File.cxx index fe71914e21..d755d6f509 100755 --- a/src/FSD/FSD_File.cxx +++ b/src/FSD/FSD_File.cxx @@ -91,6 +91,7 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_ } else { myStream.precision(17); + myStream.imbue (std::locale::classic()); // use always C locale SetOpenMode(aMode); } } @@ -461,25 +462,9 @@ Storage_BaseDriver& FSD_File::PutBoolean(const Standard_Boolean aValue) Storage_BaseDriver& FSD_File::PutReal(const Standard_Real aValue) { -#ifdef USEOSDREAL - char realbuffer[100]; - - realbuffer[0] = '\0'; - if (OSD::RealToCString(aValue,realbuffer)) { - myStream << realbuffer << " "; - } - else { - Storage_StreamWriteError::Raise(); - } - if (myStream.bad()) Storage_StreamWriteError::Raise(); - - return *this; -#else myStream << ((Standard_Real)aValue) << " "; - if (myStream.bad()) Storage_StreamWriteError::Raise(); return *this; -#endif } //======================================================================= @@ -489,25 +474,9 @@ Storage_BaseDriver& FSD_File::PutReal(const Standard_Real aValue) Storage_BaseDriver& FSD_File::PutShortReal(const Standard_ShortReal aValue) { -#ifdef USEOSDREAL - char realbuffer[100]; - - realbuffer[0] = '\0'; - if (OSD::RealToCString(aValue,realbuffer)) { - myStream << realbuffer << " "; - } - else { - Storage_StreamWriteError::Raise(); - } - if (myStream.bad()) Storage_StreamWriteError::Raise(); - - return *this; -#else myStream << aValue << " "; - if (myStream.bad()) Storage_StreamWriteError::Raise(); return *this; -#endif } //======================================================================= diff --git a/src/GeomProjLib/GeomProjLib.cxx b/src/GeomProjLib/GeomProjLib.cxx index ce1fc3810e..dd73747d29 100755 --- a/src/GeomProjLib/GeomProjLib.cxx +++ b/src/GeomProjLib/GeomProjLib.cxx @@ -91,9 +91,9 @@ Handle(Geom2d_Curve) GeomProjLib::Curve2d(const Handle(Geom_Curve)& C, //POP pour NT // char name[100]; char* name = new char[100]; - sprintf(name,"PROJCURV_%d",NBPROJ); + Sprintf(name,"PROJCURV_%d",NBPROJ); DrawTrSurf::Set(name,C); - sprintf(name,"PROJSURF_%d",NBPROJ); + Sprintf(name,"PROJSURF_%d",NBPROJ); DrawTrSurf::Set(name,S); NBPROJ++; } diff --git a/src/GeometryTest/GeometryTest_API2dCommands.cxx b/src/GeometryTest/GeometryTest_API2dCommands.cxx index d36ccef3ad..0311b23d9a 100755 --- a/src/GeometryTest/GeometryTest_API2dCommands.cxx +++ b/src/GeometryTest/GeometryTest_API2dCommands.cxx @@ -55,7 +55,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch { if ( n < 4) return 1; - gp_Pnt2d P(atof(a[2]),atof(a[3])); + gp_Pnt2d P(Draw::Atof(a[2]),Draw::Atof(a[3])); char name[100]; @@ -72,7 +72,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Handle(Geom2d_Line) L = new Geom2d_Line(P,gp_Vec2d(P,P1)); Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., P.Distance(P1)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -108,14 +108,14 @@ static Standard_Integer appro(Draw_Interpretor& di, Standard_Integer n, const ch if (n < 3) { if (n == 2) - Tol2d = atof(a[1]); + Tol2d = Draw::Atof(a[1]); di << "Tolerance for 2d approx : "<< Tol2d << "\n"; return 0; } - Standard_Integer i, Nb = atoi(a[2]); + Standard_Integer i, Nb = Draw::Atoi(a[2]); Standard_Boolean hasPoints = Standard_True; TColgp_Array1OfPnt2d Points(1, Nb); @@ -170,17 +170,17 @@ static Standard_Integer appro(Draw_Interpretor& di, Standard_Integer n, const ch // points nc = 3; for (i = 1; i <= Nb; i++) { - Points(i).SetCoord(atof(a[nc]),atof(a[nc+1])); + Points(i).SetCoord(Draw::Atof(a[nc]),Draw::Atof(a[nc+1])); nc += 2; } } else if (nc - 2 == Nb) { // YValues nc = 5; - X0 = atof(a[3]); - DX = atof(a[4]); + X0 = Draw::Atof(a[3]); + DX = Draw::Atof(a[4]); for (i = 1; i <= Nb; i++) { - YValues(i) = atof(a[nc]); + YValues(i) = Draw::Atof(a[nc]); Points(i).SetCoord(X0+(i-1)*DX,YValues(i)); nc++; } @@ -245,7 +245,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom2d_Line) L = new Geom2d_Line(P1,gp_Vec2d(P1,P2)); Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; diff --git a/src/GeometryTest/GeometryTest_APICommands.cxx b/src/GeometryTest/GeometryTest_APICommands.cxx index 53ded2477e..d5fe1ecdfd 100755 --- a/src/GeometryTest/GeometryTest_APICommands.cxx +++ b/src/GeometryTest/GeometryTest_APICommands.cxx @@ -62,7 +62,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch return 1; } - gp_Pnt P(atof(a[2]),atof(a[3]),atof(a[4])); + gp_Pnt P(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])); char name[100]; @@ -87,13 +87,13 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P.Distance(P1)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; } else { - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); di << name << " "; char* temp = name; // portage WNT DrawTrSurf::Set(temp, P1); @@ -117,13 +117,13 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P.Distance(P1)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; } else { - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, P1); di << name << " "; @@ -146,7 +146,7 @@ static Standard_Integer appro(Draw_Interpretor& di, Standard_Integer n, const ch if ( n<3) return 1; Handle(Geom_Curve) GC; - Standard_Integer Nb = atoi(a[2]); + Standard_Integer Nb = Draw::Atoi(a[2]); TColgp_Array1OfPnt Points(1, Nb); @@ -218,20 +218,20 @@ static Standard_Integer grilapp(Draw_Interpretor& di, Standard_Integer n, const if ( n < 12) return 1; Standard_Integer i,j; - Standard_Integer Nu = atoi(a[2]); - Standard_Integer Nv = atoi(a[3]); + Standard_Integer Nu = Draw::Atoi(a[2]); + Standard_Integer Nv = Draw::Atoi(a[3]); TColStd_Array2OfReal ZPoints (1, Nu, 1, Nv); - Standard_Real X0 = atof(a[4]); - Standard_Real dX = atof(a[5]); - Standard_Real Y0 = atof(a[6]); - Standard_Real dY = atof(a[7]); + Standard_Real X0 = Draw::Atof(a[4]); + Standard_Real dX = Draw::Atof(a[5]); + Standard_Real Y0 = Draw::Atof(a[6]); + Standard_Real dY = Draw::Atof(a[7]); Standard_Integer Count = 8; for ( j = 1; j <= Nv; j++) { for ( i = 1; i <= Nu; i++) { if ( Count > n) return 1; - ZPoints(i,j) = atof(a[Count]); + ZPoints(i,j) = Draw::Atof(a[Count]); Count++; } } @@ -255,8 +255,8 @@ static Standard_Integer surfapp(Draw_Interpretor& di, Standard_Integer n, const if ( n < 5 ) return 1; Standard_Integer i,j; - Standard_Integer Nu = atoi(a[2]); - Standard_Integer Nv = atoi(a[3]); + Standard_Integer Nu = Draw::Atoi(a[2]); + Standard_Integer Nv = Draw::Atoi(a[3]); TColgp_Array2OfPnt Points (1, Nu, 1, Nv); if ( n == 5) { @@ -278,7 +278,7 @@ static Standard_Integer surfapp(Draw_Interpretor& di, Standard_Integer n, const for ( j = 1; j <= Nv; j++) { for ( i = 1; i <= Nu; i++) { if ( Count > n) return 1; - Points(i,j) = gp_Pnt(atof(a[Count]),atof(a[Count+1]),atof(a[Count+2])); + Points(i,j) = gp_Pnt(Draw::Atof(a[Count]),Draw::Atof(a[Count+1]),Draw::Atof(a[Count+2])); Count += 3; } } @@ -287,7 +287,7 @@ static Standard_Integer surfapp(Draw_Interpretor& di, Standard_Integer n, const Standard_Integer Count = 1; for ( j = 1; j <= Nv; j++) { for ( i = 1; i <= Nu; i++) { - sprintf(name,"point_%d",Count++); + Sprintf(name,"point_%d",Count++); char* temp = name; // portage WNT DrawTrSurf::Set(temp,Points(i,j)); } @@ -362,7 +362,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -381,7 +381,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -396,7 +396,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -411,7 +411,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -466,7 +466,7 @@ static Standard_Integer totalextcc(Draw_Interpretor& di, Standard_Integer n, con Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",1); + Sprintf(name,"%s%d","ext_",1); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; diff --git a/src/GeometryTest/GeometryTest_ConstraintCommands.cxx b/src/GeometryTest/GeometryTest_ConstraintCommands.cxx index b90f3a791b..8cb6e1bfe2 100755 --- a/src/GeometryTest/GeometryTest_ConstraintCommands.cxx +++ b/src/GeometryTest/GeometryTest_ConstraintCommands.cxx @@ -89,7 +89,7 @@ static Standard_Integer solutions(Draw_Interpretor& di, if (ct3.IsDone()) { for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) { Handle(Geom2d_Circle) C = new Geom2d_Circle(ct3.ThisSolution(i)); - sprintf(solname,"%s_%d",name,i); + Sprintf(solname,"%s_%d",name,i); char* temp = solname; // pour portage WNT DrawTrSurf::Set(temp,C); di << solname << " "; @@ -113,7 +113,7 @@ static Standard_Integer solutions(Draw_Interpretor& di, if (ct3.IsDone()) { for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) { Handle(Geom2d_Circle) C = new Geom2d_Circle(ct3.ThisSolution(i)); - sprintf(solname,"%s_%d",name,i); + Sprintf(solname,"%s_%d",name,i); char* temp = solname; // pour portage WNT DrawTrSurf::Set(temp,C); di << solname << " "; @@ -144,7 +144,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const Standard_Boolean ip3 = DrawTrSurf::GetPoint2d(a[4],P3); Standard_Real tol = Precision::Confusion(); - if (n > 5) tol = atof(a[5]); + if (n > 5) tol = Draw::Atof(a[5]); if (!C1.IsNull()) { @@ -173,7 +173,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // C-C-R Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1), Geom2dGcc::Unqualified(C2), - atof(a[4]),tol); + Draw::Atof(a[4]),tol); return solutions(di,ct3,a[1]); } } @@ -201,7 +201,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // C-P-R Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1), new Geom2d_CartesianPoint(P2), - atof(a[4]),tol); + Draw::Atof(a[4]),tol); return solutions(di,ct3,a[1]); } } @@ -212,7 +212,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // C-R-C Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1), Geom2dGcc::Unqualified(C3), - atof(a[3]), + Draw::Atof(a[3]), tol); return solutions(di,ct3,a[1]); } @@ -221,7 +221,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // C-R-P Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1), new Geom2d_CartesianPoint(P3), - atof(a[3]), + Draw::Atof(a[3]), tol); return solutions(di,ct3,a[1]); } @@ -260,7 +260,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // P-C-R Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2), new Geom2d_CartesianPoint(P1), - atof(a[4]),tol); + Draw::Atof(a[4]),tol); return solutions(di,ct3,a[1]); } } @@ -288,7 +288,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // P-P-R Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P1), new Geom2d_CartesianPoint(P2), - atof(a[4]),tol); + Draw::Atof(a[4]),tol); return solutions(di,ct3,a[1]); } } @@ -299,7 +299,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // P-R-C Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C3), new Geom2d_CartesianPoint(P1), - atof(a[3]), + Draw::Atof(a[3]), tol); return solutions(di,ct3,a[1]); } @@ -308,7 +308,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // P-R-P Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P1), new Geom2d_CartesianPoint(P3), - atof(a[3]), + Draw::Atof(a[3]), tol); return solutions(di,ct3,a[1]); } @@ -329,7 +329,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // R-C-C Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2), Geom2dGcc::Unqualified(C3), - atof(a[2]), + Draw::Atof(a[2]), tol); return solutions(di,ct3,a[1]); } @@ -338,7 +338,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // R-C-P Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2), new Geom2d_CartesianPoint(P3), - atof(a[2]), + Draw::Atof(a[2]), tol); return solutions(di,ct3,a[1]); } @@ -355,7 +355,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // R-P-C Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C3), new Geom2d_CartesianPoint(P2), - atof(a[2]), + Draw::Atof(a[2]), tol); return solutions(di,ct3,a[1]); } @@ -364,7 +364,7 @@ static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const // R-P-P Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P2), new Geom2d_CartesianPoint(P3), - atof(a[2]), + Draw::Atof(a[2]), tol); return solutions(di,ct3,a[1]); } @@ -411,7 +411,7 @@ static Standard_Integer lintang (Draw_Interpretor& di,Standard_Integer n, const di << "Second argument must be a line"; return 1; } - Standard_Real ang = atof(a[4]) * (M_PI / 180.0); + Standard_Real ang = Draw::Atof(a[4]) * (M_PI / 180.0); Geom2dGcc_Lin2dTanObl ct3(Geom2dGcc::Unqualified(C1), L->Lin2d(), Precision::Angular(), @@ -420,7 +420,7 @@ static Standard_Integer lintang (Draw_Interpretor& di,Standard_Integer n, const if (ct3.IsDone()) { for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) { Handle(Geom2d_Line) LS = new Geom2d_Line(ct3.ThisSolution(i)); - sprintf(solname,"%s_%d",a[1],i); + Sprintf(solname,"%s_%d",a[1],i); char* temp = solname; // pour portage WNT DrawTrSurf::Set(temp,LS); di << solname << " "; @@ -438,7 +438,7 @@ static Standard_Integer lintang (Draw_Interpretor& di,Standard_Integer n, const if (ct3.IsDone()) { for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) { Handle(Geom2d_Line) LS = new Geom2d_Line(ct3.ThisSolution(i)); - sprintf(solname,"%s_%d",a[1],i); + Sprintf(solname,"%s_%d",a[1],i); char* temp = solname; // pour portage WNT DrawTrSurf::Set(temp,LS); di << solname << " "; @@ -684,7 +684,7 @@ static Standard_Integer tanginterpol (Draw_Interpretor& di, periodic_flag = Standard_True ; num_read += 1 ; } - num_parameters = atoi(a[num_read]) ; + num_parameters = Draw::Atoi(a[num_read]) ; if (num_parameters < 2) { num_parameters = 2 ; @@ -703,7 +703,7 @@ static Standard_Integer tanginterpol (Draw_Interpretor& di, num_read += 1 ; while (num_read <= num_parameters * 3 + num_start ) { for (jj = 1 ; jj <= 3 ; jj++) { - a_point.SetCoord(jj,atof(a[num_read])) ; + a_point.SetCoord(jj,Draw::Atof(a[num_read])) ; num_read += 1 ; } PointsArrayPtr->SetValue(ii,a_point) ; @@ -728,7 +728,7 @@ static Standard_Integer tanginterpol (Draw_Interpretor& di, ii = 1 ; while (ii <= num_tangents) { for (jj = 1 ; jj <= 3 ; jj++) { - a_vector.SetCoord(jj,atof(a[num_read])) ; + a_vector.SetCoord(jj,Draw::Atof(a[num_read])) ; num_read += 1 ; } TangentsArray.SetValue(ii,a_vector) ; diff --git a/src/GeometryTest/GeometryTest_ContinuityCommands.cxx b/src/GeometryTest/GeometryTest_ContinuityCommands.cxx index edd8d35f3e..9de8a3f10d 100755 --- a/src/GeometryTest/GeometryTest_ContinuityCommands.cxx +++ b/src/GeometryTest/GeometryTest_ContinuityCommands.cxx @@ -82,12 +82,12 @@ static Standard_Integer surfaceCcontinuity (Draw_Interpretor& di, Standard_Integ Handle(Geom_Surface) surf2 = DrawTrSurf::GetSurface(a[5]); if (surf2.IsNull()) return 1; - U1 = atof(a[3]); - U2 = atof(a[6]); - V1 = atof(a[4]); - V2 = atof(a[7]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[6]); + V1 = Draw::Atof(a[4]); + V2 = Draw::Atof(a[7]); - ord = atoi(a[1]); + ord = Draw::Atoi(a[1]); surf1->Bounds(u1, u2, v1, v2); b1 = ((((U1>=u1)&&(U1<=u2))||((U1<=u1)&&(U1>=u2)))); @@ -103,8 +103,8 @@ static Standard_Integer surfaceCcontinuity (Draw_Interpretor& di, Standard_Integ switch ( ord ) { case 0 : { TypeCont=GeomAbs_C0; switch(n) - { case 10 : epsC0= atof(a[9]); - case 9 : epsnl = atof(a[8]); + { case 10 : epsC0= Draw::Atof(a[9]); + case 9 : epsnl = Draw::Atof(a[8]); case 8 : {} break; default : return 1; } @@ -118,9 +118,9 @@ static Standard_Integer surfaceCcontinuity (Draw_Interpretor& di, Standard_Integ break; case 1 : { TypeCont=GeomAbs_C1; switch(n) - { case 11 : epsC1=atof(a[10]); - case 10 : epsC0= atof(a[9]); - case 9 : epsnl = atof(a[8]); + { case 11 : epsC1=Draw::Atof(a[10]); + case 10 : epsC0= Draw::Atof(a[9]); + case 9 : epsnl = Draw::Atof(a[8]); case 8 : {} break; default : return 1; } @@ -136,10 +136,10 @@ static Standard_Integer surfaceCcontinuity (Draw_Interpretor& di, Standard_Integ case 2 : { TypeCont=GeomAbs_C2; switch(n) { - case 12 : epsC2= atof(a[11]); - case 11 : epsC1=atof(a[10]); - case 10 : epsC0= atof(a[9]); - case 9 : epsnl = atof(a[8]); + case 12 : epsC2= Draw::Atof(a[11]); + case 11 : epsC1=Draw::Atof(a[10]); + case 10 : epsC0= Draw::Atof(a[9]); + case 9 : epsnl = Draw::Atof(a[8]); case 8 : {} break; default : return 1; } @@ -176,12 +176,12 @@ static Standard_Integer surfaceGcontinuity (Draw_Interpretor& di, Standard_Integ Handle(Geom_Surface) surf2 = DrawTrSurf::GetSurface(a[5]); if (surf2.IsNull()) return 1; - U1 = atof(a[3]); - U2 = atof(a[6]); - V1 = atof(a[4]); - V2 = atof(a[7]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[6]); + V1 = Draw::Atof(a[4]); + V2 = Draw::Atof(a[7]); - ord = atoi(a[1]); + ord = Draw::Atoi(a[1]); surf1->Bounds(u1, u2, v1, v2); b1 = ((((U1>=u1)&&(U1<=u2))||((U1<=u1)&&(U1>=u2)))); @@ -198,9 +198,9 @@ static Standard_Integer surfaceGcontinuity (Draw_Interpretor& di, Standard_Integ { case 1 : { TypeCont=GeomAbs_G1; switch(n) - { case 11 : epsG1=atof(a[10]); - case 10 : epsC0= atof(a[9]); - case 9 : epsnl = atof(a[8]); + { case 11 : epsG1=Draw::Atof(a[10]); + case 10 : epsC0= Draw::Atof(a[9]); + case 9 : epsnl = Draw::Atof(a[8]); case 8 : {} break; default : return 1; } @@ -215,11 +215,11 @@ static Standard_Integer surfaceGcontinuity (Draw_Interpretor& di, Standard_Integ break; case 2 : { TypeCont=GeomAbs_G2; switch(n) - { case 13 : maxlen =atof (a[12]); - case 12 : perce=atof(a[11]); - case 11 : epsG1=atof(a[10]); - case 10 : epsC0= atof(a[9]); - case 9 : epsnl = atof(a[8]); + { case 13 : maxlen =Draw::Atof (a[12]); + case 12 : perce=Draw::Atof(a[11]); + case 11 : epsG1=Draw::Atof(a[10]); + case 10 : epsC0= Draw::Atof(a[9]); + case 9 : epsnl = Draw::Atof(a[8]); case 8 : {} break; default : return 1; } @@ -253,10 +253,10 @@ static Standard_Integer curveGcontinuity(Draw_Interpretor& di, Standard_Integer Handle(Geom_Curve) curv2 = DrawTrSurf::GetCurve(a[4]); if (curv2.IsNull()) return 1; - U1 = atof(a[3]); - U2 = atof(a[5]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[5]); - ord = atoi(a[1]); + ord = Draw::Atoi(a[1]); u1=curv1->FirstParameter(); u2=curv1->LastParameter(); @@ -273,9 +273,9 @@ static Standard_Integer curveGcontinuity(Draw_Interpretor& di, Standard_Integer { case 1 : { switch(n) - { case 9 : epsG1=atof(a[8]); - case 8 : epsC0= atof(a[7]); - case 7 : epsnl = atof(a[6]); + { case 9 : epsG1=Draw::Atof(a[8]); + case 8 : epsC0= Draw::Atof(a[7]); + case 7 : epsnl = Draw::Atof(a[6]); case 6 : {} break; default : return 1; } @@ -291,12 +291,12 @@ static Standard_Integer curveGcontinuity(Draw_Interpretor& di, Standard_Integer case 2 : { TypeCont=GeomAbs_G2; switch(n) - {case 12 :maxlen =atof(a[11]); - case 11 :percent=atof(a[10]); - case 10 : epsG2= atof(a[9]); - case 9 : epsG1=atof(a[8]); - case 8 : epsC0= atof(a[7]); - case 7 : epsnl = atof(a[6]); + {case 12 :maxlen =Draw::Atof(a[11]); + case 11 :percent=Draw::Atof(a[10]); + case 10 : epsG2= Draw::Atof(a[9]); + case 9 : epsG1=Draw::Atof(a[8]); + case 8 : epsC0= Draw::Atof(a[7]); + case 7 : epsnl = Draw::Atof(a[6]); case 6 : {} break; default : return 1; } @@ -328,10 +328,10 @@ static Standard_Integer curveCcontinuity(Draw_Interpretor& di, Standard_Integer Handle(Geom_Curve) curv2 = DrawTrSurf::GetCurve(a[4]); if (curv2.IsNull()) return 1; - U1 = atof(a[3]); - U2 = atof(a[5]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[5]); - ord = atoi(a[1]); + ord = Draw::Atoi(a[1]); u1=curv1->FirstParameter(); u2=curv1->LastParameter(); @@ -347,8 +347,8 @@ static Standard_Integer curveCcontinuity(Draw_Interpretor& di, Standard_Integer InitEpsCurv( epsnl,epsC0, epsC1, epsC2, epsG1, epsG2, percent,maxlen); switch ( ord ) { case 0 : { switch(n) - { case 8 : epsC0= atof(a[7]); - case 7 : epsnl = atof(a[6]); + { case 8 : epsC0= Draw::Atof(a[7]); + case 7 : epsnl = Draw::Atof(a[6]); case 6 : {} break; default : return 1; } @@ -362,9 +362,9 @@ static Standard_Integer curveCcontinuity(Draw_Interpretor& di, Standard_Integer } break; case 1 : { switch(n) - { case 9 : epsC1 =atof(a[8]); - case 8 : epsC0= atof(a[7]); - case 7 : epsnl = atof(a[6]); + { case 9 : epsC1 =Draw::Atof(a[8]); + case 8 : epsC0= Draw::Atof(a[7]); + case 7 : epsnl = Draw::Atof(a[6]); case 6 : {} break; default : return 1; } @@ -380,10 +380,10 @@ static Standard_Integer curveCcontinuity(Draw_Interpretor& di, Standard_Integer case 2 : { TypeCont=GeomAbs_C2; switch(n) { - case 10 : epsC2= atof(a[9]); - case 9 : epsC1=atof(a[8]); - case 8 : epsC0= atof(a[7]); - case 7 : epsnl = atof(a[6]); + case 10 : epsC2= Draw::Atof(a[9]); + case 9 : epsC1=Draw::Atof(a[8]); + case 8 : epsC0= Draw::Atof(a[7]); + case 7 : epsnl = Draw::Atof(a[6]); case 6 : {} break; default : return 1; } diff --git a/src/GeometryTest/GeometryTest_CurveCommands.cxx b/src/GeometryTest/GeometryTest_CurveCommands.cxx index e7abdd9b8b..fe4878bdbd 100755 --- a/src/GeometryTest/GeometryTest_CurveCommands.cxx +++ b/src/GeometryTest/GeometryTest_CurveCommands.cxx @@ -153,17 +153,17 @@ static Standard_Integer polelaw (Draw_Interpretor& , Standard_Integer n, const c if (n < 3) return 1; Standard_Boolean periodic = Standard_False ; - Standard_Integer deg = atoi(a[2]); - Standard_Integer nbk = atoi(a[3]); + Standard_Integer deg = Draw::Atoi(a[2]); + Standard_Integer nbk = Draw::Atoi(a[3]); TColStd_Array1OfReal knots(1, nbk); TColStd_Array1OfInteger mults(1, nbk); k = 4; Standard_Integer Sigma = 0; for (i = 1; i<=nbk; i++) { - knots( i) = atof(a[k]); + knots( i) = Draw::Atof(a[k]); k++; - mults( i) = atoi(a[k]); + mults( i) = Draw::Atoi(a[k]); Sigma += mults(i); k++; } @@ -185,7 +185,7 @@ static Standard_Integer polelaw (Draw_Interpretor& , Standard_Integer n, const c flat_knots, schoenberg_points) ; for (i = 1; i <= np; i++) { - poles(i).SetCoord(schoenberg_points(i),atof(a[k])); + poles(i).SetCoord(schoenberg_points(i),Draw::Atof(a[k])); k++; } @@ -270,9 +270,9 @@ static Standard_Integer gproject(Draw_Interpretor& di, Standard_Integer n, const Standard_Integer ONE = 1; if (n == 3) - sprintf(name,"p"); + Sprintf(name,"p"); else if (n == 4) { - sprintf(name,"%s",a[1]); + Sprintf(name,"%s",a[1]); ONE = 2; } else { @@ -306,8 +306,8 @@ static Standard_Integer gproject(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom2d_Curve) PCur2d; // Only for isoparametric projection for(k = 1; k <= Projector.NbCurves(); k++){ - sprintf(newname,"%s_%d",name,k); - sprintf(newname1,"%s2d_%d",name,k); + Sprintf(newname,"%s_%d",name,k); + Sprintf(newname1,"%s2d_%d",name,k); if(Projector.IsSinglePnt(k, P2d)){ // cout<<"Part "<D0(P2d.X(), P2d.Y(), P); @@ -430,7 +430,7 @@ static Standard_Integer project (Draw_Interpretor& di, if ( a[index][0] != '-') return 1; if ( a[index][1] == 'e') { - Standard_Real p = atof(a[index+1]); + Standard_Real p = Draw::Atof(a[index+1]); Standard_Real dU = p * (U2 - U1) / 100.; Standard_Real dV = p * (V2 - V1) / 100.; U1 -= dU; U2 += dU; V1 -= dV; V2 += dV; @@ -438,10 +438,10 @@ static Standard_Integer project (Draw_Interpretor& di, } else if ( a[index][1] == 'v') { Verif = Standard_True; - NbPoints = atoi(a[index+1]); + NbPoints = Draw::Atoi(a[index+1]); } else if ( a[index][1] == 't') { - tolerance = atof(a[index+1]); + tolerance = Draw::Atof(a[index+1]); } index += 2; } @@ -507,13 +507,13 @@ Standard_Integer projonplane(Draw_Interpretor& di, if ( C.IsNull()) return 1; Standard_Boolean Param = Standard_True; - if ((n == 5 && atoi(a[4]) == 0) || - (n == 8 && atoi(a[7]) == 0)) Param = Standard_False; + if ((n == 5 && Draw::Atoi(a[4]) == 0) || + (n == 8 && Draw::Atoi(a[7]) == 0)) Param = Standard_False; gp_Dir D; if ( n == 8) { - D = gp_Dir(atof(a[4]),atof(a[5]),atof(a[6])); + D = gp_Dir(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6])); } else { D = Pl->Pln().Position().Direction(); @@ -539,9 +539,9 @@ static void solution(const Handle(GccInt_Bisec)& Bis, { char solname[200]; if ( i == 0) - sprintf(solname,"%s",name); + Sprintf(solname,"%s",name); else - sprintf(solname,"%s_%d",name,i); + Sprintf(solname,"%s_%d",name,i); const char* temp = solname; // pour portage WNT switch ( Bis->ArcType()) { @@ -591,7 +591,7 @@ static Standard_Integer bisec (Draw_Interpretor& di, char solname[200]; NbSol = Bis.NbSolutions(); for ( i = 1; i <= NbSol; i++) { - sprintf(solname,"%s_%d",a[1],i); + Sprintf(solname,"%s_%d",a[1],i); const char* temp = solname; // pour portage WNT DrawTrSurf::Set(temp,new Geom2d_Line(Bis.ThisSolution(i))); } @@ -775,8 +775,8 @@ static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const tolerance, tx ; - u = atof(a[2]); - x = atof(a[3]); + u = Draw::Atof(a[2]); + x = Draw::Atof(a[3]); tolerance = 1.0e-5 ; dimension = 2 ; if (n < 5) { @@ -784,9 +784,9 @@ static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const } Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]); if (!G2.IsNull()) { - tx = atof(a[4]) ; + tx = Draw::Atof(a[4]) ; if (n == 6) { - condition = Max(atoi(a[5]), -1) ; + condition = Max(Draw::Atoi(a[5]), -1) ; condition = Min(condition, G2->Degree()-1) ; } TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ; @@ -891,7 +891,7 @@ static Standard_Integer crvpoints (Draw_Interpretor& di, Standard_Integer /*n*/, Standard_Real defl; Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); - defl = atof(a[3]); + defl = Draw::Atof(a[3]); GeomAdaptor_Curve GAC(C); GCPnts_QuasiUniformDeflection PntGen(GAC, defl); @@ -948,10 +948,10 @@ static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, co Standard_Real defl, angle = Precision::Angular(); Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); - defl = atof(a[3]); + defl = Draw::Atof(a[3]); if(n > 3) - angle = atof(a[4]); + angle = Draw::Atof(a[4]); GeomAdaptor_Curve GAC(C); GCPnts_TangentialDeflection PntGen(GAC, angle, defl, 2); @@ -1017,7 +1017,7 @@ static Standard_Integer uniformAbscissa (Draw_Interpretor& di, Standard_Integer } Standard_Integer nocp; - nocp = atoi(a[2]); + nocp = Draw::Atoi(a[2]); if(nocp < 2) return 1; @@ -1065,12 +1065,12 @@ static Standard_Integer EllipsUniformAbscissa (Draw_Interpretor& di, Standard_In return 1; Standard_Real R1; - R1 = atof(a[1]); + R1 = Draw::Atof(a[1]); Standard_Real R2; - R2 = atof(a[2]); + R2 = Draw::Atof(a[2]); Standard_Integer nocp; - nocp = atoi(a[3]); + nocp = Draw::Atoi(a[3]); if(nocp < 2) return 1; @@ -1143,7 +1143,7 @@ static Standard_Integer mypoints (Draw_Interpretor& di, Standard_Integer /*n*/, Standard_Real defl; Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); - defl = atof(a[3]); + defl = Draw::Atof(a[3]); const Handle(Geom_BSplineCurve)& aBS = Handle(Geom_BSplineCurve)::DownCast(C); if(aBS.IsNull()) return 1; @@ -1271,7 +1271,7 @@ static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer / Standard_Real defl; Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[2]); - defl = atof(a[3]); + defl = Draw::Atof(a[3]); Handle(GeomAdaptor_HSurface) AS = new GeomAdaptor_HSurface(S); @@ -1348,7 +1348,7 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, } // Standard_Real tol = Precision::Confusion(); - if (n == 5 || n == 9 || n == 13 || n == 17) tol = atof(a[n-1]); + if (n == 5 || n == 9 || n == 13 || n == 17) tol = Draw::Atof(a[n-1]); // Handle(Geom_Curve) Result; gp_Pnt Point; @@ -1381,11 +1381,11 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, } if (useStart) for (Standard_Integer i=ista1; i <= ista2; i++) - UVsta[i-ista1] = atof(a[i]); + UVsta[i-ista1] = Draw::Atof(a[i]); if (useBnd) { Standard_Real UVbnd[8]; for (Standard_Integer i=ibnd1; i <= ibnd2; i++) - UVbnd[i-ibnd1] = atof(a[i]); + UVbnd[i-ibnd1] = Draw::Atof(a[i]); AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]); AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]); } @@ -1415,7 +1415,7 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, aNbLines = Inters.NbLines(); if (aNbLines >= 2) { for (i=1; i<=aNbLines; ++i) { - sprintf(buf, "%s_%d",a[1],i); + Sprintf(buf, "%s_%d",a[1],i); Result = Inters.Line(i); const char* temp = buf; DrawTrSurf::Set(temp,Result); @@ -1429,7 +1429,7 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, aNbPoints=Inters.NbPoints(); for (i=1; i<=aNbPoints; ++i) { Point=Inters.Point(i); - sprintf(buf,"%s_p_%d",a[1],i); + Sprintf(buf,"%s_p_%d",a[1],i); const char* temp =buf; DrawTrSurf::Set(temp, Point); } @@ -1448,13 +1448,13 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, Standard_Integer i; Standard_Integer Compt = 1; for (i = 1; i <= nblines; i++, Compt++) { - sprintf(newname,"%s_%d",a[1],Compt); + Sprintf(newname,"%s_%d",a[1],Compt); Result = Inters.Segment(i); const char* temp = newname; // pour portage WNT DrawTrSurf::Set(temp,Result); } for (i = 1; i <= nbpoints; i++, Compt++) { - sprintf(newname,"%s_%d",a[1],i); + Sprintf(newname,"%s_%d",a[1],i); Point = Inters.Point(i); const char* temp = newname; // pour portage WNT DrawTrSurf::Set(temp,Point); diff --git a/src/GeometryTest/GeometryTest_FairCurveCommands.cxx b/src/GeometryTest/GeometryTest_FairCurveCommands.cxx index df2c7ac2a3..7e99d05719 100755 --- a/src/GeometryTest/GeometryTest_FairCurveCommands.cxx +++ b/src/GeometryTest/GeometryTest_FairCurveCommands.cxx @@ -64,9 +64,9 @@ BattenCurve(Draw_Interpretor& di, Standard_Integer argc, const char** argv) Standard_Boolean Ok; FairCurve_AnalysisCode Iana; - Standard_Real a1 = atof(cangle1), - a2 = atof(cangle2), - h = atof(cheigth); + Standard_Real a1 = Draw::Atof(cangle1), + a2 = Draw::Atof(cangle2), + h = Draw::Atof(cheigth); gp_Pnt2d P1, P2; @@ -108,9 +108,9 @@ MVCurve(Draw_Interpretor& di, Standard_Integer argc, const char** argv) Standard_Boolean Ok; FairCurve_AnalysisCode Iana; - Standard_Real a1 = atof(cangle1), - a2 = atof(cangle2), - h = atof(cheigth); + Standard_Real a1 = Draw::Atof(cangle1), + a2 = Draw::Atof(cangle2), + h = Draw::Atof(cheigth); gp_Pnt2d P1, P2; @@ -146,7 +146,7 @@ SetPoint(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *PointName = argv[2]; const char *BattenName = argv[3]; - Standard_Integer cote = atoi(side); + Standard_Integer cote = Draw::Atoi(side); Handle(DrawTrSurf_Point) Pnt = Handle(DrawTrSurf_Point)::DownCast(Draw::Get(PointName)); @@ -173,8 +173,8 @@ SetAngle(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[2]; const char *BattenName = argv[3]; - Standard_Real angle = atof(val); - Standard_Integer cote = atoi(side); + Standard_Real angle = Draw::Atof(val); + Standard_Integer cote = Draw::Atoi(side); Handle(DrawFairCurve_Batten) Bat = Handle(DrawFairCurve_Batten)::DownCast(Draw::Get(BattenName)); @@ -197,8 +197,8 @@ SetCurvature(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[2]; const char *MVCName = argv[3]; - Standard_Real rho = atof(val); - Standard_Integer cote = atoi(side); + Standard_Real rho = Draw::Atof(val); + Standard_Integer cote = Draw::Atoi(side); Handle(DrawFairCurve_MinimalVariation) MVC = Handle(DrawFairCurve_MinimalVariation)::DownCast(Draw::Get(MVCName)); @@ -221,7 +221,7 @@ SetSlide(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[1]; const char *BattenName = argv[2]; - Standard_Real slide = atof(val); + Standard_Real slide = Draw::Atof(val); Handle(DrawFairCurve_Batten) Bat = Handle(DrawFairCurve_Batten)::DownCast(Draw::Get(BattenName)); @@ -243,7 +243,7 @@ FreeAngle(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *side = argv[1]; const char *BattenName = argv[2]; - Standard_Integer cote = atoi(side); + Standard_Integer cote = Draw::Atoi(side); Handle(DrawFairCurve_Batten) Bat = Handle(DrawFairCurve_Batten)::DownCast(Draw::Get(BattenName)); @@ -264,7 +264,7 @@ FreeCurvature(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *side = argv[1]; const char *MVCName = argv[2]; - Standard_Integer cote = atoi(side); + Standard_Integer cote = Draw::Atoi(side); Handle(DrawFairCurve_MinimalVariation) MVC = Handle(DrawFairCurve_MinimalVariation)::DownCast(Draw::Get(MVCName)); @@ -303,7 +303,7 @@ SetHeight(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[1]; const char *BattenName = argv[2]; - Standard_Real Height = atof(val); + Standard_Real Height = Draw::Atof(val); Handle(DrawFairCurve_Batten) Bat = Handle(DrawFairCurve_Batten)::DownCast(Draw::Get(BattenName)); @@ -324,7 +324,7 @@ SetSlope(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[1]; const char *BattenName = argv[2]; - Standard_Real Slope = atof(val); + Standard_Real Slope = Draw::Atof(val); Handle(DrawFairCurve_Batten) Bat = Handle(DrawFairCurve_Batten)::DownCast(Draw::Get(BattenName)); @@ -344,7 +344,7 @@ SetPhysicalRatio(Draw_Interpretor& di, Standard_Integer argc, const char** argv) const char *val = argv[1]; const char *MVCName = argv[2]; - Standard_Real ratio = atof(val); + Standard_Real ratio = Draw::Atof(val); Handle(DrawFairCurve_MinimalVariation) MVC = Handle(DrawFairCurve_MinimalVariation)::DownCast(Draw::Get(MVCName)); diff --git a/src/GeometryTest/GeometryTest_PolyCommands.cxx b/src/GeometryTest/GeometryTest_PolyCommands.cxx index 93f843d4e5..1694d2cbca 100755 --- a/src/GeometryTest/GeometryTest_PolyCommands.cxx +++ b/src/GeometryTest/GeometryTest_PolyCommands.cxx @@ -48,8 +48,8 @@ static Standard_Integer polytr(Draw_Interpretor& di, Standard_Integer n, const c if (n < 4) return 1; - Standard_Integer nbNodes = atoi(a[2]); - Standard_Integer nbTri = atoi(a[3]); + Standard_Integer nbNodes = Draw::Atoi(a[2]); + Standard_Integer nbTri = Draw::Atoi(a[3]); // read the nodes Standard_Integer i, j = 4; @@ -60,7 +60,7 @@ static Standard_Integer polytr(Draw_Interpretor& di, Standard_Integer n, const c di << "Not enough nodes"; return 1; } - Nodes(i).SetCoord(atof(a[j]),atof(a[j+1]),atof(a[j+2])); + Nodes(i).SetCoord(Draw::Atof(a[j]),Draw::Atof(a[j+1]),Draw::Atof(a[j+2])); j += 3; } @@ -72,7 +72,7 @@ static Standard_Integer polytr(Draw_Interpretor& di, Standard_Integer n, const c di << "Not enough triangles"; return 1; } - Triangles(i).Set(atoi(a[j]),atoi(a[j+1]),atoi(a[j+2])); + Triangles(i).Set(Draw::Atoi(a[j]),Draw::Atoi(a[j+1]),Draw::Atoi(a[j+2])); j += 3; } @@ -94,7 +94,7 @@ static Standard_Integer polygon3d(Draw_Interpretor& di, Standard_Integer n, cons if (n < 4) return 1; - Standard_Integer nbNodes = atoi(a[2]); + Standard_Integer nbNodes = Draw::Atoi(a[2]); // read the nodes Standard_Integer i, j = 3; @@ -105,7 +105,7 @@ static Standard_Integer polygon3d(Draw_Interpretor& di, Standard_Integer n, cons di << "Not enough nodes"; return 1; } - Nodes(i).SetCoord(atof(a[j]),atof(a[j+1]),atof(a[j+2])); + Nodes(i).SetCoord(Draw::Atof(a[j]),Draw::Atof(a[j+1]),Draw::Atof(a[j+2])); j += 3; } @@ -126,7 +126,7 @@ static Standard_Integer polygon2d(Draw_Interpretor& di, Standard_Integer n, cons if (n < 4) return 1; - Standard_Integer nbNodes = atoi(a[2]); + Standard_Integer nbNodes = Draw::Atoi(a[2]); // read the nodes Standard_Integer i, j = 3; @@ -137,7 +137,7 @@ static Standard_Integer polygon2d(Draw_Interpretor& di, Standard_Integer n, cons di << "Not enough nodes"; return 1; } - Nodes(i).SetCoord(atof(a[j]),atof(a[j+1])); + Nodes(i).SetCoord(Draw::Atof(a[j]),Draw::Atof(a[j+1])); j += 2; } diff --git a/src/GeometryTest/GeometryTest_SurfaceCommands.cxx b/src/GeometryTest/GeometryTest_SurfaceCommands.cxx index c84fd82eb5..21c50fda46 100755 --- a/src/GeometryTest/GeometryTest_SurfaceCommands.cxx +++ b/src/GeometryTest/GeometryTest_SurfaceCommands.cxx @@ -130,7 +130,7 @@ static Standard_Integer sweep (Draw_Interpretor&, Pipe.Init(path, Support, firstS); } else if (Option == GeomFill_IsConstantNormal) { - gp_Dir D ( atof(a[3]), atof(a[4]), atof(a[5]) ); + gp_Dir D ( Draw::Atof(a[3]), Draw::Atof(a[4]), Draw::Atof(a[5]) ); Handle(Geom_Curve) path = DrawTrSurf::GetCurve(a[6]); Handle(Geom_Curve) firstS = DrawTrSurf::GetCurve(a[7]); Pipe.Init(path, firstS, D); @@ -146,8 +146,8 @@ static Standard_Integer sweep (Draw_Interpretor&, } if (n >=isection+2) { - MaxDegree = atoi(a[isection+1]); - if (n >isection+2) NbSeg = atoi(a[isection+2]); + MaxDegree = Draw::Atoi(a[isection+1]); + if (n >isection+2) NbSeg = Draw::Atoi(a[isection+2]); } Pipe.Perform(Tol, Standard_False, GeomAbs_C2, MaxDegree, NbSeg); @@ -188,7 +188,7 @@ static Standard_Integer tuyau (Draw_Interpretor&, if ( firstS.IsNull()) { if ( narg == 4) { // tuyau a rayon constant. - Pipe.Init(path, atof(a[isect])); + Pipe.Init(path, Draw::Atof(a[isect])); } else return 1; @@ -321,7 +321,7 @@ static Standard_Integer fillcurves(Draw_Interpretor& di, Standard_Integer ist = 2; GeomFill_FillingStyle Style = GeomFill_CoonsStyle; - if(n > 6) ist = atoi(a[6]); + if(n > 6) ist = Draw::Atoi(a[6]); if(ist == 1) Style = GeomFill_StretchStyle; if(ist == 2) Style = GeomFill_CoonsStyle; diff --git a/src/GeometryTest/GeometryTest_TestProjCommands.cxx b/src/GeometryTest/GeometryTest_TestProjCommands.cxx index 19f917be07..9ecc0bd538 100644 --- a/src/GeometryTest/GeometryTest_TestProjCommands.cxx +++ b/src/GeometryTest/GeometryTest_TestProjCommands.cxx @@ -70,12 +70,12 @@ static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const ch return 0; } // - aT1=atof(a[3]); - aT2=atof(a[4]); + aT1=Draw::Atof(a[3]); + aT2=Draw::Atof(a[4]); // aNbP=10; if (n>5) { - aNbP=atoi(a[5]); + aNbP=Draw::Atoi(a[5]); } // iSize=3; diff --git a/src/GeomliteTest/GeomliteTest_API2dCommands.cxx b/src/GeomliteTest/GeomliteTest_API2dCommands.cxx index 44ad2eda13..f8eeeb69c0 100755 --- a/src/GeomliteTest/GeomliteTest_API2dCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_API2dCommands.cxx @@ -57,7 +57,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch { if ( n < 4) return 1; - gp_Pnt2d P(atof(a[2]),atof(a[3])); + gp_Pnt2d P(Draw::Atof(a[2]),Draw::Atof(a[3])); char name[100]; @@ -74,7 +74,7 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch Handle(Geom2d_Line) L = new Geom2d_Line(P,gp_Vec2d(P,P1)); Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., P.Distance(P1)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -110,14 +110,14 @@ static Standard_Integer appro(Draw_Interpretor& di, Standard_Integer n, const ch if (n < 3) { if (n == 2) - Tol2d = atof(a[1]); + Tol2d = Draw::Atof(a[1]); di << "Tolerance for 2d approx : "<< Tol2d << "\n"; return 0; } - Standard_Integer i, Nb = atoi(a[2]); + Standard_Integer i, Nb = Draw::Atoi(a[2]); Standard_Boolean hasPoints = Standard_True; TColgp_Array1OfPnt2d Points(1, Nb); @@ -172,17 +172,17 @@ static Standard_Integer appro(Draw_Interpretor& di, Standard_Integer n, const ch // points nc = 3; for (i = 1; i <= Nb; i++) { - Points(i).SetCoord(atof(a[nc]),atof(a[nc+1])); + Points(i).SetCoord(Draw::Atof(a[nc]),Draw::Atof(a[nc+1])); nc += 2; } } else if (nc - 2 == Nb) { // YValues nc = 5; - X0 = atof(a[3]); - DX = atof(a[4]); + X0 = Draw::Atof(a[3]); + DX = Draw::Atof(a[4]); for (i = 1; i <= Nb; i++) { - YValues(i) = atof(a[nc]); + YValues(i) = Draw::Atof(a[nc]); Points(i).SetCoord(X0+(i-1)*DX,YValues(i)); nc++; } @@ -260,7 +260,7 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom2d_Line) L = new Geom2d_Line(P1,gp_Vec2d(P1,P2)); Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., P1.Distance(P2)); - sprintf(name,"%s%d","ext_",i); + Sprintf(name,"%s%d","ext_",i); char* temp = name; // portage WNT DrawTrSurf::Set(temp, CT); di << name << " "; @@ -300,7 +300,7 @@ static Standard_Integer intersect(Draw_Interpretor& di, Standard_Integer n, cons return 1; } if(k < n) - Tol = atof(a[k]); + Tol = Draw::Atof(a[k]); if(!C2.IsNull()) { diff --git a/src/GeomliteTest/GeomliteTest_ApproxCommands.cxx b/src/GeomliteTest/GeomliteTest_ApproxCommands.cxx index 14ccfde3bc..71a80049ba 100755 --- a/src/GeomliteTest/GeomliteTest_ApproxCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_ApproxCommands.cxx @@ -356,7 +356,7 @@ static Standard_Integer smoothing (Draw_Interpretor& di,Standard_Integer n, cons return 0; } if (n == 3) { - Tolerance = atof(a[2]); + Tolerance = Draw::Atof(a[2]); if (Abs(Tolerance) < Precision::Confusion()*1.e-7) { Constraint = AppParCurves_PassPoint; } @@ -368,7 +368,7 @@ static Standard_Integer smoothing (Draw_Interpretor& di,Standard_Integer n, cons } else if (n >= 4) { Standard_Integer ific = 3; - Tolerance = atof(a[2]); + Tolerance = Draw::Atof(a[2]); if (Abs(Tolerance) < Precision::Confusion()*1.e-7) { Constraint = AppParCurves_PassPoint; } @@ -377,7 +377,7 @@ static Standard_Integer smoothing (Draw_Interpretor& di,Standard_Integer n, cons } if (! strcmp(a[3],"-D")) { - DegMax = atoi(a[4]); + DegMax = Draw::Atoi(a[4]); ific = 5; } @@ -536,8 +536,8 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di, return 0; } if (n >= 5) { - Tolerance = atof(a[2]); - Degree = atoi(a[3]); + Tolerance = Draw::Atof(a[2]); + Degree = Draw::Atoi(a[3]); if (! strcmp(a[4],"-GR")) { methode = 1; } diff --git a/src/GeomliteTest/GeomliteTest_CurveCommands.cxx b/src/GeomliteTest/GeomliteTest_CurveCommands.cxx index 796c7885fe..cdf2697c48 100755 --- a/src/GeomliteTest/GeomliteTest_CurveCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_CurveCommands.cxx @@ -129,11 +129,11 @@ static Standard_Integer anacurve (Draw_Interpretor& , Standard_Integer n, const if (!strcmp(a[0],"line")) { if (n == 6) - result2d = new Geom2d_Line(gp_Pnt2d(atof(a[2]),atof(a[3])), - gp_Dir2d(atof(a[4]),atof(a[5]))); + result2d = new Geom2d_Line(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), + gp_Dir2d(Draw::Atof(a[4]),Draw::Atof(a[5]))); else if (n == 8) - result = new Geom_Line(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))); + result = new Geom_Line(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))); else return 1; } @@ -141,30 +141,30 @@ static Standard_Integer anacurve (Draw_Interpretor& , Standard_Integer n, const else if (!strcmp(a[0],"circle")) { if (n == 5) result2d = - new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), + new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), gp_Dir2d(1,0)), - atof(a[4])); + Draw::Atof(a[4])); else if (n == 6) result = - new Geom_Circle(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), + new Geom_Circle(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), gp_Dir(0,0,1)), - atof(a[5])); + Draw::Atof(a[5])); else if (n == 7) result2d = - new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), - gp_Dir2d(atof(a[4]),atof(a[5]))), - atof(a[6])); + new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), + gp_Dir2d(Draw::Atof(a[4]),Draw::Atof(a[5]))), + Draw::Atof(a[6])); else if (n == 9) result = - new Geom_Circle(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))), - atof(a[8])); + new Geom_Circle(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))), + Draw::Atof(a[8])); else if (n == 12) result = - new Geom_Circle(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), - gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))), - atof(a[11])); + new Geom_Circle(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), + gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))), + Draw::Atof(a[11])); else return 1; } @@ -172,30 +172,30 @@ static Standard_Integer anacurve (Draw_Interpretor& , Standard_Integer n, const else if (!strcmp(a[0],"parabola")) { if (n == 5) result2d = - new Geom2d_Parabola(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), + new Geom2d_Parabola(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), gp_Dir2d(1,0)), - atof(a[4])); + Draw::Atof(a[4])); else if (n == 6) result = - new Geom_Parabola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), + new Geom_Parabola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), gp_Dir(0,0,1)), - atof(a[5])); + Draw::Atof(a[5])); else if (n == 7) result2d = - new Geom2d_Parabola(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), - gp_Dir2d(atof(a[4]),atof(a[5]))), - atof(a[6])); + new Geom2d_Parabola(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), + gp_Dir2d(Draw::Atof(a[4]),Draw::Atof(a[5]))), + Draw::Atof(a[6])); else if (n == 9) result = - new Geom_Parabola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))), - atof(a[8])); + new Geom_Parabola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))), + Draw::Atof(a[8])); else if (n == 12) result = - new Geom_Parabola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), - gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))), - atof(a[11])); + new Geom_Parabola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), + gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))), + Draw::Atof(a[11])); else return 1; } @@ -203,30 +203,30 @@ static Standard_Integer anacurve (Draw_Interpretor& , Standard_Integer n, const else if (!strcmp(a[0],"ellipse")) { if (n == 6) result2d = - new Geom2d_Ellipse(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), + new Geom2d_Ellipse(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), gp_Dir2d(1,0)), - atof(a[4]),atof(a[5])); + Draw::Atof(a[4]),Draw::Atof(a[5])); else if (n == 7) result = - new Geom_Ellipse(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), + new Geom_Ellipse(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), gp_Dir(0,0,1)), - atof(a[5]),atof(a[6])); + Draw::Atof(a[5]),Draw::Atof(a[6])); else if (n == 8) result2d = - new Geom2d_Ellipse(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), - gp_Dir2d(atof(a[4]),atof(a[5]))), - atof(a[6]), atof(a[7])); + new Geom2d_Ellipse(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), + gp_Dir2d(Draw::Atof(a[4]),Draw::Atof(a[5]))), + Draw::Atof(a[6]), Draw::Atof(a[7])); else if (n == 10) result = - new Geom_Ellipse(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))), - atof(a[8]), atof(a[9])); + new Geom_Ellipse(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))), + Draw::Atof(a[8]), Draw::Atof(a[9])); else if (n == 13) result = - new Geom_Ellipse(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), - gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))), - atof(a[11]), atof(a[12])); + new Geom_Ellipse(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), + gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))), + Draw::Atof(a[11]), Draw::Atof(a[12])); else return 1; } @@ -234,30 +234,30 @@ static Standard_Integer anacurve (Draw_Interpretor& , Standard_Integer n, const else if (!strcmp(a[0],"hyperbola")) { if (n == 6) result2d = - new Geom2d_Hyperbola(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), + new Geom2d_Hyperbola(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), gp_Dir2d(1,0)), - atof(a[4]),atof(a[5])); + Draw::Atof(a[4]),Draw::Atof(a[5])); else if (n == 7) result = - new Geom_Hyperbola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), + new Geom_Hyperbola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), gp_Dir(0,0,1)), - atof(a[5]),atof(a[6])); + Draw::Atof(a[5]),Draw::Atof(a[6])); else if (n == 8) result2d = - new Geom2d_Hyperbola(gp_Ax22d(gp_Pnt2d(atof(a[2]),atof(a[3])), - gp_Dir2d(atof(a[4]),atof(a[5]))), - atof(a[6]), atof(a[7])); + new Geom2d_Hyperbola(gp_Ax22d(gp_Pnt2d(Draw::Atof(a[2]),Draw::Atof(a[3])), + gp_Dir2d(Draw::Atof(a[4]),Draw::Atof(a[5]))), + Draw::Atof(a[6]), Draw::Atof(a[7])); else if (n == 10) result = - new Geom_Hyperbola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))), - atof(a[8]), atof(a[9])); + new Geom_Hyperbola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))), + Draw::Atof(a[8]), Draw::Atof(a[9])); else if (n == 13) result = - new Geom_Hyperbola(gp_Ax2(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), - gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))), - atof(a[11]), atof(a[12])); + new Geom_Hyperbola(gp_Ax2(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), + gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))), + Draw::Atof(a[11]), Draw::Atof(a[12])); else return 1; } @@ -286,7 +286,7 @@ static Standard_Integer polecurve (Draw_Interpretor& , Standard_Integer n, const if (!strcmp(a[0],"beziercurve")) { - Standard_Integer np = atoi(a[2]); + Standard_Integer np = Draw::Atoi(a[2]); if (np == 0) return 1; i = (n - 3) / (np); @@ -298,10 +298,10 @@ static Standard_Integer polecurve (Draw_Interpretor& , Standard_Integer n, const k = 3; for (i = 1; i <= np; i++) { - poles(i).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); + poles(i).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2])); k += 3; if (hasw) { - weights(i) = atof(a[k]); + weights(i) = Draw::Atof(a[k]); k++; } } @@ -316,17 +316,17 @@ static Standard_Integer polecurve (Draw_Interpretor& , Standard_Integer n, const } else if (!strcmp((*a[0] == 'p') ? a[0]+1 : a[0],"bsplinecurve")) { - Standard_Integer deg = atoi(a[2]); - Standard_Integer nbk = atoi(a[3]); + Standard_Integer deg = Draw::Atoi(a[2]); + Standard_Integer nbk = Draw::Atoi(a[3]); TColStd_Array1OfReal knots(1, nbk); TColStd_Array1OfInteger mults(1, nbk); k = 4; Standard_Integer Sigma = 0; for (i = 1; i<=nbk; i++) { - knots( i) = atof(a[k]); + knots( i) = Draw::Atof(a[k]); k++; - mults( i) = atoi(a[k]); + mults( i) = Draw::Atoi(a[k]); Sigma += mults(i); k++; } @@ -342,9 +342,9 @@ static Standard_Integer polecurve (Draw_Interpretor& , Standard_Integer n, const TColStd_Array1OfReal weights(1, np); for (i = 1; i <= np; i++) { - poles(i).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); + poles(i).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2])); k += 3; - weights(i) = atof(a[k]); + weights(i) = Draw::Atof(a[k]); k++; } @@ -370,7 +370,7 @@ static Standard_Integer polecurve2d (Draw_Interpretor& , Standard_Integer n, con if (!strcmp(a[0],"2dbeziercurve")) { - Standard_Integer np = atoi(a[2]); + Standard_Integer np = Draw::Atoi(a[2]); if (np == 0) return 1; i = (n - 2) / (np); @@ -382,10 +382,10 @@ static Standard_Integer polecurve2d (Draw_Interpretor& , Standard_Integer n, con k = 3; for (i = 1; i <= np; i++) { - poles(i).SetCoord(atof(a[k]),atof(a[k+1])); + poles(i).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1])); k += 2; if (hasw) { - weights(i) = atof(a[k]); + weights(i) = Draw::Atof(a[k]); k++; } } @@ -400,17 +400,17 @@ static Standard_Integer polecurve2d (Draw_Interpretor& , Standard_Integer n, con } else if (!strcmp((*(a[0]+2) == 'p') ? a[0]+3 : a[0]+2,"bsplinecurve")) { - Standard_Integer deg = atoi(a[2]); - Standard_Integer nbk = atoi(a[3]); + Standard_Integer deg = Draw::Atoi(a[2]); + Standard_Integer nbk = Draw::Atoi(a[3]); TColStd_Array1OfReal knots(1, nbk); TColStd_Array1OfInteger mults(1, nbk); k = 4; Standard_Integer Sigma = 0; for (i = 1; i<=nbk; i++) { - knots( i) = atof(a[k]); + knots( i) = Draw::Atof(a[k]); k++; - mults( i) = atoi(a[k]); + mults( i) = Draw::Atoi(a[k]); Sigma += mults(i); k++; } @@ -426,9 +426,9 @@ static Standard_Integer polecurve2d (Draw_Interpretor& , Standard_Integer n, con TColStd_Array1OfReal weights(1, np); for (i = 1; i <= np; i++) { - poles(i).SetCoord(atof(a[k]),atof(a[k+1])); + poles(i).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1])); k += 2; - weights(i) = atof(a[k]); + weights(i) = Draw::Atof(a[k]); k++; } @@ -475,11 +475,11 @@ static Standard_Integer cmovepole (Draw_Interpretor& , Standard_Integer n, const { if (n < 5) return 1; - Standard_Real dx = atof(a[3]); - Standard_Real dy = atof(a[4]); + Standard_Real dx = Draw::Atof(a[3]); + Standard_Real dy = Draw::Atof(a[4]); Standard_Real dz=0; - if (n >= 6) dz = atof(a[5]); - Standard_Integer Index = atoi(a[2]); + if (n >= 6) dz = Draw::Atof(a[5]); + Standard_Integer Index = Draw::Atoi(a[2]); Handle(Geom_BezierCurve) G1 = DrawTrSurf::GetBezierCurve(a[1]); if (!G1.IsNull()) { @@ -542,9 +542,9 @@ static Standard_Integer cmovetangent (Draw_Interpretor& di, Standard_Integer n, tx, ty, tz ; - u = atof(a[2]); - x = atof(a[3]); - y = atof(a[4]); + u = Draw::Atof(a[2]); + x = Draw::Atof(a[3]); + y = Draw::Atof(a[4]); z = 0.0e0, tolerance = 1.0e-5 ; dimension = 3 ; @@ -565,12 +565,12 @@ static Standard_Integer cmovetangent (Draw_Interpretor& di, Standard_Integer n, if (dimension == 3) { Handle(Geom_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve(a[1]); if (!G2.IsNull()) { - z = atof(a[5]) ; - tx = atof(a[6]) ; - ty = atof(a[7]) ; - tz = atof(a[8]) ; + z = Draw::Atof(a[5]) ; + tx = Draw::Atof(a[6]) ; + ty = Draw::Atof(a[7]) ; + tz = Draw::Atof(a[8]) ; if (n == 10) { - condition = Max(atoi(a[9]), -1) ; + condition = Max(Draw::Atoi(a[9]), -1) ; condition = Min(condition, G2->Degree()-1) ; } gp_Pnt p; @@ -598,10 +598,10 @@ static Standard_Integer cmovetangent (Draw_Interpretor& di, Standard_Integer n, else { Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]); if (!G2.IsNull()) { - tx = atof(a[5]) ; - ty = atof(a[6]) ; + tx = Draw::Atof(a[5]) ; + ty = Draw::Atof(a[6]) ; if (n == 8) { - condition = Max(atoi(a[7]), -1) ; + condition = Max(Draw::Atoi(a[7]), -1) ; condition = Min(condition, G2->Degree()-1) ; } gp_Pnt2d p; @@ -639,21 +639,21 @@ static Standard_Integer cmovepoint (Draw_Interpretor& , Standard_Integer n, cons { if (n < 5) return 1; - Standard_Real dx = atof(a[3]); - Standard_Real dy = atof(a[4]); + Standard_Real dx = Draw::Atof(a[3]); + Standard_Real dy = Draw::Atof(a[4]); Standard_Real dz=0; - if (n >= 6 && n != 7) dz = atof(a[5]); - Standard_Real u = atof(a[2]); + if (n >= 6 && n != 7) dz = Draw::Atof(a[5]); + Standard_Real u = Draw::Atof(a[2]); Standard_Integer index1 = 0; Standard_Integer index2 = 0; Standard_Integer fmodif, lmodif; if (n == 7) { - index1 = atoi(a[5]); - index2 = atoi(a[6]); + index1 = Draw::Atoi(a[5]); + index2 = Draw::Atoi(a[6]); } else if (n == 8) { - index1 = atoi(a[6]); - index2 = atoi(a[7]); + index1 = Draw::Atoi(a[6]); + index2 = Draw::Atoi(a[7]); } Handle(Geom_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve(a[1]); @@ -701,9 +701,9 @@ static Standard_Integer cinsertknot (Draw_Interpretor& , Standard_Integer n, con if (GBs.IsNull() && GBs2d.IsNull()) return 1; if (n <= 4) { - Standard_Real knot = atof(a[2]); + Standard_Real knot = Draw::Atof(a[2]); Standard_Integer mult = 1; - if (n == 4) mult = atoi(a[3]); + if (n == 4) mult = Draw::Atoi(a[3]); if (!GBs.IsNull()) GBs->InsertKnot(knot,mult,Precision::PConfusion()); else @@ -717,8 +717,8 @@ static Standard_Integer cinsertknot (Draw_Interpretor& , Standard_Integer n, con TColStd_Array1OfReal knots(1,nbk); TColStd_Array1OfInteger mults(1,nbk); for (i = 2; i < n; i += 2) { - knots(i/2) = atof(a[i]); - mults(i/2) = atoi(a[i+1]); + knots(i/2) = Draw::Atof(a[i]); + mults(i/2) = Draw::Atoi(a[i+1]); } if (!GBs.IsNull()) @@ -746,8 +746,8 @@ static Standard_Integer csetknot (Draw_Interpretor& , Standard_Integer n, const if (GBs.IsNull() && GBs2d.IsNull()) return 1; - Standard_Integer index = atoi(a[2]); - Standard_Real knot = atof(a[3]); + Standard_Integer index = Draw::Atoi(a[2]); + Standard_Real knot = Draw::Atof(a[3]); if ( n == 4) { if (!GBs.IsNull()) @@ -756,7 +756,7 @@ static Standard_Integer csetknot (Draw_Interpretor& , Standard_Integer n, const GBs2d->SetKnot(index,knot); } else { - Standard_Integer mult = atoi(a[4]); + Standard_Integer mult = Draw::Atoi(a[4]); if (!GBs.IsNull()) GBs->SetKnot(index,knot,mult); else @@ -781,12 +781,12 @@ static Standard_Integer cremknot (Draw_Interpretor& di, Standard_Integer n, cons if (GBs.IsNull() && GBs2d.IsNull()) return 1; - Standard_Integer index = atoi(a[2]); + Standard_Integer index = Draw::Atoi(a[2]); Standard_Integer mult = 0; - if (n >= 4) mult = atoi(a[3]); + if (n >= 4) mult = Draw::Atoi(a[3]); Standard_Real tol = RealLast(); - if (n >= 5) tol = atof(a[4]); + if (n >= 5) tol = Draw::Atof(a[4]); if (!GBs.IsNull()) { if (!GBs->RemoveKnot(index,mult,tol)) @@ -810,7 +810,7 @@ static Standard_Integer increasedegree (Draw_Interpretor& , Standard_Integer n, { if (n < 3) return 1; - Standard_Integer Deg = atoi(a[2]); + Standard_Integer Deg = Draw::Atoi(a[2]); Handle(Geom_BezierCurve) GBz = DrawTrSurf::GetBezierCurve(a[1]); Handle(Geom_BSplineCurve) GBs = DrawTrSurf::GetBSplineCurve(a[1]); @@ -841,7 +841,7 @@ static Standard_Integer removepole (Draw_Interpretor& di, Standard_Integer n, co { if (n < 3) return 1; - Standard_Integer Index = atoi(a[2]); + Standard_Integer Index = Draw::Atoi(a[2]); Handle(Geom_BezierCurve) GBZ = DrawTrSurf::GetBezierCurve(a[1]); Handle(Geom2d_BezierCurve) GBZ2d = DrawTrSurf::GetBezierCurve2d(a[1]); @@ -869,21 +869,21 @@ static Standard_Integer insertpole (Draw_Interpretor& di, Standard_Integer n, co { if (n < 6) return 1; - Standard_Integer Index = atoi(a[2]); + Standard_Integer Index = Draw::Atoi(a[2]); Handle(Geom_BezierCurve) GBZ = DrawTrSurf::GetBezierCurve(a[1]); Handle(Geom2d_BezierCurve) GBZ2d = DrawTrSurf::GetBezierCurve2d(a[1]); if (!GBZ.IsNull()) { - gp_Pnt P (atof(a[3]),atof(a[4]),atof(a[5])); + gp_Pnt P (Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); if ( n == 7) - GBZ->InsertPoleAfter(Index,P,atof(a[6])); + GBZ->InsertPoleAfter(Index,P,Draw::Atof(a[6])); else GBZ->InsertPoleAfter(Index,P); } else if (!GBZ2d.IsNull()) { - gp_Pnt2d P (atof(a[3]),atof(a[4])); + gp_Pnt2d P (Draw::Atof(a[3]),Draw::Atof(a[4])); if ( n == 6) - GBZ2d->InsertPoleAfter(Index,P,atof(a[5])); + GBZ2d->InsertPoleAfter(Index,P,Draw::Atof(a[5])); else GBZ2d->InsertPoleAfter(Index,P); } @@ -906,9 +906,9 @@ static Standard_Integer cfindp (Draw_Interpretor& , Standard_Integer n, const ch if (n < 6) return 1; Standard_Integer Index = 0; - Standard_Integer view = atoi(a[2]); - Standard_Real x = atof(a[3]); - Standard_Real y = atof(a[4]); + Standard_Integer view = Draw::Atoi(a[2]); + Standard_Real x = Draw::Atof(a[3]); + Standard_Real y = Draw::Atof(a[4]); Draw_Display d = dout.MakeDisplay(view); @@ -989,7 +989,7 @@ static Standard_Integer value (Draw_Interpretor& , Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]); if (GC.IsNull()) return 1; - Standard_Real U = atof(a[2]); + Standard_Real U = Draw::Atof(a[2]); Standard_Boolean DrawPoint = ( n%3 == 1); if ( DrawPoint) n--; @@ -1041,7 +1041,7 @@ static Standard_Integer value2d (Draw_Interpretor& , Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(a[1]); if (GC.IsNull()) return 1; - Standard_Real U = atof(a[2]); + Standard_Real U = Draw::Atof(a[2]); Standard_Boolean DrawPoint = ( n%2 == 0); if ( DrawPoint ) n--; @@ -1090,7 +1090,7 @@ static Standard_Integer segment (Draw_Interpretor& , Standard_Integer n, const c Handle(Geom2d_BezierCurve) GBz2d = DrawTrSurf::GetBezierCurve2d(a[1]); Handle(Geom2d_BSplineCurve) GBs2d = DrawTrSurf::GetBSplineCurve2d(a[1]); - Standard_Real f = atof(a[2]), l = atof(a[3]); + Standard_Real f = Draw::Atof(a[2]), l = Draw::Atof(a[3]); if (!GBz.IsNull()) GBz->Segment(f,l); @@ -1121,9 +1121,9 @@ static Standard_Integer setorigin (Draw_Interpretor& , Standard_Integer n, const Handle(Geom2d_BSplineCurve) GBs2d = DrawTrSurf::GetBSplineCurve2d(a[1]); if (!GBs.IsNull()) - GBs->SetOrigin(atoi(a[2])); + GBs->SetOrigin(Draw::Atoi(a[2])); if (!GBs2d.IsNull()) - GBs2d->SetOrigin(atoi(a[2])); + GBs2d->SetOrigin(Draw::Atoi(a[2])); else return 1; @@ -1141,11 +1141,11 @@ static Standard_Integer point(Draw_Interpretor& , Standard_Integer n, const char { if (n < 4) return 1; if (n >= 5) { - gp_Pnt P(atof(a[2]),atof(a[3]),atof(a[4])); + gp_Pnt P(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])); DrawTrSurf::Set(a[1],P); } else { - gp_Pnt2d P(atof(a[2]),atof(a[3])); + gp_Pnt2d P(Draw::Atof(a[2]),Draw::Atof(a[3])); DrawTrSurf::Set(a[1],P); } @@ -1283,7 +1283,7 @@ static Standard_Integer radiusmax(Draw_Interpretor&, Standard_Integer argc, const char** argv) { if (argc < 3) return 1; - Standard_Real Radius = atof(argv[2]); + Standard_Real Radius = Draw::Atof(argv[2]); Handle(DrawTrSurf_Curve2d) C2d = Handle(DrawTrSurf_Curve2d) ::DownCast(Draw::Get(argv[1])); Handle(DrawTrSurf_Curve) C3d = Handle(DrawTrSurf_Curve) @@ -1308,7 +1308,7 @@ static Standard_Integer radiusratio(Draw_Interpretor&, Standard_Integer argc, const char** argv) { if (argc < 3) return 1; - Standard_Real Ratio = atof(argv[2]); + Standard_Real Ratio = Draw::Atof(argv[2]); Handle(DrawTrSurf_Curve2d) C2d = Handle(DrawTrSurf_Curve2d) ::DownCast(Draw::Get(argv[1])); Handle(DrawTrSurf_Curve) C3d = Handle(DrawTrSurf_Curve) @@ -1334,7 +1334,7 @@ static Standard_Integer localprop(Draw_Interpretor& di, { if (argc < 3) return 1; - Standard_Real U = atof(argv[2]); + Standard_Real U = Draw::Atof(argv[2]); Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(argv[1]); Handle(Geom_Curve) C3d; @@ -1416,9 +1416,9 @@ static Standard_Integer rawcont(Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_Curve) GC2; GC2 = DrawTrSurf::GetCurve(a[2]); Standard_Real param1 = - atof(a[3]) ; + Draw::Atof(a[3]) ; Standard_Real param2 = - atof(a[4]) ; + Draw::Atof(a[4]) ; if (GC1.IsNull() || GC2.IsNull()) return 1; gp_Pnt a_point1, @@ -1481,19 +1481,19 @@ static Standard_Integer approxcurveonsurf(Draw_Interpretor& di, Standard_Integer if ( n>8 || n<4) return 1; - if (n>4) Tol = Max(atof(a[4]),1.e-10); + if (n>4) Tol = Max(Draw::Atof(a[4]),1.e-10); if (n>5) { - if (atoi(a[5]) == 0) Continuity = GeomAbs_C0; - if (atoi(a[5]) == 2) Continuity = GeomAbs_C2; + if (Draw::Atoi(a[5]) == 0) Continuity = GeomAbs_C0; + if (Draw::Atoi(a[5]) == 2) Continuity = GeomAbs_C2; } if (n>6) { - MaxDeg = atoi(a[6]); + MaxDeg = Draw::Atoi(a[6]); if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14; } - if (n>7) MaxSeg = atoi(a[7]); + if (n>7) MaxSeg = Draw::Atoi(a[7]); Handle(Geom2d_Curve) curve2d = DrawTrSurf::GetCurve2d(a[2]); Handle(Geom_Surface) Surf = DrawTrSurf::GetSurface(a[3]); @@ -1591,19 +1591,19 @@ static Standard_Integer approxcurve(Draw_Interpretor& di, Standard_Integer n, co Case = 1; } - if (n>shift) Tol = Max(atof(a[shift]),1.e-10); + if (n>shift) Tol = Max(Draw::Atof(a[shift]),1.e-10); if (n>shift+1) { - if (atoi(a[shift+1]) == 0) Continuity = GeomAbs_C0; - if (atoi(a[shift+1]) == 2) Continuity = GeomAbs_C2; + if (Draw::Atoi(a[shift+1]) == 0) Continuity = GeomAbs_C0; + if (Draw::Atoi(a[shift+1]) == 2) Continuity = GeomAbs_C2; } if (n>shift+2) { - MaxDeg = atoi(a[shift+2]); + MaxDeg = Draw::Atoi(a[shift+2]); if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14; } - if (n>shift+3) MaxSeg = atoi(a[shift+3]); + if (n>shift+3) MaxSeg = Draw::Atoi(a[shift+3]); if (Case == 1) { GeomConvert_ApproxCurve appr(curve, Tol, Continuity, MaxSeg, MaxDeg); @@ -1690,11 +1690,11 @@ static Standard_Integer splitc1(Draw_Interpretor& di, char name[100]; if (n<3) return 1; - optiontab=atoi(c[2]); + optiontab=Draw::Atoi(c[2]); if (n >= 4 ) - tolerance=atof(c[3]); + tolerance=Draw::Atof(c[3]); if (n >= 5) { - angular_tolerance = atof(c[4]) ; + angular_tolerance = Draw::Atof(c[4]) ; } Handle(Geom_Curve) ACurve = Handle(Geom_Curve)::DownCast(DrawTrSurf::Get(c[1])) ; @@ -1717,7 +1717,7 @@ static Standard_Integer splitc1(Draw_Interpretor& di, angular_tolerance, tolerance); for (i=0;i<=(tabBS->Length()-1);i++){ - sprintf(name,"%s_%d",c[1],i+1); + Sprintf(name,"%s_%d",c[1],i+1); Standard_CString new_name = name ; DrawTrSurf::Set(new_name, tabBS->Value(i)); @@ -1749,11 +1749,11 @@ static Standard_Integer splitc12d(Draw_Interpretor& di, char name[100]; if (n<3) return 1; - optiontab=atoi(c[2]); + optiontab=Draw::Atoi(c[2]); if (n==4) - tolerance=atof(c[3]); + tolerance=Draw::Atof(c[3]); if (n==5) - angular_tolerance = atof(c[4]) ; + angular_tolerance = Draw::Atof(c[4]) ; Handle(Geom2d_Curve) ACurve = Handle(Geom2d_Curve)::DownCast(DrawTrSurf::GetCurve2d(c[1])) ; Standard_Real f = ACurve->FirstParameter(); @@ -1775,7 +1775,7 @@ static Standard_Integer splitc12d(Draw_Interpretor& di, angular_tolerance, tolerance); for (i=0;i<=(tabBS->Length()-1);i++){ - sprintf(name,"%s_%d",c[1],i+1); + Sprintf(name,"%s_%d",c[1],i+1); Standard_CString new_name = name ; DrawTrSurf::Set(new_name, tabBS->Value(i)); @@ -1802,8 +1802,8 @@ static Standard_Integer canceldenom(Draw_Interpretor& , Standard_Boolean udirection=Standard_False; Standard_Boolean vdirection=Standard_False; if (n<4) return 1; - uoption=atoi(c[2]); - voption=atoi(c[3]); + uoption=Draw::Atoi(c[2]); + voption=Draw::Atoi(c[3]); if (uoption) udirection=Standard_True; if (voption) @@ -1826,7 +1826,7 @@ static Standard_Integer length(Draw_Interpretor& di, Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]); Handle(Geom2d_Curve) GC2d = DrawTrSurf::GetCurve2d(a[1]); Standard_Real Tol = Precision::Confusion(), L; - if (n==3) Tol = atof(a[2]); + if (n==3) Tol = Draw::Atof(a[2]); if (!GC.IsNull()) { GeomAdaptor_Curve AC(GC); diff --git a/src/GeomliteTest/GeomliteTest_ModificationCommands.cxx b/src/GeomliteTest/GeomliteTest_ModificationCommands.cxx index fe75d18fdc..5f3f2e5eb3 100755 --- a/src/GeomliteTest/GeomliteTest_ModificationCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_ModificationCommands.cxx @@ -59,7 +59,7 @@ static Standard_Integer extendcurve (Draw_Interpretor& di, Standard_Integer n, c apres = Standard_False ; } } - Standard_Integer cont=atoi(a[3]); + Standard_Integer cont=Draw::Atoi(a[3]); GeomLib::ExtendCurveToPoint(GB,P,cont,apres); DrawTrSurf::Set(a[1],GB); return 0; @@ -80,8 +80,8 @@ static Standard_Integer extendsurf (Draw_Interpretor& di, Standard_Integer n, co di << "extendsurf needs a Bounded surface"; return 1; } - Standard_Real chord=atof(a[2]); - Standard_Integer cont=atoi(a[3]); + Standard_Real chord=Draw::Atof(a[2]); + Standard_Integer cont=Draw::Atoi(a[3]); Standard_Boolean enU = Standard_True, apres = Standard_True; if (n >= 5) { if (strcmp(a[4], "V") == 0) { @@ -116,10 +116,10 @@ static Standard_Integer samerange (Draw_Interpretor& di, Standard_Integer n, con Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[2]); Handle(Geom2d_Curve) Res; Standard_Real f, l, rf, rl; - f = atof(a[3]); - l = atof(a[4]); - rf = atof(a[5]); - rl = atof(a[6]); + f = Draw::Atof(a[3]); + l = Draw::Atof(a[4]); + rf = Draw::Atof(a[5]); + rl = Draw::Atof(a[6]); GeomLib::SameRange(Precision::PConfusion(), C, f, l, rf, rl, Res); diff --git a/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx b/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx index ed4529530f..9f2031ee95 100755 --- a/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx @@ -116,8 +116,8 @@ static Standard_Integer surface_radius (Draw_Interpretor& di, if (n < 4) return 1; if (n >= 6) report_curvature = 1 ; - UParameter = atof(a[2]); - VParameter = atof(a[3]); + UParameter = Draw::Atof(a[2]); + VParameter = Draw::Atof(a[3]); Handle(Geom_Surface) SurfacePtr = DrawTrSurf::GetSurface(a[1]); if (!SurfacePtr.IsNull()) { GeomLProp_SLProps myProperties(SurfacePtr, @@ -177,19 +177,19 @@ static Standard_Integer anasurface (Draw_Interpretor& , i = 2; } else if (n < 8) { - loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), + loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), gp_Dir(0,0,1),gp_Dir(1,0,0)); i = 5; } else if (n < 11) { - loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7]))); + loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7]))); i = 8; } else if (n < 14) { - loc = gp_Ax3(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])), - gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])), - gp_Dir(atof(a[8]),atof(a[9]),atof(a[10]))); + loc = gp_Ax3(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4])), + gp_Dir(Draw::Atof(a[5]),Draw::Atof(a[6]),Draw::Atof(a[7])), + gp_Dir(Draw::Atof(a[8]),Draw::Atof(a[9]),Draw::Atof(a[10]))); i = 11; } else @@ -203,7 +203,7 @@ static Standard_Integer anasurface (Draw_Interpretor& , } else { if (i >= n) return 1; - Standard_Real par1 = atof(a[i]); + Standard_Real par1 = Draw::Atof(a[i]); if (!strcasecmp(a[0],"cylinder")) { Handle(Geom_CylindricalSurface) C = @@ -219,7 +219,7 @@ static Standard_Integer anasurface (Draw_Interpretor& , else { if (i+1 >= n) return 1; - Standard_Real par2 = atof(a[i+1]); + Standard_Real par2 = Draw::Atof(a[i+1]); if (!strcasecmp(a[0],"cone")) { par1 *= (M_PI / 180.0); @@ -255,8 +255,8 @@ static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, con if (!strcasecmp(a[0],"beziersurf")) { - Standard_Integer nup = atoi(a[2]); - Standard_Integer nvp = atoi(a[3]); + Standard_Integer nup = Draw::Atoi(a[2]); + Standard_Integer nvp = Draw::Atoi(a[3]); if (nup * nvp == 0) return 1; i = (n - 4) / (nup * nvp); @@ -269,10 +269,10 @@ static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, con k = 4; for (j = 1; j <= nvp; j++) { for (i = 1; i <= nup; i++) { - poles(i, j).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); + poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2])); k += 3; if (hasw) { - weights(i, j) = atof(a[k]); + weights(i, j) = Draw::Atof(a[k]); k++; } } @@ -288,8 +288,8 @@ static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, con } else { - Standard_Integer udeg = atoi(a[2]); - Standard_Integer nbuk = atoi(a[3]); + Standard_Integer udeg = Draw::Atoi(a[2]); + Standard_Integer nbuk = Draw::Atoi(a[3]); Standard_Boolean uper = (*a[0] == 'u') || (*(a[0]+1) == 'u'); Standard_Boolean vper = (*a[0] == 'v') || (*(a[0]+1) == 'v'); @@ -299,25 +299,25 @@ static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, con k = 4; Standard_Integer SigmaU = 0; for (i = 1; i<=nbuk; i++) { - uk( i) = atof(a[k]); + uk( i) = Draw::Atof(a[k]); k++; - umult( i) = atoi(a[k]); + umult( i) = Draw::Atoi(a[k]); SigmaU += umult(i); k++; } - Standard_Integer vdeg = atoi(a[k]); + Standard_Integer vdeg = Draw::Atoi(a[k]); k++; - Standard_Integer nbvk = atoi(a[k]); + Standard_Integer nbvk = Draw::Atoi(a[k]); k++; TColStd_Array1OfReal vk (1, nbvk); TColStd_Array1OfInteger vmult(1, nbvk); Standard_Integer SigmaV = 0; for (i = 1; i<=nbvk; i++) { - vk( i) = atof(a[k]); + vk( i) = Draw::Atof(a[k]); k++; - vmult( i) = atoi(a[k]); + vmult( i) = Draw::Atoi(a[k]); SigmaV += vmult(i); k++; } @@ -336,9 +336,9 @@ static Standard_Integer polesurface (Draw_Interpretor& , Standard_Integer n, con for (j = 1; j <= nvp; j++) { for (i = 1; i <= nup; i++) { - poles(i, j).SetCoord(atof(a[k]),atof(a[k+1]),atof(a[k+2])); + poles(i, j).SetCoord(Draw::Atof(a[k]),Draw::Atof(a[k+1]),Draw::Atof(a[k+2])); k += 3; - weights(i, j) = atof(a[k]); + weights(i, j) = Draw::Atof(a[k]); k++; } } @@ -372,7 +372,7 @@ static Standard_Integer algosurface (Draw_Interpretor& , Standard_Integer n, con gp_Pnt P; if (!strcasecmp(a[0],"extsurf")) { - D.SetCoord(atof(a[3]),atof(a[4]),atof(a[5])); + D.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); Handle(Geom_SurfaceOfLinearExtrusion) result = new Geom_SurfaceOfLinearExtrusion(GC,D); @@ -381,8 +381,8 @@ static Standard_Integer algosurface (Draw_Interpretor& , Standard_Integer n, con } else if (!strcasecmp(a[0],"revsurf")) { if (n<8) return 1; - P.SetCoord(atof(a[3]),atof(a[4]),atof(a[5])); - D.SetCoord(atof(a[6]),atof(a[7]),atof(a[8])); + P.SetCoord(Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); + D.SetCoord(Draw::Atof(a[6]),Draw::Atof(a[7]),Draw::Atof(a[8])); Handle(Geom_SurfaceOfRevolution) result = new Geom_SurfaceOfRevolution(GC,gp_Ax1(P,D)); @@ -432,8 +432,8 @@ static Standard_Integer trimming (Draw_Interpretor& , if (n < 5) return 1; - Standard_Real u1 = atof(a[3]); - Standard_Real u2 = atof(a[4]); + Standard_Real u1 = Draw::Atof(a[3]); + Standard_Real u2 = Draw::Atof(a[4]); Handle(Geom_Geometry) result; Handle(Geom2d_Curve) result2d; @@ -442,7 +442,7 @@ static Standard_Integer trimming (Draw_Interpretor& , if (!GS.IsNull()) { if (n<7) return 1; result = - new Geom_RectangularTrimmedSurface(GS,u1,u2,atof(a[5]),atof(a[6])); + new Geom_RectangularTrimmedSurface(GS,u1,u2,Draw::Atof(a[5]),Draw::Atof(a[6])); } else if (!GC.IsNull()) { result = new Geom_TrimmedCurve(GC, u1, u2); @@ -552,10 +552,10 @@ static Standard_Integer tobezier(Draw_Interpretor& di, if ( S.IsNull()) return 1; if (n == 7) { Standard_Real U1, U2, V1, V2; - U1 = atof(a[3]); - U2 = atof(a[4]); - V1 = atof(a[5]); - V2 = atof(a[6]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[4]); + V1 = Draw::Atof(a[5]); + V2 = Draw::Atof(a[6]); GeomConvert_BSplineSurfaceToBezierSurface Conv(S, U1, U2, V1, V2, Precision::PConfusion()); NbU = Conv.NbUPatches(); @@ -563,7 +563,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di, di << NbU << " X " << NbV << " patches in the result" << "\n"; for (i = 1; i <= NbU; i++) { for (j = 1; j <= NbV; j++) { - sprintf(name,"%s_%i_%i",a[1],i,j); + Sprintf(name,"%s_%i_%i",a[1],i,j); char *temp = name ; DrawTrSurf::Set(temp,Conv.Patch(i,j)); } @@ -576,7 +576,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di, di << NbU << " X " << NbV << " patches in the result" << "\n"; for (i = 1; i <= NbU; i++) { for (j = 1; j <= NbV; j++) { - sprintf(name,"%s_%i_%i",a[1],i,j); + Sprintf(name,"%s_%i_%i",a[1],i,j); char *temp = name ; DrawTrSurf::Set(temp,Conv.Patch(i,j)); } @@ -586,14 +586,14 @@ static Standard_Integer tobezier(Draw_Interpretor& di, else { if (n==5) { Standard_Real U1, U2; - U1 = atof(a[3]); - U2 = atof(a[4]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[4]); GeomConvert_BSplineCurveToBezierCurve Conv(C3d, U1, U2, Precision::PConfusion()); NbArc = Conv.NbArcs(); di << NbArc << " arcs in the result" << "\n"; for (i = 1; i <= NbArc; i++) { - sprintf(name,"%s_%i",a[1],i); + Sprintf(name,"%s_%i",a[1],i); char *temp = name ; DrawTrSurf::Set(temp,Conv.Arc(i)); } @@ -603,7 +603,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di, NbArc = Conv.NbArcs(); di << NbArc << " arcs in the result" << "\n"; for (i = 1; i <= NbArc; i++) { - sprintf(name,"%s_%i",a[1],i); + Sprintf(name,"%s_%i",a[1],i); char *temp = name ; DrawTrSurf::Set(temp,Conv.Arc(i)); } @@ -613,14 +613,14 @@ static Standard_Integer tobezier(Draw_Interpretor& di, else { if (n==5) { Standard_Real U1, U2; - U1 = atof(a[3]); - U2 = atof(a[4]); + U1 = Draw::Atof(a[3]); + U2 = Draw::Atof(a[4]); Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d, U1, U2, Precision::PConfusion()); NbArc = Conv.NbArcs(); di << NbArc << " arcs in the result" << "\n"; for (i = 1; i <= NbArc; i++) { - sprintf(name,"%s_%i",a[1],i); + Sprintf(name,"%s_%i",a[1],i); char *temp = name ; DrawTrSurf::Set(temp,Conv.Arc(i)); } @@ -630,7 +630,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di, NbArc = Conv.NbArcs(); di << NbArc << " arcs in the result" << "\n"; for (i = 1; i <= NbArc; i++) { - sprintf(name,"%s_%i",a[1],i); + Sprintf(name,"%s_%i",a[1],i); char *temp = name ; DrawTrSurf::Set(temp,Conv.Arc(i)); } @@ -653,11 +653,11 @@ static Standard_Integer convbz(Draw_Interpretor& di, Standard_Integer ii, jj, kk=0, NbU, NbV; Standard_Real Tol = Precision::Confusion(); - NbU = atoi(a[2]); + NbU = Draw::Atoi(a[2]); if ( (Handle(Geom_Curve):: DownCast(DrawTrSurf::Get(a[3]))).IsNull()) { // Cas Surfacique - NbV = atoi(a[3]); + NbV = Draw::Atoi(a[3]); if (n<4+NbU*NbV) { di << "The number of bezier surface have to be " << NbU*NbV << "\n"; return 1; @@ -674,7 +674,7 @@ static Standard_Integer convbz(Draw_Interpretor& di, } kk++; } - if (kk10 || n<3) return 1; - if (n>3) Tol = Max(atof(a[3]),1.e-10); + if (n>3) Tol = Max(Draw::Atof(a[3]),1.e-10); if (n==5) return 1; if (n>5) { - if (atoi(a[4]) == 0) myUCont = GeomAbs_C0; - if (atoi(a[4]) == 2) myUCont = GeomAbs_C2; - if (atoi(a[5]) == 0) myVCont = GeomAbs_C0; - if (atoi(a[5]) == 2) myVCont = GeomAbs_C2; + if (Draw::Atoi(a[4]) == 0) myUCont = GeomAbs_C0; + if (Draw::Atoi(a[4]) == 2) myUCont = GeomAbs_C2; + if (Draw::Atoi(a[5]) == 0) myVCont = GeomAbs_C0; + if (Draw::Atoi(a[5]) == 2) myVCont = GeomAbs_C2; } if (n==7) return 1; if (n>7) { - ( degU = (atoi(a[6]))); - ( degV = (atoi(a[7]))); + ( degU = (Draw::Atoi(a[6]))); + ( degV = (Draw::Atoi(a[7]))); if ((degU<1) || (degU>24)) degU = 14; if ((degV<1) || (degV>24)) degV = 14; } - if (n>8) nmax = atoi(a[8]); - if (n>9) myPrec = atoi(a[9]); + if (n>8) nmax = Draw::Atoi(a[8]); + if (n>9) myPrec = Draw::Atoi(a[9]); Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(a[2]); if (surf.IsNull()) return 1; @@ -789,7 +789,7 @@ static Standard_Integer offseting (Draw_Interpretor& , // test the Geom2d curve Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]); if (!C2d.IsNull()) { - Handle(Geom2d_OffsetCurve) OC = new Geom2d_OffsetCurve(C2d,atof(a[3])); + Handle(Geom2d_OffsetCurve) OC = new Geom2d_OffsetCurve(C2d,Draw::Atof(a[3])); DrawTrSurf::Set(a[1],OC); return 0; } @@ -805,7 +805,7 @@ static Standard_Integer offseting (Draw_Interpretor& , yasurf = Standard_True; } - Standard_Real dist = atof(a[3]); + Standard_Real dist = Draw::Atof(a[3]); Handle(Geom_Geometry) result; @@ -815,7 +815,7 @@ static Standard_Integer offseting (Draw_Interpretor& , } else { if (n < 7) return 1; - gp_Dir D(atof(a[4]),atof(a[5]),atof(a[6])); + gp_Dir D(Draw::Atof(a[4]),Draw::Atof(a[5]),Draw::Atof(a[6])); Handle(Geom_OffsetCurve) GT = new Geom_OffsetCurve(GC, dist, D); result = GT; } @@ -859,7 +859,7 @@ static Standard_Integer iso (Draw_Interpretor& , Standard_Integer n, const char* if (n < 4) return 1; Handle(Geom_Curve) C; - Standard_Real par = atof(a[3]); + Standard_Real par = Draw::Atof(a[3]); Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]); if (!GS.IsNull()) { if (*a[0] == 'u') @@ -886,8 +886,8 @@ static Standard_Integer value (Draw_Interpretor& , Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[1]); if (GS.IsNull()) return 1; - Standard_Real U = atof(a[2]); - Standard_Real V = atof(a[3]); + Standard_Real U = Draw::Atof(a[2]); + Standard_Real V = Draw::Atof(a[3]); Standard_Boolean DrawPoint = ( n%3 == 2); if ( DrawPoint) n--; @@ -952,9 +952,9 @@ static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const BSpline = Standard_True; } - Standard_Real dx = atof(a[n-3]); - Standard_Real dy = atof(a[n-2]); - Standard_Real dz = atof(a[n-1]); + Standard_Real dx = Draw::Atof(a[n-3]); + Standard_Real dy = Draw::Atof(a[n-2]); + Standard_Real dz = Draw::Atof(a[n-1]); Standard_Integer nup, nvp; if( !BSpline) { @@ -972,22 +972,22 @@ static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const if (!strcasecmp(a[0],"movep")) { if (n<7) return 1; - FirstRow = atoi(a[2]); - FirstCol = atoi(a[3]); + FirstRow = Draw::Atoi(a[2]); + FirstCol = Draw::Atoi(a[3]); if ( FirstRow < 1 || FirstRow > nup || FirstCol < 1 || FirstCol > nvp ) return 1; LastRow = FirstRow; LastCol = FirstCol; } else if (!strcasecmp(a[0],"moverowp")) { - FirstRow = atoi(a[2]); + FirstRow = Draw::Atoi(a[2]); if ( FirstRow < 1 || FirstRow > nup ) return 1; LastRow = FirstRow; FirstCol = 1; LastCol = nvp; } else if (!strcasecmp(a[0],"movecolp")) { - FirstCol = atoi(a[2]); + FirstCol = Draw::Atoi(a[2]); if ( FirstCol < 1 || FirstCol > nvp ) return 1; LastCol = FirstCol; FirstRow = 1; @@ -1031,12 +1031,12 @@ static Standard_Integer movepoint (Draw_Interpretor& , Standard_Integer n, const return 1; } - Standard_Real u = atof(a[2]); - Standard_Real v = atof(a[3]); + Standard_Real u = Draw::Atof(a[2]); + Standard_Real v = Draw::Atof(a[3]); - Standard_Real dx = atof(a[4]); - Standard_Real dy = atof(a[5]); - Standard_Real dz = atof(a[6]); + Standard_Real dx = Draw::Atof(a[4]); + Standard_Real dy = Draw::Atof(a[5]); + Standard_Real dz = Draw::Atof(a[6]); Standard_Integer index1u = 0; Standard_Integer index2u = 0; @@ -1045,10 +1045,10 @@ static Standard_Integer movepoint (Draw_Interpretor& , Standard_Integer n, const Standard_Integer fmodifu, lmodifu, fmodifv, lmodifv; if (n == 11) { - index1u = atoi(a[7]); - index2u = atoi(a[8]); - index1v = atoi(a[9]); - index2v = atoi(a[10]); + index1u = Draw::Atoi(a[7]); + index2u = Draw::Atoi(a[8]); + index1v = Draw::Atoi(a[9]); + index2v = Draw::Atoi(a[10]); } else { index1u = 2; @@ -1085,13 +1085,13 @@ static Standard_Integer insertknot (Draw_Interpretor& , Standard_Integer n, cons if ( !strcasecmp(a[0],"insertuknot") || !strcasecmp(a[0],"insertvknot") ) { if (n<4) return 1; - knot = atof(a[2]); - mult = atoi(a[3]); + knot = Draw::Atof(a[2]); + mult = Draw::Atoi(a[3]); } else if ( !strcasecmp(a[0],"remuknot") || !strcasecmp(a[0],"remvknot") ) { - index = atoi(a[2]); - if (n>=4) mult = atoi(a[3]); + index = Draw::Atoi(a[2]); + if (n>=4) mult = Draw::Atoi(a[3]); } Standard_Real tol = RealLast(); @@ -1103,12 +1103,12 @@ static Standard_Integer insertknot (Draw_Interpretor& , Standard_Integer n, cons GBs->InsertVKnot(knot,mult,Precision::PConfusion()); } else if (!strcasecmp(a[0],"remuknot")) { - if (n>=5) tol = atof(a[4]); + if (n>=5) tol = Draw::Atof(a[4]); if (!GBs->RemoveUKnot(index,mult,tol)) return 1; } else if (!strcasecmp(a[0],"remvknot")) { - if (n>=5) tol = atof(a[4]); + if (n>=5) tol = Draw::Atof(a[4]); if (!GBs->RemoveVKnot(index,mult,tol)) return 1; } @@ -1126,7 +1126,7 @@ static Standard_Integer incdegree (Draw_Interpretor& di, Standard_Integer n, con { if (n < 3) return 1; - Standard_Integer NewDeg = atoi(a[2]); + Standard_Integer NewDeg = Draw::Atoi(a[2]); Standard_Boolean BSpline = Standard_False; Standard_Integer UDeg=0, VDeg=0; @@ -1190,7 +1190,7 @@ static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const { if (n < 3) return 1; - Standard_Integer NewIndex = atoi(a[2]); + Standard_Integer NewIndex = Draw::Atoi(a[2]); Standard_Boolean BSpline = Standard_False; Handle(Geom_BezierSurface) GBz = DrawTrSurf::GetBezierSurface(a[1]); @@ -1259,9 +1259,9 @@ static Standard_Integer sfindp (Draw_Interpretor& , Standard_Integer n, const ch Standard_Integer UIndex = 0; Standard_Integer VIndex = 0; - Standard_Integer view = atoi(a[2]); - Standard_Real x = atof(a[3]); - Standard_Real y = atof(a[4]); + Standard_Integer view = Draw::Atoi(a[2]); + Standard_Real x = Draw::Atof(a[3]); + Standard_Real y = Draw::Atof(a[4]); Draw_Display d = dout.MakeDisplay(view); @@ -1381,10 +1381,10 @@ static Standard_Integer segsur (Draw_Interpretor& , Standard_Integer n, const ch GBs = DrawTrSurf::GetBSplineSurface(a[1]); if (GBs.IsNull()) return 1; - GBs->Segment(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); + GBs->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); } else { - GBz->Segment(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); + GBz->Segment(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); } Draw::Repaint(); @@ -1460,10 +1460,10 @@ static Standard_Integer setuvorigin (Draw_Interpretor& , Standard_Integer n, con if (GBs.IsNull()) return 1; if ( !strcasecmp(a[0],"setuorigin")) { - GBs->SetUOrigin(atoi(a[2])); + GBs->SetUOrigin(Draw::Atoi(a[2])); } else if ( !strcasecmp(a[0],"setvorigin")) { - GBs->SetVOrigin(atoi(a[2])); + GBs->SetVOrigin(Draw::Atoi(a[2])); } else return 1; @@ -1485,8 +1485,8 @@ static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, co // try to find parameters on a Surface Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]); if( S.IsNull() ) { di << "Unknown surface" << "\n"; return 1; } - gp_Pnt P(atof(a[2]), atof(a[3]), atof(a[4])); - Standard_Real Tol = atof(a[5]), U = 0., V = 0.; + gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4])); + Standard_Real Tol = Draw::Atof(a[5]), U = 0., V = 0.; Standard_Boolean res = GeomLib_Tool::Parameters(S,P,Tol,U,V); Draw::Set(a[6],U); @@ -1499,8 +1499,8 @@ static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, co // try to find parameters on a 3d Curve Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[1]); if( C.IsNull() ) { di << "Unknown curve" << "\n"; return 1; } - gp_Pnt P(atof(a[2]), atof(a[3]), atof(a[4])); - Standard_Real Tol = atof(a[5]), U = 0.; + gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4])); + Standard_Real Tol = Draw::Atof(a[5]), U = 0.; Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U); Draw::Set(a[6],U); @@ -1512,8 +1512,8 @@ static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, co // try to find parameters on a 2d Curve Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[1]); if( C.IsNull() ) { di << "Unknown curve 2d" << "\n"; return 1; } - gp_Pnt2d P(atof(a[2]), atof(a[3])); - Standard_Real Tol = atof(a[4]), U = 0.; + gp_Pnt2d P(Draw::Atof(a[2]), Draw::Atof(a[3])); + Standard_Real Tol = Draw::Atof(a[4]), U = 0.; Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U); Draw::Set(a[5],U); diff --git a/src/HLRTest/HLRTest.cxx b/src/HLRTest/HLRTest.cxx index 06bc1d1b5e..244b11dad1 100755 --- a/src/HLRTest/HLRTest.cxx +++ b/src/HLRTest/HLRTest.cxx @@ -95,22 +95,22 @@ hprj (Draw_Interpretor& , Standard_Integer n, const char** a) { Standard_Integer id = 1; if (n < 2) return 1; - if (n > 2) id = atoi(a[2]); + if (n > 2) id = Draw::Atoi(a[2]); // gp_Ax2 anAx2 = gp::XOY(); if (n == 11) { - Standard_Real x = atof(a[2]); - Standard_Real y = atof(a[3]); - Standard_Real z = atof(a[4]); + Standard_Real x = Draw::Atof(a[2]); + Standard_Real y = Draw::Atof(a[3]); + Standard_Real z = Draw::Atof(a[4]); - Standard_Real dx = atof(a[5]); - Standard_Real dy = atof(a[6]); - Standard_Real dz = atof(a[7]); + Standard_Real dx = Draw::Atof(a[5]); + Standard_Real dy = Draw::Atof(a[6]); + Standard_Real dz = Draw::Atof(a[7]); - Standard_Real dx1 = atof(a[8]); - Standard_Real dy1 = atof(a[9]); - Standard_Real dz1 = atof(a[10]); + Standard_Real dx1 = Draw::Atof(a[8]); + Standard_Real dy1 = Draw::Atof(a[9]); + Standard_Real dz1 = Draw::Atof(a[10]); gp_Pnt anOrigin (x, y, z); gp_Dir aNormal (dx, dy, dz); @@ -152,7 +152,7 @@ hfil (Draw_Interpretor& di, Standard_Integer n, const char** a) { Standard_Integer nbIso = 0; if (n < 3) return 1; - if (n > 3) nbIso = atoi(a[3]); + if (n > 3) nbIso = Draw::Atoi(a[3]); const char *name1 = a[1]; Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name1); if (HS.IsNull()) { diff --git a/src/IGESData/IGESData_GlobalSection.cxx b/src/IGESData/IGESData_GlobalSection.cxx index 7513d3acfd..cce3f1e569 100755 --- a/src/IGESData/IGESData_GlobalSection.cxx +++ b/src/IGESData/IGESData_GlobalSection.cxx @@ -153,7 +153,7 @@ void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params, if (fpt == Interface_ParamInteger) { // but a real is expected if ( i == 13 || i == 17 || i == 19 || i == 20) - realval = atof(val); + realval = Atof(val); intval = atoi(val); } @@ -168,7 +168,7 @@ void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params, text[j++] = val[k]; if (val[k] == '\0') break; } - realval = atof(text);//Interface_FileReaderData::Fastof(val); + realval = Atof(text); } // if the param is a text diff --git a/src/IGESData/IGESData_ParamReader.cxx b/src/IGESData/IGESData_ParamReader.cxx index dd5fa27a0f..32a6b54ab6 100755 --- a/src/IGESData/IGESData_ParamReader.cxx +++ b/src/IGESData/IGESData_ParamReader.cxx @@ -1249,9 +1249,9 @@ Standard_Boolean IGESData_ParamReader::ReadingReal (const Standard_Integer num, text[j++] = orig[i]; if (orig[i] == '\0') break; } - if (FP.ParamType() == Interface_ParamReal) val = atof(text); - //Interface_FileReaderData::Fastof(FP.CValue()); - else if (FP.ParamType() == Interface_ParamEnum) { // convention + if (FP.ParamType() == Interface_ParamReal) + val = Atof(text); + else if (FP.ParamType() == Interface_ParamEnum) { // convention if (!pbrealform) { if (testconv < 0) testconv = 0; //Interface_Static::IVal("iges.convert.read"); if (testconv > 0) { @@ -1266,7 +1266,7 @@ Standard_Boolean IGESData_ParamReader::ReadingReal (const Standard_Integer num, // mais avec exposant (sinon ce serait un entier) // -> un message avertissement + on ajoute le point puis on convertit - val = atof(text);//Interface_FileReaderData::Fastof(text); + val = Atof(text); } else if (FP.ParamType() == Interface_ParamVoid) { val = 0.0; // DEFAULT } else { @@ -1317,8 +1317,8 @@ Standard_Boolean IGESData_ParamReader::ReadingReal text[j++] = orig[i]; if (orig[i] == '\0') break; } - if (FP.ParamType() == Interface_ParamReal) val = atof(text); - //Interface_FileReaderData::Fastof(FP.CValue()); + if (FP.ParamType() == Interface_ParamReal) + val = Atof(text); else if (FP.ParamType() == Interface_ParamEnum) { // convention if (!pbrealform) { if (testconv < 0) testconv = 0; //Interface_Static::IVal("iges.convert.read"); @@ -1334,7 +1334,7 @@ Standard_Boolean IGESData_ParamReader::ReadingReal // mais avec exposant (sinon ce serait un entier) // -> un message avertissement + on ajoute le point puis on convertit - val = atof(text);//Interface_FileReaderData::Fastof(text); + val = Atof(text); } else if (FP.ParamType() == Interface_ParamVoid) { val = 0.0; // DEFAULT } else { diff --git a/src/IGESGeom/IGESGeom_ToolCircularArc.cxx b/src/IGESGeom/IGESGeom_ToolCircularArc.cxx index ac4d2f6a42..83ebcae87e 100755 --- a/src/IGESGeom/IGESGeom_ToolCircularArc.cxx +++ b/src/IGESGeom/IGESGeom_ToolCircularArc.cxx @@ -125,7 +125,7 @@ void IGESGeom_ToolCircularArc::OwnCheck Standard_Real ratio = Abs(Rad1 - Rad2) / (Rad1+Rad2); if (ratio > eps) { char mess[80]; - sprintf(mess,"Radius at Start & End Points, relative gap over %f", + Sprintf(mess,"Radius at Start & End Points, relative gap over %f", Interface_MSG::Intervalled (ratio)); ach.AddFail(mess,"Radius at Start & End Points, relative gap over %f"); } diff --git a/src/IGESGeom/IGESGeom_ToolConicArc.cxx b/src/IGESGeom/IGESGeom_ToolConicArc.cxx index f6da547bd1..312a3123be 100755 --- a/src/IGESGeom/IGESGeom_ToolConicArc.cxx +++ b/src/IGESGeom/IGESGeom_ToolConicArc.cxx @@ -217,7 +217,7 @@ void IGESGeom_ToolConicArc::OwnCheck(const Handle(IGESGeom_ConicArc)& ent, //Standard_Real eq = (A*x*x + B*x*y + C*y*y + D*x + E*y + F); // These messages are transfered in the translation procedure /* if (eq < -eps || eq > eps) { - sprintf(mess,"Start point does not satisfy conic equation, gap over %f", + Sprintf(mess,"Start point does not satisfy conic equation, gap over %f", Interface_MSG::Intervalled(eq)); ach.AddFail(mess,"Start point does not satisfy conic equation, gap over %f"); @@ -228,7 +228,7 @@ void IGESGeom_ToolConicArc::OwnCheck(const Handle(IGESGeom_ConicArc)& ent, //y = ent->EndPoint().Y(); //eq = (A*x*x + B*x*y + C*y*y + D*x + E*y + F); /* if (eq < -eps || eq > eps) { - sprintf(mess,"End point does not satisfy conic equation, gap over %f", + Sprintf(mess,"End point does not satisfy conic equation, gap over %f", Interface_MSG::Intervalled(eq)); ach.AddFail(mess,"End point does not satisfy conic equation, gap over %f"); } diff --git a/src/IGESGeom/IGESGeom_ToolPlane.cxx b/src/IGESGeom/IGESGeom_ToolPlane.cxx index 28c92b3669..92bbb43862 100755 --- a/src/IGESGeom/IGESGeom_ToolPlane.cxx +++ b/src/IGESGeom/IGESGeom_ToolPlane.cxx @@ -244,7 +244,7 @@ void IGESGeom_ToolPlane::OwnCheck(const Handle(IGESGeom_Plane)& ent, C * ent->SymbolAttach().Z() - D; if ( ec > eps || ec < -eps) { char mess[80]; - sprintf(mess,"Symbol Attach not in the Plane, gap/equation over %f", + Sprintf(mess,"Symbol Attach not in the Plane, gap/equation over %f", Interface_MSG::Intervalled(ec)); ach.SendWarning(mess,"Symbol Attach not in the Plane"); diff --git a/src/IGESSelect/IGESSelect_Activator.cxx b/src/IGESSelect/IGESSelect_Activator.cxx index 804db54ef5..31d212946a 100755 --- a/src/IGESSelect/IGESSelect_Activator.cxx +++ b/src/IGESSelect/IGESSelect_Activator.cxx @@ -290,8 +290,8 @@ static int initActivator = 0; } Standard_Real Rmin=0., Rmax=0.; if (argc > 4) { - Rmin = atof(pilot->Word(4).ToCString()); - Rmax = atof(pilot->Word(5).ToCString()); + Rmin = Atof(pilot->Word(4).ToCString()); + Rmax = Atof(pilot->Word(5).ToCString()); if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<= 5) { //char flotrange[20]; //szv#4:S4163:12Mar99 unused Standard_Real rangemin, rangemax; - rangemin = atof (file.ParamValue(4).ToCString()); - rangemax = atof (file.ParamValue(5).ToCString()); + rangemin = Atof (file.ParamValue(4).ToCString()); + rangemax = Atof (file.ParamValue(5).ToCString()); ff->SetFormatForRange (file.ParamValue(3).ToCString(),rangemin,rangemax); } item = ff; diff --git a/src/IGESSelect/IGESSelect_FloatFormat.cxx b/src/IGESSelect/IGESSelect_FloatFormat.cxx index e677a88667..caa9740ae3 100755 --- a/src/IGESSelect/IGESSelect_FloatFormat.cxx +++ b/src/IGESSelect/IGESSelect_FloatFormat.cxx @@ -36,9 +36,9 @@ IGESSelect_FloatFormat::IGESSelect_FloatFormat () } else { char format[20]; char pourcent = '%'; char point = '.'; - sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits); + Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits); themainform.AssignCat (format); - sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits); + Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits); theformrange.AssignCat (format); } therangemin = 0.1; therangemax = 1000.; @@ -90,7 +90,7 @@ IGESSelect_FloatFormat::IGESSelect_FloatFormat () lab.AssignCat (themainform); if (theformrange.Length() > 0) { char mess[30]; -// sprintf(mess,", in range %f %f %s", +// Sprintf(mess,", in range %f %f %s", // therangemin,therangemax,theformrange.ToCString()); // lab.AssignCat(mess); // ... FloatFormat a droit aussi a un beau format pour son propre compte ... diff --git a/src/IGESToBRep/IGESToBRep_Reader.cxx b/src/IGESToBRep/IGESToBRep_Reader.cxx index 6afeadae92..dd2c0d06bc 100755 --- a/src/IGESToBRep/IGESToBRep_Reader.cxx +++ b/src/IGESToBRep/IGESToBRep_Reader.cxx @@ -197,11 +197,11 @@ Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename) Standard_Integer minute, hour; c.Show(second, minute, hour,cpu); if (hour > 0) - sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); + Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); else if (minute > 0) - sprintf(t,"%dm:%.2fs",minute,second); + Sprintf(t,"%dm:%.2fs",minute,second); else - sprintf(t,"%.2fs",second); + Sprintf(t,"%.2fs",second); // Sending of message : End of Loading Msg8.Arg(t); TF->Send (Msg8, Message_Info); @@ -467,11 +467,11 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible) Standard_Integer minute, hour; c.Show(second, minute, hour,cpu); if (hour > 0) - sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); + Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); else if (minute > 0) - sprintf(t,"%dm:%.2fs",minute,second); + Sprintf(t,"%dm:%.2fs",minute,second); else - sprintf(t,"%.2fs",second); + Sprintf(t,"%.2fs",second); // Sending of message : End of Loading msg2065.Arg(t); TF->Send (msg2065, Message_Info); @@ -588,11 +588,11 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num) Standard_Integer minute, hour; c.Show(second, minute, hour,cpu); if (hour > 0) - sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); + Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second); else if (minute > 0) - sprintf(t,"%dm:%.2fs",minute,second); + Sprintf(t,"%dm:%.2fs",minute,second); else - sprintf(t,"%.2fs",second); + Sprintf(t,"%.2fs",second); // Sending of message : End of Loading msg2065.Arg(t); TF->Send (msg2065, Message_Info); diff --git a/src/Interface/Interface_FileReaderData.cxx b/src/Interface/Interface_FileReaderData.cxx index 56576113c3..808e4d2e2a 100755 --- a/src/Interface/Interface_FileReaderData.cxx +++ b/src/Interface/Interface_FileReaderData.cxx @@ -405,10 +405,10 @@ static const Standard_Real vtab[] = je = jx*9; if (jx > jj) { valdiv = 1.; - if (jx >= 100 || grexp) return atof(ligne); // issue de secours + if (jx >= 100 || grexp) return Atof(ligne); // issue de secours } else { k = jj*9; - if (jj >= 100 || grexp || (k-je >= 900)) return atof(ligne); // issue de secours + if (jj >= 100 || grexp || (k-je >= 900)) return Atof(ligne); // issue de secours valdiv = vtab[k-je]; je = k; } diff --git a/src/Interface/Interface_FloatWriter.cxx b/src/Interface/Interface_FloatWriter.cxx index 7dea6115b0..9e3976fbdc 100755 --- a/src/Interface/Interface_FloatWriter.cxx +++ b/src/Interface/Interface_FloatWriter.cxx @@ -55,8 +55,8 @@ Interface_FloatWriter::Interface_FloatWriter (const Standard_Integer chars) strcpy(therangeform ,"%f"); } else { char pourcent = '%'; char point = '.'; - sprintf(themainform, "%c%d%c%dE",pourcent,chars+2,point,chars); - sprintf(therangeform, "%c%d%c%df",pourcent,chars+2,point,chars); + Sprintf(themainform, "%c%d%c%dE",pourcent,chars+2,point,chars); + Sprintf(therangeform, "%c%d%c%df",pourcent,chars+2,point,chars); } therange1 = 0.1; therange2 = 1000.; thezerosup = Standard_True; @@ -111,10 +111,10 @@ Standard_Integer Interface_FloatWriter::Convert (const Standard_Real val, // if ( (val >= R1 && val < R2) || (val <= -R1 && val > -R2) ) { - sprintf(pText,rangeform,val); + Sprintf(pText,rangeform,val); } else { - sprintf(pText,mainform,val); + Sprintf(pText,mainform,val); } if (zsup) { diff --git a/src/Interface/Interface_Static.cxx b/src/Interface/Interface_Static.cxx index 1d979f02e4..7b43d64584 100755 --- a/src/Interface/Interface_Static.cxx +++ b/src/Interface/Interface_Static.cxx @@ -184,9 +184,9 @@ Standard_Boolean Interface_Static::Init else if (init[0] == 'i' && init[2] == 'a') unstat->SetIntegerLimit (Standard_True ,atoi(&init[iblc])); else if (init[0] == 'r' && init[2] == 'i') - unstat->SetRealLimit (Standard_False,atof(&init[iblc])); + unstat->SetRealLimit (Standard_False,Atof(&init[iblc])); else if (init[0] == 'r' && init[2] == 'a') - unstat->SetRealLimit (Standard_True ,atof(&init[iblc])); + unstat->SetRealLimit (Standard_True ,Atof(&init[iblc])); else if (init[0] == 'u') unstat->SetUnitDef (&init[iblc]); else if (init[0] == 'e' && init[1] == 'm') @@ -249,12 +249,12 @@ Standard_CString Interface_Static::CDef if (part[0] == 'i') { Standard_Integer ilim; if (!stat->IntegerLimit((part[2] == 'a'),ilim)) return ""; - sprintf(defmess,"%d",ilim); return defmess; + Sprintf(defmess,"%d",ilim); return defmess; } if (part[0] == 'r') { Standard_Real rlim; if (!stat->RealLimit((part[2] == 'a'),rlim)) return ""; - sprintf(defmess,"%f",rlim); return defmess; + Sprintf(defmess,"%f",rlim); return defmess; } if (part[0] == 'u') return stat->UnitDef(); return ""; diff --git a/src/Materials/Materials_MaterialDefinition.cxx b/src/Materials/Materials_MaterialDefinition.cxx index 69ba882b0f..264aa93786 100755 --- a/src/Materials/Materials_MaterialDefinition.cxx +++ b/src/Materials/Materials_MaterialDefinition.cxx @@ -70,9 +70,9 @@ Handle(Dynamic_Parameter) Materials_MaterialDefinition::Switch( fr = sscanf(avalue,"%s%s%s",value1,value2,value3); Handle(Materials_Color) pcolor = - new Materials_Color(Quantity_Color(atof(value1), - atof(value2), - atof(value3), + new Materials_Color(Quantity_Color(Atof(value1), + Atof(value2), + Atof(value3), Quantity_TOC_RGB)); objectparameter = new Dynamic_ObjectParameter(aname,pcolor); parameter = *(Handle_Dynamic_Parameter*)&objectparameter; diff --git a/src/Materials/Materials_MaterialsDictionary.cxx b/src/Materials/Materials_MaterialsDictionary.cxx index cdfc1e192f..b5db77308c 100755 --- a/src/Materials/Materials_MaterialsDictionary.cxx +++ b/src/Materials/Materials_MaterialsDictionary.cxx @@ -143,13 +143,13 @@ Materials_MaterialsDictionary::Materials_MaterialsDictionary() if (!strcasecmp(type,"Materials_Color")) { Quantity_Color color - (atof(value1),atof(value2),atof(value3),Quantity_TOC_RGB); + (Atof(value1),Atof(value2),Atof(value3),Quantity_TOC_RGB); pcolor = new Materials_Color(color); material->Parameter(name,pcolor); } else if(!strcasecmp(type,"Standard_Real")) { - material->Parameter(name,atof(value1)); + material->Parameter(name,Atof(value1)); } else if(!strcasecmp(type,"Standard_CString")) { diff --git a/src/MeshTest/MeshTest.cxx b/src/MeshTest/MeshTest.cxx index 956c2833a0..5142232313 100755 --- a/src/MeshTest/MeshTest.cxx +++ b/src/MeshTest/MeshTest.cxx @@ -199,11 +199,11 @@ static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer n di << " null shapes is not allowed here\n"; return 0; } - Standard_Real aDeflection = atof(argv[2]); + Standard_Real aDeflection = Draw::Atof(argv[2]); Standard_Boolean isInParallel = Standard_False; if (nbarg == 4) { - isInParallel = atoi(argv[3]) == 1; + isInParallel = Draw::Atoi(argv[3]) == 1; } di << "Incremental Mesh, multi-threading " << (isInParallel ? "ON\n" : "OFF\n"); @@ -280,17 +280,17 @@ static Standard_Integer fastdiscret(Draw_Interpretor& di, Standard_Integer nbarg TopoDS_Shape S = DBRep::Get(argv[1]); if (S.IsNull()) return 1; - const Standard_Real d = atof(argv[2]); + const Standard_Real d = Draw::Atof(argv[2]); Standard_Boolean WithShare = Standard_True; - if (nbarg > 3) WithShare = atoi(argv[3]); + if (nbarg > 3) WithShare = Draw::Atoi(argv[3]); Bnd_Box B; BRepBndLib::Add(S,B); BRepMesh_FastDiscret MESH(d,0.5,B,WithShare,Standard_True,Standard_False,Standard_True); //Standard_Integer NbIterations = MESH.NbIterations(); - //if (nbarg > 4) NbIterations = atoi(argv[4]); + //if (nbarg > 4) NbIterations = Draw::Atoi(argv[4]); //MESH.NbIterations() = NbIterations; di<<"Starting FastDiscret with :"<<"\n"; @@ -472,19 +472,19 @@ static Standard_Integer triangule(Draw_Interpretor& di, Standard_Integer nbarg, TopoDS_Shape S = DBRep::Get(id1); if (S.IsNull()) return 1; di << argv[1] << " "; - Standard_Real Deflect=atof(argv[3]); + Standard_Real Deflect=Draw::Atof(argv[3]); if (Deflect<=0.) { di << " Donner la fleche !" << "\n"; return 1; } if (nbarg >4) { - save = (atoi(argv[4])==1); + save = (Draw::Atoi(argv[4])==1); } Standard_Boolean partage=Standard_True; if (nbarg>5) { - partage=atoi(argv[5])==1; + partage=Draw::Atoi(argv[5])==1; } Handle(MeshTest_DrawableMesh) DM = @@ -664,7 +664,7 @@ static Standard_Integer medge (Draw_Interpretor&, Standard_Integer n, const char Standard_Integer i,j,e; TColStd_SequenceOfInteger& eseq = D->Edges(); for (i = 2; i < n; i++) { - e = atoi(a[i]); + e = Draw::Atoi(a[i]); if (e > 0) eseq.Append(e); else if (e < 0) { @@ -702,7 +702,7 @@ static Standard_Integer mvertex (Draw_Interpretor&, Standard_Integer n, const ch Standard_Integer i,j,v; TColStd_SequenceOfInteger& vseq = D->Vertices(); for (i = 2; i < n; i++) { - v = atoi(a[i]); + v = Draw::Atoi(a[i]); if (v > 0) vseq.Append(v); else if (v < 0) { @@ -739,7 +739,7 @@ static Standard_Integer triangle (Draw_Interpretor&, Standard_Integer n, const c Standard_Integer i,j,v; TColStd_SequenceOfInteger& tseq = D->Triangles(); for (i = 2; i < n; i++) { - v = atoi(a[i]); + v = Draw::Atoi(a[i]); if (v > 0) tseq.Append(v); else if (v < 0) { @@ -810,12 +810,12 @@ Handle(BRepMesh_DataStructureOfDelaun) struc = D->Mesh()->Result(); Standard_Integer in=1; if (argc>=3) { -in=atoi(argv[2]); +in=Draw::Atoi(argv[2]); in=Max(1,in); } Standard_Integer nbn=in; if (argc>=4) { -nbn=atoi(argv[3]); +nbn=Draw::Atoi(argv[3]); nbn=Min(nbn,struc->NbNodes()); } @@ -850,12 +850,12 @@ if (D.IsNull()) return 1; Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result(); Standard_Integer il=1; if (argc>=3) { -il=atoi(argv[2]); +il=Draw::Atoi(argv[2]); il=Max(1, il); } Standard_Integer nbl=il; if (argc>=4) { -nbl=atoi(argv[3]); +nbl=Draw::Atoi(argv[3]); nbl=Min(nbl, struc->NbLinks()); } @@ -890,12 +890,12 @@ if (D.IsNull()) return 1; Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result(); Standard_Integer ie=1; if (argc>=3) { -ie=atoi(argv[2]); +ie=Draw::Atoi(argv[2]); ie=Max(1, ie); } Standard_Integer nbe=ie; if (argc>=4) { -nbe=atoi(argv[3]); +nbe=Draw::Atoi(argv[3]); nbe=Min(nbe, struc->NbElements()); } @@ -1429,7 +1429,7 @@ Standard_Integer onetriangulation(Draw_Interpretor&, Standard_Integer nbarg, con } } - sprintf(name, "%s_%i", "tr", nbshell); + Sprintf(name, "%s_%i", "tr", nbshell); DrawTrSurf::Set(name, TFinale); } @@ -1502,10 +1502,10 @@ Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer nbarg, const cha Handle(Geom_Curve) C = DrawTrSurf::GetCurve(argv[1]); Standard_Real X, Y, Z, U0; - X = atof(argv[2]); - Y = atof(argv[3]); - Z = atof(argv[4]); - U0 = atof(argv[5]); + X = Draw::Atof(argv[2]); + Y = Draw::Atof(argv[3]); + Z = Draw::Atof(argv[4]); + U0 = Draw::Atof(argv[5]); gp_Pnt P(X, Y, Z); GeomAdaptor_Curve GC(C); @@ -1586,9 +1586,9 @@ Standard_Integer triedgepoints(Draw_Interpretor& di, Standard_Integer nbarg, con P3d.Transform(aLoc.Transformation()); if( anEdgeMap.Extent() > 1 ) - sprintf(p,"%d_%d",nbEdge,j); + Sprintf(p,"%d_%d",nbEdge,j); else - sprintf(p,"%d",j); + Sprintf(p,"%d",j); DBRep::Set( newname, BRepBuilderAPI_MakeVertex(P3d) ); di.AppendElement(newname); } diff --git a/src/MeshTest/MeshTest_PluginCommands.cxx b/src/MeshTest/MeshTest_PluginCommands.cxx index 93ab936390..7e33ef5cdd 100755 --- a/src/MeshTest/MeshTest_PluginCommands.cxx +++ b/src/MeshTest/MeshTest_PluginCommands.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -235,10 +236,10 @@ static Standard_Integer mpincmesh (Draw_Interpretor& , Standard_Integer n, const return 0; } // - aDeflection=atof(a[2]); + aDeflection=Draw::Atof(a[2]); aAngle=0.5; if (n>3) { - aAngle=atof(a[3]); + aAngle=Draw::Atof(a[3]); } // Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (aS, @@ -276,7 +277,7 @@ static Standard_Integer triarea (Draw_Interpretor& di, int n, const char ** a) if (shape.IsNull()) return 1; Standard_Real anEps = -1.; if (n > 2) - anEps = atof(a[2]); + anEps = Draw::Atof(a[2]); TopTools_IndexedMapOfShape aMapF; TopExp::MapShapes (shape, TopAbs_FACE, aMapF); @@ -526,7 +527,7 @@ static int mpparallel (Draw_Interpretor& di, Standard_Integer argc, const char** { if (argc == 2) { - Standard_Boolean isParallelOn = atoi (argv[1]) == 1; + Standard_Boolean isParallelOn = Draw::Atoi (argv[1]) == 1; BRepMesh_IncrementalMesh::SetParallelDefault (isParallelOn); if (isParallelOn) Standard::SetReentrant(Standard_True); diff --git a/src/Message/Message.cxx b/src/Message/Message.cxx index c5f30e5571..87872627d2 100755 --- a/src/Message/Message.cxx +++ b/src/Message/Message.cxx @@ -48,10 +48,10 @@ TCollection_AsciiString Message::FillTime (const Standard_Integer hour, { char t [30]; if (hour > 0) - sprintf (t, "%02dh:%02dm:%.2fs", hour, minute, second); + Sprintf (t, "%02dh:%02dm:%.2fs", hour, minute, second); else if (minute > 0) - sprintf (t, "%02dm:%.2fs", minute, second); + Sprintf (t, "%02dm:%.2fs", minute, second); else - sprintf (t, "%.2fs", second); + Sprintf (t, "%.2fs", second); return TCollection_AsciiString (t); } diff --git a/src/Message/Message_Msg.cxx b/src/Message/Message_Msg.cxx index 363f80b4c3..2f89469a86 100755 --- a/src/Message/Message_Msg.cxx +++ b/src/Message/Message_Msg.cxx @@ -170,7 +170,7 @@ Message_Msg& Message_Msg::Arg (const Standard_CString theString) // print string according to format char * sStringBuffer = new char [Max ((Standard_Integer)strlen(theString)+1, 1024)]; - sprintf (sStringBuffer, aFormat.ToCString(), theString); + Sprintf (sStringBuffer, aFormat.ToCString(), theString); TCollection_ExtendedString aStr ( sStringBuffer ); delete [] sStringBuffer; sStringBuffer = 0; @@ -216,7 +216,7 @@ Message_Msg& Message_Msg::Arg (const Standard_Integer theValue) // print string according to format char sStringBuffer [64]; - sprintf (sStringBuffer, aFormat.ToCString(), theValue); + Sprintf (sStringBuffer, aFormat.ToCString(), theValue); TCollection_ExtendedString aStr ( sStringBuffer ); // replace the format placeholder by the actual string @@ -240,7 +240,7 @@ Message_Msg& Message_Msg::Arg (const Standard_Real theValue) // print string according to format char sStringBuffer [64]; - sprintf (sStringBuffer, aFormat.ToCString(), theValue); + Sprintf (sStringBuffer, aFormat.ToCString(), theValue); TCollection_ExtendedString aStr ( sStringBuffer ); // replace the format placeholder by the actual string diff --git a/src/MoniTool/MoniTool_Timer.cxx b/src/MoniTool/MoniTool_Timer.cxx index b9c7f880bf..5bf0ca6465 100755 --- a/src/MoniTool/MoniTool_Timer.cxx +++ b/src/MoniTool/MoniTool_Timer.cxx @@ -40,7 +40,7 @@ void MoniTool_Timer::Dump(Standard_OStream &ostr) Standard_Real elapsed = seconds + minutes*60 + hours*3600; char buff[1024]; - sprintf ( buff, "Elapsed:%6.1f sec, CPU User:%9.4f sec, CPU Sys:%9.4f sec, hits: %d", + Sprintf ( buff, "Elapsed:%6.1f sec, CPU User:%9.4f sec, CPU Sys:%9.4f sec, hits: %d", elapsed, user, system, myCount ); ostr << buff << endl; @@ -113,7 +113,7 @@ void MoniTool_Timer::DumpTimers (Standard_OStream &ostr) } //Handle(MoniTool_Timer) MT = iter.Value(); char buff[1024]; - sprintf ( buff, "%-20s\t", stmp ); + Sprintf ( buff, "%-20s\t", stmp ); ostr << "TIMER: " << buff; //iter.Value()->Dump ( ostr ); Timer(stmp)->Dump(ostr); diff --git a/src/MoniTool/MoniTool_TypedValue.cxx b/src/MoniTool/MoniTool_TypedValue.cxx index 13f25c5d78..df4c4a8fc6 100755 --- a/src/MoniTool/MoniTool_TypedValue.cxx +++ b/src/MoniTool/MoniTool_TypedValue.cxx @@ -156,11 +156,11 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) def.AssignCat("Integer"); Standard_Integer ilim; if (IntegerLimit(Standard_False, ilim)) { - sprintf(mess," >= %d",ilim); + Sprintf(mess," >= %d",ilim); def.AssignCat(mess); } if (IntegerLimit(Standard_True, ilim)) { - sprintf(mess," <= %d",ilim); + Sprintf(mess," <= %d",ilim); def.AssignCat(mess); } } @@ -169,11 +169,11 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) def.AssignCat("Real"); Standard_Real rlim; if (RealLimit(Standard_False, rlim)) { - sprintf(mess," >= %f",rlim); + Sprintf(mess," >= %f",rlim); def.AssignCat(mess); } if (RealLimit(Standard_True, rlim)) { - sprintf(mess," <= %f",rlim); + Sprintf(mess," <= %f",rlim); def.AssignCat(mess); } if (theunidef.Length() > 0) @@ -184,12 +184,12 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) def.AssignCat("Enum"); Standard_Integer startcase, endcase; Standard_Boolean match; EnumDef (startcase,endcase,match); - sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase); + Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase); def.AssignCat(mess); for (Standard_Integer i = startcase; i <= endcase; i ++) { Standard_CString enva = EnumVal(i); if (enva[0] == '?' || enva[0] == '\0') continue; - sprintf(mess," %d:%s",i,enva); + Sprintf(mess," %d:%s",i,enva); def.AssignCat (mess); } if (!theeadds.IsNull()) { @@ -198,7 +198,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) for (listadd.Start(); listadd.More(); listadd.Next()) { Standard_CString enva = listadd.Name().ToCString(); if (enva[0] == '?') continue; - sprintf(mess,":%d ",listadd.Value()); + Sprintf(mess,":%d ",listadd.Value()); def.AssignCat (enva); def.AssignCat (mess); } @@ -216,7 +216,7 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) case MoniTool_ValueText : { def.AssignCat("Text"); if (themaxlen > 0) { - sprintf (mess," <= %d C.",themaxlen); + Sprintf (mess," <= %d C.",themaxlen); def.AssignCat (mess); } break; @@ -280,9 +280,9 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) else if (init[0] == 'i' && init[2] == 'a') // imax ival SetIntegerLimit (Standard_True ,atoi(&init[iblc])); else if (init[0] == 'r' && init[2] == 'i') // rmin rval - SetRealLimit (Standard_False,atof(&init[iblc])); + SetRealLimit (Standard_False,Atof(&init[iblc])); else if (init[0] == 'r' && init[2] == 'a') // rmax rval - SetRealLimit (Standard_True ,atof(&init[iblc])); + SetRealLimit (Standard_True ,Atof(&init[iblc])); else if (init[0] == 'u') // unit name SetUnitDef (&init[iblc]); else if (init[0] == 'e' && init[1] == 'm') // ematch istart diff --git a/src/OSD/FILES b/src/OSD/FILES index 8379d40671..28acd96926 100755 --- a/src/OSD/FILES +++ b/src/OSD/FILES @@ -16,7 +16,6 @@ OSD_signal.cxx OSD_signal_WNT.cxx OSD_ThreadFunction.hxx OSD_PThread.hxx -OSD_Localizer.cxx OSD_PerfMeter.cxx OSD_PerfMeter.h OSD_PerfMeter.hxx diff --git a/src/OSD/OSD.cdl b/src/OSD/OSD.cdl index 7235c416ee..5482440aeb 100755 --- a/src/OSD/OSD.cdl +++ b/src/OSD/OSD.cdl @@ -176,13 +176,6 @@ is class Thread; ---Purpose: A tool to manage threads - class Real2String; - ---Purpose: Convertion of CString to Real and reciprocally - - class Localizer; - ---Purpose: Manages locale. - - ----------------------------------------------- -- UNIX specific exceptions and enumeration -- ----------------------------------------------- diff --git a/src/OSD/OSD.cxx b/src/OSD/OSD.cxx index d7a8db373f..26de1363b7 100755 --- a/src/OSD/OSD.cxx +++ b/src/OSD/OSD.cxx @@ -28,17 +28,6 @@ # define finite isfinite #endif -static Standard_Integer DecimalPoint = 0 ; - -static void GetDecimalPoint() { - float F1 = (float ) 1.1 ; - char str[5] ; - - sprintf(str,"%.1f",F1) ; - // printf("%s\n",str) ; - DecimalPoint = str[1] ; -} - // Convert Real to CString in format e with 16 significant digits. // The decimal point character is always a period. // The conversion is independant from current locale database @@ -48,20 +37,9 @@ Standard_Boolean OSD::RealToCString(const Standard_Real aReal, { char *p, *q ; - // Get the local decimal point character - - if (!DecimalPoint) - GetDecimalPoint() ; - - // Substitute it - -// if (sprintf(aString,"%.15le",aReal) <= 0) - if (sprintf(aString,"%.17e",aReal) <= 0) //BUC60808 + if (Sprintf(aString,"%.17e",aReal) <= 0) //BUC60808 return Standard_False ; - if ((p = strchr(aString,DecimalPoint))) - *p = '.' ; - // Suppress "e+00" and unsignificant 0's if ((p = strchr(aString,'e'))) { @@ -83,25 +61,8 @@ Standard_Boolean OSD::RealToCString(const Standard_Real aReal, Standard_Boolean OSD::CStringToReal(const Standard_CString aString, Standard_Real& aReal) { - const char *p; char *endptr ; - - - // Get the local decimal point character - - if (!DecimalPoint) - GetDecimalPoint() ; - - const char *str = aString; - char buff[1024]; - //if((p = strchr(aString,'.'))) - if(DecimalPoint != '.' && (p = strchr(aString,'.'))&& ((p-aString) < 1000) ) - { - strncpy(buff, aString, 1000); - buff[p-aString] = DecimalPoint ; - str = buff; - } - aReal = strtod(str,&endptr) ; + aReal = Strtod(aString, &endptr); if (*endptr) return Standard_False ; return Standard_True; diff --git a/src/OSD/OSD_Localizer.cdl b/src/OSD/OSD_Localizer.cdl deleted file mode 100755 index 1f8c394eaf..0000000000 --- a/src/OSD/OSD_Localizer.cdl +++ /dev/null @@ -1,60 +0,0 @@ --- Created on: 2010-08-27 --- Created by: Paul SUPRYATKIN --- Copyright (c) 2010-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class Localizer from OSD - - ---Purpose: Define the locale. - -is - Create ( Category : Integer from Standard; - Locale : CString from Standard); - ---Purpose: Set locale - ---Level: Public - - Restore( me: in out ); - ---Purpose: Restore previously locale - ---Level: Public - - SetLocale( me: in out; - Category : Integer from Standard; - Locale : CString from Standard); - ---Purpose: Set locale - ---Level: Public - - Locale( me ) - returns CString from Standard; - ---Purpose: Get locale - ---Level: Public - - - Category( me ) - returns Integer from Standard; - ---Purpose: Get Gategory - ---Level: Public - - -fields - - myLocale : CString from Standard; - myCategory : Integer from Standard; - -end Localizer from OSD; - - diff --git a/src/OSD/OSD_Localizer.cxx b/src/OSD/OSD_Localizer.cxx deleted file mode 100755 index 37301dc55d..0000000000 --- a/src/OSD/OSD_Localizer.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Created on: 2010-08-27 -// Created by: Paul SUPRYATKIN -// Copyright (c) 2010-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include - -OSD_Localizer::OSD_Localizer(const Standard_Integer Category,const Standard_CString Locale ) -{ - SetLocale( Category, Locale ); -} - - -void OSD_Localizer::Restore() -{ - setlocale( myCategory, myLocale ); -} - - -void OSD_Localizer::SetLocale(const Standard_Integer Category,const Standard_CString Locale ) -{ - myLocale = setlocale( Category, 0 ); - myCategory = Category; - setlocale( Category, Locale ); -} - -Standard_CString OSD_Localizer::Locale() const -{ - return myLocale; -} - -Standard_Integer OSD_Localizer::Category() const -{ - return myCategory; -} - - diff --git a/src/OSD/OSD_Real2String.cdl b/src/OSD/OSD_Real2String.cdl deleted file mode 100755 index e15c688ee5..0000000000 --- a/src/OSD/OSD_Real2String.cdl +++ /dev/null @@ -1,54 +0,0 @@ --- Created on: 2002-01-25 --- Created by: doneux --- Copyright (c) 2002-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class Real2String from OSD - - ---Purpose: Convertion of CString to Real and reciprocally - -is - - Create - returns Real2String from OSD; - - RealToCString(me; - aReal: Real; - aString:out PCharacter) - returns Boolean ; - ---Purpose: - -- Converts aReal into aCstring in exponential format with maximum - -- 17 digits. The size of the destination string must be sufficient (at least 23 characters) - -- The decimal separator account for locale setting, but - -- neither thousand separator nor grouping of digits in the output string. - -- - - CStringToReal(me: in out; - aString: CString; - aReal: out Real) returns Boolean ; - ---Purpose: - -- Converts aCstring representing a real. The first occurence of the decimal separator - -- (comma or period) defines it values for further readings. - -- Neither thousand separator nor grouping of digits are allowed in the CString - -fields - - myReadDecimalPoint: Integer from Standard; - myLocalDecimalPoint: Integer from Standard; - -end Real2String; diff --git a/src/OSD/OSD_Real2String.cxx b/src/OSD/OSD_Real2String.cxx deleted file mode 100755 index 5b81c07746..0000000000 --- a/src/OSD/OSD_Real2String.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// Created on: 2002-01-25 -// Created by: doneux -// Copyright (c) 2002-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -// Lastly modified by : -// +---------------------------------------------------------------------------+ -// ! doneux ! Creation ! 06/17/02! %V%-1! -// +---------------------------------------------------------------------------+ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#if defined(HAVE_STDLIB_H) || defined(WNT) -# include -#endif - -//======================================================================= -//function : OSD_Real2String -//purpose : -//======================================================================= - -OSD_Real2String::OSD_Real2String(): - myReadDecimalPoint(0) -{ - float F1 = (float ) 1.1 ; - char str[5] ; - - sprintf(str,"%.1f",F1) ; - // printf("%s\n",str) ; - myLocalDecimalPoint = str[1] ; -} - -//======================================================================= -//function : RealToCString -//purpose : -//======================================================================= - -Standard_Boolean OSD_Real2String::RealToCString(const Standard_Real theReal, - Standard_PCharacter& theString) const -{ - char *p, *q ; - - if (sprintf(theString,"%.17e",theReal) <= 0) - return Standard_False ; - - // Suppress "e+00" and unsignificant 0's - - if ((p = strchr(theString,'e'))) { - if (!strcmp(p,"e+00")) - *p = 0 ; - for (q = p-1 ; *q == '0' ; q--) ; - if (q != p-1) { - - if (*q != myLocalDecimalPoint) q++ ; - - while (*p) - *q++ = *p++ ; - *q = 0 ; - } - } - return Standard_True ; -} - -//======================================================================= -//function : CStringToReal -//purpose : -//======================================================================= - -Standard_Boolean OSD_Real2String::CStringToReal(const Standard_CString theString, - Standard_Real& theReal) -{ - char *endptr ; - - if (! theString) return Standard_False; - - // Get the decimal point character in the string (if any) - if (!myReadDecimalPoint) { - if (strchr(theString, ',')) myReadDecimalPoint = ','; - else if (strchr(theString, '.')) myReadDecimalPoint = '.'; - } - - - const char *str = theString; - char buff[1024]; - if (myReadDecimalPoint) { - if (myReadDecimalPoint != myLocalDecimalPoint) { - const char * p; - // replace the decimal point by the local one - if(myReadDecimalPoint != myLocalDecimalPoint && - (p = strchr(theString,myReadDecimalPoint))&& ((p-theString) < 1000) ) - { - strncpy(buff, theString, 1000); - buff[p-theString] = myLocalDecimalPoint; - str = buff; - } - } - } - - theReal = strtod(str,&endptr) ; - if (*endptr) - return Standard_False ; - - return Standard_True; -} - diff --git a/src/OpenGl/OpenGl_GraphicDriver_Export.cxx b/src/OpenGl/OpenGl_GraphicDriver_Export.cxx index 75a9b8fab2..6b9b7387a3 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_Export.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_Export.cxx @@ -15,14 +15,11 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -/************************************************************************/ -/* Includes */ -/************************************************************************/ - #include #include #include -#include + +#include #ifdef HAVE_CONFIG_H # include @@ -32,8 +29,6 @@ #include #endif -#include - /************************************************************************/ /* Print Methods */ /************************************************************************/ @@ -110,7 +105,7 @@ Standard_Boolean OpenGl_GraphicDriver::Export (const Standard_CString theFileNam GLint anErrCode = GL2PS_SUCCESS; // gl2ps uses standard write functions and do not check locale - OSD_Localizer locate (LC_NUMERIC, "C"); + Standard_CLocaleSentry aLocaleSentry; while (aBufferSize > 0) { @@ -139,7 +134,6 @@ Standard_Boolean OpenGl_GraphicDriver::Export (const Standard_CString theFileNam break; } - locate.Restore(); return anErrCode == GL2PS_SUCCESS; #else return Standard_False; diff --git a/src/PCDM/PCDM_RetrievalDriver.cxx b/src/PCDM/PCDM_RetrievalDriver.cxx index 617a138d37..54b899045d 100755 --- a/src/PCDM/PCDM_RetrievalDriver.cxx +++ b/src/PCDM/PCDM_RetrievalDriver.cxx @@ -70,15 +70,10 @@ void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSc //purpose : //======================================================================= -void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName, +void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName, const Handle(CDM_Document)& aNewDocument, - const Handle(CDM_Application)& theApplication) { - - - char *oldnum,*plocal ; - plocal = setlocale(LC_NUMERIC, NULL) ; - oldnum = new char[strlen(plocal)+1] ; - strcpy(oldnum,plocal); + const Handle(CDM_Application)& theApplication) +{ Standard_SStream aMsg; Standard_Boolean Failure=Standard_False; Handle(Storage_Schema) aSchema; @@ -201,10 +196,6 @@ void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName, // read comments aNewDocument->SetComments(theData->Comments()); -// on remet le LC_NUMERIC a la precedente valeur - setlocale(LC_NUMERIC, oldnum) ; - delete[] oldnum; - PCDM_DriverError_Raise_if(Failure,aMsg); } diff --git a/src/PCDM/PCDM_StorageDriver.cxx b/src/PCDM/PCDM_StorageDriver.cxx index 48707a987d..65b8b90444 100755 --- a/src/PCDM/PCDM_StorageDriver.cxx +++ b/src/PCDM/PCDM_StorageDriver.cxx @@ -39,14 +39,8 @@ -void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) { - - // on sauvegarde l'ancien LC_NUMERIC - char *oldnum,*plocal ; - plocal = setlocale(LC_NUMERIC, NULL) ; - oldnum = new char[strlen(plocal)+1] ; - strcpy(oldnum,plocal); - +void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) +{ Handle(Storage_Schema) theSchema=PCDM::Schema(SchemaName(),aDocument->Application()); TColStd_SequenceOfExtendedString theExtensions; @@ -104,10 +98,6 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol theSchema->Write(theFile,theData); theFile.Close(); - // on remet le LC_NUMERIC a la precedente valeur - setlocale(LC_NUMERIC, oldnum) ; - delete[] oldnum; - if ( theData->ErrorStatus() != Storage_VSOk ) PCDM_DriverError::Raise(theData->ErrorStatusExtension().ToCString()); } diff --git a/src/PCollection/PCollection_HAsciiString.cxx b/src/PCollection/PCollection_HAsciiString.cxx index f2fc6fdf1f..5e25c72dcd 100755 --- a/src/PCollection/PCollection_HAsciiString.cxx +++ b/src/PCollection/PCollection_HAsciiString.cxx @@ -402,7 +402,7 @@ Standard_Boolean PCollection_HAsciiString::IsRealValue () const for(i = 0; i < astring->Length(); i++) cnvbuf[i] = astring->Value(i+1); cnvbuf[i] = 0; - cnvreal = strtod(cnvbuf,&ptr); + cnvreal = Strtod(cnvbuf,&ptr); if (ptr < cnvbuf+astring->Length()) return Standard_False; else return Standard_True; } diff --git a/src/Poly/Poly_CoherentNode.cxx b/src/Poly/Poly_CoherentNode.cxx index bd583951cd..343e0326d3 100755 --- a/src/Poly/Poly_CoherentNode.cxx +++ b/src/Poly/Poly_CoherentNode.cxx @@ -108,12 +108,12 @@ Standard_Boolean Poly_CoherentNode::RemoveTriangle void Poly_CoherentNode::Dump(Standard_OStream& theStream) const { char buf[256]; - sprintf (buf, " X =%9.4f; Y =%9.4f; Z =%9.4f", X(), Y(), Z()); + Sprintf (buf, " X =%9.4f; Y =%9.4f; Z =%9.4f", X(), Y(), Z()); theStream << buf << endl; Poly_CoherentTriPtr::Iterator anIter(* myTriangles); for (; anIter.More(); anIter.Next()) { const Poly_CoherentTriangle& aTri = anIter.Value(); - sprintf (buf, " %5d %5d %5d", aTri.Node(0),aTri.Node(1),aTri.Node(2)); + Sprintf (buf, " %5d %5d %5d", aTri.Node(0),aTri.Node(1),aTri.Node(2)); theStream << buf << endl; } } diff --git a/src/QABugs/QABugs_1.cxx b/src/QABugs/QABugs_1.cxx index 3f5101ef56..7489123529 100644 --- a/src/QABugs/QABugs_1.cxx +++ b/src/QABugs/QABugs_1.cxx @@ -236,7 +236,7 @@ static Standard_Integer OCC145bug (Draw_Interpretor& di, Standard_Integer argc, } TCollection_AsciiString aFileName = argv[1]; - Standard_Integer aMaxNbr = atoi(argv[2]); + Standard_Integer aMaxNbr = Draw::Atoi(argv[2]); BRep_Builder aBld; TopoDS_Shape aShape; @@ -282,7 +282,7 @@ static Standard_Integer OCC73_SelectionMode (Draw_Interpretor& di, Standard_Inte //cout << "OCC73_SelectionMode 4" << endl; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( argc == 4 ) { - prs->SetSelectionMode((Standard_Integer)atoi(argv[3])); + prs->SetSelectionMode((Standard_Integer)Draw::Atoi(argv[3])); TPrsStd_AISViewer::Update(L); } else { @@ -316,7 +316,7 @@ static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, c } TCollection_AsciiString name(argv[1]); - Standard_Real Length = atof(argv[3]); + Standard_Real Length = Draw::Atof(argv[3]); // Construction de l'AIS_PlaneTrihedron Handle(AIS_PlaneTrihedron) theAISPlaneTri; @@ -412,7 +412,7 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg TCollection_AsciiString aName(argv[1]); Handle(AIS_InteractiveObject) AISObj; - Standard_Integer SelectMode = atoi(argv[2]); + Standard_Integer SelectMode = Draw::Atoi(argv[2]); if(!aMap.IsBound2(aName)) { di << "Use 'vdisplay' before" << "\n"; diff --git a/src/QABugs/QABugs_10.cxx b/src/QABugs/QABugs_10.cxx index 15132d0cb5..1e3f220560 100755 --- a/src/QABugs/QABugs_10.cxx +++ b/src/QABugs/QABugs_10.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -60,7 +59,7 @@ static Standard_Integer OCC426 (Draw_Interpretor& di, Standard_Integer argc, con } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 8) { - Standard_Integer IsB = atoi(argv[7]); + Standard_Integer IsB = Draw::Atoi(argv[7]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -231,12 +230,12 @@ static Standard_Integer OCC486(Draw_Interpretor& di, Standard_Integer argc, cons Handle(Geom_Surface) GS; GS = DrawTrSurf::GetSurface(argv[1]); if (GS.IsNull()) { di << "OCC486 FAULTY. Null surface /n";return 1;} - gp_Pnt P3D( atof(argv[2]),atof(argv[3]),atof(argv[4]) ); + gp_Pnt P3D( Draw::Atof(argv[2]),Draw::Atof(argv[3]),Draw::Atof(argv[4]) ); Standard_Real Tol = Precision::PConfusion(); Extrema_ExtPS myExtPS; - if (argc > 5) du = atof(argv[5]); - if (argc > 6) dv = atof(argv[6]); + if (argc > 5) du = Draw::Atof(argv[5]); + if (argc > 6) dv = Draw::Atof(argv[6]); Standard_Real uf, ul, vf, vl; GS->Bounds(uf, ul, vf, vl); @@ -306,8 +305,8 @@ static Standard_Integer OCC712 (Draw_Interpretor& di, Standard_Integer argc, con // Case:3 draftAngle = 10, slabThick = 40 --> Ok // // -------------------------------------------------- - Standard_Real draftAngle = atof(argv[1]); - Standard_Real slabThick = atof(argv[2]); + Standard_Real draftAngle = Draw::Atof(argv[1]); + Standard_Real slabThick = Draw::Atof(argv[2]); Standard_Real f1 = 75; Standard_Real f2 = 35; @@ -466,7 +465,7 @@ static Standard_Integer OCC822_1 (Draw_Interpretor& di, Standard_Integer argc, c } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 5) { - Standard_Integer IsB = atoi(argv[4]); + Standard_Integer IsB = Draw::Atoi(argv[4]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -556,7 +555,7 @@ static Standard_Integer OCC822_2 (Draw_Interpretor& di,Standard_Integer argc, co } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 5) { - Standard_Integer IsB = atoi(argv[4]); + Standard_Integer IsB = Draw::Atoi(argv[4]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -623,7 +622,7 @@ static Standard_Integer OCC823 (Draw_Interpretor& di,Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 5) { - Standard_Integer IsB = atoi(argv[4]); + Standard_Integer IsB = Draw::Atoi(argv[4]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -691,7 +690,7 @@ static Standard_Integer OCC824 (Draw_Interpretor& di,Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 5) { - Standard_Integer IsB = atoi(argv[4]); + Standard_Integer IsB = Draw::Atoi(argv[4]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -760,7 +759,7 @@ static Standard_Integer OCC825 (Draw_Interpretor& di,Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 7) { - Standard_Integer IsB = atoi(argv[6]); + Standard_Integer IsB = Draw::Atoi(argv[6]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def02) @@ -866,7 +865,7 @@ static Standard_Integer OCC826 (Draw_Interpretor& di,Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 5) { - Standard_Integer IsB = atoi(argv[4]); + Standard_Integer IsB = Draw::Atoi(argv[4]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -945,7 +944,7 @@ static Standard_Integer OCC827 (Draw_Interpretor& di,Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 7) { - Standard_Integer IsB = atoi(argv[6]); + Standard_Integer IsB = Draw::Atoi(argv[6]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index d1ed2872bd..fc2e9b6a48 100755 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -23,6 +23,7 @@ #include +#include #include #include #include @@ -164,7 +165,7 @@ static Standard_Integer OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/ // // Standard_Integer aNum = -1; // -// if(atoi(argv[2])) { +// if(Draw::Atoi(argv[2])) { // aNum = anAISCtx->OpenLocalContext(); // } // @@ -274,7 +275,7 @@ static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** a di << "Num points = " << plin.NbPoints() << "\n"; if(argc > 2) { i++; - sprintf(Ch,"%s_%i",argv[2],1); + Sprintf(Ch,"%s_%i",argv[2],1); DBRep::Set(Ch,E); } } @@ -304,7 +305,7 @@ static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, co #endif Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2]; - sprintf(file1,"%s/%s",DD,a[1]); + Sprintf(file1,"%s/%s",DD,a[1]); IGESToBRep_Reader reader; Standard_Integer status = reader.LoadFile(file1); @@ -360,7 +361,7 @@ static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** arg } // TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep")); TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1])); - Standard_Real l = 0.5; //atof(argv[2]); + Standard_Real l = 0.5; //Draw::Atof(argv[2]); // Find the first vertex of the wire BRepTools_WireExplorer wire_exp(myTopoDSWire); TopoDS_Vertex vlast; @@ -445,10 +446,10 @@ static int pipe_OCC9 (Draw_Interpretor& di, GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ), Handle(Geom_Curve)::DownCast( aCurveSeq(2) ), Handle(Geom_Curve)::DownCast( aCurveSeq(3) ), - atof (a[5]) ); + Draw::Atof (a[5]) ); if (n == 7) { - aPipe.Perform(atof (a[6]), Standard_True); + aPipe.Perform(Draw::Atof (a[6]), Standard_True); } else { aPipe.Perform(Standard_True/*, Standard_True*/); } @@ -530,7 +531,7 @@ Standard_Integer OCC157(Draw_Interpretor& di, di << "Invalid input shape"<< "\n"; return 1; } - Standard_Real toler = atof(a[3]); + Standard_Real toler = Draw::Atof(a[3]); TopoDS_Wire aWire = TopoDS::Wire(inputShape); BRepLib_FindSurface FS(aWire, toler, Standard_True); if(FS.Found()) { @@ -897,13 +898,13 @@ Standard_Integer OCC299bug (Draw_Interpretor& di, TopoDS_Shape aS = DBRep::Get(a[1]); if (aS.IsNull()) { - sprintf(sbf, " Null Shape is not allowed here\n"); + Sprintf(sbf, " Null Shape is not allowed here\n"); di<SetTransparency(atof(arg[3])); + prs->SetTransparency(Draw::Atof(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -1933,7 +1934,7 @@ static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetColor((Quantity_NameOfColor)atoi(arg[3])); + prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else @@ -1966,7 +1967,7 @@ static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3])); + prs->SetMaterial((Graphic3d_NameOfMaterial)Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -2000,7 +2001,7 @@ static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetWidth(atof(arg[3])); + prs->SetWidth(Draw::Atof(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -2034,7 +2035,7 @@ static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetMode(atoi(arg[3])); + prs->SetMode(Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -2068,7 +2069,7 @@ static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di, Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( nb == 4 ) { - prs->SetSelectionMode(atoi(arg[3])); + prs->SetSelectionMode(Draw::Atoi(arg[3])); TPrsStd_AISViewer::Update(L); } else { @@ -2099,7 +2100,7 @@ static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, co } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 6) { - Standard_Integer IsB = atoi(argv[5]); + Standard_Integer IsB = Draw::Atoi(argv[5]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; // di << "Error: There is not BRepAlgo_Cut class" << "\n"; @@ -2107,7 +2108,7 @@ static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, co } } - Standard_Integer CaseNumber = atoi(argv[1]); + Standard_Integer CaseNumber = Draw::Atoi(argv[1]); //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000); gp_Dir myDir(1,0,0); @@ -2306,7 +2307,7 @@ static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer a } adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire)); } - double step = atof(argv[3]); + double step = Draw::Atof(argv[3]); GCPnts_UniformAbscissa aUni(*adapCurve, step); int res; if (!aUni.IsDone()) @@ -2322,7 +2323,7 @@ static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer a double par = aUni.Parameter(i+1); gp_Pnt p = adapCurve->Value(par); char n[20], *pname=n; - sprintf(n,"%s_%d",name,i+1); + Sprintf(n,"%s_%d",name,i+1); DrawTrSurf::Set(pname,p); di< 1) - nCount = atoi(argv[1]); + nCount = Draw::Atoi(argv[1]); STEPCAFControl_Writer writer; Handle_TDocStd_Document document; document = new TDocStd_Document("Pace Test-StepExporter-"); @@ -2868,8 +2869,8 @@ static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, c return 1; } - Standard_Integer LOWER = atoi(argv[1]); - Standard_Integer UPPER = atoi(argv[2]); + Standard_Integer LOWER = Draw::Atoi(argv[1]); + Standard_Integer UPPER = Draw::Atoi(argv[2]); //! 0. Create an empty document with several test labels Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf"); @@ -3082,8 +3083,8 @@ static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, co NCollection_Vector vec; for (i = 0; i < argc - 1; i++) { i++; - aValue = atoi(argv[i]); - aPosition = atoi(argv[i+1]); + aValue = Draw::Atoi(argv[i]); + aPosition = Draw::Atoi(argv[i+1]); vec.SetValue(aValue, aPosition); } NCollection_Vector::Iterator it(vec); @@ -3210,7 +3211,7 @@ static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, c BRepBuilderAPI_MakePolygon W; j = 3; for (i = 1; i <= np; i ++) { - W.Add(gp_Pnt(atof(argv[j]),atof(argv[j+1]),atof(argv[j+2]))); + W.Add(gp_Pnt(Draw::Atof(argv[j]),Draw::Atof(argv[j+1]),Draw::Atof(argv[j+2]))); j += 3; } W.Close(); @@ -3228,12 +3229,12 @@ static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, c gp_Ax2 aPln (gp_Pnt(0.,0.,0.), gp_Dir(1., -1., 0.)); gp_GTrsf aTrf; - aTrf.SetAffinity (aPln, atof(argv[4])); - gp_XYZ aOrigin (atof(argv[1]),atof(argv[2]),atof(argv[3])); + aTrf.SetAffinity (aPln, Draw::Atof(argv[4])); + gp_XYZ aOrigin (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3])); gp_XYZ aResult (aOrigin); aTrf.Transforms(aResult); char sbf[512]; - sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n", + Sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n", aOrigin.X(), aOrigin.Y(), aOrigin.Z(), aResult.X(), aResult.Y(), aResult.Z()); di< 2) { - aDeflection = atof(argv[2]); + aDeflection = Draw::Atof(argv[2]); } di<<"deflection="<< aDeflection << "\n"; @@ -3282,7 +3283,7 @@ static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, c } try { - gp_Lin2d aLin2d (atof(argv[1]),atof(argv[2]),atof(argv[3])); + gp_Lin2d aLin2d (Draw::Atof(argv[1]),Draw::Atof(argv[2]),Draw::Atof(argv[3])); gp_Pnt2d anOrigin = aLin2d.Location(); di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ; } @@ -4585,7 +4586,7 @@ static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, c Standard_Integer mode = 0; if (argc == 2) { - mode = atoi(argv[1]); + mode = Draw::Atoi(argv[1]); } if (mode > 2 || mode < 0) { @@ -4689,7 +4690,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer // amv 26.09.2003 : this is used to avoid error of enter's simbol char str[80]; cin>>str; - modepri = atoi(str); + modepri = Draw::Atoi(str); } if (modepri == 0) { //fin @@ -4724,7 +4725,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer //amv 26.09.2003 char str_a[80]; cin >> str_a; - answer = atoi(str_a); + answer = Draw::Atoi(str_a); } if ( answer == 0) continue; if ( answer == 1 || answer == 3) { @@ -4732,7 +4733,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer // save the shape if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; } char fname[110]; - sprintf(fname, "%s", rnom.ToCString()); + Sprintf(fname, "%s", rnom.ToCString()); di << "Saving shape in variable Draw : " << fname << "\n"; if (answer == 3) IGESToBRep::WriteShape (shape,1); try { @@ -4755,7 +4756,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer TopoDS_Shape shape = Reader.Shape(inum); if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; } char fname[110]; - sprintf(fname, "%s_%d", rnom.ToCString(),inum); + Sprintf(fname, "%s_%d", rnom.ToCString(),inum); di << "Saving shape in variable Draw : " << fname << "\n"; if (answer == 4) IGESToBRep::WriteShape (shape,inum); try { @@ -4782,7 +4783,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "< DRAW Shape: "<>str_answer; - answer = atoi(str_answer); + answer = Draw::Atoi(str_answer); } if (answer <= 0 || answer > 3) continue; if (answer == 3) { @@ -4895,7 +4896,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "< DRAW Shape: "< +#include #include #include #include @@ -54,9 +53,9 @@ static Standard_Integer OCC895 (Draw_Interpretor& di, Standard_Integer argc, con } const Standard_Real rad = 1.0; - const Standard_Real angle = (argc > 2)? atof(argv[2]) : 0.0; - const Standard_Integer reverse = (argc > 3)? atoi(argv[3]) : 0; - const Standard_Integer order = (argc > 4)? atoi(argv[4]) : 0; + const Standard_Real angle = (argc > 2)? Draw::Atof(argv[2]) : 0.0; + const Standard_Integer reverse = (argc > 3)? Draw::Atoi(argv[3]) : 0; + const Standard_Integer order = (argc > 4)? Draw::Atoi(argv[4]) : 0; // Make a wire from the first arc for ThruSections. // diff --git a/src/QABugs/QABugs_13.cxx b/src/QABugs/QABugs_13.cxx index 12179f48b4..29ed685cfa 100755 --- a/src/QABugs/QABugs_13.cxx +++ b/src/QABugs/QABugs_13.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -74,11 +73,11 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, double major_radius = 280.0; // Convert arguments - if (argc>1) wall_thickness = atof(argv[1]); - if (argc>2) dia1 = atof(argv[2]); - if (argc>3) dia2 = atof(argv[3]); - if (argc>4) major_radius = atof(argv[4]); - if (argc>5) length = atof(argv[5]); + if (argc>1) wall_thickness = Draw::Atof(argv[1]); + if (argc>2) dia1 = Draw::Atof(argv[2]); + if (argc>3) dia2 = Draw::Atof(argv[3]); + if (argc>4) major_radius = Draw::Atof(argv[4]); + if (argc>5) length = Draw::Atof(argv[5]); double bend_angle = length/major_radius; //if ((bend_angle >= M_PI)) { @@ -203,20 +202,20 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, if (!mkEdge.IsDone()) return 0; TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire(); - sprintf (name,"SpineWire"); + Sprintf (name,"SpineWire"); DBRep::Set(name,SpineWire); - sprintf (name,"Wire1_"); + Sprintf (name,"Wire1_"); DBRep::Set(name,Wire1_); - sprintf (name,"outerWire1_"); + Sprintf (name,"outerWire1_"); DBRep::Set(name,outerWire1_); // SUPPORT: // - There is no need to create 2nd circles - //sprintf (name,"Wire2_"); + //Sprintf (name,"Wire2_"); //DBRep::Set(name,Wire2_); - //sprintf (name,"outerWire2_"); + //Sprintf (name,"outerWire2_"); //DBRep::Set(name,outerWire2_); di.Eval("fit"); @@ -292,7 +291,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, mkPipe1.MakeSolid(); gasSolid = mkPipe1.Shape(); - sprintf (name,"gasSolid_"); + Sprintf (name,"gasSolid_"); DBRep::Set(name,gasSolid); //getFaces.Clear(); @@ -313,7 +312,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, B.MakeSolid(wallSolid); B.Add(wallSolid,TubeShell); - sprintf (name,"wallSolid_"); + Sprintf (name,"wallSolid_"); DBRep::Set(name,wallSolid); // Now calculated the volume of the outside tube. @@ -385,7 +384,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, while (getFaces.More()) { i++; - sprintf(name,"Face%d",i); + Sprintf(name,"Face%d",i); di << "Face named " << name << "\n"; DBRep::Set(name,getFaces.Current()); getFaces.Next(); @@ -415,7 +414,7 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 7) { - Standard_Integer IsB = atoi(argv[6]); + Standard_Integer IsB = Draw::Atoi(argv[6]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -442,11 +441,11 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con // Convert arguments - if (argc>1) radius_l = atof(argv[1]); - if (argc>2) radius_r = atof(argv[2]); - if (argc>3) bend_angle = atof(argv[3]); - if (argc>4) major_rad = atof(argv[4]); - if (argc>5) wall_thickness = atof(argv[5]); + if (argc>1) radius_l = Draw::Atof(argv[1]); + if (argc>2) radius_r = Draw::Atof(argv[2]); + if (argc>3) bend_angle = Draw::Atof(argv[3]); + if (argc>4) major_rad = Draw::Atof(argv[4]); + if (argc>5) wall_thickness = Draw::Atof(argv[5]); // mkv 15.07.03 if ((bend_angle >= 2.0*M_PI)) { if ((bend_angle >= 2.0*M_PI)) { @@ -538,19 +537,19 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con if (!mkEdge.IsDone()) return TCL_ERROR; TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire(); - sprintf (name,"SpineWire"); + Sprintf (name,"SpineWire"); DBRep::Set(name,SpineWire); - sprintf (name,"Wire1_"); + Sprintf (name,"Wire1_"); DBRep::Set(name,Wire1_); - sprintf (name,"outerWire1_"); + Sprintf (name,"outerWire1_"); DBRep::Set(name,outerWire1_); - sprintf (name,"Wire2_"); + Sprintf (name,"Wire2_"); DBRep::Set(name,Wire2_); - sprintf (name,"outerWire2_"); + Sprintf (name,"outerWire2_"); DBRep::Set(name,outerWire2_); di.Eval("fit"); @@ -559,10 +558,10 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con TopExp::Vertices(SpineWire, Location2, Location1); - sprintf (name,"Location1"); + Sprintf (name,"Location1"); DBRep::Set(name,Location1); - sprintf (name,"Location2"); + Sprintf (name,"Location2"); DBRep::Set(name,Location2); // Make inner pipe shell @@ -583,16 +582,16 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con mkPipe2.Build(); if (!mkPipe2.IsDone()) return TCL_ERROR; -// sprintf(name,"w1-first"); +// Sprintf(name,"w1-first"); // DBRep::Set(name,mkPipe1.FirstShape()); -// sprintf(name,"w1-last"); +// Sprintf(name,"w1-last"); // DBRep::Set(name,mkPipe1.LastShape()); -// sprintf(name,"w2-first"); +// Sprintf(name,"w2-first"); // DBRep::Set(name,mkPipe2.FirstShape()); -// sprintf(name,"w2-last"); +// Sprintf(name,"w2-last"); // DBRep::Set(name,mkPipe2.LastShape()); BRepOffsetAPI_Sewing SewIt(1.0e-4); @@ -727,7 +726,7 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con { di << "Next shell found in compound" << "\n"; di << "B.Add(wallSolid,TopoDS::Shell(getShel.Current()));" << "\n"; - sprintf(name,"shell%d", i++); + Sprintf(name,"shell%d", i++); DBRep::Set(name,getShel.Current()); B.Add(wallSolid,TopoDS::Shell(getShel.Current())); getShel.Next(); @@ -736,7 +735,7 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con } } - sprintf(name,"result"); + Sprintf(name,"result"); DBRep::Set(name,wallSolid); // Now calculated the volume of the outside tube. @@ -825,7 +824,7 @@ static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, con } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 4) { - Standard_Integer IsB = atoi(argv[3]); + Standard_Integer IsB = Draw::Atoi(argv[3]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def02) @@ -840,7 +839,7 @@ static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, con } Standard_Real delt = 5.0*Precision::Confusion(); - Standard_Real mesh_delt = atof(argv[2]); + Standard_Real mesh_delt = Draw::Atof(argv[2]); if (mesh_delt <= 0.0) { di<<"Error: mesh_delta must be positive value"<<"\n"; @@ -1050,7 +1049,7 @@ static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, con if (err) { char astr[80]; - sprintf(astr,"e_%d",l); + Sprintf(astr,"e_%d",l); DBRep::Set(astr,commonShape); } } diff --git a/src/QABugs/QABugs_14.cxx b/src/QABugs/QABugs_14.cxx index 448917e63a..08e57ddde0 100644 --- a/src/QABugs/QABugs_14.cxx +++ b/src/QABugs/QABugs_14.cxx @@ -74,7 +74,7 @@ static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc* Standard_Character abuf[16]; Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(100, 0), gp_Dir2d(-1, 0)); - sprintf(abuf,"line"); + Sprintf(abuf,"line"); Standard_CString st = abuf; DrawTrSurf::Set (st, aLine); @@ -83,7 +83,7 @@ static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc* aPoints.SetValue(2, gp_Pnt2d(50, 50)); aPoints.SetValue(3, gp_Pnt2d(0, 100)); Handle(Geom2d_BezierCurve) aCurve = new Geom2d_BezierCurve(aPoints); - sprintf(abuf,"curve"); + Sprintf(abuf,"curve"); DrawTrSurf::Set (st, aCurve); Geom2dAdaptor_Curve aCLine(aLine); @@ -107,7 +107,7 @@ static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc* di << "\n" << "tangency1 : X " << aPnt2d1.X() << " Y " << aPnt2d1.Y(); di << "\n" << "tangency2 : X " << aPnt2d2.X() << " Y " << aPnt2d2.Y() << "\n"; - sprintf(abuf,"circle_%d",i); + Sprintf(abuf,"circle_%d",i); Handle(Geom2d_Curve) circ_res = new Geom2d_Circle(aCirc2d); DrawTrSurf::Set (st, circ_res); } @@ -137,7 +137,7 @@ static Standard_Integer BUC60889 (Draw_Interpretor& di, Standard_Integer argc, c BRepAdaptor_Curve curve(ed); gp_Dir d = curve.Line().Direction(); Bnd_Box bnd_box; - bnd_box.Update(atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7]), atof(argv[8]), atof(argv[9])); + bnd_box.Update(Draw::Atof(argv[4]), Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7]), Draw::Atof(argv[8]), Draw::Atof(argv[9])); if(bnd_box.IsOut(p1, p2, d)) di << "The band lies out of the box" << "\n"; else @@ -159,7 +159,7 @@ static Standard_Integer BUC60852 (Draw_Interpretor& di, Standard_Integer argc, c BRepAdaptor_Curve curve(shape); gp_Lin lin = curve.Line(); Bnd_Box bnd_box; - bnd_box.Update(atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7])); + bnd_box.Update(Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7])); if(bnd_box.IsOut(lin)) di << "Line that lies on edge does not intersect the box" << "\n"; else @@ -278,11 +278,11 @@ static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, c } const char *ns1 = (argv[2]), *ns2 = (argv[3]), *ns0 = (argv[1]); TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ; - Standard_Real dev = atof(argv[4]); + Standard_Real dev = Draw::Atof(argv[4]); BRepExtrema_DistShapeShape dst(S1 ,S2, dev ); if (dst.IsDone()) { char named[100]; - sprintf(named, "%s%s" ,ns0,"_val"); + Sprintf(named, "%s%s" ,ns0,"_val"); char* tempd = named; Draw::Set(tempd,dst.Value()); di << named << " "; @@ -294,9 +294,9 @@ static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, c TopoDS_Vertex V =BRepLib_MakeVertex(P1); char namev[100]; if (i1==1) { - sprintf(namev, "%s" ,ns0); + Sprintf(namev, "%s" ,ns0); } else { - sprintf(namev, "%s%d" ,ns0,i1); + Sprintf(namev, "%s%d" ,ns0,i1); } char* tempv = namev; DBRep::Set(tempv,V); @@ -305,9 +305,9 @@ static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, c char name[100]; TopoDS_Edge E = BRepLib_MakeEdge (P1, P2); if (i1==1) { - sprintf(name,"%s",ns0); + Sprintf(name,"%s",ns0); } else { - sprintf(name,"%s%d",ns0,i1); + Sprintf(name,"%s%d",ns0,i1); } char* temp = name; DBRep::Set(temp,E); @@ -573,7 +573,7 @@ static Standard_Integer BUC60924 (Draw_Interpretor& di, Standard_Integer argc, c return 1; } - gp_XYZ aVec(atof(argv[2]),atof(argv[3]),atof(argv[4])); + gp_XYZ aVec(Draw::Atof(argv[2]),Draw::Atof(argv[3]),Draw::Atof(argv[4])); Standard_Boolean isPlanar=Standard_False; isPlanar=ShapeAnalysis_Curve::IsPlanar(aCurve,aVec,1e-7); @@ -702,7 +702,7 @@ static Standard_Integer OCC984 (Draw_Interpretor& di, Standard_Integer argc, co LDOM_Document myDOM; //Standard_Character *File = new Standard_Character [100]; - //sprintf(File,"%s",argv[1]); + //Sprintf(File,"%s",argv[1]); const char *File = (argv[1]); if(!aParser.parse(File)) { @@ -728,7 +728,7 @@ static Standard_Integer OCC1786 (Draw_Interpretor& di, Standard_Integer argc, co cerr << "use 'vinit' command before " << argv[0] << "\n"; return 1; } - Standard_Integer AutoHilightInteger = atoi(argv[1]); + Standard_Integer AutoHilightInteger = Draw::Atoi(argv[1]); Standard_Boolean AutoHilightBoolean = Standard_False; if (AutoHilightInteger != 0) { AutoHilightBoolean = Standard_True; @@ -859,7 +859,7 @@ static Standard_Integer OCC1919_real (Draw_Interpretor& di, Standard_Integer arg TDF_Label L; DDF::AddLabel(DF, argv[2], L); - //TDataStd_Real::Set(L,atof(arg[3])); + //TDataStd_Real::Set(L,Draw::Atof(arg[3])); TCollection_AsciiString AsciiStringReal(argv[3]); if (!AsciiStringReal.IsRealValue()) return 1; Standard_Real aReal = AsciiStringReal.RealValue(); @@ -914,7 +914,7 @@ static Standard_Integer OCC2932_SetTag (Draw_Interpretor& di, Standard_Integer a if (!DDF::GetDF(argv[1],DF)) return 1; TDF_Label L; DDF::AddLabel(DF, argv[2], L); - Standard_Integer Tag = atoi(argv[3]); + Standard_Integer Tag = Draw::Atoi(argv[3]); Handle(TDF_TagSource) A = TDF_TagSource::Set(L); A->Set(Tag); return 0; @@ -1001,12 +1001,12 @@ static Standard_Integer OCC6794 (Draw_Interpretor& di, Standard_Integer argc, co Standard_Integer aNb = 1; if ( max ) - aNb += atoi( max ); + aNb += Draw::Atoi( max ); else aNb += 40000; if ( argc > 1 ) - aNb = atoi( argv[1] ); + aNb = Draw::Atoi( argv[1] ); di << "Use nb = " << aNb << "\n"; diff --git a/src/QABugs/QABugs_15.cxx b/src/QABugs/QABugs_15.cxx index 6185371019..2945bca2ef 100755 --- a/src/QABugs/QABugs_15.cxx +++ b/src/QABugs/QABugs_15.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -46,14 +45,14 @@ static Standard_Integer BUC60720 (Draw_Interpretor& di,Standard_Integer argc,con di << "Usage : " << argv[0] << " 0/1" << "\n"; } - if(atoi(argv[1]) == 0) { + if(Draw::Atoi(argv[1]) == 0) { if ( theObject1.IsNull() ) { theObject1 = new QABugs_PresentableObject(); theObject1->SetDisplayMode(0); myAISContext->Display(theObject1); } - } else if(atoi(argv[1]) == 1) { + } else if(Draw::Atoi(argv[1]) == 1) { if ( theObject2.IsNull() ) { theObject2 = new QABugs_PresentableObject(); diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx index 350d3bc194..29246b5926 100755 --- a/src/QABugs/QABugs_16.cxx +++ b/src/QABugs/QABugs_16.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -252,10 +251,10 @@ static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, c TCollection_ExtendedString aText(argv[5]); //Standard_ExtString ExtString_aText = aText.ToExtString(); - //di << ExtString_aText << " " << atof(argv[4]) << "\n"; - di << argv[5] << " " << atof(argv[4]) << "\n"; + //di << ExtString_aText << " " << Draw::Atof(argv[4]) << "\n"; + di << argv[5] << " " << Draw::Atof(argv[4]) << "\n"; - Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, atof(argv[4]), aText); + Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, Draw::Atof(argv[4]), aText); aContext->Display(aDim); return 0; @@ -535,7 +534,7 @@ static Standard_Integer OCC252 (Draw_Interpretor& di, Standard_Integer argc, con //QAModTopOpe_ModeOfLimitation ModeOfLimitation = QAModTopOpe_Forward; QANewModTopOpe_ModeOfLimitation ModeOfLimitation = QANewModTopOpe_Forward; if(argc==5) { - Standard_Integer ModeOfLimitationInteger = atoi(argv[4]); + Standard_Integer ModeOfLimitationInteger = Draw::Atoi(argv[4]); if(!(ModeOfLimitationInteger == 0 || ModeOfLimitationInteger == 1 || ModeOfLimitationInteger == 2)) { di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n"; return 1; @@ -571,7 +570,7 @@ static Standard_Integer OCC307 (Draw_Interpretor& di, Standard_Integer argc, con Standard_Boolean AllowCutting = Standard_False; if(argc==5) { - Standard_Integer AllowCuttingInteger = atoi(argv[4]); + Standard_Integer AllowCuttingInteger = Draw::Atoi(argv[4]); if(!( AllowCuttingInteger == 0 || AllowCuttingInteger == 1)) { di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n"; return 1; @@ -651,13 +650,13 @@ static Standard_Integer OCC394 (Draw_Interpretor& di, Standard_Integer argc, con Standard_Integer mode = 2; Standard_Real tolang = M_PI/2; if(argc > k) - tol = atof(argv[k++]); + tol = Draw::Atof(argv[k++]); if(argc > k) - mode= atoi(argv[k++]); + mode= Draw::Atoi(argv[k++]); if(argc > k) - tolang = atof(argv[k++]); + tolang = Draw::Atof(argv[k++]); Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe(); @@ -693,10 +692,10 @@ static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, con return 1; } - Standard_Real X = atof(argv[1]); - Standard_Real Y = atof(argv[2]); - Standard_Real Z = atof(argv[3]); - Standard_Real ArrowSize = atof(argv[4]); + Standard_Real X = Draw::Atof(argv[1]); + Standard_Real Y = Draw::Atof(argv[2]); + Standard_Real Z = Draw::Atof(argv[3]); + Standard_Real ArrowSize = Draw::Atof(argv[4]); gp_Pnt p1 = gp_Pnt(10.,10.,0.); gp_Pnt p2 = gp_Pnt(50.,10.,0.); @@ -757,10 +756,10 @@ static Standard_Integer OCC60 (Draw_Interpretor& di, Standard_Integer argc, cons return 1; } - Standard_Integer xmin = atoi(argv[1]); - Standard_Integer ymin = atoi(argv[2]); - Standard_Integer xmax = atoi(argv[3]); - Standard_Integer ymax = atoi(argv[4]); + Standard_Integer xmin = Draw::Atoi(argv[1]); + Standard_Integer ymin = Draw::Atoi(argv[2]); + Standard_Integer xmax = Draw::Atoi(argv[3]); + Standard_Integer ymax = Draw::Atoi(argv[4]); Handle(V3d_View) V3dView = ViewerTest::CurrentView(); @@ -790,7 +789,7 @@ static Standard_Integer OCC70 (Draw_Interpretor& di, Standard_Integer argc, cons TColgp_Array1OfPnt2d Polyline(1,np); j = 1; for (i = 1; i <= np; i++) { - Polyline(i) = gp_Pnt2d(atof(argv[j]), atof(argv[j+1])); + Polyline(i) = gp_Pnt2d(Draw::Atof(argv[j]), Draw::Atof(argv[j+1])); j += 2; } @@ -845,7 +844,7 @@ static Standard_Integer OCC904 (Draw_Interpretor& di, Standard_Integer argc, con di << " Shape is null" << "\n"; return 1; } - Standard_Boolean nonmanifmode = (atoi(argv[3]) != 0); + Standard_Boolean nonmanifmode = (Draw::Atoi(argv[3]) != 0); Handle(ShapeFix_Shell) SFSh = new ShapeFix_Shell; SFSh->FixFaceOrientation(TopoDS::Shell(S),Standard_True,nonmanifmode); DBRep::Set(argv[1],SFSh->Shape()); diff --git a/src/QABugs/QABugs_17.cxx b/src/QABugs/QABugs_17.cxx index 04b03479f7..649e5a4e44 100755 --- a/src/QABugs/QABugs_17.cxx +++ b/src/QABugs/QABugs_17.cxx @@ -22,6 +22,7 @@ #include +#include #include #include #include @@ -94,7 +95,7 @@ static Standard_Integer BUC60842 (Draw_Interpretor& di, Standard_Integer /*argc* gp_Pln pln = plne->Pln(); Handle(Geom2d_Curve) curve2d = GeomAPI::To2d (ell, pln); - sprintf(abuf,"ell"); + Sprintf(abuf,"ell"); DrawTrSurf::Set(st,curve2d); if(!aContext.IsNull()) { Handle(AIS_Shape) aisp = @@ -103,7 +104,7 @@ static Standard_Integer BUC60842 (Draw_Interpretor& di, Standard_Integer /*argc* } Handle(Geom2d_Curve) fromcurve2d = GeomAPI::To2d (cir, pln); - sprintf(abuf,"cil"); + Sprintf(abuf,"cil"); DrawTrSurf::Set(st,fromcurve2d); if(!aContext.IsNull()) { Handle(AIS_Shape) aisp = @@ -117,7 +118,7 @@ static Standard_Integer BUC60842 (Draw_Interpretor& di, Standard_Integer /*argc* Geom2dGcc_Lin2d2Tan lintan (qcur, qfromcur, 0.1, 0.0, 0.0); Standard_Integer i=0; for(i=0;i= 5) - par1 = atof(argv[4]); + par1 = Draw::Atof(argv[4]); if (argc == 6) - par2 = atof(argv[5]); + par2 = Draw::Atof(argv[5]); if (argc == 7) - tol = atof(argv[6]); + tol = Draw::Atof(argv[6]); Handle(Geom2d_Curve) aCur2d1 = DrawTrSurf::GetCurve2d(argv[2]); Handle(Geom2d_Curve) aCur2d2 = DrawTrSurf::GetCurve2d(argv[3]); if (aCur2d1.IsNull() || aCur2d2.IsNull()) { @@ -154,7 +155,7 @@ static Standard_Integer BUC60843 (Draw_Interpretor& di, Standard_Integer argc,co Handle(Geom2d_Circle) aCir2d = Handle(Geom2d_Circle)::DownCast(aCur2d1); if (!aCir2d.IsNull()) { c1IsCircle = Standard_True; - if (argc == 6) tol = atof(argv[5]); + if (argc == 6) tol = Draw::Atof(argv[5]); } if(c1IsCircle) { Geom2dAdaptor_Curve acur(aCur2d2); @@ -431,13 +432,13 @@ static Standard_Integer BUC60821(Draw_Interpretor& di, Standard_Integer argc,con return -1; } - Handle(QABugs_MyText) txt1 = new QABugs_MyText("Gosha1",gp_Pnt(0,0,0),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_RED,atoi(argv[1])); + Handle(QABugs_MyText) txt1 = new QABugs_MyText("Gosha1",gp_Pnt(0,0,0),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_RED,Draw::Atoi(argv[1])); aContext->Display(txt1); - Handle(QABugs_MyText) txt2 = new QABugs_MyText("Gosha2",gp_Pnt(0,0,100),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_YELLOW,atoi(argv[2])); + Handle(QABugs_MyText) txt2 = new QABugs_MyText("Gosha2",gp_Pnt(0,0,100),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_YELLOW,Draw::Atoi(argv[2])); aContext->Display(txt2); - Handle(QABugs_MyText) txt3 = new QABugs_MyText("Gosha3",gp_Pnt(0,100,100),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_SKYBLUE,atoi(argv[3])); + Handle(QABugs_MyText) txt3 = new QABugs_MyText("Gosha3",gp_Pnt(0,100,100),Font_NOF_ASCII_SIMPLEX,Quantity_NOC_SKYBLUE,Draw::Atoi(argv[3])); aContext->Display(txt3); return 0; @@ -507,7 +508,7 @@ static Standard_Integer OCC353 (Draw_Interpretor& di, Standard_Integer , const c res = sol.NbSolutions(); for(Standard_Integer i=1;i<=res;i++) { Handle(Geom2d_Circle) aC = new Geom2d_Circle(sol.ThisSolution(i)); - sprintf(buf,"Result_%d",i); + Sprintf(buf,"Result_%d",i); st = buf; DrawTrSurf::Set(st,aC); } @@ -535,14 +536,14 @@ static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, con return 1; } - Standard_Integer HLR = atoi(argv[1]); + Standard_Integer HLR = Draw::Atoi(argv[1]); if (HLR != 0) { HLR = 1; } Handle(V3d_View) anOldView = ViewerTest::CurrentView(); Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext(); - if (atoi (argv[2])) + if (Draw::Atoi (argv[2])) { aViewer->SetDefaultSurfaceDetail (V3d_TEX_ALL); } @@ -901,8 +902,8 @@ static Standard_Integer UPDATEVOL(Draw_Interpretor& di, TopoDS_Shape aLocalEdge(DBRep::Get(a[1],TopAbs_EDGE)); TopoDS_Edge E = TopoDS::Edge(aLocalEdge); for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){ - Par = atof(a[2*ii]); - Rad = atof(a[2*ii + 1]); + Par = Draw::Atof(a[2*ii]); + Rad = Draw::Atof(a[2*ii + 1]); uandr.ChangeValue(ii).SetCoord(Par,Rad); } //HELPDESK: Add law creation @@ -1018,8 +1019,8 @@ static Standard_Integer OCC813 (Draw_Interpretor& di, Standard_Integer argc,cons } Standard_CString str; - Standard_Real U = atof(argv[1]); - Standard_Real V = atof(argv[2]); + Standard_Real U = Draw::Atof(argv[1]); + Standard_Real V = Draw::Atof(argv[2]); //Between ellipse and point: @@ -1057,7 +1058,7 @@ static Standard_Integer OCC813 (Draw_Interpretor& di, Standard_Integer argc,cons Standard_Integer i; for(i=1;i<=lintan.NbSolutions();i++) { - sprintf(abuf,"lintan_%d",i); + Sprintf(abuf,"lintan_%d",i); Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i)); DrawTrSurf::Set(st,glin); if(!aContext.IsNull()) { @@ -1128,7 +1129,7 @@ static Standard_Integer OCC814 (Draw_Interpretor& di, Standard_Integer argc,cons Standard_Integer i; for(i=1;i<=lintan.NbSolutions();i++) { - sprintf(abuf,"lintan_%d",i); + Sprintf(abuf,"lintan_%d",i); Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i)); DrawTrSurf::Set(st,glin); if(!aContext.IsNull()) { @@ -1204,7 +1205,7 @@ static Standard_Integer OCC884 (Draw_Interpretor& di, Standard_Integer argc, con { gp_Pnt pt = points3d(i); di << "Info: Intersecting pt : (" << pt.X() << ", " << pt.Y() << ", " << pt.Z() << ")\n"; - sprintf(str,"p_%d",i); + Sprintf(str,"p_%d",i); DrawTrSurf::Set(name,pt); } @@ -1212,8 +1213,8 @@ static Standard_Integer OCC884 (Draw_Interpretor& di, Standard_Integer argc, con sfw->Load(wire); sfw->SetFace(face); - if (argc > 3) sfw->SetPrecision(atof(argv[3])/*0.1*/); - if (argc > 4) sfw->SetMaxTolerance(atof(argv[4])); + if (argc > 3) sfw->SetPrecision(Draw::Atof(argv[3])/*0.1*/); + if (argc > 4) sfw->SetMaxTolerance(Draw::Atof(argv[4])); di << "Info: Precision is set to " << sfw->Precision() << "\n"; di << "Info: MaxTolerance is set to " << sfw->MaxTolerance() << "\n"; @@ -1443,9 +1444,9 @@ static Standard_Integer OCCN1 (Draw_Interpretor& di, Standard_Integer argc, cons di << "use 'vinit' command before " << argv[0] << "\n"; return 1; } - Standard_Real angle = atof(argv[1]); - Standard_Integer fuse = atoi(argv[2]); - Standard_Real length = atof(argv[3]); + Standard_Real angle = Draw::Atof(argv[1]); + Standard_Integer fuse = Draw::Atoi(argv[2]); + Standard_Real length = Draw::Atof(argv[3]); BRepBuilderAPI_MakeEdge edge1(gp_Pnt(0, 0, 0), gp_Pnt(50, 0, 0)); BRepBuilderAPI_MakeEdge edge2(gp_Pnt(50, 0, 0), gp_Pnt(50, 50, 0)); @@ -1499,7 +1500,7 @@ static Standard_Integer OCCN2 (Draw_Interpretor& di, Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 2) { - Standard_Integer IsB = atoi(argv[1]); + Standard_Integer IsB = Draw::Atoi(argv[1]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def04) @@ -1565,7 +1566,7 @@ static Standard_Integer OCC2569 (Draw_Interpretor& di, Standard_Integer argc, co return 1; } - int poles=atoi(argv[1]); + int poles=Draw::Atoi(argv[1]); TColgp_Array1OfPnt arr(1, poles); for(int i=1; i<=poles; i++) diff --git a/src/QABugs/QABugs_18.cxx b/src/QABugs/QABugs_18.cxx index 6fd759ab00..16c7399a54 100755 --- a/src/QABugs/QABugs_18.cxx +++ b/src/QABugs/QABugs_18.cxx @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -131,7 +132,7 @@ static Standard_Integer OCC181 (Draw_Interpretor& di, Standard_Integer argc, con Standard_CString aFileName = argv[1]; Standard_CString aDir1 = argv[2]; Standard_CString aDir2 = argv[3]; - Standard_Integer verboseInt = atoi(argv[4]); + Standard_Integer verboseInt = Draw::Atoi(argv[4]); Standard_Boolean verboseBool = Standard_False; if (verboseInt != 0) { @@ -180,11 +181,11 @@ static Standard_Integer OCC367 (Draw_Interpretor& di, Standard_Integer argc, con } TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1])); - Standard_Real l = atof(argv[2]); - Standard_Real goodX = atof(argv[3]); - Standard_Real goodY = atof(argv[4]); - Standard_Real goodZ = atof(argv[5]); - Standard_Real percent = atof(argv[6]); + Standard_Real l = Draw::Atof(argv[2]); + Standard_Real goodX = Draw::Atof(argv[3]); + Standard_Real goodY = Draw::Atof(argv[4]); + Standard_Real goodZ = Draw::Atof(argv[5]); + Standard_Real percent = Draw::Atof(argv[6]); Standard_Boolean Status = Standard_False; // Find the first vertex of the wire diff --git a/src/QABugs/QABugs_2.cxx b/src/QABugs/QABugs_2.cxx index 637f31b617..001715e0e0 100755 --- a/src/QABugs/QABugs_2.cxx +++ b/src/QABugs/QABugs_2.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -60,7 +59,7 @@ static Standard_Integer OCC527(Draw_Interpretor& di, Standard_Integer argc, cons } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 3) { - Standard_Integer IsB = atoi(argv[2]); + Standard_Integer IsB = Draw::Atoi(argv[2]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; //#if ! defined(BRepAlgo_def04) @@ -76,13 +75,13 @@ static Standard_Integer OCC527(Draw_Interpretor& di, Standard_Integer argc, cons // 3. Explode entry shape on faces and build sections from Zmin to Zmax with step aStep const Standard_Real Zmin = -40.228173882121, Zmax = 96.408126285268, aStep = 1.0; - char str[100]; str[0] = 0; sprintf(str,"Test range: [%f, %f] with step %f\n",Zmin,Zmax,aStep); di << str; + char str[100]; str[0] = 0; Sprintf(str,"Test range: [%f, %f] with step %f\n",Zmin,Zmax,aStep); di << str; int nbf = 0; TopExp_Explorer aExp1; for (aExp1.Init(aShape,TopAbs_FACE); aExp1.More(); aExp1.Next()) { // Process one face - str[0] = 0; sprintf(str,"Face #%d: \t",nbf++); di << str; + str[0] = 0; Sprintf(str,"Face #%d: \t",nbf++); di << str; TopoDS_Face aFace = TopoDS::Face(aExp1.Current()); // Build BndBox in order to avoid try of building section @@ -150,15 +149,15 @@ static Standard_Integer OCC527(Draw_Interpretor& di, Standard_Integer argc, cons // if (wasBuilt) // { // if(gmaxdist > Precision::Confusion()) -// sprintf(str,"Dist=%f, Param=%f FAULTY\n",gmaxdist,gzmax); +// Sprintf(str,"Dist=%f, Param=%f FAULTY\n",gmaxdist,gzmax); // else -// sprintf(str,"Dist=%f, Param=%f\n",gmaxdist,gzmax); +// Sprintf(str,"Dist=%f, Param=%f\n",gmaxdist,gzmax); if(dist > toler) - sprintf(str,"Dist=%f, Toler=%f, Param=%f FAULTY\n",dist,toler,gzmax); + Sprintf(str,"Dist=%f, Toler=%f, Param=%f FAULTY\n",dist,toler,gzmax); else - sprintf(str,"Dist=%f, Toler=%f, Param=%f\n",dist,toler,gzmax); + Sprintf(str,"Dist=%f, Toler=%f, Param=%f\n",dist,toler,gzmax); // } -// else sprintf(str,"No result\n"); +// else Sprintf(str,"No result\n"); di << str; } if (lmaxdist > gmaxdist) diff --git a/src/QABugs/QABugs_3.cxx b/src/QABugs/QABugs_3.cxx index 6184282bc9..0624b61dba 100644 --- a/src/QABugs/QABugs_3.cxx +++ b/src/QABugs/QABugs_3.cxx @@ -22,17 +22,18 @@ #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a) { @@ -219,12 +220,12 @@ static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** a di << "U=" << 1.28 << " V=" << 5.1 << " classified OUTSIDE" << "\n"; } } else { - uvSurf = gp_Pnt2d(atof(argv[3]),atof(argv[4])); + uvSurf = gp_Pnt2d(Draw::Atof(argv[3]),Draw::Atof(argv[4])); state = PClass.Classify(face,uvSurf,Precision::PConfusion()); if(state == TopAbs_IN || state == TopAbs_ON){ - di << "U=" << atof(argv[3]) << " V=" << atof(argv[4]) << " classified INSIDE" << "\n"; + di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified INSIDE" << "\n"; }else{ - di << "U=" << atof(argv[3]) << " V=" << atof(argv[4]) << " classified OUTSIDE" << "\n"; + di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified OUTSIDE" << "\n"; } } return 0; @@ -335,7 +336,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 6) { - Standard_Integer IsB = atoi(argv[5]); + Standard_Integer IsB = Draw::Atoi(argv[5]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def04) @@ -375,7 +376,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a #endif Standard_Character *filename = new Standard_Character [strlen(DD)+17]; - sprintf(filename,"%s/%s.topo",DD,argv[1]); + Sprintf(filename,"%s/%s.topo",DD,argv[1]); filebuf fic; istream in(&fic); @@ -497,24 +498,24 @@ static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** a TopoDS_Shape free_1,free_2,free_3,free_4; BRep_Builder B; - sprintf(FileName,"%s/%s",DD,"buc60547a.brep"); + Sprintf(FileName,"%s/%s",DD,"buc60547a.brep"); BRepTools::Read(free_1,FileName,B); - sprintf(FileName,"%s/%s",DD,"buc60547b.brep"); + Sprintf(FileName,"%s/%s",DD,"buc60547b.brep"); BRepTools::Read(free_2,FileName,B); - sprintf(FileName,"%s/%s",DD,"buc60547c.brep"); + Sprintf(FileName,"%s/%s",DD,"buc60547c.brep"); BRepTools::Read(free_3,FileName,B); - sprintf(FileName,"%s/%s",DD,"buc60547d.brep"); + Sprintf(FileName,"%s/%s",DD,"buc60547d.brep"); BRepTools::Read(free_4,FileName,B); - sprintf(Ch,"%s_%i",argv[1],1); + Sprintf(Ch,"%s_%i",argv[1],1); DBRep::Set(Ch,free_1); di << Ch << " "; - sprintf(Ch,"%s_%i",argv[1],2); + Sprintf(Ch,"%s_%i",argv[1],2); DBRep::Set(Ch,free_2); di << Ch << " "; - sprintf(Ch,"%s_%i",argv[1],3); + Sprintf(Ch,"%s_%i",argv[1],3); DBRep::Set(Ch,free_3); di << Ch << " "; - sprintf(Ch,"%s_%i",argv[1],4); + Sprintf(Ch,"%s_%i",argv[1],4); DBRep::Set(Ch,free_4); di << Ch << " "; @@ -540,14 +541,14 @@ static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** a bui.Add(Com,free_3); bui.Add(Com,free_4); - sprintf(Ch,"%s_%c",argv[1],'c'); + Sprintf(Ch,"%s_%c",argv[1],'c'); DBRep::Set(Ch,Com); di << Ch << " "; Handle(AIS_Shape) SC = new AIS_Shape(Com); myAISContext->Display(SC); // nothing on the screen If I save the compound : - sprintf(FileName,"%s/%s",DD,"free.brep"); + Sprintf(FileName,"%s/%s",DD,"free.brep"); BRepTools::Write(Com,FileName); @@ -582,9 +583,9 @@ static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, c Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1)); TCollection_ExtendedString Ext1("Dim1"); - Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1); + Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,Draw::Atof(a[2]),Ext1); - myAIScontext->SetDisplayMode(Dim1, atoi(a[1])); + myAIScontext->SetDisplayMode(Dim1, Draw::Atoi(a[1])); myAIScontext->Display(Dim1); return 0; } @@ -632,10 +633,10 @@ Standard_Integer ksection(Draw_Interpretor& di, Standard_Integer n, const char * TopoDS_Shape s1 = DBRep::Get(a[2],TopAbs_SHELL); TopoDS_Shape s2 = DBRep::Get(a[3],TopAbs_SHELL); if (s1.IsNull() || s2.IsNull()) return 1; - NbPntMax=atoi(a[4]); - Toler3d=atof(a[5]); - Toler2d=atof(a[6]); - RelativeTol=atoi(a[7]); + NbPntMax=Draw::Atoi(a[4]); + Toler3d=Draw::Atof(a[5]); + Toler2d=Draw::Atof(a[6]); + RelativeTol=Draw::Atoi(a[7]); di << "BRepAlgo_BooleanOperations myalgo" << "\n"; BRepAlgo_BooleanOperations myalgo; @@ -693,7 +694,7 @@ static Standard_Integer BUC60698(Draw_Interpretor& di, Standard_Integer argc, co } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 2) { - Standard_Integer IsB = atoi(a[1]); + Standard_Integer IsB = Draw::Atoi(a[1]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -819,7 +820,7 @@ static Standard_Integer GER61394(Draw_Interpretor& di, Standard_Integer argc, co } Handle(V3d_View) myV3dView = ViewerTest::CurrentView(); - if((argc == 2) && (atof(argv[1]) == 0)) + if((argc == 2) && (Draw::Atof(argv[1]) == 0)) myV3dView->SetAntialiasingOff(); else myV3dView->SetAntialiasingOn(); @@ -899,9 +900,9 @@ switch (argc){ // Change the background color of the view with the color values ,, // A color value must be defined in the space [0.,1.] - Standard_Real QuantityOfRed = atoi(argv[1]); - Standard_Real QuantityOfGreen = atoi(argv[2]); - Standard_Real QuantityOfBlue = atoi(argv[3]); + Standard_Real QuantityOfRed = Draw::Atoi(argv[1]); + Standard_Real QuantityOfGreen = Draw::Atoi(argv[2]); + Standard_Real QuantityOfBlue = Draw::Atoi(argv[3]); myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue); myV3dView->Redraw(); break; @@ -915,9 +916,9 @@ switch (argc){ // change the object color with RGB values. - Standard_Real QuantityOfRed = atof(argv[2]); - Standard_Real QuantityOfGreen = atof(argv[3]); - Standard_Real QuantityOfBlue = atof(argv[4]); + Standard_Real QuantityOfRed = Draw::Atof(argv[2]); + Standard_Real QuantityOfGreen = Draw::Atof(argv[3]); + Standard_Real QuantityOfBlue = Draw::Atof(argv[4]); TopoDS_Shape aShape = DBRep::Get(argv[1]); Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape); @@ -944,16 +945,16 @@ static Standard_Integer BUC60726 (Draw_Interpretor& di,Standard_Integer argc, co di << "Usage : " << argv[0] << " 0/1" << "\n"; } - if(atoi(argv[1]) == 0) { + if(Draw::Atoi(argv[1]) == 0) { myAISContext->CloseAllContexts(); BRepPrimAPI_MakeBox B(gp_Pnt(-400.,-400.,-100.),200.,150.,100.); Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape()); myAISContext->Display(aBox); - } else if(atoi(argv[1]) == 1) { + } else if(Draw::Atoi(argv[1]) == 1) { myAISContext->CloseAllContexts(); myAISContext->OpenLocalContext(); myAISContext->ActivateStandardMode(TopAbs_EDGE); - } else if(atoi(argv[1]) == 2) { + } else if(Draw::Atoi(argv[1]) == 2) { myAISContext->CloseAllContexts(); myAISContext->OpenLocalContext(); myAISContext->ActivateStandardMode(TopAbs_FACE); @@ -1065,7 +1066,7 @@ static Standard_Integer BUC60792(Draw_Interpretor& di, Standard_Integer /*argc*/ gccc = new Geom2d_Circle(ccc); TopoDS_Shape sh = BRepBuilderAPI_MakeEdge(gccc, pln).Shape(); Standard_Character aStr[5]; - sprintf(aStr,"sh%d",i); + Sprintf(aStr,"sh%d",i); DBRep::Set(aStr,sh); Handle_AIS_Shape ais = new AIS_Shape(sh); if( i ==1 ) @@ -1268,7 +1269,7 @@ static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char ** a } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 2) { - Standard_Integer IsB = atoi(argv[1]); + Standard_Integer IsB = Draw::Atoi(argv[1]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -1398,7 +1399,7 @@ static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, file.getline(line,80); for(int i=0;i<30;i++) X[i]=Y[i]=0; fr = sscanf(line,"%20c%20c",&X,&Y); - V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0)); + V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(Draw::Atof(X),Draw::Atof(Y),0.0)); for(;;) { @@ -1406,7 +1407,7 @@ static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, if (!file) break; for(int i=0;i<30;i++) X[i]=Y[i]=0; fr = sscanf(line,"%20c%20c",&X,&Y); - V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0)); + V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(Draw::Atof(X),Draw::Atof(Y),0.0)); Edge = BRepBuilderAPI_MakeEdge(V1,V2); WB.Add(Edge); V1=V2; @@ -1444,7 +1445,7 @@ static Standard_Integer BUC60876_ (Draw_Interpretor& di, TopoDS_Shape aShape = DBRep::Get(argv[1]); Handle(AIS_InteractiveObject) anIO = new AIS_Shape(aShape); // Handle(AIS_InteractiveObject) anIOa = ViewerTest::GetAISShapeFromName(argv[1]); - anIO->SetHilightMode((argc == 3) ? atoi(argv[2]) : 1); + anIO->SetHilightMode((argc == 3) ? Draw::Atoi(argv[2]) : 1); aContext->Display(anIO); return 0; } @@ -1477,7 +1478,7 @@ static int TestCMD(Draw_Interpretor& di, Standard_Integer argc, const char ** ar } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 2) { - Standard_Integer IsB = atoi(argv[1]); + Standard_Integer IsB = Draw::Atoi(argv[1]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -1670,7 +1671,7 @@ static Standard_Integer BUC60841(Draw_Interpretor& di, Standard_Integer argc, co } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 2) { - Standard_Integer IsB = atoi(argv[1]); + Standard_Integer IsB = Draw::Atoi(argv[1]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) @@ -2081,7 +2082,7 @@ static int AISWidth(Draw_Interpretor& di, Standard_Integer argc, const char ** a Handle(TPrsStd_AISPresentation) prs; if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) { if( argc == 4 ) { - prs->SetWidth(atof(argv[3])); + prs->SetWidth(Draw::Atof(argv[3])); TPrsStd_AISViewer::Update(L); } else { @@ -2148,7 +2149,7 @@ static Standard_Integer BUC60951_(Draw_Interpretor& di, Standard_Integer argc, c } Standard_Boolean IsBRepAlgoAPI = Standard_True; if (argc == 3) { - Standard_Integer IsB = atoi(a[2]); + Standard_Integer IsB = Draw::Atoi(a[2]); if (IsB != 1) { IsBRepAlgoAPI = Standard_False; #if ! defined(BRepAlgo_def01) diff --git a/src/QABugs/QABugs_4.cxx b/src/QABugs/QABugs_4.cxx index 08977e54fa..a6b9592738 100755 --- a/src/QABugs/QABugs_4.cxx +++ b/src/QABugs/QABugs_4.cxx @@ -89,7 +89,7 @@ static int BUC60606(Draw_Interpretor& di, Standard_Integer argc, const char ** a // Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY); // Standard_Character *filename = new Standard_Character [strlen(DD)+strlen(argv[2])+1]; -// sprintf(filename,"%s/%s",DD,argv[2]); +// Sprintf(filename,"%s/%s",DD,argv[2]); // satModel->ReadSaveFile(filename); @@ -102,7 +102,7 @@ static int BUC60606(Draw_Interpretor& di, Standard_Integer argc, const char ** a // for(Standard_Integer i=1;i<=nbs;i++) { // TopoDS_Shape xShape = satShapes->Value(i); // if(!xShape.IsNull()) { -// sprintf(Ch,"%s_%i",argv[1],i); +// Sprintf(Ch,"%s_%i",argv[1],i); // DBRep::Set(Ch,xShape); // } else cout << "The shape " << argv[1] << "_" << i << " is NULL !" << endl; // } diff --git a/src/QABugs/QABugs_5.cxx b/src/QABugs/QABugs_5.cxx index b4400685fa..ce778d9347 100755 --- a/src/QABugs/QABugs_5.cxx +++ b/src/QABugs/QABugs_5.cxx @@ -83,7 +83,7 @@ static Standard_Integer OCC6001 (Draw_Interpretor& di, Standard_Integer argc, co di<<"inter "< +#include #include #include #include @@ -47,9 +46,9 @@ static Standard_Integer OCC281bug (Draw_Interpretor& di, Standard_Integer argc, } Standard_Integer x,y,TypeOfMarker; - x = atoi(argv[1]); - y = atoi(argv[2]); - TypeOfMarker = atoi(argv[3]); + x = Draw::Atoi(argv[1]); + y = Draw::Atoi(argv[2]); + TypeOfMarker = Draw::Atoi(argv[3]); if( x <= 0) { di << "Bad value x=" << x << "\n"; return 1; diff --git a/src/QABugs/QABugs_8.cxx b/src/QABugs/QABugs_8.cxx index 8c05282aae..7ccfefe6ed 100755 --- a/src/QABugs/QABugs_8.cxx +++ b/src/QABugs/QABugs_8.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -126,7 +125,7 @@ static Standard_Integer BUC60753 (Draw_Interpretor& di, Standard_Integer argc, c Handle(V3d_View) myV3dView = ViewerTest::CurrentView(); myV3dView->SetAnimationMode(Standard_True,Standard_True); - myAISContext-> SetDegenerateModel((Aspect_TypeOfDegenerateModel) atoi(argv[1]),atof(argv[2])); + myAISContext-> SetDegenerateModel((Aspect_TypeOfDegenerateModel) Draw::Atoi(argv[1]),Draw::Atof(argv[2])); // Timer.Reset (); // Timer.Start (); @@ -194,7 +193,7 @@ static Standard_Integer OCC204 (Draw_Interpretor& di, Standard_Integer argc, co return 1; } Standard_Boolean UpdateViewer = Standard_True; - Standard_Integer IntegerUpdateViewer = atoi(argv[1]); + Standard_Integer IntegerUpdateViewer = Draw::Atoi(argv[1]); if (IntegerUpdateViewer == 0) { UpdateViewer = Standard_False; } @@ -245,8 +244,8 @@ static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, co TopoDS_Shape aShape = DBRep::Get(argv[1]); if (aShape.IsNull()) return 0; - gp_Pnt aP1(atof(argv[2]), atof(argv[3]), atof(argv[4])); - gp_Dir aD1(atof(argv[5]), atof(argv[6]), atof(argv[7])); + gp_Pnt aP1(Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4])); + gp_Dir aD1(Draw::Atof(argv[5]), Draw::Atof(argv[6]), Draw::Atof(argv[7])); gp_Lin aL1(aP1,aD1); BRepClass3d_Intersector3d aI1; aI1.Perform(aL1, -250, 1e-7, TopoDS::Face(aShape)); diff --git a/src/QABugs/QABugs_9.cxx b/src/QABugs/QABugs_9.cxx index b1f6646b28..5dfe86fdf2 100755 --- a/src/QABugs/QABugs_9.cxx +++ b/src/QABugs/QABugs_9.cxx @@ -17,10 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include +#include #include #include #include @@ -117,14 +116,14 @@ static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, con ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS()); while ( it.More() ) { Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1()); - AISObj->SetHilightMode(atoi(argv[1])); + AISObj->SetHilightMode(Draw::Atoi(argv[1])); if(AISObj->HasSelection(4)) { //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4); const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4); if(!aSelection.IsNull()) { for(aSelection->Init();aSelection->More();aSelection->Next()) { Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->OwnerId()); - aO->SetHilightMode(atoi(argv[1])); + aO->SetHilightMode(Draw::Atoi(argv[1])); } } } @@ -145,7 +144,7 @@ static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, c di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]" << "\n"; return 1; } - aContext->SetZDetection(((argc == 1 || (argc == 2 && atoi(argv[1]) == 1)) ? Standard_True : Standard_False)); + aContext->SetZDetection(((argc == 1 || (argc == 2 && Draw::Atoi(argv[1]) == 1)) ? Standard_True : Standard_False)); return 0; } diff --git a/src/QADNaming/QADNaming.cxx b/src/QADNaming/QADNaming.cxx index f0c7ceb3db..af2f76ed8b 100755 --- a/src/QADNaming/QADNaming.cxx +++ b/src/QADNaming/QADNaming.cxx @@ -191,7 +191,7 @@ static Standard_Integer QADNaming_CenterOfShape (Draw_Interpretor& di, } if (all != 0) { char s[100]; - sprintf(s,"%f %f %f",(float)x/all,(float)y/all,(float)z/all); + Sprintf(s,"%f %f %f",(float)x/all,(float)y/all,(float)z/all); di< 3) T = atoi(a[3]); + if (n > 3) T = Draw::Atoi(a[3]); else T = ND->Transaction (); //TNaming_OldShapeIterator it (S, T, US); @@ -95,7 +95,7 @@ static Standard_Integer Ascendants (Draw_Interpretor& di, Standard_Integer n, co TCollection_AsciiString entry; for (;it.More (); it.Next ()) { S = it.Shape (); - sprintf (name,"%s_%s_%d",a[2],"old", i++); + Sprintf (name,"%s_%s_%d",a[2],"old", i++); DBRep::Set (name,it.Shape()); TDF_Label Label = it.Label (); TDF_Tool::Entry(Label,entry); @@ -127,7 +127,7 @@ static Standard_Integer Descendants (Draw_Interpretor& di, Standard_Integer n, c Standard_Integer T; - if (n > 3) T = atoi(a[3]); + if (n > 3) T = Draw::Atoi(a[3]); else T = ND->Transaction (); TNaming_NewShapeIterator it (S, T, ND->Root()); @@ -135,7 +135,7 @@ static Standard_Integer Descendants (Draw_Interpretor& di, Standard_Integer n, c TCollection_AsciiString entry; for (;it.More (); it.Next ()) { S = it.Shape (); - sprintf (name,"%s_%s_%d",a[2],"new", i++); + Sprintf (name,"%s_%s_%d",a[2],"new", i++); DBRep::Set (name,it.Shape ()); TDF_Label Label = it.Label (); TDF_Tool::Entry(Label,entry); @@ -285,7 +285,7 @@ static Standard_Integer Exploreshape (Draw_Interpretor& di, Standard_Integer n, // ND->Root().FindAttribute(TNaming_UsedShapes::GetID(),US); Standard_Integer Trans = ND->Transaction(); - if (n == 5) { Trans = (Standard_Integer ) atof(a[4]);} + if (n == 5) { Trans = (Standard_Integer ) Draw::Atof(a[4]);} TDF_Label Lab; DDF::FindLabel(ND,a[2],Lab); @@ -304,11 +304,11 @@ static Standard_Integer Exploreshape (Draw_Interpretor& di, Standard_Integer n, for (TNaming_Iterator itL(Lab,Trans) ; itL.More(); itL.Next()) { if (!itL.OldShape().IsNull()) { - sprintf(name,"%s%s_%d","old",a[3],NbShapes); + Sprintf(name,"%s%s_%d","old",a[3],NbShapes); DBRep::Set (name,itL.OldShape()); } if (!itL.NewShape().IsNull()) { - sprintf(name,"%s_%d",a[3],NbShapes); + Sprintf(name,"%s_%d",a[3],NbShapes); DBRep::Set (name,itL.NewShape()); } NbShapes++; @@ -393,7 +393,7 @@ static Standard_Integer Collect (Draw_Interpretor& di, if (!DDF::GetDF(arg[1],DF)) return 1; if (!DDF::Find(DF,arg[2],TNaming_NamedShape::GetID(),A)) return 1; if (nb >= 4) { - OnlyModif = atoi(arg[3]); + OnlyModif = Draw::Atoi(arg[3]); } TNaming_Tool::Collect(A,MNS,OnlyModif); for (TNaming_MapIteratorOfMapOfNamedShape it(MNS); it.More(); it.Next()) { diff --git a/src/QADNaming/QADNaming_BuilderCommands.cxx b/src/QADNaming/QADNaming_BuilderCommands.cxx index 75c3977f07..aad9852779 100755 --- a/src/QADNaming/QADNaming_BuilderCommands.cxx +++ b/src/QADNaming/QADNaming_BuilderCommands.cxx @@ -76,7 +76,7 @@ static Standard_Integer BuildNamedShape (Draw_Interpretor& di, } // if (nb >= 4) { -// OnlyModif = atoi(arg[3]); +// OnlyModif = Draw::Atoi(arg[3]); // } } else { di<<"Usage: BuildName df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) shape1 [shape2 ...]"<<"\n"; diff --git a/src/QADNaming/QADNaming_IteratorsCommands.cxx b/src/QADNaming/QADNaming_IteratorsCommands.cxx index 77e1aa373e..785f967102 100755 --- a/src/QADNaming/QADNaming_IteratorsCommands.cxx +++ b/src/QADNaming/QADNaming_IteratorsCommands.cxx @@ -75,7 +75,7 @@ static Standard_Integer GetNewShapes (Draw_Interpretor& di, for(a=1;anIter.More();anIter.Next(),a++) { if (anIter.NewShape().IsNull()) a--; else if (nb==4) { - sprintf(aName,"%s_%d",arg[3],a); + Sprintf(aName,"%s_%d",arg[3],a); DBRep::Set (aName,anIter.NewShape()); } } @@ -105,7 +105,7 @@ static Standard_Integer GetOldShapes (Draw_Interpretor& di, for(a=1;anIter.More();anIter.Next(),a++) { if (anIter.OldShape().IsNull()) a--; else if (nb==4) { - sprintf(aName,"%s_%d",arg[3],a); + Sprintf(aName,"%s_%d",arg[3],a); DBRep::Set (aName,anIter.OldShape()); } } diff --git a/src/QADNaming/QADNaming_SelectionCommands.cxx b/src/QADNaming/QADNaming_SelectionCommands.cxx index cca42fe43e..140c50893c 100755 --- a/src/QADNaming/QADNaming_SelectionCommands.cxx +++ b/src/QADNaming/QADNaming_SelectionCommands.cxx @@ -160,7 +160,7 @@ static Standard_Integer QADNaming_SolveSelection (Draw_Interpretor& di, Standard Standard_Boolean done = SL.Solve(valid); TopoDS_Shape Res = TNaming_Tool::CurrentShape(SL.NamedShape()); //TopoDS_Shape Res = TNaming_Tool::CurrentShape(NS); - sprintf (name,"%s_%s","new",a[2]); + Sprintf (name,"%s_%s","new",a[2]); Display (name,Res); return done?0:1; } diff --git a/src/QADraw/QADraw.cxx b/src/QADraw/QADraw.cxx index 5c26bd66d0..8a97930a80 100755 --- a/src/QADraw/QADraw.cxx +++ b/src/QADraw/QADraw.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -106,7 +107,7 @@ static Standard_Boolean shouldDUP() { "QA_DUP",TCL_GLOBAL_ONLY); #endif Standard_Integer aDUP=1; - if((adup != NULL) && (atof(adup) == 0)) { + if((adup != NULL) && (Draw::Atof(adup) == 0)) { aDUP = 0; } @@ -363,16 +364,16 @@ static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& theDi, anAISWindow->Size (aWindowSizeX, aWindowSizeY); Standard_Integer anArgIter = 1; - const Standard_Integer aPickCoordX = atoi (theArgs[anArgIter++]); - const Standard_Integer aPickCoordY = atoi (theArgs[anArgIter++]); + const Standard_Integer aPickCoordX = Draw::Atoi (theArgs[anArgIter++]); + const Standard_Integer aPickCoordY = Draw::Atoi (theArgs[anArgIter++]); const Standard_Integer aRadius = (theArgsNb == 3) ? 0 : 1; Image_ColorRGBF aColorInput = {{ 0.0f, 0.0f, 0.0f }}; if (theArgsNb == 6) { - aColorInput.r() = (Standard_ShortReal )atof (theArgs[anArgIter++]); - aColorInput.g() = (Standard_ShortReal )atof (theArgs[anArgIter++]); - aColorInput.b() = (Standard_ShortReal )atof (theArgs[anArgIter++]); + aColorInput.r() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); + aColorInput.g() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); + aColorInput.b() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); } Image_PixMap anImage; @@ -495,9 +496,9 @@ static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integ Standard_Integer QAAIS_MousePoint_X = 0; Standard_Integer QAAIS_MousePoint_Y = 0; Standard_Character QAAIS_MousePointX[32]; - sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X); + Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X); Standard_Character QAAIS_MousePointY[32]; - sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y); + Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y); Standard_ShortReal QAAIS_ColorRED = 0; Standard_ShortReal QAAIS_ColorGRN = 0; Standard_ShortReal QAAIS_ColorBLU = 0; @@ -524,8 +525,8 @@ static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integ QAAIS_ColorView -> SetBackgroundColor (QAAIS_ShowingColor); QAAIS_ColorView -> Redraw (); QAAIS_CoordWindow.Clear(); - sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X); - sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y); + Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X); + Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y); QAAIS_CoordWindow.DrawString (30, 35, QAAIS_MousePointX); QAAIS_CoordWindow.DrawString (125, 35, QAAIS_MousePointY); } @@ -628,7 +629,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di, static Standard_Integer ViewId(const Standard_CString a) { - Standard_Integer id = atoi(a); + Standard_Integer id = Draw::Atoi(a); if ((id < 0) || (id >= MAXVIEW)) { cout << "Incorrect view-id, must be in 0.."< + +#include #include #include -// HashCode and IsEquel must be defined for key types of maps -Standard_Integer HashCode(const gp_Pnt thePnt, - int theUpper) +// HashCode and IsEquel must be defined for key types of maps +Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper) { return HashCode(thePnt.X(),theUpper); } @@ -57,8 +56,8 @@ Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, co di << "Usage : " << argv[0] << " Lower Upper" << "\n"; return 1; } - Lower = atoi(argv[1]); - Upper = atoi(argv[2]); + Lower = Draw::Atoi(argv[1]); + Upper = Draw::Atoi(argv[2]); if ( Lower > Upper ) { di << "Lower > Upper" << "\n"; return 1; @@ -76,10 +75,10 @@ Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, co di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n"; return 1; } - LowerRow = atoi(argv[1]); - UpperRow = atoi(argv[2]); - LowerCol = atoi(argv[3]); - UpperCol = atoi(argv[4]); + LowerRow = Draw::Atoi(argv[1]); + UpperRow = Draw::Atoi(argv[2]); + LowerCol = Draw::Atoi(argv[3]); + UpperCol = Draw::Atoi(argv[4]); if ( LowerRow > UpperRow ) { di << "LowerRow > UpperRow" << "\n"; return 1; diff --git a/src/QANCollection/QANCollection3.cxx b/src/QANCollection/QANCollection3.cxx index 04b281b6d5..5d7ce9e5b0 100755 --- a/src/QANCollection/QANCollection3.cxx +++ b/src/QANCollection/QANCollection3.cxx @@ -17,9 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include + +#include #include #define ItemType gp_Pnt @@ -45,8 +45,8 @@ Standard_Integer CheckArguments(Draw_Interpretor& di, Standard_Integer argc, con di << "Usage : " << argv[0] << " Repeat Size" << "\n"; return 1; } - Repeat = atoi(argv[1]); - Size = atoi(argv[2]); + Repeat = Draw::Atoi(argv[1]); + Size = Draw::Atoi(argv[2]); if ( Repeat < 1 ) { di << "Repeat > 0" << "\n"; return 1; diff --git a/src/QANewDBRepNaming/QANewDBRepNaming.cxx b/src/QANewDBRepNaming/QANewDBRepNaming.cxx index 64c16f41ec..a2c33fa3b0 100755 --- a/src/QANewDBRepNaming/QANewDBRepNaming.cxx +++ b/src/QANewDBRepNaming/QANewDBRepNaming.cxx @@ -189,14 +189,14 @@ static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor& di,Standa // *** - if (!atoi(a[3])) return 0; + if (!Draw::Atoi(a[3])) return 0; Standard_Real aDX = 100.0; Standard_Real aDY = 100.0; Standard_Real aDZ = 100.0; if(nb > 6) { - aDX = atof(a[6]); - if(nb > 7) aDY = atof(a[7]); - if(nb > 8) aDZ = atof(a[8]); + aDX = Draw::Atof(a[6]); + if(nb > 7) aDY = Draw::Atof(a[7]); + if(nb > 8) aDZ = Draw::Atof(a[8]); } // cout<Get(); - TopExp_Explorer expl(aContext, (TopAbs_ShapeEnum)atoi(a[3])); + TopExp_Explorer expl(aContext, (TopAbs_ShapeEnum)Draw::Atoi(a[3])); for (; expl.More(); expl.Next()) { if (expl.Current().IsSame(aSelectedShape)) { di<<"QANewDBRepNaming_CheckSelectShape(): The context is found at "; diff --git a/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx b/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx index f4f00ca2a8..fc704d06af 100755 --- a/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx +++ b/src/QANewDBRepNaming/QANewDBRepNaming_FeatureCommands.cxx @@ -111,12 +111,12 @@ static Standard_Integer QANewDBRepNaming_NameBooleanOperationFeat (Draw_Interpre TDF_Label L; if (!DDF::AddLabel(D->GetData(), arg[2], L)) return 1; - const Standard_Integer Op = (Standard_Integer)atoi(arg[3]); + const Standard_Integer Op = (Standard_Integer)Draw::Atoi(arg[3]); const TopoDS_Shape& S1 = DBRep::Get(arg[4]); const TopoDS_Shape& S2 = DBRep::Get(arg[5]); Standard_Integer Orientation = 0; - if (nb == 7) Orientation = atoi(arg[6]); + if (nb == 7) Orientation = Draw::Atoi(arg[6]); switch (Op) { case 1: { @@ -320,7 +320,7 @@ static Standard_Integer QANewDBRepNaming_NameLimit (Draw_Interpretor& di, const TopoDS_Shape& S2 = DBRep::Get(arg[4]); Standard_Integer Orientation = 0; if (nb == 6) { - Orientation = atoi(arg[5]); + Orientation = Draw::Atoi(arg[5]); } QANewBRepNaming_Limitation nameBool(L); const QANewModTopOpe_ModeOfLimitation aMode = (QANewModTopOpe_ModeOfLimitation) Orientation; diff --git a/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx b/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx index 2c1aa58241..04a0b0f1ac 100755 --- a/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx +++ b/src/QANewDBRepNaming/QANewDBRepNaming_PrimitiveCommands.cxx @@ -83,7 +83,7 @@ static Standard_Integer QANewDBRepNaming_NameBox (Draw_Interpretor& di, TDF_Label L; if (!QADNaming::Entry(arg, L)) return 1; - BRepPrimAPI_MakeBox mkBox(atof(arg[3]), atof(arg[4]), atof(arg[5])); + BRepPrimAPI_MakeBox mkBox(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); mkBox.Build(); if(!mkBox.IsDone()) { @@ -112,10 +112,10 @@ static Standard_Integer QANewDBRepNaming_NameCylinder (Draw_Interpretor& di, TDF_Label L; if (!QADNaming::Entry(arg, L)) return 1; - BRepPrimAPI_MakeCylinder mkCylinder(atof(arg[3]), atof(arg[4])); - if (atof(arg[5]) != 0.) { - // for Mandrake-10 - mkv,02.06.06 - mkCylinder = BRepPrimAPI_MakeCylinder(atof(arg[3]), atof(arg[4]), atof(arg[5])); - BRepPrimAPI_MakeCylinder MakeCylinder(atof(arg[3]), atof(arg[4]), atof(arg[5])); + BRepPrimAPI_MakeCylinder mkCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4])); + if (Draw::Atof(arg[5]) != 0.) { + // for Mandrake-10 - mkv,02.06.06 - mkCylinder = BRepPrimAPI_MakeCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); + BRepPrimAPI_MakeCylinder MakeCylinder(Draw::Atof(arg[3]), Draw::Atof(arg[4]), Draw::Atof(arg[5])); mkCylinder = MakeCylinder; } mkCylinder.Build(); @@ -127,7 +127,7 @@ static Standard_Integer QANewDBRepNaming_NameCylinder (Draw_Interpretor& di, QANewBRepNaming_Cylinder nameCylinder(L); if (nb == 6) nameCylinder.Load(mkCylinder, QANewBRepNaming_SHELL); - else if (atoi(arg[6]) == 0) nameCylinder.Load(mkCylinder, QANewBRepNaming_SHELL); + else if (Draw::Atoi(arg[6]) == 0) nameCylinder.Load(mkCylinder, QANewBRepNaming_SHELL); else nameCylinder.Load(mkCylinder, QANewBRepNaming_SOLID); return 0; @@ -148,15 +148,15 @@ static Standard_Integer QANewDBRepNaming_NameCylinder (Draw_Interpretor& di, { TDF_Label L; if (!QADNaming::Entry(arg, L)) return 1; - Standard_Real R = atof(arg[3]); - Standard_Real X = atof(arg[4]); - Standard_Real Y = atof(arg[5]); - Standard_Real Z = atof(arg[6]); - Standard_Real DX = atof(arg[7]); - Standard_Real DY = atof(arg[8]); - Standard_Real DZ = atof(arg[9]); + Standard_Real R = Draw::Atof(arg[3]); + Standard_Real X = Draw::Atof(arg[4]); + Standard_Real Y = Draw::Atof(arg[5]); + Standard_Real Z = Draw::Atof(arg[6]); + Standard_Real DX = Draw::Atof(arg[7]); + Standard_Real DY = Draw::Atof(arg[8]); + Standard_Real DZ = Draw::Atof(arg[9]); QANewBRepNaming_TypeOfPrimitive3D type = QANewBRepNaming_SHELL; - if (nb == 11) type = (QANewBRepNaming_TypeOfPrimitive3D) atoi(arg[10]); + if (nb == 11) type = (QANewBRepNaming_TypeOfPrimitive3D) Draw::Atoi(arg[10]); QANewBRepNaming_Sphere nameSphere(L); BRepPrimAPI_MakeSphere mkSphere(R); @@ -196,7 +196,7 @@ static Standard_Integer QANewDBRepNaming_NamePrism (Draw_Interpretor& di, if (!QADNaming::Entry(arg, L)) return 1; if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; - Standard_Real H = atof(arg[4]); + Standard_Real H = Draw::Atof(arg[4]); Handle(TNaming_NamedShape) BasisNS; if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; @@ -205,7 +205,7 @@ static Standard_Integer QANewDBRepNaming_NamePrism (Draw_Interpretor& di, QANewBRepNaming_Prism namePrism(L); if (nb >= 8) { - gp_Dir Direction(atof(arg[5]), atof(arg[6]), atof(arg[7])); + gp_Dir Direction(Draw::Atof(arg[5]), Draw::Atof(arg[6]), Draw::Atof(arg[7])); gp_Vec Vector(Direction); Vector.Normalize(); Vector *= H; @@ -222,7 +222,7 @@ static Standard_Integer QANewDBRepNaming_NamePrism (Draw_Interpretor& di, namePrism.Load(mkPrism, Basis); } else if (nb == 9) { - BRepPrimAPI_MakePrism mkPrism(Basis, Direction, (Standard_Boolean)atoi(arg[8])); + BRepPrimAPI_MakePrism mkPrism(Basis, Direction, (Standard_Boolean)Draw::Atoi(arg[8])); mkPrism.Build(); if(!mkPrism.IsDone()) { @@ -295,7 +295,7 @@ static Standard_Integer QANewDBRepNaming_NameRevol (Draw_Interpretor& di, } else if (nb == 6) { - Standard_Real Angle = atof(arg[5]); + Standard_Real Angle = Draw::Atof(arg[5]); BRepPrimAPI_MakeRevol mkRevol(Basis, axis, Angle); mkRevol.Build(); @@ -331,7 +331,7 @@ static Standard_Integer QANewDBRepNaming_NameFillet (Draw_Interpretor& di, if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; if (!DDF::AddLabel(L.Data(), arg[4], PL)) return 1; - Standard_Real aRadius = atoi(arg[5]); + Standard_Real aRadius = Draw::Atoi(arg[5]); Handle(TNaming_NamedShape) BasisNS, PathNS; if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; if (!PL.FindAttribute(TNaming_NamedShape::GetID(), PathNS)) return 1; @@ -374,8 +374,8 @@ static Standard_Integer QANewDBRepNaming_NameChamfer (Draw_Interpretor& di, if (!DDF::AddLabel(L.Data(), arg[3], BL)) return 1; if (!DDF::AddLabel(L.Data(), arg[4], EL)) return 1; if (!DDF::AddLabel(L.Data(), arg[5], FL)) return 1; - aDist1 = atoi(arg[6]); - aDist2 = atoi(arg[7]); + aDist1 = Draw::Atoi(arg[6]); + aDist2 = Draw::Atoi(arg[7]); Handle(TNaming_NamedShape) BasisNS, EdgeNS, FaceNS; if (!BL.FindAttribute(TNaming_NamedShape::GetID(), BasisNS)) return 1; diff --git a/src/RWStl/RWStl.cxx b/src/RWStl/RWStl.cxx index 403cf90eaa..d6276c22c3 100755 --- a/src/RWStl/RWStl.cxx +++ b/src/RWStl/RWStl.cxx @@ -251,7 +251,7 @@ Standard_Boolean RWStl::WriteAscii (const Handle(StlMesh_Mesh)& theMesh, // si Vnorm est quasi-nul, on le charge a 0 explicitement Vnorm.SetCoord (0., 0., 0.); } - sprintf (sval, + Sprintf (sval, " facet normal % 12e % 12e % 12e\n" " outer loop\n" " vertex % 12e % 12e % 12e\n" @@ -411,7 +411,6 @@ Handle_StlMesh_Mesh RWStl::ReadAscii (const OSD_Path& thePath, Standard_Integer nbLines = 0; Standard_Integer nbTris = 0; Standard_Integer iTri; - Standard_ShortReal x[4],y[4],z[4]; Standard_Integer i1,i2,i3; Handle(StlMesh_Mesh) ReadMesh; @@ -427,8 +426,6 @@ Handle_StlMesh_Mesh RWStl::ReadAscii (const OSD_Path& thePath, fclose(file); file = fopen(filename.ToCString(),"r"); - - // count the number of lines for (ipos = 0; ipos < filesize; ++ipos) { if (getc(file) == '\n') @@ -455,23 +452,33 @@ Handle_StlMesh_Mesh RWStl::ReadAscii (const OSD_Path& thePath, Message_ProgressSentry aPS (theProgInd, "Triangles", 0, (nbTris - 1) * 1.0 / IND_THRESHOLD, 1); for (iTri = 0; iTri < nbTris && aPS.More();) { + char x[256]="", y[256]="", z[256]=""; + // reading the facet normal - fscanf(file,"%*s %*s %f %f %f\n",&x[0],&y[0],&z[0]); + if (3 != fscanf(file,"%*s %*s %80s %80s %80s\n", x, y, z)) + break; // error should be properly reported + gp_XYZ aN (Atof(x), Atof(y), Atof(z)); // skip the keywords "outer loop" fscanf(file,"%*s %*s"); // reading vertex - fscanf(file,"%*s %f %f %f\n",&x[1],&y[1],&z[1]); - fscanf(file,"%*s %f %f %f\n",&x[2],&y[2],&z[2]); - fscanf(file,"%*s %f %f %f\n",&x[3],&y[3],&z[3]); + if (3 != fscanf(file,"%*s %80s %80s %80s\n", x, y, z)) + break; // error should be properly reported + gp_XYZ aV1 (Atof(x), Atof(y), Atof(z)); + if (3 != fscanf(file,"%*s %80s %80s %80s\n", x, y, z)) + break; // error should be properly reported + gp_XYZ aV2 (Atof(x), Atof(y), Atof(z)); + if (3 != fscanf(file,"%*s %80s %80s %80s\n", x, y, z)) + break; // error should be properly reported + gp_XYZ aV3 (Atof(x), Atof(y), Atof(z)); // here the facet must be built and put in the mesh datastructure - i1 = ReadMesh->AddOnlyNewVertex ((Standard_Real)x[1],(Standard_Real)y[1],(Standard_Real)z[1]); - i2 = ReadMesh->AddOnlyNewVertex ((Standard_Real)x[2],(Standard_Real)y[2],(Standard_Real)z[2]); - i3 = ReadMesh->AddOnlyNewVertex ((Standard_Real)x[3],(Standard_Real)y[3],(Standard_Real)z[3]); - ReadMesh->AddTriangle (i1,i2,i3,(Standard_Real)x[0],(Standard_Real)y[0],(Standard_Real)z[0]); + i1 = ReadMesh->AddOnlyNewVertex (aV1.X(), aV1.Y(), aV1.Z()); + i2 = ReadMesh->AddOnlyNewVertex (aV2.X(), aV2.Y(), aV2.Z()); + i3 = ReadMesh->AddOnlyNewVertex (aV3.X(), aV3.Y(), aV3.Z()); + ReadMesh->AddTriangle (i1, i2, i3, aN.X(), aN.Y(), aN.Z()); // skip the keywords "endloop" fscanf(file,"%*s"); @@ -488,5 +495,4 @@ Handle_StlMesh_Mesh RWStl::ReadAscii (const OSD_Path& thePath, #endif fclose(file); return ReadMesh; - } diff --git a/src/SWDRAW/SWDRAW.cxx b/src/SWDRAW/SWDRAW.cxx index a938ac4949..bf45573d88 100755 --- a/src/SWDRAW/SWDRAW.cxx +++ b/src/SWDRAW/SWDRAW.cxx @@ -17,11 +17,8 @@ #include +#include #include -// CKY 4-AOUT-1998 : pb avec GeomFill -//#include -//#include -//#include #include #include @@ -162,9 +159,9 @@ static Standard_Integer NSPApply (Draw_Interpretor& di, Standard_Integer argc, c return 1; } TopoDS_Shape newshape; - Standard_Real tol = atof(argv[5]); + Standard_Real tol = Draw::Atof(argv[5]); Standard_Real maxtol = 1.; - if (argc > 6) maxtol = atof(argv[6]); + if (argc > 6) maxtol = Draw::Atof(argv[6]); XSAlgo::AlgoContainer()->PrepareForTransfer(); Handle(Standard_Transient) info; // reserved for special uses diff --git a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx index 535c58dae2..25c3f42ed0 100755 --- a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx +++ b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -113,9 +114,9 @@ static Standard_Integer tolerance if (nextarg < 3) opt = 'a'; Standard_Real tol1= 0., tol2= 0.; - if (nextarg < argc) tol1 = atof (argv[nextarg]); - if (nextarg < argc-1) tol2 = atof (argv[nextarg+1]); -// Standard_Real tol = atof (argv[2]); + if (nextarg < argc) tol1 = Draw::Atof (argv[nextarg]); + if (nextarg < argc-1) tol2 = Draw::Atof (argv[nextarg+1]); +// Standard_Real tol = Draw::Atof (argv[2]); Handle(TopTools_HSequenceOfShape) list = sat.InTolerance (Shape,tol1,tol2,type); Standard_Integer i, nb = list->Length(); switch (type) { @@ -133,7 +134,7 @@ static Standard_Integer tolerance di<<"\n"; char nomsh[30]; for (i = 1; i <= nb; i ++) { - sprintf (nomsh,"tol_%d",i); + Sprintf (nomsh,"tol_%d",i); DBRep::Set (nomsh,list->Value(i)); } } @@ -152,10 +153,10 @@ static Standard_Integer projface Handle(Geom_Surface) thesurf = BRep_Tool::Surface (F); // pas locface // On y va Standard_Real X,Y,Z,U,V; - X = U = atof (argv[2]); - Y = V = atof (argv[3]); + X = U = Draw::Atof (argv[2]); + Y = V = Draw::Atof (argv[3]); if (argc > 4) { - Z = atof (argv[4]); + Z = Draw::Atof (argv[4]); gp_Pnt P3D (X,Y,Z); di<<" Point 3D X = "<FirstParameter(); cl = C->LastParameter(); - if (argc >= 7) { cf = atof (argv[2]); cl = atof (argv[3]); i0 = 2; } + if (argc >= 7) { cf = Draw::Atof (argv[2]); cl = Draw::Atof (argv[3]); i0 = 2; } di<<"Curve 3D "<Length(); i++) { - sprintf(nompart,"%s_bigspl_%d",arg2,i); + Sprintf(nompart,"%s_bigspl_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } if(analyzer.ModifyIndirectMode()) { sec = analyzer.IndirectSec(); for(Standard_Integer i = 1; i <= sec->Length(); i++) { - sprintf(nompart,"%s_indsur_%d",arg2,i); + Sprintf(nompart,"%s_indsur_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } if(analyzer.ModifyOffestSurfaceMode()) { sec = analyzer.OffsetSurfaceSec(); for(Standard_Integer i = 1; i <= sec->Length(); i++) { - sprintf(nompart,"%s_ofsur_%d",arg2,i); + Sprintf(nompart,"%s_ofsur_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } if(analyzer.ModifyTrimmed3dMode()) { sec = analyzer.Trimmed3dSec(); for(Standard_Integer i = 1; i <= sec->Length(); i++) { - sprintf(nompart,"%s_trc3d_%d",arg2,i); + Sprintf(nompart,"%s_trc3d_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } if(analyzer.ModifyOffsetCurveMode()) { sec = analyzer.OffsetCurveSec(); for(Standard_Integer i = 1; i <= sec->Length(); i++) { - sprintf(nompart,"%s_ofcur_%d",arg2,i); + Sprintf(nompart,"%s_ofcur_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } if(analyzer.ModifyTrimmed2dMode()) { sec = analyzer.Trimmed2dSec(); for(Standard_Integer i = 1; i <= sec->Length(); i++) { - sprintf(nompart,"%s_trc2d_%d",arg2,i); + Sprintf(nompart,"%s_trc2d_%d",arg2,i); DBRep::Set (nompart,sec->Value(i)); } } @@ -540,7 +541,7 @@ static Standard_Integer XSHAPE_comptoledge Standard_CString prefix = 0; if ( argc >2 ) { if ( IsDigit(argv[2][0]) ) { - nbpnts = atoi(argv[2]); + nbpnts = Draw::Atoi(argv[2]); if ( nbpnts <2 ) nbpnts = 2; if ( argc >3 ) prefix = argv[3]; } @@ -577,12 +578,12 @@ static Standard_Integer XSHAPE_comptoledge "MAX=" << relmax << " AVG=" << relave/num << " MIN=" << relmin << "\n"; if ( prefix && prefix[0] ) { char name[21]; - sprintf ( name, "%.10s_edge_tol", prefix ); + Sprintf ( name, "%.10s_edge_tol", prefix ); DBRep::Set (name,edmax); di << "Edge with max tolerance saved to " << name; if ( edmax.IsSame ( edmaxrel ) ) di << "\n"; else { - sprintf ( name, "%.10s_edge_rel", prefix ); + Sprintf ( name, "%.10s_edge_rel", prefix ); DBRep::Set (name,edmaxrel); di << "; edge with max relation saved to " << name << "\n"; } @@ -593,7 +594,7 @@ static Standard_Integer XSHAPE_comptoledge TopoDS_Edge edge = TopoDS::Edge ( ed.Current() ); if ( edge.IsSame ( edmax ) || edge.IsSame ( edmaxrel ) ) { if ( ! num1 ) di << "Concerned faces saved to shapes "; - sprintf ( name, "%.10s_%d", prefix, num1+1 ); + Sprintf ( name, "%.10s_%d", prefix, num1+1 ); DBRep::Set (name,face); //cout << ( num1 ? ", " : "" ) << name; if (num1 == 0) { @@ -622,10 +623,10 @@ static Standard_Integer freebounds (Draw_Interpretor& di, if ((n < 3) || (n > 5)) return 1; TopoDS_Shape shape = DBRep::Get(a[1]); if (shape.IsNull()) return 1; - Standard_Real toler = atof (a[2]); + Standard_Real toler = Draw::Atof (a[2]); Standard_Boolean splitclosed = Standard_False, splitopen = Standard_False; - if ( n > 3) splitclosed = atoi (a[3]); - if ( n > 4) splitopen = atoi (a[4]); + if ( n > 3) splitclosed = Draw::Atoi (a[3]); + if ( n > 4) splitopen = Draw::Atoi (a[4]); ShapeAnalysis_FreeBounds F; if (toler <= 0) @@ -635,11 +636,11 @@ static Standard_Integer freebounds (Draw_Interpretor& di, char name[100]; TopoDS_Shape wires = F.GetClosedWires(); - sprintf (name, "%s_c", a[1]); + Sprintf (name, "%s_c", a[1]); DBRep::Set (name, wires); di << name << " - closed wires" << "\n"; wires = F.GetOpenWires(); - sprintf (name, "%s_o", a[1]); + Sprintf (name, "%s_o", a[1]); DBRep::Set (name, wires); di << name << " - open wires" << "\n"; @@ -662,7 +663,7 @@ static void PrintProps(Standard_Integer i, Standard_Real ratio = fbd->Ratio(); Standard_Real width = fbd->Width(); Standard_Integer notch = fbd->NbNotches(); - sprintf(str," %d\t%12.5f\t%12.5f\t%12.5f\t%12.5f\t%d", i, area, perimeter, ratio, width, notch); + Sprintf(str," %d\t%12.5f\t%12.5f\t%12.5f\t%12.5f\t%d", i, area, perimeter, ratio, width, notch); di< 2) toler = atof(a[2]); - if (n > 3) splitclosed = atoi(a[3]); - if (n > 4) splitopen = atoi(a[4]); + if (n > 2) toler = Draw::Atof(a[2]); + if (n > 3) splitclosed = Draw::Atoi(a[3]); + if (n > 4) splitopen = Draw::Atoi(a[4]); ShapeAnalysis_FreeBoundsProperties analyzer; if (toler > 0) analyzer.Init(source, toler, splitclosed, splitopen); @@ -724,10 +725,10 @@ static Standard_Integer FreeBoundsProps(Draw_Interpretor& di, } char name[100]; - sprintf (name, "%s_c",a[1]); + Sprintf (name, "%s_c",a[1]); di << name << " - closed wires, "; DBRep::Set(name, closed); - sprintf (name, "%s_o",a[1]); + Sprintf (name, "%s_o",a[1]); di << name << " - closed wires " << "\n"; DBRep::Set(name, open); return 0; @@ -744,10 +745,10 @@ static Standard_Integer closefreebounds (Draw_Interpretor& di, if ((n < 4) || (n > 6)) return 1; TopoDS_Shape shape = DBRep::Get(a[1]); if (shape.IsNull()) return 1; - Standard_Real sewtoler = atof (a[2]), closetoler = atof (a[3]); + Standard_Real sewtoler = Draw::Atof (a[2]), closetoler = Draw::Atof (a[3]); Standard_Boolean splitclosed = Standard_False, splitopen = Standard_False; - if ( n > 4) splitclosed = atoi (a[3]); - if ( n > 5) splitopen = atoi (a[4]); + if ( n > 4) splitclosed = Draw::Atoi (a[3]); + if ( n > 5) splitopen = Draw::Atoi (a[4]); ShapeFix_FreeBounds F; if (sewtoler <= 0) @@ -757,11 +758,11 @@ static Standard_Integer closefreebounds (Draw_Interpretor& di, char name[100]; TopoDS_Shape wires = F.GetClosedWires(); - sprintf (name, "%s_c", a[1]); + Sprintf (name, "%s_c", a[1]); DBRep::Set (name, wires); di << name << " - closed wires" << "\n"; wires = F.GetOpenWires(); - sprintf (name, "%s_o", a[1]); + Sprintf (name, "%s_o", a[1]); DBRep::Set (name, wires); di << name << " - open wires" << "\n"; @@ -783,7 +784,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/, if (TheList.IsNull()) return 1; Standard_Real toler = 0.001; int create = 0; - if ( n >= 3) toler = atof(a[2]); + if ( n >= 3) toler = Draw::Atof(a[2]); if (n == 4 && !strcmp(a[3],"C")) create = 1; ShapeAnalysis_FreeBounds F(TheList,toler); // @@ -798,7 +799,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/, Standard_Integer iwire = 0; while (S.More()) { - sprintf (num,"%d",iwire); + Sprintf (num,"%d",iwire); name[0] = 'w'; name[1] = '\0'; strncat(name,num,strlen(num)); @@ -813,7 +814,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/, iwire = 0; while (S.More()) { - sprintf (num,"%d",iwire); + Sprintf (num,"%d",iwire); name[0] = 'E'; name[1] = '\0'; strncat(name,num,strlen(num)); diff --git a/src/SWDRAW/SWDRAW_ShapeCustom.cxx b/src/SWDRAW/SWDRAW_ShapeCustom.cxx index 67ce5204d5..a21fc04f99 100755 --- a/src/SWDRAW/SWDRAW_ShapeCustom.cxx +++ b/src/SWDRAW/SWDRAW_ShapeCustom.cxx @@ -18,9 +18,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -// abv 08.05.99: new command convtorevol - #include + +#include #include #include #include @@ -287,8 +287,8 @@ static Standard_Integer expshape(Draw_Interpretor& di, Standard_Integer argc, co } Standard_CString arg2 = argv[1]; TopoDS_Shape Shape = DBRep::Get(arg2); - Standard_Integer Degree = atoi(argv[2]); - Standard_Integer MaxSeg = atoi(argv[3]); + Standard_Integer Degree = Draw::Atoi(argv[2]); + Standard_Integer MaxSeg = Draw::Atoi(argv[3]); GeomAbs_Shape aCont3 = GeomAbs_C0; Standard_Integer k = 4; if( argc > k) @@ -407,7 +407,7 @@ static Standard_Integer scaleshape(Draw_Interpretor& di, Standard_Integer argc, TopoDS_Shape Shape = DBRep::Get(arg2); if (Shape.IsNull()) { di << "Shape unknown: " << arg2 << "\n"; return 1 /* Error */; } - TopoDS_Shape result = ShapeCustom::ScaleShape (Shape, atof(argv[3])); + TopoDS_Shape result = ShapeCustom::ScaleShape (Shape, Draw::Atof(argv[3])); if (result.IsNull()) { di << "NO RESULT" << "\n"; return 1; } else if (result == Shape) { di << "NO MODIFICATIONS" << "\n"; return 0; } DBRep::Set (argv[1],result); @@ -444,7 +444,7 @@ static Standard_Integer BSplRes(Draw_Interpretor& di, Standard_Integer argc, con di<< "Invalid argument Cont3e" << "\n"; return 1; } Handle(ShapeCustom_RestrictionParameters) aParameters = new ShapeCustom_RestrictionParameters; - TopoDS_Shape result = ShapeCustom::BSplineRestriction (Shape, atof(argv[3]), atof(argv[4]), atoi(argv[5]),atoi(argv[6]),aCont3,aCont2,(Standard_Boolean) atoi(argv[9]),(Standard_Boolean) atoi(argv[10]),aParameters); + TopoDS_Shape result = ShapeCustom::BSplineRestriction (Shape, Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atoi(argv[5]),Draw::Atoi(argv[6]),aCont3,aCont2,(Standard_Boolean) Draw::Atoi(argv[9]),(Standard_Boolean) Draw::Atoi(argv[10]),aParameters); if (result.IsNull()) { di << "NO RESULT" << "\n"; return 1; } else if (result == Shape) { di << "NO MODIFICATIONS" << "\n"; diff --git a/src/SWDRAW/SWDRAW_ShapeFix.cxx b/src/SWDRAW/SWDRAW_ShapeFix.cxx index 0d8ddf0019..a5051beedc 100755 --- a/src/SWDRAW/SWDRAW_ShapeFix.cxx +++ b/src/SWDRAW/SWDRAW_ShapeFix.cxx @@ -18,9 +18,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - #include + +#include #include #include #include @@ -125,10 +125,10 @@ static Standard_Integer settolerance (Draw_Interpretor& di, Standard_Integer arg Standard_Real tmin,tmax; mod2 = argv[premarg][0]; - if (mod2 == '=') tmin = tmax = atof (argv[argc-1]); - else if (mod2 == '<') { tmin = 0; tmax = atof (argv[argc-1]); } - else if (mod2 == '>') { tmin = atof (argv[argc-1]); tmax = 0; } - else { tmin = atof (argv[premarg]); tmax = atof (argv[argc-1]); } + if (mod2 == '=') tmin = tmax = Draw::Atof (argv[argc-1]); + else if (mod2 == '<') { tmin = 0; tmax = Draw::Atof (argv[argc-1]); } + else if (mod2 == '>') { tmin = Draw::Atof (argv[argc-1]); tmax = 0; } + else { tmin = Draw::Atof (argv[premarg]); tmax = Draw::Atof (argv[argc-1]); } if (argc == premarg + 1 || tmin == tmax) di<<"Setting Tolerance to "<Init ( initShape ); } break; - case 2: sfs->SetPrecision (atof(argv[i])); break; - case 3: sfs->SetMaxTolerance(atof(argv[i])); break; + case 2: sfs->SetPrecision (Draw::Atof(argv[i])); break; + case 3: sfs->SetMaxTolerance(Draw::Atof(argv[i])); break; } } par++; @@ -508,7 +508,7 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c if ( mess < 0 ) { char buff[256]; - sprintf ( buff, "%s_%s", res, "m" ); + Sprintf ( buff, "%s_%s", res, "m" ); di << " Modified shapes saved in compound: " << buff; DBRep::Set (buff, aCompound); } @@ -533,7 +533,7 @@ Standard_Integer fixgaps(Draw_Interpretor& di, Standard_Integer n, const char** } Handle(ShapeFix_Wireframe) SFWF = new ShapeFix_Wireframe(S); - Standard_Real prec = ( n >3 ? atof(a[3]) : 0. ); + Standard_Real prec = ( n >3 ? Draw::Atof(a[3]) : 0. ); SFWF->SetPrecision(prec); if ( SFWF->FixWireGaps() ) { DBRep::Set(a[1],SFWF->Shape()); @@ -558,7 +558,7 @@ Standard_Integer fixsmall(Draw_Interpretor& di, Standard_Integer n, const char** return 1; } - Standard_Real prec = (n == 4)? atof(a[3]) : 1.; + Standard_Real prec = (n == 4)? Draw::Atof(a[3]) : 1.; ShapeFix_Wireframe SFWF(S); SFWF.SetPrecision(prec); @@ -588,13 +588,13 @@ static Standard_Integer fixsmalledges(Draw_Interpretor& di, Standard_Integer n, Standard_Integer mode = 2; Standard_Real tolang = M_PI/2; if(n > k) - tol = atof(a[k++]); + tol = Draw::Atof(a[k++]); if(n > k) - mode= atoi(a[k++]); + mode= Draw::Atoi(a[k++]); if(n > k) - tolang = atof(a[k++]); + tolang = Draw::Atof(a[k++]); Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe(); Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape; @@ -642,9 +642,9 @@ static Standard_Integer checkoverlapedges(Draw_Interpretor& di, Standard_Integer Standard_Real aDistDomain = 0.0; Standard_Integer k = 3; if(k < n) - aTol = atof(a[k++]); + aTol = Draw::Atof(a[k++]); if(k < n) - aDistDomain = atof(a[k++]); + aDistDomain = Draw::Atof(a[k++]); ShapeAnalysis_Edge sae; if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) { @@ -672,8 +672,8 @@ static Standard_Integer checkfclass2d(Draw_Interpretor& di, Standard_Integer n, return 1; } TopoDS_Shape Sh1 = DBRep::Get(a[1]); - Standard_Real ucoord = atof(a[2]); - Standard_Real vcoord = atof(a[3]); + Standard_Real ucoord = Draw::Atof(a[2]); + Standard_Real vcoord = Draw::Atof(a[3]); if(Sh1.IsNull() || Sh1.ShapeType()!= TopAbs_FACE) { di<<"Invalid arguments"<<"\n"; return 1; @@ -706,11 +706,11 @@ static Standard_Integer connectedges(Draw_Interpretor& di, Standard_Integer n, c } Standard_Real aTol = Precision::Confusion(); if( n > 3) - aTol = atof(a[3]); + aTol = Draw::Atof(a[3]); Standard_Boolean shared = Standard_True; if( n > 4) - shared = (atoi(a[4]) == 1); + shared = (Draw::Atoi(a[4]) == 1); TopExp_Explorer aExpE(aSh1,TopAbs_EDGE); Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape; diff --git a/src/SWDRAW/SWDRAW_ShapeTool.cxx b/src/SWDRAW/SWDRAW_ShapeTool.cxx index 3c7de48ab7..fee64818f1 100755 --- a/src/SWDRAW/SWDRAW_ShapeTool.cxx +++ b/src/SWDRAW/SWDRAW_ShapeTool.cxx @@ -22,6 +22,7 @@ // 15.06.99 abv/pdn: command comptol added (from S4030) #include +#include #include #include #include @@ -82,7 +83,7 @@ static Standard_Integer XSHAPE_edge if (curve3d.IsNull()) { char nomsh[30]; nbf ++; - sprintf (nomsh,"faultedge_%d",nbf); + Sprintf (nomsh,"faultedge_%d",nbf); di<<"Edge sans Curve3d, n0 "< 1) { di<<"Edge n0 "< 2) tolang = atof (arg2); + if (argc > 2) tolang = Draw::Atof (arg2); if (tolang <= 0) { di<<"Not a suitable value : "< //#include +#include #include #include #include @@ -124,7 +125,7 @@ static Standard_Integer DT_ShapeDivide (Draw_Interpretor& di, // tolerance is optional if (n==4) { - Standard_Real Tol=atof(a[3]); + Standard_Real Tol=Draw::Atof(a[3]); tool.SetTolerance(Tol); } @@ -173,8 +174,8 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di, return 1; } - Standard_Integer c2d = atoi(a[3]); - Standard_Integer c3d = atoi(a[4]); + Standard_Integer c2d = Draw::Atoi(a[3]); + Standard_Integer c3d = Draw::Atoi(a[4]); TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape); if (revsh.IsNull()) { di<<"NO RESULT"<<"\n"; return 1; } else if (revsh == inputShape) { di<<"No modif"<<"\n";} @@ -240,7 +241,7 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di, // tolerance is optional if (n==4) { - Standard_Real Tol=atof(a[n-1]); + Standard_Real Tol=Draw::Atof(a[n-1]); theTool.SetTolerance(Tol); } @@ -275,7 +276,7 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di, else { // not a face: we can use the empty consturctor. ShapeUpgrade_ShapeDivideContinuity theTool; - Standard_Real Tol=atof(a[n-1]); + Standard_Real Tol=Draw::Atof(a[n-1]); theTool.SetTolerance(Tol); theTool.SetGlobalCriterion(GeomAbs_C1); @@ -323,8 +324,8 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di, return 1; } // number of surf: - Standard_Integer NbU=atoi(a[2]); - Standard_Integer NbV=atoi(a[3]); + Standard_Integer NbU=Draw::Atoi(a[2]); + Standard_Integer NbV=Draw::Atoi(a[3]); if (n < 4+NbU*NbV+1) { di << "bad number of arguments" <<"\n"; return 1; @@ -411,8 +412,8 @@ static Standard_Integer DT_ShapeConvert (Draw_Interpretor& di, return 1; } - Standard_Integer c2d = atoi(a[3]); - Standard_Integer c3d = atoi(a[4]); + Standard_Integer c2d = Draw::Atoi(a[3]); + Standard_Integer c3d = Draw::Atoi(a[4]); ShapeUpgrade_ShapeConvertToBezier tool(inputShape); tool.SetSurfaceConversion(Standard_True); @@ -464,7 +465,7 @@ static Standard_Integer DT_SplitAngle(Draw_Interpretor& di, Standard_Real maxangle = 95; if ( n >3 ) { - maxangle = atof ( a[3] ); + maxangle = Draw::Atof ( a[3] ); if ( maxangle <1 ) maxangle = 1; } @@ -518,7 +519,7 @@ static Standard_Integer DT_PlaneDividedFace (Draw_Interpretor& di, return 1; } - Standard_Real Tol=atof(a[3]); + Standard_Real Tol=Draw::Atof(a[3]); TopoDS_Shape inputShape=DBRep::Get(a[2]); TopoDS_Face inputFace = TopoDS::Face(inputShape); if (inputFace.IsNull()) { @@ -564,8 +565,8 @@ static Standard_Integer DT_PlaneGridShell (Draw_Interpretor& di, // a[4+NbU+NbV+1] = Tol // number of knots: - Standard_Integer NbU=atoi(a[2]); - Standard_Integer NbV=atoi(a[3]); + Standard_Integer NbU=Draw::Atoi(a[2]); + Standard_Integer NbV=Draw::Atoi(a[3]); if (n != 4+NbU+NbV+1) { di << "bad number of arguments" <<"\n"; return 1; @@ -575,13 +576,13 @@ static Standard_Integer DT_PlaneGridShell (Draw_Interpretor& di, TColStd_Array1OfReal TheVKnots(1,NbV); for (Standard_Integer ii=1; ii<=NbU; ii++) { - TheUKnots(ii)=atof(a[4+ii-1]); + TheUKnots(ii)=Draw::Atof(a[4+ii-1]); } for (ii=1; ii<=NbV; ii++) { - TheVKnots(ii)=atof(a[4+NbU+ii-1]); + TheVKnots(ii)=Draw::Atof(a[4+NbU+ii-1]); } - Standard_Real Tol=atof(a[4+NbU+NbV]); + Standard_Real Tol=Draw::Atof(a[4+NbU+NbV]); ShapeUpgrade_PlaneGridShell TheGrid(ThePlane,TheUKnots,TheVKnots,Tol); @@ -652,10 +653,10 @@ static Standard_Integer DT_SplitCurve (Draw_Interpretor& di, return 1; } - Standard_Real Tol=atof(a[2]); + Standard_Real Tol=Draw::Atof(a[2]); Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]); if ( GC.IsNull()) return 1; - Standard_Integer Split = atoi(a[3]); + Standard_Integer Split = Draw::Atoi(a[3]); Handle(ShapeUpgrade_SplitCurve3dContinuity) theTool = new ShapeUpgrade_SplitCurve3dContinuity; theTool->Init(GC); theTool->SetTolerance (Tol); @@ -670,7 +671,7 @@ static Standard_Integer DT_SplitCurve (Draw_Interpretor& di, Standard_Integer NbC=theCurves->Length(); for (Standard_Integer icurv=1; icurv<=NbC; icurv++) { char name[100]; - sprintf(name,"%s%s%d",a[1],"_",icurv); + Sprintf(name,"%s%s%d",a[1],"_",icurv); char* newname = name; DrawTrSurf::Set(newname, theCurves->Value(icurv)); di.AppendElement(newname); @@ -697,10 +698,10 @@ static Standard_Integer DT_SplitCurve2d (Draw_Interpretor& di, return 1; } - Standard_Real Tol=atof(a[2]); + Standard_Real Tol=Draw::Atof(a[2]); Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(a[1]); if ( GC.IsNull()) return 1; - Standard_Integer Split = atoi(a[3]); + Standard_Integer Split = Draw::Atoi(a[3]); Handle(ShapeUpgrade_SplitCurve2dContinuity) theTool = new ShapeUpgrade_SplitCurve2dContinuity; theTool->Init(GC); theTool->SetTolerance (Tol); @@ -715,7 +716,7 @@ static Standard_Integer DT_SplitCurve2d (Draw_Interpretor& di, Standard_Integer NbC=theCurves->Length(); for (Standard_Integer icurv=1; icurv<=NbC; icurv++) { char name[100]; - sprintf(name,"%s%s%d",a[1],"_",icurv); + Sprintf(name,"%s%s%d",a[1],"_",icurv); char* newname = name; DrawTrSurf::Set(newname, theCurves->Value(icurv)); di.AppendElement(newname); @@ -755,7 +756,7 @@ static Standard_Integer DT_SplitWire (Draw_Interpretor& di, Handle(ShapeUpgrade_WireDivideContinuity) tool = new ShapeUpgrade_WireDivideContinuity; tool->Init(wire,source); if(n >=4 ) { - Standard_Real Tol=atof(a[3]); + Standard_Real Tol=Draw::Atof(a[3]); } Handle(ShapeBuild_ReShape) context = new ShapeBuild_ReShape; tool->Perform(context); @@ -782,7 +783,7 @@ static Standard_Integer DT_SplitFace (Draw_Interpretor& di, Handle(ShapeUpgrade_ShapeDivideContinuity) tool = new ShapeUpgrade_FaceDivideContinuity; tool->Init(source); if(n >=4 ) { - Standard_Real Tol=atof(a[3]); + Standard_Real Tol=Draw::Atof(a[3]); tool->SetPrecision(Tol); } @@ -839,8 +840,8 @@ static Standard_Integer DT_SplitSurface (Draw_Interpretor& di, Handle(ShapeUpgrade_SplitSurfaceContinuity) theTool = new ShapeUpgrade_SplitSurfaceContinuity;//S4137 - Standard_Real Tol=atof(a[3]); - Standard_Integer Split = atoi(a[4]); + Standard_Real Tol=Draw::Atof(a[3]); + Standard_Integer Split = Draw::Atoi(a[4]); theTool->SetTolerance(Tol); theTool->SetCriterion(GeomAbs_C1); Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]); @@ -848,8 +849,8 @@ static Standard_Integer DT_SplitSurface (Draw_Interpretor& di, if ( GS.IsNull()) { // Case of composite grid surface di << "composite surf" << "\n"; - Standard_Integer nbU=atoi(a[2]); - Standard_Integer nbV=atoi(a[3]); + Standard_Integer nbU=Draw::Atoi(a[2]); + Standard_Integer nbV=Draw::Atoi(a[3]); if (nbU==0 || nbV==0) return 1; Handle(TColGeom_HArray2OfSurface) theGrid= new TColGeom_HArray2OfSurface(1,nbU,1,nbV); @@ -902,7 +903,7 @@ di << "transfert resultat" << "\n"; for (Standard_Integer irow=1; irow<=NbRow; irow++) { for (Standard_Integer icol=1; icol<=NbCol; icol++) { char name[100]; - sprintf(name,"%s%s%d%s%d",a[1],"_",irow,"_",icol); + Sprintf(name,"%s%s%d%s%d",a[1],"_",irow,"_",icol); char* newname = name; DrawTrSurf::Set(newname, theSurfaces->Value(irow, icol)); di.AppendElement(newname); @@ -955,7 +956,7 @@ di << "transfert resultat" << "\n"; theMap.Bind(theFace,theSurf); } - Standard_Real the2d3dFactor=atof(a[4]); + Standard_Real the2d3dFactor=Draw::Atof(a[4]); ShapeUpgrade_SupportModification theTool(inputShell,theMap,the2d3dFactor); TopoDS_Shell res = theTool.Shell(); @@ -981,7 +982,7 @@ static Standard_Integer DT_Debug (Draw_Interpretor& di, return 1; } - if (atoi(a[1])==1) { + if (Draw::Atoi(a[1])==1) { di << "Activation of debug messages"<<"\n"; ShapeUpgrade::SetDebug(Standard_True); } @@ -1090,7 +1091,7 @@ static Standard_Integer offset2dcurve } // Standard_CString arg1 = argv[1]; // Standard_CString arg2 = argv[2]; - Standard_Real Offset = atof(argv[3]); + Standard_Real Offset = Draw::Atof(argv[3]); Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(argv[2]); if ( GC.IsNull()) return 1; Handle(Geom2d_OffsetCurve) offcrv = new Geom2d_OffsetCurve(GC,Offset); @@ -1113,7 +1114,7 @@ static Standard_Integer offsetcurve } // Standard_CString arg1 = argv[1]; // Standard_CString arg2 = argv[2]; - Standard_Real Offset = atof(argv[3]); + Standard_Real Offset = Draw::Atof(argv[3]); Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(argv[2]); if ( GC.IsNull()) return 1; gp_Pnt point; @@ -1174,7 +1175,7 @@ static Standard_Integer splitface if ( argv[i][0] == 'u' ) byV = Standard_False; else if ( argv[i][0] == 'v' ) byV = Standard_True; else { - Standard_Real val = atof ( argv[i] ); + Standard_Real val = Draw::Atof ( argv[i] ); TColStd_SequenceOfReal &vals = ( byV ? vval : uval ); if ( vals.Length() >0 && val - vals.Last() < Precision::PConfusion() ) { di << "Values should be sorted in increasing order; skipped" << "\n"; @@ -1339,12 +1340,12 @@ static Standard_Integer splitarea (Draw_Interpretor& di, di << "Unknown shape"<< "\n"; return 1; } - Standard_Real aMaxArea = atof(argv[3]); + Standard_Real aMaxArea = Draw::Atof(argv[3]); ShapeUpgrade_ShapeDivideArea tool (inputShape); if(argc >4) { - Standard_Real prec = atof(argv[4]); + Standard_Real prec = Draw::Atof(argv[4]); tool.SetPrecision(prec); } tool.MaxArea() = aMaxArea; @@ -1364,7 +1365,7 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di, di << "bad number of arguments" <<"\n"; return 1; } - Standard_Real aMinArea = atof(argv[2]); + Standard_Real aMinArea = Draw::Atof(argv[2]); TopoDS_Shape inputShape=DBRep::Get(argv[3]); if (inputShape.IsNull()) { di << "Unknown shape"<< "\n"; @@ -1394,7 +1395,7 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di, } } if(!isShape) - aModeRemoveFaces = (atoi(argv[k]) == 1); + aModeRemoveFaces = (Draw::Atoi(argv[k]) == 1); } aTool->MinArea() = aMinArea; @@ -1475,9 +1476,9 @@ static Standard_Integer copytranslate(Draw_Interpretor& di, TopoDS_Shape aShape = DBRep::Get(argv[2]); if(aShape.IsNull()) return 1; - Standard_Real aDx = atof(argv[3]); - Standard_Real aDy = atof(argv[4]); - Standard_Real aDz = atof(argv[5]); + Standard_Real aDx = Draw::Atof(argv[3]); + Standard_Real aDy = Draw::Atof(argv[4]); + Standard_Real aDz = Draw::Atof(argv[5]); gp_Trsf aTrsf; aTrsf.SetTranslation(gp_Vec(aDx, aDy, aDz)); BRepBuilderAPI_Transform builderTransform(aTrsf); diff --git a/src/Standard/FILES b/src/Standard/FILES index 39b374a7ff..4738b3c5dd 100755 --- a/src/Standard/FILES +++ b/src/Standard/FILES @@ -21,6 +21,8 @@ Standard_Boolean.cxx Standard_Boolean.hxx Standard_Byte.hxx Standard_PByte.hxx +Standard_CLocaleSentry.hxx +Standard_CLocaleSentry.cxx Standard_CString.cxx Standard_CString.hxx Standard_Character.cxx diff --git a/src/Standard/Standard.cxx b/src/Standard/Standard.cxx index 9341a9418e..47bb1bfd58 100755 --- a/src/Standard/Standard.cxx +++ b/src/Standard/Standard.cxx @@ -29,8 +29,9 @@ #include #if(defined(_WIN32) || defined(__WIN32__)) -#include -#include + #include + #include + #include #endif #ifndef OCCT_MMGT_OPT_DEFAULT @@ -63,12 +64,23 @@ class Standard_MMgrFactory { Standard_MMgrFactory::Standard_MMgrFactory() : myFMMgr (NULL) { +/*#if defined(_MSC_VER) && (_MSC_VER > 1400) + // Turn ON thread-safe C locale globally to avoid side effects by setlocale() calls between threads. + // After this call all following _configthreadlocale() will be ignored assuming + // Notice that this is MSVCRT feature - on POSIX systems xlocale API (uselocale instead of setlocale) + // should be used explicitly to ensure thread-safety! + + // This is not well documented call because _ENABLE_PER_THREAD_LOCALE_GLOBAL flag is defined but not implemented for some reason. + // -1 will set global locale flag to force _ENABLE_PER_THREAD_LOCALE_GLOBAL + _ENABLE_PER_THREAD_LOCALE_NEW behaviour + // although there NO way to turn it off again and following calls will have no effect (locale will be changed only for current thread). + _configthreadlocale (-1); +#endif*/ + char* aVar; Standard_Integer anAllocId = (aVar = getenv ("MMGT_OPT" )) ? atoi (aVar) : (OCCT_MMGT_OPT_DEFAULT); Standard_Boolean toClear = (aVar = getenv ("MMGT_CLEAR" )) ? (atoi (aVar) != 0) : Standard_True; - // on Windows (actual for XP and 2000) activate low fragmentation heap // for CRT heap in order to get best performance. // Environment variable MMGT_LFH can be used to switch off this action (if set to 0) diff --git a/src/Standard/Standard_CLocaleSentry.cxx b/src/Standard/Standard_CLocaleSentry.cxx new file mode 100644 index 0000000000..a3a6e600f0 --- /dev/null +++ b/src/Standard/Standard_CLocaleSentry.cxx @@ -0,0 +1,128 @@ +// Created on: 2013-01-17 +// Created by: Kirill GAVRILOV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#include + +#include + +namespace +{ + + //! CLocalePtr - static object representing C locale + class CLocalePtr + { + public: + + CLocalePtr() + #ifdef HAVE_XLOCALE_H + : myLocale (newlocale (LC_ALL_MASK, "C", NULL)) + #elif defined(_WIN32) + : myLocale (_create_locale (LC_ALL, "C")) + #else + : myLocale (NULL) + #endif + {} + + ~CLocalePtr() + { + #ifdef HAVE_XLOCALE_H + freelocale (myLocale); + #elif defined(_WIN32) + _free_locale (myLocale); + #endif + } + + public: + + Standard_CLocaleSentry::clocale_t myLocale; + + }; + + static CLocalePtr theCLocale; + +}; + +// ======================================================================= +// function : GetCLocale +// purpose : +// ======================================================================= +Standard_CLocaleSentry::clocale_t Standard_CLocaleSentry::GetCLocale() +{ + return theCLocale.myLocale; +} + +// ======================================================================= +// function : Standard_CLocaleSentry +// purpose : +// ======================================================================= +Standard_CLocaleSentry::Standard_CLocaleSentry() +#ifdef HAVE_XLOCALE_H +: myPrevLocale (uselocale (theCLocale.myLocale)) // switch to C locale within this thread only using xlocale API +#else +: myPrevLocale (setlocale (LC_ALL, 0)) +#if defined(_MSC_VER) && (_MSC_VER > 1400) +, myPrevTLocaleState (_configthreadlocale (_ENABLE_PER_THREAD_LOCALE)) +#endif +#endif +{ +#ifndef HAVE_XLOCALE_H + const char* aPrevLocale = (const char* )myPrevLocale; + if (aPrevLocale[0] == 'C' && aPrevLocale[1] == '\0') + { + myPrevLocale = NULL; // already C locale + return; + } + // copy string as following setlocale calls may invalidate returned pointer + Standard_Size aLen = std::strlen (aPrevLocale) + 1; + myPrevLocale = new char[aLen]; + memcpy (myPrevLocale, aPrevLocale, aLen); + + setlocale (LC_ALL, "C"); +#endif +} + +// ======================================================================= +// function : ~Standard_CLocaleSentry +// purpose : +// ======================================================================= +Standard_CLocaleSentry::~Standard_CLocaleSentry() +{ +#ifdef HAVE_XLOCALE_H + uselocale ((locale_t )myPrevLocale); +#else + if (myPrevLocale != NULL) + { + const char* aPrevLocale = (const char* )myPrevLocale; + setlocale (LC_ALL, aPrevLocale); + delete[] aPrevLocale; + } +#if defined(_MSC_VER) && (_MSC_VER > 1400) + if (myPrevTLocaleState != _ENABLE_PER_THREAD_LOCALE) + { + _configthreadlocale (myPrevTLocaleState); + } +#endif +#endif +} diff --git a/src/Standard/Standard_CLocaleSentry.hxx b/src/Standard/Standard_CLocaleSentry.hxx new file mode 100644 index 0000000000..140fc360a4 --- /dev/null +++ b/src/Standard/Standard_CLocaleSentry.hxx @@ -0,0 +1,88 @@ +// Created on: 2013-01-17 +// Created by: Kirill GAVRILOV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Standard_CLocaleSentry_H__ +#define _Standard_CLocaleSentry_H__ + +#include + +#include + +//! "xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension +//! and become part of POSIX since '2008. +//! Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L) +//! since POSIX didn't declared such identifier. +//! We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler. +#if defined(__APPLE__) || defined(_GNU_SOURCE) || defined(HAVE_XLOCALE_H) + #include + #ifndef HAVE_XLOCALE_H + #define HAVE_XLOCALE_H + #endif +#endif + +//! This class intended to temporary switch C locale and logically equivalent to setlocale(LC_ALL, "C"). +//! It is intended to format text regardless of user locale settings (for import/export functionality). +//! Thus following calls to sprintf, atoi and other functions will use "C" locale. +//! Destructor of this class will return original locale. +//! +//! Notice that this functionality is platfrom dependent and intended only to workaround alien code +//! that doesn't setup locale correctly. +//! +//! Internally you should prefer more portable C++ locale interfaces +//! or OCCT wrappers to some C functions like Sprintf, Atof, Strtod. +class Standard_CLocaleSentry +{ +public: + + //! Setup current C locale to "C". + Standard_EXPORT Standard_CLocaleSentry(); + + //! Restore previous locale. + Standard_EXPORT virtual ~Standard_CLocaleSentry(); + +public: + +#ifdef HAVE_XLOCALE_H + typedef locale_t clocale_t; +#elif defined(_WIN32) + typedef _locale_t clocale_t; +#else + typedef void* clocale_t; +#endif + + //! @return locale "C" instance (locale_t within xlocale or _locale_t within Windows) + //! to be used for _l functions with locale argument. + static Standard_EXPORT clocale_t GetCLocale(); + +private: + + void* myPrevLocale; //!< previous locale, platform-dependent pointer! +#ifdef _WIN32 + int myPrevTLocaleState; //!< previous thread-locale state, MSVCRT-specific +#endif + +private: + + //! Copying disallowed + Standard_CLocaleSentry (const Standard_CLocaleSentry& ); + Standard_CLocaleSentry& operator= (const Standard_CLocaleSentry& ); + +}; + +#endif // _Standard_CLocaleSentry_H__ diff --git a/src/Standard/Standard_CString.cxx b/src/Standard/Standard_CString.cxx index 7f6fdc7fb0..8ee527d9e3 100755 --- a/src/Standard/Standard_CString.cxx +++ b/src/Standard/Standard_CString.cxx @@ -1,5 +1,5 @@ // Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS +// Copyright (c) 1999-2013 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file @@ -30,9 +30,9 @@ # include #endif - +#include #include -#include +#include #include #if OptJr @@ -51,13 +51,14 @@ static const Standard_Integer static_MaskEndIntegerString[4] = { 0x00000000 , #include #include +#include //============================================================================ -//==== +//==== //============================================================================ -const Handle_Standard_Type& Standard_CString_Type_() +const Handle_Standard_Type& Standard_CString_Type_() { - static Handle_Standard_Type _aType = + static Handle_Standard_Type _aType = new Standard_Type("Standard_CString",sizeof(Standard_CString),0,NULL); return _aType; @@ -72,7 +73,7 @@ Standard_EXPORT void ShallowDump (const Standard_CString Value, Standard_OStream //============================================================================ //==== HashCode of a CString //============================================================================ -Standard_Integer HashCode (const Standard_CString Value, +Standard_Integer HashCode (const Standard_CString Value, const Standard_Integer Upper ) { Standard_Integer aLen ; @@ -113,7 +114,7 @@ Standard_Integer HashCodes (const Standard_CString Value , *tmphash; char tabchar[20]; #endif - + if (Value != NULL) { #if !OptJr @@ -124,7 +125,7 @@ Standard_Integer HashCodes (const Standard_CString Value , else tabchar[count] = charPtr[pos + count]; i++; } - tmphash = (Standard_Integer *)tabchar; + tmphash = (Standard_Integer *)tabchar; aHashCode = aHashCode ^ *tmphash; } } @@ -256,4 +257,67 @@ Standard_Boolean ISSIMILAR(const Standard_CString One , return Standard_True ; } +#ifdef __APPLE__ + // There are a lot of *_l functions availalbe on Mac OS X - we use them + #define SAVE_TL() +#elif defined(_WIN32) + // MSVCRT has equivalents with slightly different syntax + #define SAVE_TL() + #define strtod_l(thePtr, theNextPtr, theLocale) _strtod_l(thePtr, theNextPtr, theLocale) + #define vprintf_l(theLocale, theFormat, theArgPtr) _vprintf_l(theFormat, theLocale, theArgPtr) + #define vsprintf_l(theBuffer, theLocale, theFormat, theArgPtr) _vsprintf_l(theBuffer, theFormat, theLocale, theArgPtr) + #define vfprintf_l(theFile, theLocale, theFormat, theArgPtr) _vfprintf_l(theFile, theFormat, theLocale, theArgPtr) +#else + // glibc provides only limited xlocale implementation: + // strtod_l/strtol_l/strtoll_l functions with explicitly specified locale + // and newlocale/uselocale/freelocale to switch locale within current thread only. + // So we switch to C locale temporarily + #define SAVE_TL() Standard_CLocaleSentry aLocaleSentry; + #ifndef HAVE_XLOCALE_H + #error System does not support xlocale. Import/export could be broken if C locale did not specified by application. + #define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr) + #endif + #define vprintf_l(theLocale, theFormat, theArgPtr) vprintf(theFormat, theArgPtr) + #define vsprintf_l(theBuffer, theLocale, theFormat, theArgPtr) vsprintf(theBuffer, theFormat, theArgPtr) + #define vfprintf_l(theFile, theLocale, theFormat, theArgPtr) vfprintf(theFile, theFormat, theArgPtr) +#endif + +double Strtod (const char* theStr, char** theNextPtr) +{ + return strtod_l (theStr, theNextPtr, Standard_CLocaleSentry::GetCLocale()); +} + +double Atof (const char* theStr) +{ + return Strtod (theStr, NULL); +} + +int Printf (const Standard_CString theFormat, ...) +{ + SAVE_TL(); + va_list argp; + va_start(argp, theFormat); + int result = vprintf_l (Standard_CLocaleSentry::GetCLocale(), theFormat, argp); + va_end(argp); + return result; +} +int Fprintf (FILE* theFile, const char* theFormat, ...) +{ + SAVE_TL(); + va_list argp; + va_start(argp, theFormat); + int result = vfprintf_l(theFile, Standard_CLocaleSentry::GetCLocale(), theFormat, argp); + va_end(argp); + return result; +} + +int Sprintf (char* theBuffer, const char* theFormat, ...) +{ + SAVE_TL(); + va_list argp; + va_start(argp, theFormat); + int result = vsprintf_l(theBuffer, Standard_CLocaleSentry::GetCLocale(), theFormat, argp); + va_end(argp); + return result; +} diff --git a/src/Standard/Standard_CString.hxx b/src/Standard/Standard_CString.hxx old mode 100755 new mode 100644 index e6fef5ddde..acd19bf920 --- a/src/Standard/Standard_CString.hxx +++ b/src/Standard/Standard_CString.hxx @@ -19,7 +19,7 @@ //============================================================================ //==== Titre: Standard_CString.hxx //==== Role : The headr file of primitve type "CString" from package "Standard" -//==== +//==== //==== Implementation: This is a primitive type implementadef with typedef //==== typedef char* Standard_CString; //============================================================================ @@ -31,11 +31,12 @@ # include # endif -# ifdef WNT +# ifdef _MSC_VER # define strcasecmp _stricmp # endif # include +# include # ifndef _Standard_Integer_HeaderFile # include @@ -79,6 +80,13 @@ inline Standard_Integer HASHCODE (const Standard_CString, __Standard_API Standard_Integer HASHCODES (const Standard_CString, const Standard_Integer); +//! Equivalents of functions from standard C library that use always C locale +__Standard_API double Atof (const char* theStr); +__Standard_API double Strtod (const char* theStr, char** theNextPtr); +__Standard_API int Printf (const char* theFormat, ...); +__Standard_API int Fprintf (FILE* theFile, const char* theFormat, ...); +__Standard_API int Sprintf (char* theBuffer, const char* theFormat, ...); + //============================================================================ //==== ShallowCopy: Returns a CString //============================================================================ @@ -92,7 +100,7 @@ inline Standard_CString ShallowCopy (const Standard_CString Value) //============================================================================ inline Standard_Boolean IsSimilar(const Standard_CString One ,const Standard_CString Two) -{ +{ return (strcmp(One,Two) == 0); } @@ -101,7 +109,7 @@ inline Standard_Boolean IsSimilar(const Standard_CString One //==== the HashCode % Upper //============================================================================ inline Standard_Integer HashCode (const Standard_CString Value, - const Standard_Integer Len , + const Standard_Integer Len , const Standard_Integer Upper , Standard_Integer& aHashCode ) { @@ -127,7 +135,7 @@ inline Standard_Integer HashCode (const Standard_CString Value, //==== and the HashCode % Upper //============================================================================ inline Standard_Integer HASHCODE (const Standard_CString Value, - const Standard_Integer Len , + const Standard_Integer Len , const Standard_Integer Upper , Standard_Integer& aHashCode ) { @@ -140,7 +148,7 @@ inline Standard_Integer HASHCODE (const Standard_CString Value, //==== HashCode of a CString converted to uppercase //============================================================================ inline Standard_Integer HASHCODE (const Standard_CString Value, - const Standard_Integer Len , + const Standard_Integer Len , const Standard_Integer Upper) { // return (Abs( HASHCODES( Value , Len ) ) % Upper ) + 1 ; @@ -159,7 +167,7 @@ inline Standard_Boolean ISEQUAL(const Standard_CString One , const Standard_Integer LenOne , const Standard_CString Two, const Standard_Integer LenTwo ) -{ +{ if ( One == Two ) return Standard_True ; diff --git a/src/StepSelect/StepSelect_Activator.cxx b/src/StepSelect/StepSelect_Activator.cxx index c7e7401b85..dc30cc7ee6 100755 --- a/src/StepSelect/StepSelect_Activator.cxx +++ b/src/StepSelect/StepSelect_Activator.cxx @@ -114,8 +114,8 @@ IFSelect_ReturnStatus StepSelect_Activator::Do } Standard_Real Rmin=0., Rmax=0.; if (argc > 4) { - Rmin = atof(pilot->Word(4).ToCString()); - Rmax = atof(pilot->Word(5).ToCString()); + Rmin = Atof(pilot->Word(4).ToCString()); + Rmax = Atof(pilot->Word(5).ToCString()); if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"< 0) { char mess[30]; - sprintf(mess,", in range %f %f %s", + Sprintf(mess,", in range %f %f %s", therangemin,therangemax,theformrange.ToCString()); lab.AssignCat(mess); } diff --git a/src/Storage/Storage_Schema.cxx b/src/Storage/Storage_Schema.cxx index d5d6e67357..7436a45d64 100755 --- a/src/Storage/Storage_Schema.cxx +++ b/src/Storage/Storage_Schema.cxx @@ -1548,20 +1548,10 @@ Handle(Storage_Data)& Storage_Schema::ICurrentData() TCollection_AsciiString Storage_Schema::ICreationDate() { - // on sauvegarde l'ancien LC_NUMERIC - char *oldnum,*plocal ; - plocal = setlocale(LC_NUMERIC, NULL); - oldnum = new char[strlen(plocal)+1] ; - strcpy(oldnum,plocal); - - char nowstr[SLENGTH]; time_t nowbin; struct tm *nowstruct; - - (void)setlocale(LC_ALL, ""); - - if (time(&nowbin) == (time_t) - 1) + if (time(&nowbin) == (time_t)-1) cerr << "Storage ERROR : Could not get time of day from time()" << endl; nowstruct = localtime(&nowbin); @@ -1570,11 +1560,6 @@ TCollection_AsciiString Storage_Schema::ICreationDate() cerr << "Storage ERROR : Could not get string from strftime()" << endl; TCollection_AsciiString t(nowstr); - - // on remet le LC_NUMERIC a la precedente valeur - setlocale(LC_NUMERIC, oldnum); - delete[] oldnum; - return t; } diff --git a/src/TCollection/TCollection_AsciiString.cxx b/src/TCollection/TCollection_AsciiString.cxx index 43d949d3e6..29374177da 100755 --- a/src/TCollection/TCollection_AsciiString.cxx +++ b/src/TCollection/TCollection_AsciiString.cxx @@ -160,7 +160,7 @@ TCollection_AsciiString::TCollection_AsciiString(const Standard_Integer aValue) union { int bid ; // ?? to ensure alignment of t[] by double-word?? char t [13]; } CHN ; - sprintf(&CHN.t[0],"%d",aValue); + Sprintf(&CHN.t[0],"%d",aValue); #if OptJr STRINGLEN( CHN.t , mylength ) ; #else @@ -184,7 +184,7 @@ TCollection_AsciiString::TCollection_AsciiString(const Standard_Real aValue) union { int bid ; char t [50]; } CHN ; - sprintf(&CHN.t[0],"%g",aValue); + Sprintf(&CHN.t[0],"%g",aValue); #if OptJr STRINGLEN( CHN.t , mylength ) ; #else @@ -1023,11 +1023,7 @@ Standard_Boolean TCollection_AsciiString::IsRealValue()const { char *ptr; if(mystring) { -//#ifdef DEB -// Standard_Real value = strtod(mystring,&ptr); -//#else - strtod(mystring,&ptr); -//#endif + Strtod(mystring,&ptr); if (ptr != mystring) return Standard_True; else return Standard_False; } @@ -1161,7 +1157,7 @@ Standard_Real TCollection_AsciiString::RealValue()const char *ptr; Standard_Real value = 0; if(mystring) { - value = strtod(mystring,&ptr); + value = Strtod(mystring,&ptr); if (ptr != mystring) return value; } Standard_NumericError::Raise("TCollection_AsciiString::RealValue"); diff --git a/src/TCollection/TCollection_ExtendedString.cxx b/src/TCollection/TCollection_ExtendedString.cxx index 7b0dfa3dee..d9a70d845e 100755 --- a/src/TCollection/TCollection_ExtendedString.cxx +++ b/src/TCollection/TCollection_ExtendedString.cxx @@ -257,7 +257,7 @@ TCollection_ExtendedString::TCollection_ExtendedString { union {int bid ; char t [13];} CHN ; - sprintf(&CHN.t[0],"%d",aValue); + Sprintf(&CHN.t[0],"%d",aValue); #if OptJr STRINGLEN( CHN.t , mylength ) ; #else @@ -276,7 +276,7 @@ TCollection_ExtendedString::TCollection_ExtendedString { union {int bid ; char t [50];} CHN ; - sprintf(&CHN.t[0],"%g",aValue); + Sprintf(&CHN.t[0],"%g",aValue); #if OptJr STRINGLEN( CHN.t , mylength ) ; #else diff --git a/src/TObjDRAW/TObjDRAW.cxx b/src/TObjDRAW/TObjDRAW.cxx index 35baacaedb..5d175694ee 100755 --- a/src/TObjDRAW/TObjDRAW.cxx +++ b/src/TObjDRAW/TObjDRAW.cxx @@ -318,14 +318,14 @@ static Standard_Integer setVal (Draw_Interpretor& di, Standard_Integer argc, con } if ( !strcmp(argv[3],"-r") ) { - int Nb = atoi(argv[4]); + int Nb = Draw::Atoi(argv[4]); Handle(TColStd_HArray1OfReal) rArr = new TColStd_HArray1OfReal(1,Nb); for ( int i = 1; i <= Nb; i++ ) - rArr->SetValue(i, atof(argv[4+i])); + rArr->SetValue(i, Draw::Atof(argv[4+i])); tObj->SetRealArr( rArr ); } else - tObj->SetInt( atoi(argv[3] ) ); + tObj->SetInt( Draw::Atoi(argv[3] ) ); return 0; } diff --git a/src/TestTopOpe/TestTopOpe_BOOP.cxx b/src/TestTopOpe/TestTopOpe_BOOP.cxx index d719796d2d..935699eefb 100755 --- a/src/TestTopOpe/TestTopOpe_BOOP.cxx +++ b/src/TestTopOpe/TestTopOpe_BOOP.cxx @@ -169,7 +169,7 @@ Standard_Integer TestTopOpe_BOOP::FindShape(const TCollection_AsciiString& name) Standard_Integer ix = 0; if (ISINTEGER(name.ToCString())) { if (myHDS.IsNull()) return 0; - Standard_Integer is = atoi(name.ToCString()); + Standard_Integer is = Draw::Atoi(name.ToCString()); Standard_Integer ns = myHDS->NbShapes(); Standard_Integer i1 = 0, i2 = 0; if (is != 0) { diff --git a/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx b/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx index b06745257d..3106068036 100755 --- a/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx +++ b/src/TestTopOpe/TestTopOpe_BOOPCommands.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #ifdef HAVE_STRINGS_H # include @@ -99,18 +100,18 @@ Standard_Integer TOPOC(Draw_Interpretor& interpretor,Standard_Integer na,const c } else if (na > 3) { // tsp IN/ON/OUT e/f/s i1 i2 ... - for(i=3;iGetSplit(typ,sta,atoi(a[i])); + for(i=3;iGetSplit(typ,sta,Draw::Atoi(a[i])); } } else { // tsp IN/ON/OUT i1 i2 ... - for(i=2;iGetSplit(sta,atoi(a[i])); + for(i=2;iGetSplit(sta,Draw::Atoi(a[i])); } } } else { // tsp i1 i2 ... for (i = 1; i < na; i++) { - if ( ISINTEGER(a[i]) ) PBOOP->GetSplit(atoi(a[i])); + if ( ISINTEGER(a[i]) ) PBOOP->GetSplit(Draw::Atoi(a[i])); } } } @@ -142,18 +143,18 @@ Standard_Integer TOPOC(Draw_Interpretor& interpretor,Standard_Integer na,const c } else if (na > 3) { // tme IN/ON/OUT e/f/s i1 i2 ... - for(i=3;iGetMerged(typ,sta,atoi(a[i])); + for(i=3;iGetMerged(typ,sta,Draw::Atoi(a[i])); } } else { // tme IN/ON/OUT i1 i2 ... - for(i=2;iGetMerged(sta,atoi(a[i])); + for(i=2;iGetMerged(sta,Draw::Atoi(a[i])); } } } else { // tme i1 i2 ... for (i = 1; i < na; i++) { - if ( ISINTEGER(a[i]) ) PBOOP->GetMerged(atoi(a[i])); + if ( ISINTEGER(a[i]) ) PBOOP->GetMerged(Draw::Atoi(a[i])); } } } @@ -186,7 +187,7 @@ Standard_Integer TOPOC(Draw_Interpretor& interpretor,Standard_Integer na,const c if (!strcmp(a[ia],"-d")) continue; if (!strcmp(a[ia],"-c")) continue; if (!strcmp(a[ia],"-AB")) continue; - Standard_Integer ie = atoi(a[ia]); + Standard_Integer ie = Draw::Atoi(a[ia]); if (ie>=1 && ie<=n) { onedef = Standard_True; tabloe->SetValue(ie,Standard_True); } } if (!onedef) tabloe->Init(Standard_True); @@ -327,7 +328,7 @@ Standard_Integer BOOPCHK(Draw_Interpretor& ,Standard_Integer na,const char** a) #ifdef DEB // Standard_IMPORT extern Standard_Integer TopOpeBRepTool_BOOOPE_CHECK_DEB; Standard_IMPORT Standard_Integer TopOpeBRepTool_BOOOPE_CHECK_DEB; - if ( na >= 2 ) TopOpeBRepTool_BOOOPE_CHECK_DEB = (atoi(a[1])) ? 1 : 0; + if ( na >= 2 ) TopOpeBRepTool_BOOOPE_CHECK_DEB = (Draw::Atoi(a[1])) ? 1 : 0; #endif return 0; } @@ -345,21 +346,21 @@ Standard_Integer TOPOSETCOMMANDS(TestTopOpe_BOOP& PT,Standard_Integer na,const c return 1; case 4: if(!strcasecmp(a[1],"p")) - PT.SetTol(TopOpeBRepDS_POINT,atoi(a[2]),atof(a[3])); + PT.SetTol(TopOpeBRepDS_POINT,Draw::Atoi(a[2]),Draw::Atof(a[3])); else if(!strcasecmp(a[1],"c"))// c ou C - PT.SetTol(TopOpeBRepDS_CURVE,atoi(a[2]),atof(a[3])); + PT.SetTol(TopOpeBRepDS_CURVE,Draw::Atoi(a[2]),Draw::Atof(a[3])); else if(!strcasecmp(a[1],"s")) - PT.SetTol(TopOpeBRepDS_SURFACE,atoi(a[2]),atof(a[3])); + PT.SetTol(TopOpeBRepDS_SURFACE,Draw::Atoi(a[2]),Draw::Atof(a[3])); else if(!strcasecmp(a[1],"sh") || !strcasecmp(a[1],"v") || !strcasecmp(a[1],"e") || !strcasecmp(a[1],"f") || !strcasecmp(a[1],"w")) - PT.SetTol(atoi(a[2]),atof(a[3])); + PT.SetTol(Draw::Atoi(a[2]),Draw::Atof(a[3])); break; case 6: if(!strcasecmp(a[1],"p")) - PT.SetPnt(atoi(a[2]),atof(a[3]),atof(a[4]),atof(a[5])); + PT.SetPnt(Draw::Atoi(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]),Draw::Atof(a[5])); else return 1; break; @@ -431,7 +432,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha else if (!strcmp(thea,"-tx")) { suppressarg(na,a,ia); if (ia + 1 < na) { - VT.SetTolx(atof(a[ia]),atof(a[ia + 1])); + VT.SetTolx(Draw::Atof(a[ia]),Draw::Atof(a[ia + 1])); suppressarg(na,a,ia); suppressarg(na,a,ia); } @@ -441,7 +442,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha suppressarg(na,a,ia); } else { - VT.SetTolx(atof(a[ia]),atof(a[ia])); + VT.SetTolx(Draw::Atof(a[ia]),Draw::Atof(a[ia])); suppressarg(na,a,ia); } } @@ -449,7 +450,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha else if (!strcmp(thea,"-ti")) { suppressarg(na,a,ia); if (ia + 1 < na) { - VT.SetToli(atof(a[ia]),atof(a[ia + 1])); + VT.SetToli(Draw::Atof(a[ia]),Draw::Atof(a[ia + 1])); suppressarg(na,a,ia); suppressarg(na,a,ia); } @@ -459,7 +460,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha suppressarg(na,a,ia); } else { - VT.SetToli(atof(a[ia]),atof(a[ia])); + VT.SetToli(Draw::Atof(a[ia]),Draw::Atof(a[ia])); suppressarg(na,a,ia); } } @@ -467,7 +468,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha else if (!strcmp(thea,"-c")) { suppressarg(na,a,ia); if (ia < na) { - VT.SetClear((Standard_Boolean)atoi(a[ia])); + VT.SetClear((Standard_Boolean)Draw::Atoi(a[ia])); suppressarg(na,a,ia); } else VT.SetClear(Standard_True); @@ -483,7 +484,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha else if (!strcmp(thea,"-m")) { suppressarg(na,a,ia); if (ia < na) { - VT.SetMode(atoi(a[ia])); + VT.SetMode(Draw::Atoi(a[ia])); suppressarg(na,a,ia); } else VT.SetMode(0); @@ -491,7 +492,7 @@ Standard_Integer VARSTOPOARGS(TestTopOpe_BOOP& PT,Standard_Integer& na,const cha else if (!strcmp(thea,"-v")) { suppressarg(na,a,ia); if (ia < na) { - VT.SetVerbose(atoi(a[ia])); + VT.SetVerbose(Draw::Atoi(a[ia])); suppressarg(na,a,ia); } else VT.SetVerbose(0); diff --git a/src/TestTopOpe/TestTopOpe_CORCommands.cxx b/src/TestTopOpe/TestTopOpe_CORCommands.cxx index b77d2f0b1f..8f02967132 100755 --- a/src/TestTopOpe/TestTopOpe_CORCommands.cxx +++ b/src/TestTopOpe/TestTopOpe_CORCommands.cxx @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -575,7 +576,7 @@ void FUN_mkBnd2dBREP(const TopoDS_Shape& W, const TopoDS_Shape& F,Bnd_Box2d& B2d static Standard_Integer drawbnd2d(Draw_Interpretor& , Standard_Integer n, const char** a) { if (n < 5) return 1; - Standard_Integer i = atoi(a[4]); + Standard_Integer i = Draw::Atoi(a[4]); TopoDS_Shape W = DBRep::Get(a[2]); TopoDS_Shape F = DBRep::Get(a[3]); if (W.IsNull() || F.IsNull()) return 1; @@ -643,7 +644,7 @@ static Standard_Integer classifBnd2d(Draw_Interpretor& di, Standard_Integer n, c static Standard_Integer pntonc(Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n < 3) return 1; - Standard_Real x = atof(a[1]); + Standard_Real x = Draw::Atof(a[1]); Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]); if (C.IsNull()) {di<<"null curve"<<"\n"; return 1;} gp_Pnt p = C->Value(x); @@ -655,7 +656,7 @@ static Standard_Integer pntonc(Draw_Interpretor& di, Standard_Integer n, const c static Standard_Integer pntonc2d(Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n < 4) return 1; - Standard_Real x = atof(a[1]); + Standard_Real x = Draw::Atof(a[1]); Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]); if (C2d.IsNull()) {di<<"null curve"<<"\n"; return 1;} Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[3]); @@ -701,7 +702,7 @@ static Standard_Integer solidclassifier(Draw_Interpretor& di, Standard_Integer n TopoDS_Shape s = DBRep::Get(a[1]); if (s.IsNull()) {di<<"null shape"<<"\n";return 1;} gp_Pnt p; DrawTrSurf::GetPoint(a[2], p); - Standard_Real tol = atof(a[3]); + Standard_Real tol = Draw::Atof(a[3]); TopOpeBRepTool_SolidClassifier soclassi; TopAbs_State sta = TopAbs_UNKNOWN; @@ -725,7 +726,7 @@ static Standard_Integer class3dclassifier(Draw_Interpretor& di, Standard_Integer TopoDS_Shape s = DBRep::Get(a[1]); if (s.IsNull()) {di<<"null shape"<<"\n";return 1;} gp_Pnt p; DrawTrSurf::GetPoint(a[2], p); - Standard_Real tol = atof(a[3]); + Standard_Real tol = Draw::Atof(a[3]); BRepClass3d_SolidClassifier soclassi(s); TopAbs_State sta = TopAbs_UNKNOWN; @@ -783,7 +784,7 @@ static Standard_Integer normal(Draw_Interpretor& di, Standard_Integer n, const c if (f.IsNull()) {di<<"null shape"<<"\n";return 1;} gp_Pnt p; DrawTrSurf::GetPoint(a[2], p); #ifdef DEB - Standard_Real length = atof(a[3]); + Standard_Real length = Draw::Atof(a[3]); #endif Standard_Real dist=0.; gp_Pnt2d uv; Standard_Boolean ok = FUN_tool_projPonF(p,f,uv,dist); if (!ok) {di<<"projection failed"<<"\n"; return 1;} @@ -805,9 +806,9 @@ static Standard_Integer curvature(Draw_Interpretor& di, Standard_Integer n, cons TopoDS_Face f = TopoDS::Face(aLocalShape); // TopoDS_Face f = TopoDS::Face(DBRep::Get(a[1])); if (f.IsNull()) {di<<"null shape"<<"\n";return 1;} - Standard_Real x = atof(a[2]); - Standard_Real y = atof(a[3]); - Standard_Real z = atof(a[4]); + Standard_Real x = Draw::Atof(a[2]); + Standard_Real y = Draw::Atof(a[3]); + Standard_Real z = Draw::Atof(a[4]); Handle(Geom_Line) line = new Geom_Line(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Dir(x,y,z))); BRepAdaptor_Surface BS(f); Handle(Geom_Surface) su = BRep_Tool::Surface(f); diff --git a/src/TestTopOpe/TestTopOpe_HDSCommands.cxx b/src/TestTopOpe/TestTopOpe_HDSCommands.cxx index 48a4b03ea4..37834ccfb6 100755 --- a/src/TestTopOpe/TestTopOpe_HDSCommands.cxx +++ b/src/TestTopOpe/TestTopOpe_HDSCommands.cxx @@ -165,7 +165,7 @@ void tsee_entity::Delete() Standard_Integer tsee_entity::Set(Standard_Integer na,const char** a,Standard_Integer iargK,Standard_Integer iargI) { myEOK = Standard_False; if (iargK>=na) return 1; if (iargI>=na) return 1; - TCollection_AsciiString ascK = a[iargK]; myEindex = atoi(a[iargI]); + TCollection_AsciiString ascK = a[iargK]; myEindex = Draw::Atoi(a[iargI]); myEiskind = TestTopOpeDraw_TTOT::StringToKind(ascK,myETK); if (!myEiskind) return 1; if (myETK == TopOpeBRepDS_UNKNOWN) return 1; @@ -649,7 +649,7 @@ static void tsee_flags(Standard_Integer& na,const char** a) { } else if (!strcasecmp(a[ia],"-p") && (ia < na-1)) { suppressargs(na,a,ia,ia+1); - Standard_Real t = atof(a[ia+1]); + Standard_Real t = Draw::Atof(a[ia+1]); if (t >= 0. && t <= 1.) { OldParFlag = ParFlag; ParFlag = t; } @@ -788,7 +788,7 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c else if ( Tpar.isshap() ) { // na == 2 : display all DS shapes of type TS - // na > 2 : display DS shapes of type TS of index atoi(a[2]..a[narg-1]) + // na > 2 : display DS shapes of type TS of index Draw::Atoi(a[2]..a[narg-1]) if (na == 2 ) { TopOpeBRepDS_Explorer x(HDS,Tpar.TS(),Standard_False); for(;x.More();x.Next()) (*SeeShapefunc)(x.Index(),x.Current()); @@ -809,7 +809,7 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c } else { for (ia = i1arg+1; ia < na; ia++) { - is = atoi(a[ia]); + is = Draw::Atoi(a[ia]); (*SeeShapefunc)(is,GetShape(is,Tpar.TS())); } } @@ -817,7 +817,7 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c } else { for (ia = i1arg+1; ia < na; ia++) { - is = atoi(a[ia]); + is = Draw::Atoi(a[ia]); (*SeeShapefunc)(is,GetShape(is,Tpar.TS())); } } @@ -826,9 +826,9 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c else if ( Tpar.isgeom() ) { // na == 2 : display all DS geometries of type TK - // na > 2 : display DS geometries of type TK index atoi(a[2])..a[narg-1]) + // na > 2 : display DS geometries of type TK index Draw::Atoi(a[2])..a[narg-1]) if (na == 2 ) SeeGeometry(Tpar.TK()); - else for (ia = i1arg+1; ia < na; ia++) SeeGeometry(Standard_Integer(atoi(a[ia])),Tpar.TK()); + else for (ia = i1arg+1; ia < na; ia++) SeeGeometry(Standard_Integer(Draw::Atoi(a[ia])),Tpar.TK()); } else if ( Tpar.isafev() ) { @@ -841,14 +841,14 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c else if ( Tpar.isedcu() ) { // na == 2 : display curves of all DS edges - // na > 2 : display curve of DS edges index atoi(a[2])..a[narg-1]) + // na > 2 : display curve of DS edges index Draw::Atoi(a[2])..a[narg-1]) if ( na == 2 ) { TopOpeBRepDS_Explorer x(HDS,TopAbs_EDGE,Standard_False); for (;x.More();x.Next()) SeeEdgeCurve(x.Index(),x.Edge()); } else { for (ia = i1arg+1; ia < na; ia++) { - is = atoi(a[ia]); + is = Draw::Atoi(a[ia]); SeeEdgeCurve(is,GetShape(is,TopAbs_EDGE)); } } @@ -857,7 +857,7 @@ Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,c else if ( Tpar.issect() ) { // na=2 all section edges,na>2 section edges (a[2]..a[na-1]) Standard_Integer ise,nse = BDS.NbSectionEdges(); if (na == 2) for (ise = 1; ise<=nse; ise++) SeeSectionEdge(ise); - else for (ia = i1arg+1; ia 2 : dump DS entities of type TK index atoi(a[2])..a[narg-1]) + // nna > 2 : dump DS entities of type TK index Draw::Atoi(a[2])..a[narg-1]) for (ia = 2; ia < na; ia++) { if ( !strcmp(a[ia],"sd") ) { // dump all shapes HasSameDomain of type TS @@ -1183,7 +1183,7 @@ Standard_Integer tds(Draw_Interpretor& di,Standard_Integer na,const char** a) } } else { - ids = atoi(a[ia]); + ids = Draw::Atoi(a[ia]); if ( Tpar.isshap() ) { if (Tpar.TS() != TopAbs_SHAPE) Dumper.DumpTopology(Tpar.TK(),ids,cout); else { @@ -1216,8 +1216,8 @@ Standard_Integer TPPE(Draw_Interpretor& di,Standard_Integer na,const char** a) gp_Pnt pds; TopoDS_Edge ed; - Standard_Integer ip = atoi(a[2]); - Standard_Integer ie = atoi(a[4]); + Standard_Integer ip = Draw::Atoi(a[2]); + Standard_Integer ie = Draw::Atoi(a[4]); ok = ok && (ip >= 1); ok = ok && (ie >= 1); if (!ok) { di <<" bad data"<<"\n"; @@ -1371,7 +1371,7 @@ Standard_Integer tcx(Draw_Interpretor& di,Standard_Integer na,const char** a) if ( HDS.IsNull() ) { COUTNOHDS(di); return 0; } if (na == 1) FDSCNX_Dump(HDS); else if (na == 2) { - if (ISINTEGER(a[1])) FDSCNX_Dump(HDS,atoi(a[1])); + if (ISINTEGER(a[1])) FDSCNX_Dump(HDS,Draw::Atoi(a[1])); else } return 0; @@ -1396,11 +1396,11 @@ Standard_Integer tdsri(Draw_Interpretor& di,Standard_Integer na_in,const char** TDSpar Tpar(a[i1arg]); if ( strcasecmp(a[i1arg + 2],"i") ) return 0; - Standard_Integer ii = atoi(a[i1arg + 3]); + Standard_Integer ii = Draw::Atoi(a[i1arg + 3]); // Standard_Integer ia,is,ig; Standard_Integer is,ig; if ( Tpar.isshap() ) { - is = atoi(a[i1arg + 1]); + is = Draw::Atoi(a[i1arg + 1]); const TopoDS_Shape& s = GetShape(is,Tpar.TS()); if (s.IsNull()) return 0; TopOpeBRepDS_ListOfInterference& li = BDS.ChangeShapeInterferences(is); Standard_Integer i=0; TopOpeBRepDS_ListIteratorOfListOfInterference it(li); @@ -1413,7 +1413,7 @@ Standard_Integer tdsri(Draw_Interpretor& di,Standard_Integer na_in,const char** } } else if ( Tpar.isgeom() ) { - ig = atoi(a[i1arg + 1]); + ig = Draw::Atoi(a[i1arg + 1]); } return 0; } // tdsri diff --git a/src/TestTopOpe/TestTopOpe_MesureCommands.cxx b/src/TestTopOpe/TestTopOpe_MesureCommands.cxx index 7ba8783072..32909a9d22 100755 --- a/src/TestTopOpe/TestTopOpe_MesureCommands.cxx +++ b/src/TestTopOpe/TestTopOpe_MesureCommands.cxx @@ -132,7 +132,7 @@ Standard_Integer Mes(Draw_Interpretor& di,Standard_Integer na, const char** a) } else if (na == 4) { if (!strcmp(a[1],"xy")) { - Standard_Integer i = atoi(a[2]); + Standard_Integer i = Draw::Atoi(a[2]); const TestTopOpeTools_Mesure& M = (*PAMES).Value(SetName(a[3],di)); Standard_Real x,y,z;gp_Pnt p=M.Pnt(i);p.Coord(x,y,z); di<Eval("info proc vx2d_displayface"); if (mypdi->Result()) { - sprintf(s,"vx2d_displayface %s",myfacename.ToCString()); + Sprintf(s,"vx2d_displayface %s",myfacename.ToCString()); mypdi->Eval(s); } else cout<<"procedure vx2d_displayface non trouvee"<= 3) ? atoi(a[2]) : 0; + Standard_Integer iearg = (na >= 3) ? Draw::Atoi(a[2]) : 0; TCollection_AsciiString stss; Standard_Integer i = 1; TopExp_Explorer ex; for (ex.Init(S,tt);ex.More();ex.Next(),i++) { diff --git a/src/TestTopOpeTools/TestTopOpeTools_TraceCommands.cxx b/src/TestTopOpeTools/TestTopOpeTools_TraceCommands.cxx index fed9bc0086..5be2c38d46 100755 --- a/src/TestTopOpeTools/TestTopOpeTools_TraceCommands.cxx +++ b/src/TestTopOpeTools/TestTopOpeTools_TraceCommands.cxx @@ -255,7 +255,7 @@ Standard_EXPORT Standard_Integer TestTopOpeTools_SetFlags const char* flag = a[1]; t_value value; // new value of flag if (n == 2) value = Standard_True; - else value = (atoi(a[2]) ? Standard_True : Standard_False); + else value = (Draw::Atoi(a[2]) ? Standard_True : Standard_False); if (mute == 0) { if ( n == 2 ) { diff --git a/src/TopOpeBRep/TopOpeBRep_traceALWL.cxx b/src/TopOpeBRep/TopOpeBRep_traceALWL.cxx index 0ef930d20e..85e40edb1a 100755 --- a/src/TopOpeBRep/TopOpeBRep_traceALWL.cxx +++ b/src/TopOpeBRep/TopOpeBRep_traceALWL.cxx @@ -89,10 +89,10 @@ void TopOpeBRep_ALWL::Set(const Standard_Boolean b, for (Standard_Integer i=0; i < n; i++) { const char *p = a[i]; if ( !strcasecmp(p,"def") ) { - if ( ++i < n ) SetDef(atof(a[i])); + if ( ++i < n ) SetDef(Atof(a[i])); } else if ( !strcasecmp(p,"pas") ) { - if ( ++i < n ) SetPas(atof(a[i])); + if ( ++i < n ) SetPas(Atof(a[i])); } else if ( !strcasecmp(p,"nbp") ) { if ( ++i < n ) SetNbp(atoi(a[i])); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx index 898c660ac4..1c30e11164 100755 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx @@ -296,7 +296,8 @@ void TopOpeBRepBuild_Builder::GdumpEDG(const TopoDS_Shape& E, Standard_Integer n = 0; GdumpSHAORI(E, (char *) "vertices of ");cout<UserBreak()) { - cout << "Interrupted by the user"<NewScope ( 10, "Locations" ); myLocations.SetProgress(myProgress); @@ -487,12 +473,9 @@ void TopTools_ShapeSet::Write(Standard_OStream& OS) myProgress->Show(); } - if (!myProgress.IsNull() && myProgress->UserBreak()) { - cout << "Interrupted by the user"<EndScope(); myProgress->Show(); + if (myProgress->UserBreak()) + OS << "Interrupted by the user"<UserBreak()) { cout << "Interrupted by the user"<UserBreak()) { cout << "Interrupted by the user"< #include - -// GG 09.04.98 PRO13136 -// Ne pas utiliser la fonction systeme atof() qui -// depend de la localisation -static char DecimalPoint = '\0'; -static void GetDecimalPoint() { - Standard_Real f = 1.1 ; - char str[5] ; - - sprintf(str,"%.1f",f) ; -//#ifdef DEB -// printf("Local System is %s\n",str) ; -//#endif - DecimalPoint = str[1] ; -} - //======================================================================= //function : Units_UnitsDictionary //purpose : diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index c5f70b7f53..47980f3f3c 100755 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -677,18 +677,18 @@ static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char } else if( argc > 1 ) { - StdSelect_SensitivityMode aMode = ( StdSelect_SensitivityMode )atoi( argv[1] ); + StdSelect_SensitivityMode aMode = ( StdSelect_SensitivityMode )Draw::Atoi( argv[1] ); aContext->SetSensitivityMode( aMode ); if( argc > 2 ) { if( aMode == StdSelect_SM_WINDOW ) { - Standard_Integer aPixelTolerance = atoi( argv[2] ); + Standard_Integer aPixelTolerance = Draw::Atoi( argv[2] ); aContext->SetPixelTolerance( aPixelTolerance ); } else if( aMode == StdSelect_SM_VIEW ) { - Standard_Real aSensitivity = atof( argv[2] ); + Standard_Real aSensitivity = Draw::Atof( argv[2] ); aContext->SetSensitivity( aSensitivity ); } } @@ -727,8 +727,8 @@ static Standard_Integer VDump (Draw_Interpretor& di, Standard_Integer argc, cons } } - Standard_Integer aWidth = (argc > 3) ? atoi (argv[3]) : 0; - Standard_Integer aHeight = (argc > 4) ? atoi (argv[4]) : 0; + Standard_Integer aWidth = (argc > 3) ? Draw::Atoi (argv[3]) : 0; + Standard_Integer aHeight = (argc > 4) ? Draw::Atoi (argv[4]) : 0; Handle(AIS_InteractiveContext) IC; Handle(V3d_View) view; @@ -855,7 +855,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar } } else if(argc==2){ - Standard_Integer Dmode = atoi(argv[1]); + Standard_Integer Dmode = Draw::Atoi(argv[1]); if(Ctx->NbCurrents()==0 && TypeOfOperation==3){ Handle(AIS_InteractiveObject) IO; VwrTst_DispErase(IO,Dmode,TypeOfOperation,Standard_True); @@ -878,7 +878,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar if(GetMapOfAIS().IsBound2(name)) IO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name)); if (!IO.IsNull()) - VwrTst_DispErase(IO,atoi(argv[2]),TypeOfOperation,Standard_True); + VwrTst_DispErase(IO,Draw::Atoi(argv[2]),TypeOfOperation,Standard_True); } return 0; } @@ -891,7 +891,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if(argc==1) return 1; - Standard_Integer On = atoi(argv[1]); + Standard_Integer On = Draw::Atoi(argv[1]); const Handle(AIS_InteractiveContext)& Ctx = ViewerTest::GetAISContext(); if(argc==2){ @@ -1095,14 +1095,14 @@ static int VTransparency (Draw_Interpretor& di, Standard_Integer argc, const Handle(AIS_InteractiveObject) ashape = Handle(AIS_InteractiveObject)::DownCast(anObj); if(HaveToSet) - TheAISContext()->SetTransparency(ashape,atof(argv[2]) ); + TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[2]) ); else TheAISContext()->UnsetTransparency(ashape); } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) { const Handle(NIS_InteractiveObject) ashape = Handle(NIS_InteractiveObject)::DownCast(anObj); if(HaveToSet) - ashape->SetTransparency(atof(argv[2]) ); + ashape->SetTransparency(Draw::Atof(argv[2]) ); else ashape->UnsetTransparency(); } @@ -1118,7 +1118,7 @@ static int VTransparency (Draw_Interpretor& di, Standard_Integer argc, { Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current(); if(HaveToSet) - TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False); + TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False); else TheAISContext()->UnsetTransparency(ashape,Standard_False); } @@ -1136,7 +1136,7 @@ static int VTransparency (Draw_Interpretor& di, Standard_Integer argc, Handle(AIS_InteractiveObject)::DownCast(it.Key1()); if (!ashape.IsNull()) if(HaveToSet) - TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False); + TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False); else TheAISContext()->UnsetTransparency(ashape,Standard_False); it.Next(); @@ -1281,14 +1281,14 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg const Handle(AIS_InteractiveObject) ashape = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name)); if (HaveToSet) - TheAISContext()->SetWidth ( ashape,atof (argv[2]) ); + TheAISContext()->SetWidth ( ashape,Draw::Atof (argv[2]) ); else TheAISContext()->UnsetWidth (ashape); } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) { const Handle(NIS_Triangulated) ashape = Handle(NIS_Triangulated)::DownCast(GetMapOfAIS().Find2(name)); if (HaveToSet && !ashape.IsNull()) - ashape->SetLineWidth ( atof (argv[2]) ); + ashape->SetLineWidth ( Draw::Atof (argv[2]) ); } } @@ -1303,7 +1303,7 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg { Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current(); if (HaveToSet) - TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False); + TheAISContext()->SetWidth(ashape,Draw::Atof(argv[1]),Standard_False); else TheAISContext()->UnsetWidth(ashape,Standard_False); } @@ -1320,7 +1320,7 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg Handle(AIS_InteractiveObject)::DownCast (it.Key1()); if (!ashape.IsNull()) if (HaveToSet) - TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False); + TheAISContext()->SetWidth(ashape,Draw::Atof(argv[1]),Standard_False); else TheAISContext()->UnsetWidth(ashape,Standard_False); it.Next(); @@ -1387,7 +1387,7 @@ static int VInteriorStyle (Draw_Interpretor& di, Standard_Integer argc, const ch if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) { const Handle(AIS_InteractiveObject) ashape = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name)); - SetInteriorStyle (ashape, atoi (argv[2]), di); + SetInteriorStyle (ashape, Draw::Atoi (argv[2]), di); } } //======================================================================= @@ -1400,7 +1400,7 @@ static int VInteriorStyle (Draw_Interpretor& di, Standard_Integer argc, const ch TheAISContext() ->NextCurrent() ) { Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current(); - SetInteriorStyle (ashape, atoi (argv[1]), di); + SetInteriorStyle (ashape, Draw::Atoi (argv[1]), di); } } //======================================================================= @@ -1413,7 +1413,7 @@ static int VInteriorStyle (Draw_Interpretor& di, Standard_Integer argc, const ch Handle(AIS_InteractiveObject) ashape = Handle(AIS_InteractiveObject)::DownCast (it.Key1()); if (!ashape.IsNull()) - SetInteriorStyle (ashape, atoi (argv[1]), di); + SetInteriorStyle (ashape, Draw::Atoi (argv[1]), di); it.Next(); } } @@ -1773,8 +1773,8 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha } myShape->SetTextureScale (( argv[2] ? Standard_True : Standard_False ), - ( argv[2] ? atof(argv[2]) : 1.0 ), - ( argv[2] ? atof(argv[argc-1]) : 1.0 ) ); + ( argv[2] ? Draw::Atof(argv[2]) : 1.0 ), + ( argv[2] ? Draw::Atof(argv[argc-1]) : 1.0 ) ); break; case 3: // vtexorigin : we change the origin of the texture on the shape @@ -1784,8 +1784,8 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha return 1; } myShape->SetTextureOrigin (( argv[2] ? Standard_True : Standard_False ), - ( argv[2] ? atof(argv[2]) : 0.0 ), - ( argv[2] ? atof(argv[argc-1]) : 0.0 )); + ( argv[2] ? Draw::Atof(argv[2]) : 0.0 ), + ( argv[2] ? Draw::Atof(argv[argc-1]) : 0.0 )); break; case 4: // vtexrepeat : we change the number of occurences of the texture on the shape @@ -1797,7 +1797,7 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha if (argc>2 && argv[2]) { di <<"Texture repeat enabled"<<"\n"; - myShape->SetTextureRepeat(Standard_True, atof(argv[2]), atof(argv[argc-1]) ); + myShape->SetTextureRepeat(Standard_True, Draw::Atof(argv[2]), Draw::Atof(argv[argc-1]) ); } else { @@ -2040,7 +2040,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) { myTimer.Start(); - if (atoi(argv[3])==1 ) { + if (Draw::Atoi(argv[3])==1 ) { di<<" Primitives sensibles OFF"<<"\n"; TheAISContext()->Deactivate(aIO); } @@ -2048,7 +2048,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) { di<<" Primitives sensibles ON"<<"\n"; } // Movement par transformation - if(atoi(argv[2]) ==1) { + if(Draw::Atoi(argv[2]) ==1) { di<<" Calcul par Transformation"<<"\n"; for (Standard_Real myAngle=0;Angle<10*2*M_PI; myAngle++) { @@ -2075,7 +2075,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) { TheAISContext() ->UpdateCurrentViewer(); } } - if (atoi(argv[3])==1 ){ + if (Draw::Atoi(argv[3])==1 ){ // On reactive la selection des primitives sensibles TheAISContext()->Activate(aIO,0); } @@ -2219,7 +2219,7 @@ static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv) if (argc < 3) { myDevCoef = 0.0008; } else { - myDevCoef =atof(argv[2]); + myDevCoef =Draw::Atof(argv[2]); } TCollection_AsciiString name=argv[1]; @@ -2294,7 +2294,7 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch // IL n'y a aps de nom de shape passe en argument if (HaveToSet && !ThereIsName){ - Standard_Integer aMode=atoi(argv [1]); + Standard_Integer aMode=Draw::Atoi(argv [1]); const char *cmode="???"; switch (aMode) { @@ -2406,7 +2406,7 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch } } else if (HaveToSet && ThereIsName){ - Standard_Integer aMode=atoi(argv [2]); + Standard_Integer aMode=Draw::Atoi(argv [2]); Handle(AIS_InteractiveObject) aIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[1])); @@ -3173,20 +3173,20 @@ static int VSetTransMode ( Draw_Interpretor& di, Standard_Integer argc, const ch TCollection_AsciiString shapeName; shapeName = argv[1]; - Standard_Integer persFlag1 = atoi(argv[2]); + Standard_Integer persFlag1 = Draw::Atoi(argv[2]); Standard_Integer persFlag2 = 0; Standard_Integer persFlag3 = 0; gp_Pnt origin = gp_Pnt( 0.0, 0.0, 0.0 ); if ( argc == 4 || argc == 5 || argc == 7 || argc == 8 ) { - persFlag2 = atoi(argv[3]); + persFlag2 = Draw::Atoi(argv[3]); } if ( argc == 5 || argc == 8 ) { - persFlag3 = atoi(argv[4]); + persFlag3 = Draw::Atoi(argv[4]); } if ( argc >= 6 ) { - origin.SetX( atof(argv[argc - 3]) ); - origin.SetY( atof(argv[argc - 2]) ); - origin.SetZ( atof(argv[argc - 1]) ); + origin.SetX( Draw::Atof(argv[argc - 3]) ); + origin.SetY( Draw::Atof(argv[argc - 2]) ); + origin.SetZ( Draw::Atof(argv[argc - 1]) ); } Standard_Boolean IsBound = GetMapOfAIS().IsBound2(shapeName); @@ -3247,7 +3247,7 @@ Standard_Integer hlrtest(Draw_Interpretor&, Standard_Integer n, const char** Standard_Boolean IsPoly = Standard_False; gp_Ax2 anAx2 = gp::XOY(); - //if(n > 2) aPolyAlgo = atoi(a[2]); + //if(n > 2) aPolyAlgo = Draw::Atoi(a[2]); //IsPoly = aPolyAlgo > 0; @@ -3256,17 +3256,17 @@ Standard_Integer hlrtest(Draw_Interpretor&, Standard_Integer n, const char** if (n == 11) { - Standard_Real x = atof(a[2]); - Standard_Real y = atof(a[3]); - Standard_Real z = atof(a[4]); + Standard_Real x = Draw::Atof(a[2]); + Standard_Real y = Draw::Atof(a[3]); + Standard_Real z = Draw::Atof(a[4]); - Standard_Real dx = atof(a[5]); - Standard_Real dy = atof(a[6]); - Standard_Real dz = atof(a[7]); + Standard_Real dx = Draw::Atof(a[5]); + Standard_Real dy = Draw::Atof(a[6]); + Standard_Real dz = Draw::Atof(a[7]); - Standard_Real dx1 = atof(a[8]); - Standard_Real dy1 = atof(a[9]); - Standard_Real dz1 = atof(a[10]); + Standard_Real dx1 = Draw::Atof(a[8]); + Standard_Real dy1 = Draw::Atof(a[9]); + Standard_Real dz1 = Draw::Atof(a[10]); gp_Pnt anOrigin (x, y, z); gp_Dir aNormal (dx, dy, dz); @@ -3307,7 +3307,7 @@ Standard_Integer phlrtest(Draw_Interpretor&, Standard_Integer n, const char* Standard_Boolean IsPoly = Standard_True; gp_Ax2 anAx2 = gp::XOY(); - //if(n > 2) aPolyAlgo = atoi(a[2]); + //if(n > 2) aPolyAlgo = Draw::Atoi(a[2]); //IsPoly = aPolyAlgo > 0; @@ -3316,17 +3316,17 @@ Standard_Integer phlrtest(Draw_Interpretor&, Standard_Integer n, const char* if (n == 11) { - Standard_Real x = atof(a[2]); - Standard_Real y = atof(a[3]); - Standard_Real z = atof(a[4]); + Standard_Real x = Draw::Atof(a[2]); + Standard_Real y = Draw::Atof(a[3]); + Standard_Real z = Draw::Atof(a[4]); - Standard_Real dx = atof(a[5]); - Standard_Real dy = atof(a[6]); - Standard_Real dz = atof(a[7]); + Standard_Real dx = Draw::Atof(a[5]); + Standard_Real dy = Draw::Atof(a[6]); + Standard_Real dz = Draw::Atof(a[7]); - Standard_Real dx1 = atof(a[8]); - Standard_Real dy1 = atof(a[9]); - Standard_Real dz1 = atof(a[10]); + Standard_Real dx1 = Draw::Atof(a[8]); + Standard_Real dy1 = Draw::Atof(a[9]); + Standard_Real dz1 = Draw::Atof(a[10]); gp_Pnt anOrigin (x, y, z); gp_Dir aNormal (dx, dy, dz); @@ -3623,7 +3623,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons // argv[4] - Standard_Real Angle // argv[5] - Standard_Integer Reverse -// sprintf(prefix, argv[1]); +// Sprintf(prefix, argv[1]); Standard_Real anAngle = 0; Standard_Boolean Rev = Standard_False; Standard_Integer rev = 0; @@ -3635,7 +3635,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons di << "TEST : Plane is NULL" << "\n"; return 1; } - anAngle = atof(argv[4]); + anAngle = Draw::Atof(argv[4]); anAngle = 2*M_PI * anAngle / 360.0; gp_Pln aPln; Handle( Geom_Surface )aSurf; @@ -3643,7 +3643,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons Standard_Real Offset; gp_Dir aDir; if(argc > 4) { // == 5 - rev = atoi(argv[5]); + rev = Draw::Atoi(argv[5]); Rev = (rev)? Standard_True : Standard_False; } diff --git a/src/ViewerTest/ViewerTest_FilletCommands.cxx b/src/ViewerTest/ViewerTest_FilletCommands.cxx index 0da56aec51..03b0f5fb71 100755 --- a/src/ViewerTest/ViewerTest_FilletCommands.cxx +++ b/src/ViewerTest/ViewerTest_FilletCommands.cxx @@ -104,10 +104,10 @@ static Standard_Integer tolblend(Draw_Interpretor& di, Standard_Integer narg, co return 0; } else if(narg == 5){ - ta = atof(a[1]); - t3d = atof(a[2]); - t2d = atof(a[3]); - fl = atof(a[4]); + ta = Draw::Atof(a[1]); + t3d = Draw::Atof(a[2]); + t2d = Draw::Atof(a[3]); + fl = Draw::Atof(a[4]); return 0; } return 1; @@ -149,7 +149,7 @@ static Standard_Integer VBLEND(Draw_Interpretor& di, Standard_Integer narg, cons TopoDS_Edge E; Standard_Integer nbedge = 0; for (Standard_Integer ii = 1; ii < (narg-1)/2; ii++){ - Rad = atof(a[2*ii + 1]); + Rad = Draw::Atof(a[2*ii + 1]); TopoDS_Shape aLocalShape = DBRep::Get(a[(2*ii+2)],TopAbs_EDGE); E = TopoDS::Edge(aLocalShape); // E = TopoDS::Edge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE)); diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 32dc281102..d64bf6b4e6 100755 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -266,19 +266,19 @@ static int VTrihedron (Draw_Interpretor& theDi, Standard_Integer anArgIter = 2; // 1st is an IO name if (anArgIter < theArgsNb) { - anOrigin.SetX (atof (theArgVec[anArgIter++])); - anOrigin.SetY (atof (theArgVec[anArgIter++])); - anOrigin.SetZ (atof (theArgVec[anArgIter++])); + anOrigin.SetX (Draw::Atof (theArgVec[anArgIter++])); + anOrigin.SetY (Draw::Atof (theArgVec[anArgIter++])); + anOrigin.SetZ (Draw::Atof (theArgVec[anArgIter++])); if (anArgIter < theArgsNb) { - Standard_Real aX = atof (theArgVec[anArgIter++]); - Standard_Real aY = atof (theArgVec[anArgIter++]); - Standard_Real aZ = atof (theArgVec[anArgIter++]); + Standard_Real aX = Draw::Atof (theArgVec[anArgIter++]); + Standard_Real aY = Draw::Atof (theArgVec[anArgIter++]); + Standard_Real aZ = Draw::Atof (theArgVec[anArgIter++]); aDirZ.SetCoord (aX, aY, aZ); - aX = atof (theArgVec[anArgIter++]); - aY = atof (theArgVec[anArgIter++]); - aZ = atof (theArgVec[anArgIter++]); + aX = Draw::Atof (theArgVec[anArgIter++]); + aY = Draw::Atof (theArgVec[anArgIter++]); + aZ = Draw::Atof (theArgVec[anArgIter++]); aDirX.SetCoord (aX, aY, aZ); } } @@ -323,8 +323,8 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv // Verification du nombre d'arguments if (argc==1) {ThereIsName=Standard_False;value=100;} - else if (argc==2) {ThereIsName=Standard_False;value=atof(argv[1]);} - else {ThereIsName=Standard_True;value=atof(argv[2]);} + else if (argc==2) {ThereIsName=Standard_False;value=Draw::Atof(argv[1]);} + else {ThereIsName=Standard_True;value=Draw::Atof(argv[2]);} // On ferme le contexte local pour travailler dans le contexte global if(TheAISContext()->HasOpenedContext()) @@ -564,7 +564,7 @@ static int VAxisBuilder(Draw_Interpretor& di, Standard_Integer argc, const char* if (HasArg) { Standard_Real coord[6]; for(Standard_Integer i=0;i<=5;i++){ - coord[i]=atof(argv[2+i]); + coord[i]=Draw::Atof(argv[2+i]); } gp_Pnt p1(coord[0],coord[1],coord[2]), p2(coord[3],coord[4],coord[5]) ; @@ -816,7 +816,7 @@ static int VPointBuilder(Draw_Interpretor& di, Standard_Integer argc, const char if (HasArg) { Standard_Real thecoord[3]; for(Standard_Integer i=0;i<=2;i++) - thecoord[i]=atof(argv[2+i]); + thecoord[i]=Draw::Atof(argv[2+i]); Handle(Geom_CartesianPoint ) myGeomPoint= new Geom_CartesianPoint (thecoord[0],thecoord[1],thecoord[2]); Handle(AIS_Point) myAISPoint=new AIS_Point(myGeomPoint ); GetMapOfAIS().Bind (myAISPoint,name); @@ -990,23 +990,23 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& di, Handle(Geom_CartesianPoint)::DownCast( anAISPointC->Component()); // Verification that the three points are different - if(abs(aCartPointB->X()-aCartPointA->X())<=Precision::Confusion() && - abs(aCartPointB->Y()-aCartPointA->Y())<=Precision::Confusion() && - abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion()) + if(Abs(aCartPointB->X()-aCartPointA->X())<=Precision::Confusion() && + Abs(aCartPointB->Y()-aCartPointA->Y())<=Precision::Confusion() && + Abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion()) { // B=A std::cout<<"vplane error: same points"<<"\n";return 1; } - if(abs(aCartPointC->X()-aCartPointA->X())<=Precision::Confusion() && - abs(aCartPointC->Y()-aCartPointA->Y())<=Precision::Confusion() && - abs(aCartPointC->Z()-aCartPointA->Z())<=Precision::Confusion()) + if(Abs(aCartPointC->X()-aCartPointA->X())<=Precision::Confusion() && + Abs(aCartPointC->Y()-aCartPointA->Y())<=Precision::Confusion() && + Abs(aCartPointC->Z()-aCartPointA->Z())<=Precision::Confusion()) { // C=A std::cout<<"vplane error: same points"<<"\n";return 1; } - if(abs(aCartPointC->X()-aCartPointB->X())<=Precision::Confusion() && - abs(aCartPointC->Y()-aCartPointB->Y())<=Precision::Confusion() && - abs(aCartPointC->Z()-aCartPointB->Z())<=Precision::Confusion()) + if(Abs(aCartPointC->X()-aCartPointB->X())<=Precision::Confusion() && + Abs(aCartPointC->Y()-aCartPointB->Y())<=Precision::Confusion() && + Abs(aCartPointC->Z()-aCartPointB->Z())<=Precision::Confusion()) { // C=B std::cout<<"vplane error: same points"<<"\n";return 1; @@ -1682,8 +1682,8 @@ static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char* Standard_Real coord[6]; for(Standard_Integer i=0;i<=2;i++){ - coord[i]=atof(argv[2+i]); - coord[i+3]=atof(argv[5+i]); + coord[i]=Draw::Atof(argv[2+i]); + coord[i+3]=Draw::Atof(argv[5+i]); } Handle(Geom_CartesianPoint ) myCartPointA=new Geom_CartesianPoint (coord[0],coord[1],coord[2] ); @@ -1927,7 +1927,7 @@ static int VCircleBuilder(Draw_Interpretor& di, Standard_Integer argc, const cha { // Get arguments TCollection_AsciiString aName(argv[1]); - Standard_Boolean isFilled = (Standard_Boolean)atoi(argv[5]); + Standard_Boolean isFilled = (Standard_Boolean)Draw::Atoi(argv[5]); Handle(AIS_InteractiveObject) theShapeA; Handle(AIS_InteractiveObject) theShapeB; @@ -1976,25 +1976,25 @@ static int VCircleBuilder(Draw_Interpretor& di, Standard_Integer argc, const cha Handle(Geom_CartesianPoint)::DownCast(myGeomPointC); // Test A=B - if (abs(myCartPointA->X()-myCartPointB->X()) <= Precision::Confusion() && - abs(myCartPointA->Y()-myCartPointB->Y()) <= Precision::Confusion() && - abs(myCartPointA->Z()-myCartPointB->Z()) <= Precision::Confusion() ) + if (Abs(myCartPointA->X()-myCartPointB->X()) <= Precision::Confusion() && + Abs(myCartPointA->Y()-myCartPointB->Y()) <= Precision::Confusion() && + Abs(myCartPointA->Z()-myCartPointB->Z()) <= Precision::Confusion() ) { std::cout << "vcircle error: Same points.\n"; return 1; // TCL_ERROR } // Test A=C - if (abs(myCartPointA->X()-myCartPointC->X()) <= Precision::Confusion() && - abs(myCartPointA->Y()-myCartPointC->Y()) <= Precision::Confusion() && - abs(myCartPointA->Z()-myCartPointC->Z()) <= Precision::Confusion() ) + if (Abs(myCartPointA->X()-myCartPointC->X()) <= Precision::Confusion() && + Abs(myCartPointA->Y()-myCartPointC->Y()) <= Precision::Confusion() && + Abs(myCartPointA->Z()-myCartPointC->Z()) <= Precision::Confusion() ) { std::cout << "vcircle error: Same points.\n"; return 1; // TCL_ERROR } // Test B=C - if (abs(myCartPointB->X()-myCartPointC->X()) <= Precision::Confusion() && - abs(myCartPointB->Y()-myCartPointC->Y()) <= Precision::Confusion() && - abs(myCartPointB->Z()-myCartPointC->Z()) <= Precision::Confusion() ) + if (Abs(myCartPointB->X()-myCartPointC->X()) <= Precision::Confusion() && + Abs(myCartPointB->Y()-myCartPointC->Y()) <= Precision::Confusion() && + Abs(myCartPointB->Z()-myCartPointC->Z()) <= Precision::Confusion() ) { std::cout << "vcircle error: Same points.\n"; return 1;// TCL_ERROR @@ -2028,7 +2028,7 @@ static int VCircleBuilder(Draw_Interpretor& di, Standard_Integer argc, const cha return 1; // TCL_ERROR } // Ñheck that the radius is >= 0 - if (atof(argv[4]) <= 0 ) + if (Draw::Atof(argv[4]) <= 0 ) { std::cout << "vcircle error: the radius must be >=0.\n"; return 1; // TCL_ERROR @@ -2047,7 +2047,7 @@ static int VCircleBuilder(Draw_Interpretor& di, Standard_Integer argc, const cha gp_Ax1 thegpAxe = mygpPlane.Axis(); gp_Dir theDir = thegpAxe.Direction(); gp_Pnt theCenter = myCartPointB->Pnt(); - Standard_Real TheR = atof(argv[4]); + Standard_Real TheR = Draw::Atof(argv[4]); GC_MakeCircle Cir = GC_MakeCircle (theCenter, theDir ,TheR); Handle (Geom_Circle) theGeomCircle; try @@ -2416,32 +2416,32 @@ static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** } // Text position - const Standard_Real X = atof(argv[2]); - const Standard_Real Y = atof(argv[3]); - const Standard_Real Z = atof(argv[4]); + const Standard_Real X = Draw::Atof(argv[2]); + const Standard_Real Y = Draw::Atof(argv[3]); + const Standard_Real Z = Draw::Atof(argv[4]); const gp_Pnt pnt(X,Y,Z); // Text color - const Quantity_Parameter R = atof(argv[5])/255.; - const Quantity_Parameter G = atof(argv[6])/255.; - const Quantity_Parameter B = atof(argv[7])/255.; + const Quantity_Parameter R = Draw::Atof(argv[5])/255.; + const Quantity_Parameter G = Draw::Atof(argv[6])/255.; + const Quantity_Parameter B = Draw::Atof(argv[7])/255.; const Quantity_Color aColor( R, G, B, Quantity_TOC_RGB ); // Text alignment - const int hor_align = atoi(argv[8]); - const int ver_align = atoi(argv[9]); + const int hor_align = Draw::Atoi(argv[8]); + const int ver_align = Draw::Atoi(argv[9]); // Text angle - const Standard_Real angle = atof(argv[10]); + const Standard_Real angle = Draw::Atof(argv[10]); // Text zooming - const Standard_Boolean zoom = atoi(argv[11]); + const Standard_Boolean zoom = Draw::Atoi(argv[11]); // Text height - const Standard_Real height = atof(argv[12]); + const Standard_Real height = Draw::Atof(argv[12]); // Text aspect - const Font_FontAspect aspect = Font_FontAspect(atoi(argv[13])); + const Font_FontAspect aspect = Font_FontAspect(Draw::Atoi(argv[13])); // Text font TCollection_AsciiString font; @@ -2451,7 +2451,7 @@ static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** font.AssignCat(argv[14]); // Text is multibyte - const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (atoi(argv[15]) != 0); + const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (Draw::Atoi(argv[15]) != 0); // Read text string TCollection_ExtendedString name; @@ -2769,12 +2769,12 @@ static int VDrawSphere (Draw_Interpretor& di, Standard_Integer argc, const char* // read the arguments TCollection_AsciiString aShapeName (argv[1]); - Standard_Integer aResolution = atoi (argv[2]); - Standard_Real aCenterX = (argc > 5) ? atof (argv[3]) : 0.0; - Standard_Real aCenterY = (argc > 5) ? atof (argv[4]) : 0.0; - Standard_Real aCenterZ = (argc > 5) ? atof (argv[5]) : 0.0; - Standard_Real aRadius = (argc > 6) ? atof (argv[6]) : 100.0; - Standard_Boolean toShowEdges = (argc > 7) ? atoi (argv[7]) : Standard_False; + Standard_Integer aResolution = Draw::Atoi (argv[2]); + Standard_Real aCenterX = (argc > 5) ? Draw::Atof (argv[3]) : 0.0; + Standard_Real aCenterY = (argc > 5) ? Draw::Atof (argv[4]) : 0.0; + Standard_Real aCenterZ = (argc > 5) ? Draw::Atof (argv[5]) : 0.0; + Standard_Real aRadius = (argc > 6) ? Draw::Atof (argv[6]) : 100.0; + Standard_Boolean toShowEdges = (argc > 7) ? Draw::Atoi (argv[7]) : Standard_False; // remove AIS object with given name from map VDisplayAISObject (aShapeName, Handle(AIS_InteractiveObject)()); @@ -2908,7 +2908,7 @@ static int VClipPlane (Draw_Interpretor& di, Standard_Integer argc, const char** } else if (argc == 2 || argc == 3) { - Standard_Integer aPlaneIdToOff = (argc == 3) ? atoi (argv[1]) : 1; + Standard_Integer aPlaneIdToOff = (argc == 3) ? Draw::Atoi (argv[1]) : 1; Standard_Boolean toIterateAll = (argc == 2); TCollection_AsciiString isOnOffStr ((argc == 3) ? argv[2] : argv[1]); isOnOffStr.LowerCase(); @@ -3001,12 +3001,12 @@ static int VClipPlane (Draw_Interpretor& di, Standard_Integer argc, const char** return 1; } - Standard_Real aLocX = atof (argv[1]); - Standard_Real aLocY = atof (argv[2]); - Standard_Real aLocZ = atof (argv[3]); - Standard_Real aNormDX = atof (argv[4]); - Standard_Real aNormDY = atof (argv[5]); - Standard_Real aNormDZ = atof (argv[6]); + Standard_Real aLocX = Draw::Atof (argv[1]); + Standard_Real aLocY = Draw::Atof (argv[2]); + Standard_Real aLocZ = Draw::Atof (argv[3]); + Standard_Real aNormDX = Draw::Atof (argv[4]); + Standard_Real aNormDY = Draw::Atof (argv[5]); + Standard_Real aNormDZ = Draw::Atof (argv[6]); Handle(V3d_Plane) aPlaneV3d = new V3d_Plane(); gp_Pln aPlane (gp_Pnt (aLocX, aLocY, aLocZ), gp_Dir (aNormDX, aNormDY, aNormDZ)); @@ -3093,9 +3093,9 @@ static int VComputeHLR (Draw_Interpretor& di, { gp_Dir anUp; - anEye.SetCoord (atof (argv[3]), atof (argv[4]), atof (argv[5])); - aDir.SetCoord (atof (argv[6]), atof (argv[7]), atof (argv[8])); - anUp.SetCoord (atof (argv[9]), atof (argv[10]), atof (argv[11])); + anEye.SetCoord (Draw::Atof (argv[3]), Draw::Atof (argv[4]), Draw::Atof (argv[5])); + aDir.SetCoord (Draw::Atof (argv[6]), Draw::Atof (argv[7]), Draw::Atof (argv[8])); + anUp.SetCoord (Draw::Atof (argv[9]), Draw::Atof (argv[10]), Draw::Atof (argv[11])); aProjAx.SetLocation (anEye); aProjAx.SetDirection (aDir); aProjAx.SetYDirection (anUp); @@ -3377,38 +3377,38 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char* // vertex command if (CheckInputCommand ("v", argv, aArgIndex, 3, argc)) { - anArray->AddVertex (atof (argv[aArgIndex - 3]), - atof (argv[aArgIndex - 2]), - atof (argv[aArgIndex - 1])); + anArray->AddVertex (Draw::Atof (argv[aArgIndex - 3]), + Draw::Atof (argv[aArgIndex - 2]), + Draw::Atof (argv[aArgIndex - 1])); // vertex has a normal or normal with color or texel if (CheckInputCommand ("n", argv, aArgIndex, 3, argc)) anArray->SetVertexNormal (anArray->VertexNumber (), - atof (argv[aArgIndex - 3]), - atof (argv[aArgIndex - 2]), - atof (argv[aArgIndex - 1])); + Draw::Atof (argv[aArgIndex - 3]), + Draw::Atof (argv[aArgIndex - 2]), + Draw::Atof (argv[aArgIndex - 1])); if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) anArray->SetVertexColor (anArray->VertexNumber (), - atof (argv[aArgIndex - 3]), - atof (argv[aArgIndex - 2]), - atof (argv[aArgIndex - 1])); + Draw::Atof (argv[aArgIndex - 3]), + Draw::Atof (argv[aArgIndex - 2]), + Draw::Atof (argv[aArgIndex - 1])); if (CheckInputCommand ("t", argv, aArgIndex, 2, argc)) anArray->SetVertexTexel (anArray->VertexNumber (), - atof (argv[aArgIndex - 2]), - atof (argv[aArgIndex - 1])); + Draw::Atof (argv[aArgIndex - 2]), + Draw::Atof (argv[aArgIndex - 1])); } // bounds command else if (CheckInputCommand ("b", argv, aArgIndex, 1, argc)) { - Standard_Integer aVertCount = atoi (argv[aArgIndex - 1]); + Standard_Integer aVertCount = Draw::Atoi (argv[aArgIndex - 1]); if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) anArray->AddBound (aVertCount, - atof (argv[aArgIndex - 3]), - atof (argv[aArgIndex - 2]), - atof (argv[aArgIndex - 1])); + Draw::Atof (argv[aArgIndex - 3]), + Draw::Atof (argv[aArgIndex - 2]), + Draw::Atof (argv[aArgIndex - 1])); else anArray->AddBound (aVertCount); @@ -3416,7 +3416,7 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char* // edge command else if (CheckInputCommand ("e", argv, aArgIndex, 1, argc)) { - Standard_Integer aVertIndex = atoi (argv[aArgIndex - 1]); + Standard_Integer aVertIndex = Draw::Atoi (argv[aArgIndex - 1]); // edge has/hasn't hide flag if (CheckInputCommand ("h", argv, aArgIndex, 0, argc)) @@ -3461,9 +3461,9 @@ static Standard_Integer VSetLocation (Draw_Interpretor& di, } TCollection_AsciiString aName (argv[1]); - Standard_Real aX = atof (argv[2]); - Standard_Real aY = atof (argv[3]); - Standard_Real aZ = atof (argv[4]); + Standard_Real aX = Draw::Atof (argv[2]); + Standard_Real aY = Draw::Atof (argv[3]); + Standard_Real aZ = Draw::Atof (argv[4]); // find object ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); @@ -3620,15 +3620,15 @@ static Standard_Integer VConnect(Draw_Interpretor& di, } // Get location data - Standard_Real aXo = atof (argv[anArgIter++]); - Standard_Real aYo = atof (argv[anArgIter++]); - Standard_Real aZo = atof (argv[anArgIter++]); - Standard_Real aXu = atof (argv[anArgIter++]); - Standard_Real aXv = atof (argv[anArgIter++]); - Standard_Real aXw = atof (argv[anArgIter++]); - Standard_Real aZu = atof (argv[anArgIter++]); - Standard_Real aZv = atof (argv[anArgIter++]); - Standard_Real aZw = atof (argv[anArgIter++]); + Standard_Real aXo = Draw::Atof (argv[anArgIter++]); + Standard_Real aYo = Draw::Atof (argv[anArgIter++]); + Standard_Real aZo = Draw::Atof (argv[anArgIter++]); + Standard_Real aXu = Draw::Atof (argv[anArgIter++]); + Standard_Real aXv = Draw::Atof (argv[anArgIter++]); + Standard_Real aXw = Draw::Atof (argv[anArgIter++]); + Standard_Real aZu = Draw::Atof (argv[anArgIter++]); + Standard_Real aZv = Draw::Atof (argv[anArgIter++]); + Standard_Real aZw = Draw::Atof (argv[anArgIter++]); // Create transformation gp_Pnt aPoint(aXo, aYo, aZo); @@ -3803,15 +3803,15 @@ static Standard_Integer VConnectShape(Draw_Interpretor& di, } // Get location data - Standard_Real aXo = atof (argv[anArgIter++]); - Standard_Real aYo = atof (argv[anArgIter++]); - Standard_Real aZo = atof (argv[anArgIter++]); - Standard_Real aXu = atof (argv[anArgIter++]); - Standard_Real aXv = atof (argv[anArgIter++]); - Standard_Real aXw = atof (argv[anArgIter++]); - Standard_Real aZu = atof (argv[anArgIter++]); - Standard_Real aZv = atof (argv[anArgIter++]); - Standard_Real aZw = atof (argv[anArgIter++]); + Standard_Real aXo = Draw::Atof (argv[anArgIter++]); + Standard_Real aYo = Draw::Atof (argv[anArgIter++]); + Standard_Real aZo = Draw::Atof (argv[anArgIter++]); + Standard_Real aXu = Draw::Atof (argv[anArgIter++]); + Standard_Real aXv = Draw::Atof (argv[anArgIter++]); + Standard_Real aXw = Draw::Atof (argv[anArgIter++]); + Standard_Real aZu = Draw::Atof (argv[anArgIter++]); + Standard_Real aZv = Draw::Atof (argv[anArgIter++]); + Standard_Real aZw = Draw::Atof (argv[anArgIter++]); // Create transformation gp_Pnt aPoint(aXo, aYo, aZo); @@ -3907,8 +3907,8 @@ static Standard_Integer VSetSelectionMode(Draw_Interpretor& di, if(argc == 3) { // Get arguments - Standard_Integer aMode = atoi(argv[1]); - Standard_Boolean isTurnOn = atoi(argv[2]); + Standard_Integer aMode = Draw::Atoi(argv[1]); + Standard_Boolean isTurnOn = Draw::Atoi(argv[2]); // Get all displayed objects AIS_ListOfInteractive anObjList; @@ -3962,8 +3962,8 @@ static Standard_Integer VSetSelectionMode(Draw_Interpretor& di, else { // Get argumnets - Standard_Integer aMode = atoi(argv[2]); - Standard_Boolean isTurnOn = atoi(argv[3]); + Standard_Integer aMode = Draw::Atoi(argv[2]); + Standard_Boolean isTurnOn = Draw::Atoi(argv[3]); TCollection_AsciiString aName(argv[1]); // Check if there is an object with given name in context @@ -4116,9 +4116,9 @@ Standard_Boolean IsPoint (const TCollection_AsciiString& theName, Standard_Boolean IsMatch (const Handle(Geom_CartesianPoint)& thePoint1, const Handle(Geom_CartesianPoint)& thePoint2) { - if(abs(thePoint1->X()-thePoint2->X()) <= Precision::Confusion() && - abs(thePoint1->Y()-thePoint2->Y()) <= Precision::Confusion() && - abs(thePoint1->Z()-thePoint2->Z()) <= Precision::Confusion()) + if(Abs(thePoint1->X()-thePoint2->X()) <= Precision::Confusion() && + Abs(thePoint1->Y()-thePoint2->Y()) <= Precision::Confusion() && + Abs(thePoint1->Z()-thePoint2->Z()) <= Precision::Confusion()) { return Standard_True; } @@ -4380,7 +4380,7 @@ static Standard_Integer VObjZLayer (Draw_Interpretor& di, // process operation if (aOperation.IsEqual ("set")) { - Standard_Integer aLayerId = atoi (argv [3]); + Standard_Integer aLayerId = Draw::Atoi (argv [3]); aContext->SetZLayer (anInterObj, aLayerId); } else if (aOperation.IsEqual ("get")) @@ -4439,9 +4439,9 @@ static Standard_Integer VPolygonOffset(Draw_Interpretor& di, Standard_ShortReal aFactor, aUnits; if (argc == 5) { - aMode = atoi(argv[2]); - aFactor = (Standard_ShortReal) atof(argv[3]); - aUnits = (Standard_ShortReal) atof(argv[4]); + aMode = Draw::Atoi(argv[2]); + aFactor = (Standard_ShortReal) Draw::Atof(argv[3]); + aUnits = (Standard_ShortReal) Draw::Atof(argv[4]); anInterObj->SetPolygonOffsets(aMode, aFactor, aUnits); aContext->UpdateCurrentViewer(); @@ -4547,28 +4547,28 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& di, TheAISContext ()->DefaultDrawer () : anInterObj->Attributes (); // turn boundaries on/off - Standard_Boolean isBoundaryDraw = (atoi (argv[2]) == 1); + Standard_Boolean isBoundaryDraw = (Draw::Atoi (argv[2]) == 1); aDrawer->SetFaceBoundaryDraw (isBoundaryDraw); // set boundary line color if (argc >= 6) { // Text color - aRed = atof (argv[3])/255.; - aGreen = atof (argv[4])/255.; - aBlue = atof (argv[5])/255.; + aRed = Draw::Atof (argv[3])/255.; + aGreen = Draw::Atof (argv[4])/255.; + aBlue = Draw::Atof (argv[5])/255.; } // set line width if (argc >= 7) { - aWidth = (Standard_Real)atof (argv[6]); + aWidth = (Standard_Real)Draw::Atof (argv[6]); } // select appropriate line type if (argc == 8) { - switch (atoi (argv[7])) + switch (Draw::Atoi (argv[7])) { case 1: aLineType = Aspect_TOL_DASH; break; case 2: aLineType = Aspect_TOL_DOT; break; diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index ededd567c4..3ba400dea4 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -328,10 +328,10 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I static int VInit (Draw_Interpretor& , Standard_Integer argc, const char** argv) { - Standard_Integer aPxLeft = (argc > 1) ? atoi (argv[1]) : 0; - Standard_Integer aPxTop = (argc > 2) ? atoi (argv[2]) : 0; - Standard_Integer aPxWidth = (argc > 3) ? atoi (argv[3]) : 0; - Standard_Integer aPxHeight = (argc > 4) ? atoi (argv[4]) : 0; + Standard_Integer aPxLeft = (argc > 1) ? Draw::Atoi (argv[1]) : 0; + Standard_Integer aPxTop = (argc > 2) ? Draw::Atoi (argv[2]) : 0; + Standard_Integer aPxWidth = (argc > 3) ? Draw::Atoi (argv[3]) : 0; + Standard_Integer aPxHeight = (argc > 4) ? Draw::Atoi (argv[4]) : 0; ViewerTest::ViewerInit (aPxLeft, aPxTop, aPxWidth, aPxHeight); return 0; } @@ -475,7 +475,7 @@ void VT_ProcessKeyPress (const char* buf_ret) } // Number else{ - Standard_Integer Num = atoi(buf_ret); + Standard_Integer Num = Draw::Atoi(buf_ret); if(Num>=0 && Num<=7) ViewerTest::StandardModeActivation(Num); } @@ -1606,17 +1606,17 @@ static int VSetGradientBg(Draw_Interpretor& di, Standard_Integer argc, const cha if (argc == 8) { - Standard_Real R1 = atof(argv[1])/255.; - Standard_Real G1 = atof(argv[2])/255.; - Standard_Real B1 = atof(argv[3])/255.; + Standard_Real R1 = Draw::Atof(argv[1])/255.; + Standard_Real G1 = Draw::Atof(argv[2])/255.; + Standard_Real B1 = Draw::Atof(argv[3])/255.; Quantity_Color aColor1(R1,G1,B1,Quantity_TOC_RGB); - Standard_Real R2 = atof(argv[4])/255.; - Standard_Real G2 = atof(argv[5])/255.; - Standard_Real B2 = atof(argv[6])/255.; + Standard_Real R2 = Draw::Atof(argv[4])/255.; + Standard_Real G2 = Draw::Atof(argv[5])/255.; + Standard_Real B2 = Draw::Atof(argv[6])/255.; Quantity_Color aColor2(R2,G2,B2,Quantity_TOC_RGB); - int aType = atoi(argv[7]); + int aType = Draw::Atoi(argv[7]); if( aType < 0 || aType > 8 ) { di << "Wrong fill type " << "\n"; @@ -1656,7 +1656,7 @@ static int VSetGradientBgMode(Draw_Interpretor& di, Standard_Integer argc, const } if (argc == 2) { - int aType = atoi(argv[1]); + int aType = Draw::Atoi(argv[1]); if( aType < 0 || aType > 8 ) { di << "Wrong fill type " << "\n"; @@ -1696,9 +1696,9 @@ static int VSetColorBg(Draw_Interpretor& di, Standard_Integer argc, const char** if (argc == 4) { - Standard_Real R = atof(argv[1])/255.; - Standard_Real G = atof(argv[2])/255.; - Standard_Real B = atof(argv[3])/255.; + Standard_Real R = Draw::Atof(argv[1])/255.; + Standard_Real G = Draw::Atof(argv[2])/255.; + Standard_Real B = Draw::Atof(argv[3])/255.; Quantity_Color aColor(R,G,B,Quantity_TOC_RGB); Handle(V3d_View) V3dView = ViewerTest::CurrentView(); @@ -1723,7 +1723,7 @@ static int VScale(Draw_Interpretor& di, Standard_Integer argc, const char** argv di << argv[0] << "Invalid number of arguments" << "\n"; return 1; } - V3dView->SetAxialScale( atof(argv[1]), atof(argv[2]), atof(argv[3]) ); + V3dView->SetAxialScale( Draw::Atof(argv[1]), Draw::Atof(argv[2]), Draw::Atof(argv[3]) ); return 0; } //============================================================================== @@ -1774,12 +1774,12 @@ static int VTestZBuffTrihedron(Draw_Interpretor& di, Standard_Integer argc, cons return 1; } - Standard_Real R = atof(argv[2])/255.; - Standard_Real G = atof(argv[3])/255.; - Standard_Real B = atof(argv[4])/255.; + Standard_Real R = Draw::Atof(argv[2])/255.; + Standard_Real G = Draw::Atof(argv[3])/255.; + Standard_Real B = Draw::Atof(argv[4])/255.; Quantity_Color aColor(R, G, B, Quantity_TOC_RGB); - Standard_Real aScale = atof(argv[5]); + Standard_Real aScale = Draw::Atof(argv[5]); if( aScale <= 0.0 ) { @@ -1829,10 +1829,10 @@ static int VRotate( Draw_Interpretor& di, Standard_Integer argc, const char** ar } if ( argc == 4 ) { - V3dView->Rotate( atof(argv[1]), atof(argv[2]), atof(argv[3]) ); + V3dView->Rotate( Draw::Atof(argv[1]), Draw::Atof(argv[2]), Draw::Atof(argv[3]) ); return 0; } else if ( argc == 7 ) { - V3dView->Rotate( atof(argv[1]), atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]), atof(argv[6]) ); + V3dView->Rotate( Draw::Atof(argv[1]), Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Draw::Atof(argv[6]) ); return 0; } else { di << argv[0] << " Invalid number of arguments" << "\n"; @@ -1852,12 +1852,12 @@ static int VZoom( Draw_Interpretor& di, Standard_Integer argc, const char** argv } if ( argc == 2 ) { - Standard_Real coef = atof(argv[1]); + Standard_Real coef = Draw::Atof(argv[1]); if ( coef <= 0.0 ) { di << argv[1] << "Invalid value" << "\n"; return 1; } - V3dView->SetZoom( atof(argv[1]) ); + V3dView->SetZoom( Draw::Atof(argv[1]) ); return 0; } else { di << argv[0] << " Invalid number of arguments" << "\n"; @@ -1875,7 +1875,7 @@ static int VPan( Draw_Interpretor& di, Standard_Integer argc, const char** argv if ( V3dView.IsNull() ) return 1; if ( argc == 3 ) { - V3dView->Pan( atoi(argv[1]), atoi(argv[2]) ); + V3dView->Pan( Draw::Atoi(argv[1]), Draw::Atoi(argv[2]) ); return 0; } else { di << argv[0] << " Invalid number of arguments" << "\n"; @@ -1993,18 +1993,18 @@ static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char { if( argc > 3 ) { - minRange = atof( argv[1] ); - maxRange = atof( argv[2] ); - numIntervals = atoi( argv[3] ); + minRange = Draw::Atof( argv[1] ); + maxRange = Draw::Atof( argv[2] ); + numIntervals = Draw::Atoi( argv[3] ); } if ( argc > 4 ) - textHeight = atoi( argv[4] ); + textHeight = Draw::Atoi( argv[4] ); if ( argc > 5 ) - position = (Aspect_TypeOfColorScalePosition)atoi( argv[5] ); + position = (Aspect_TypeOfColorScalePosition)Draw::Atoi( argv[5] ); if ( argc > 7 ) { - X = atof( argv[6] ); - Y = atof( argv[7] ); + X = Draw::Atof( argv[6] ); + Y = Draw::Atof( argv[7] ); } } Handle(V3d_View) curView = ViewerTest::CurrentView( ); @@ -2068,7 +2068,7 @@ static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, cons } // Erase (==0) or display (!=0) - const int display = atoi(argv[1]); + const int display = Draw::Atoi(argv[1]); if (display) { @@ -2080,7 +2080,7 @@ static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, cons font.AssignCat(argv[5]); // Text is multibyte - const Standard_Boolean isMultibyte = (argc < 7)? Standard_False : (atoi(argv[6]) != 0); + const Standard_Boolean isMultibyte = (argc < 7)? Standard_False : (Draw::Atoi(argv[6]) != 0); // Set axis names TCollection_ExtendedString xname, yname, zname; @@ -2173,12 +2173,12 @@ static int VPrintView (Draw_Interpretor& di, Standard_Integer argc, } // get the input params - Standard_Integer aWidth = atoi (argv[1]); - Standard_Integer aHeight = atoi (argv[2]); + Standard_Integer aWidth = Draw::Atoi (argv[1]); + Standard_Integer aHeight = Draw::Atoi (argv[2]); Standard_Integer aMode = 0; TCollection_AsciiString aFileName = TCollection_AsciiString (argv[3]); if (argc==5) - aMode = atoi (argv[4]); + aMode = Draw::Atoi (argv[4]); // check the input parameters if (aWidth <= 0 || aHeight <= 0) @@ -2316,7 +2316,7 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar return 1; } - Standard_Integer aDelId = atoi (argv[2]); + Standard_Integer aDelId = Draw::Atoi (argv[2]); if (!aViewer->RemoveZLayer (aDelId)) { di << "Impossible to remove the z layer or invalid id!\n"; @@ -2519,10 +2519,10 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char** } // get the input params - Standard_Real X1 = atof(argv[1]); - Standard_Real Y1 = atof(argv[2]); - Standard_Real X2 = atof(argv[3]); - Standard_Real Y2 = atof(argv[4]); + Standard_Real X1 = Draw::Atof(argv[1]); + Standard_Real Y1 = Draw::Atof(argv[2]); + Standard_Real X2 = Draw::Atof(argv[3]); + Standard_Real Y2 = Draw::Atof(argv[4]); Standard_Real aWidth = 0.5; Standard_Integer aType = 0; @@ -2530,16 +2530,16 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char** // has width if (argc > 5) - aWidth = atof(argv[5]); + aWidth = Draw::Atof(argv[5]); // has type if (argc > 6) - aType = (Standard_Integer) atoi(argv[6]); + aType = (Standard_Integer) Draw::Atoi(argv[6]); // has transparency if (argc > 7) { - aTransparency = atof(argv[7]); + aTransparency = Draw::Atof(argv[7]); if (aTransparency < 0 || aTransparency > 1.0) aTransparency = 1.0; } @@ -2609,9 +2609,9 @@ static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char } TCollection_AsciiString aText (argv[1]); - Standard_Real aPosX = atof(argv[2]); - Standard_Real aPosY = atof(argv[3]); - Standard_Real aHeight = (argc >= 5) ? atof (argv[4]) : 10.0; + Standard_Real aPosX = Draw::Atof(argv[2]); + Standard_Real aPosY = Draw::Atof(argv[3]); + Standard_Real aHeight = (argc >= 5) ? Draw::Atof (argv[4]) : 10.0; // font name TCollection_AsciiString aFontName = "Courier"; @@ -2624,9 +2624,9 @@ static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char Quantity_Parameter aColorBlue = 1.0; if (argc >= 9) { - aColorRed = atof (argv[6])/255.; - aColorGreen = atof (argv[7])/255.; - aColorBlue = atof (argv[8])/255.; + aColorRed = Draw::Atof (argv[6])/255.; + aColorGreen = Draw::Atof (argv[7])/255.; + aColorBlue = Draw::Atof (argv[8])/255.; } // display type @@ -2648,9 +2648,9 @@ static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char Quantity_Parameter aSubBlue = 1.0; if (argc == 13) { - aSubRed = atof (argv[10])/255.; - aSubGreen = atof (argv[11])/255.; - aSubBlue = atof (argv[12])/255.; + aSubRed = Draw::Atof (argv[10])/255.; + aSubGreen = Draw::Atof (argv[11])/255.; + aSubBlue = Draw::Atof (argv[12])/255.; } // check fo current overlay @@ -2750,13 +2750,13 @@ static int VGrid (Draw_Interpretor& theDI, Quantity_Length aRStepX, aRStepY; aViewer->RectangularGridValues (anOriginX, anOriginY, aRStepX, aRStepY, aRotAngle); - anOriginX = atof (theArgVec[anIter++]); - anOriginY = atof (theArgVec[anIter++]); + anOriginX = Draw::Atof (theArgVec[anIter++]); + anOriginY = Draw::Atof (theArgVec[anIter++]); if (aTail == 5) { - aRStepX = atof (theArgVec[anIter++]); - aRStepY = atof (theArgVec[anIter++]); - aRotAngle = atof (theArgVec[anIter++]); + aRStepX = Draw::Atof (theArgVec[anIter++]); + aRStepY = Draw::Atof (theArgVec[anIter++]); + aRotAngle = Draw::Atof (theArgVec[anIter++]); } aViewer->SetRectangularGridValues (anOriginX, anOriginY, aRStepX, aRStepY, aRotAngle); aViewer->ActivateGrid (aType, aMode); @@ -2767,13 +2767,13 @@ static int VGrid (Draw_Interpretor& theDI, Standard_Integer aDivisionNumber; aViewer->CircularGridValues (anOriginX, anOriginY, aRadiusStep, aDivisionNumber, aRotAngle); - anOriginX = atof (theArgVec[anIter++]); - anOriginY = atof (theArgVec[anIter++]); + anOriginX = Draw::Atof (theArgVec[anIter++]); + anOriginY = Draw::Atof (theArgVec[anIter++]); if (aTail == 5) { - aRadiusStep = atof (theArgVec[anIter++]); - aDivisionNumber = atoi (theArgVec[anIter++]); - aRotAngle = atof (theArgVec[anIter++]); + aRadiusStep = Draw::Atof (theArgVec[anIter++]); + aDivisionNumber = Draw::Atoi (theArgVec[anIter++]); + aRotAngle = Draw::Atof (theArgVec[anIter++]); } aViewer->SetCircularGridValues (anOriginX, anOriginY, aRadiusStep, aDivisionNumber, aRotAngle); @@ -2800,7 +2800,7 @@ static int VFps (Draw_Interpretor& theDI, return 1; } - Standard_Integer aFramesNb = (theArgNb > 1) ? atoi(theArgVec[1]) : 100; + Standard_Integer aFramesNb = (theArgNb > 1) ? Draw::Atoi(theArgVec[1]) : 100; if (aFramesNb <= 0) { std::cerr << "Incorrect arguments!\n"; @@ -2867,7 +2867,7 @@ static int VVbo (Draw_Interpretor& theDI, return 1; } - aDriver->EnableVBO (atoi(theArgVec[1]) != 0); + aDriver->EnableVBO (Draw::Atoi(theArgVec[1]) != 0); return 0; } @@ -2942,8 +2942,8 @@ static int VReadPixel (Draw_Interpretor& theDI, Standard_Integer aWidth, aHeight; aView->Window()->Size (aWidth, aHeight); - const Standard_Integer anX = atoi (theArgVec[1]); - const Standard_Integer anY = atoi (theArgVec[2]); + const Standard_Integer anX = Draw::Atoi (theArgVec[1]); + const Standard_Integer anY = Draw::Atoi (theArgVec[2]); if (anX < 0 || anX >= aWidth || anY < 0 || anY > aHeight) { std::cerr << "Pixel coordinates (" << anX << "; " << anY << ") are out of view (" << aWidth << " x " << aHeight << ")\n"; @@ -3068,14 +3068,14 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const const char* anImgPathNew = theArgVec[2]; // get string tolerance and check its validity - Standard_Real aTolColor = atof (theArgVec[3]); + Standard_Real aTolColor = Draw::Atof (theArgVec[3]); if (aTolColor < 0.0) aTolColor = 0.0; if (aTolColor > 1.0) aTolColor = 1.0; - Standard_Boolean toBlackWhite = (atoi (theArgVec[4]) == 1); - Standard_Boolean isBorderFilterOn = (atoi (theArgVec[5]) == 1); + Standard_Boolean toBlackWhite = (Draw::Atoi (theArgVec[4]) == 1); + Standard_Boolean isBorderFilterOn = (Draw::Atoi (theArgVec[5]) == 1); // image file of difference const char* aDiffImagePath = (theArgNb >= 7) ? theArgVec[6] : NULL; diff --git a/src/Voxel/Voxel_Reader.cxx b/src/Voxel/Voxel_Reader.cxx index a6749ed1de..326843d20f 100755 --- a/src/Voxel/Voxel_Reader.cxx +++ b/src/Voxel/Voxel_Reader.cxx @@ -161,13 +161,13 @@ Standard_Boolean Voxel_Reader::ReadBoolAsciiVoxels(const TCollection_ExtendedStr fclose(f); return Standard_False; } - x = atof(sx); y = atof(sy); z = atof(sz); + x = Atof(sx); y = Atof(sy); z = Atof(sz); if (fscanf(f, "%s %s %s\n", sx, sy, sz) != 3) { fclose(f); return Standard_False; } - xlen = atof(sx); ylen = atof(sy); zlen = atof(sz); + xlen = Atof(sx); ylen = Atof(sy); zlen = Atof(sz); if (fscanf(f, "%d %d %d\n", &nbx, &nby, &nbz) != 3) { fclose(f); @@ -238,13 +238,13 @@ Standard_Boolean Voxel_Reader::ReadColorAsciiVoxels(const TCollection_ExtendedSt fclose(f); return Standard_False; } - x = atof(sx); y = atof(sy); z = atof(sz); + x = Atof(sx); y = Atof(sy); z = Atof(sz); if (fscanf(f, "%s %s %s\n", sx, sy, sz) != 3) { fclose(f); return Standard_False; } - xlen = atof(sx); ylen = atof(sy); zlen = atof(sz); + xlen = Atof(sx); ylen = Atof(sy); zlen = Atof(sz); if (fscanf(f, "%d %d %d\n", &nbx, &nby, &nbz) != 3) { fclose(f); @@ -315,13 +315,13 @@ Standard_Boolean Voxel_Reader::ReadFloatAsciiVoxels(const TCollection_ExtendedSt fclose(f); return Standard_False; } - x = atof(sx); y = atof(sy); z = atof(sz); + x = Atof(sx); y = Atof(sy); z = Atof(sz); if (fscanf(f, "%s %s %s\n", sx, sy, sz) != 3) { fclose(f); return Standard_False; } - xlen = atof(sx); ylen = atof(sy); zlen = atof(sz); + xlen = Atof(sx); ylen = Atof(sy); zlen = Atof(sz); if (fscanf(f, "%d %d %d\n", &nbx, &nby, &nbz) != 3) { fclose(f); @@ -359,7 +359,7 @@ Standard_Boolean Voxel_Reader::ReadFloatAsciiVoxels(const TCollection_ExtendedSt return Standard_False; } } - value = atof(line); + value = Atof(line); // Set value if (!((Standard_ShortReal**)((Voxel_DS*)myFloatVoxels)->myData)[i1]) diff --git a/src/VrmlData/VrmlData_Geometry.cxx b/src/VrmlData/VrmlData_Geometry.cxx index ca634a52ed..421f4696c2 100755 --- a/src/VrmlData/VrmlData_Geometry.cxx +++ b/src/VrmlData/VrmlData_Geometry.cxx @@ -157,7 +157,7 @@ VrmlData_ErrorStatus VrmlData_Box::Write (const char * thePrefix) const if (OK (aStatus, Scene().WriteLine (thePrefix, header, GlobalIndent()))) { char buf[128]; - sprintf (buf, "size %.12g %.12g %.12g", mySize.X(), mySize.Y(), mySize.Z()); + Sprintf (buf, "size %.12g %.12g %.12g", mySize.X(), mySize.Y(), mySize.Z()); Scene().WriteLine (buf); aStatus = WriteClosing(); } @@ -259,12 +259,12 @@ VrmlData_ErrorStatus VrmlData_Cone::Write (const char * thePrefix) const { char buf[128]; if ((myBottomRadius - 1.)*(myBottomRadius - 1.) > Precision::Confusion()) { - sprintf (buf, "bottomRadius %.12g", myBottomRadius); + Sprintf (buf, "bottomRadius %.12g", myBottomRadius); aStatus = Scene().WriteLine (buf); } if (OK(aStatus) && (myHeight - 2.)*(myHeight - 2.) > Precision::Confusion()) { - sprintf (buf, "height %.12g", myHeight); + Sprintf (buf, "height %.12g", myHeight); aStatus = Scene().WriteLine (buf); } if (OK(aStatus) && myHasBottom == Standard_False) @@ -393,12 +393,12 @@ VrmlData_ErrorStatus VrmlData_Cylinder::Write (const char * thePrefix) const { char buf[128]; if ((myRadius - 1.)*(myRadius - 1.) > Precision::Confusion()) { - sprintf (buf, "radius %.12g", myRadius); + Sprintf (buf, "radius %.12g", myRadius); aStatus = Scene().WriteLine (buf); } if (OK(aStatus) && (myHeight - 2.)*(myHeight - 2.) > Precision::Confusion()) { - sprintf (buf, "height %.12g", myHeight); + Sprintf (buf, "height %.12g", myHeight); aStatus = Scene().WriteLine (buf); } if (OK(aStatus) && myHasBottom == Standard_False) @@ -494,7 +494,7 @@ VrmlData_ErrorStatus VrmlData_Sphere::Write (const char * thePrefix) const if (OK (aStatus, Scene().WriteLine (thePrefix, header, GlobalIndent()))) { char buf[128]; - sprintf (buf, "radius %.12g", myRadius); + Sprintf (buf, "radius %.12g", myRadius); Scene().WriteLine (buf); aStatus = WriteClosing(); } diff --git a/src/VrmlData/VrmlData_Group.cxx b/src/VrmlData/VrmlData_Group.cxx index cea02f5268..d4c48c50bf 100755 --- a/src/VrmlData/VrmlData_Group.cxx +++ b/src/VrmlData/VrmlData_Group.cxx @@ -478,13 +478,13 @@ VrmlData_ErrorStatus VrmlData_Group::Write (const char * thePrefix) const }; // Check that the box is not void if (aBoxCorner[0].X() < aBoxCorner[1].X() + Precision::Confusion()) { - sprintf (buf, "bboxCenter %.9g %.9g %.9g", + Sprintf (buf, "bboxCenter %.9g %.9g %.9g", 0.5 * (aBoxCorner[0].X() + aBoxCorner[1].X()), 0.5 * (aBoxCorner[0].Y() + aBoxCorner[1].Y()), 0.5 * (aBoxCorner[0].Z() + aBoxCorner[1].Z())); aStatus = aScene.WriteLine (buf); if (OK(aStatus)) { - sprintf (buf, "bboxSize %.9g %.9g %.9g", + Sprintf (buf, "bboxSize %.9g %.9g %.9g", aBoxCorner[1].X() - aBoxCorner[0].X(), aBoxCorner[1].Y() - aBoxCorner[0].Y(), aBoxCorner[1].Z() - aBoxCorner[0].Z()); @@ -499,7 +499,7 @@ VrmlData_ErrorStatus VrmlData_Group::Write (const char * thePrefix) const if ((aScaleFactor - 1.)*(aScaleFactor - 1.) > 0.0001*Precision::Confusion()) { - sprintf (buf, "scale %.12g %.12g %.12g", + Sprintf (buf, "scale %.12g %.12g %.12g", aScaleFactor, aScaleFactor, aScaleFactor); aStatus = aScene.WriteLine (buf); } @@ -507,7 +507,7 @@ VrmlData_ErrorStatus VrmlData_Group::Write (const char * thePrefix) const // Output the Translation const gp_XYZ& aTrans = myTrsf.TranslationPart(); if (aTrans.SquareModulus() > 0.0001*Precision::Confusion()) { - sprintf (buf, "translation %.12g %.12g %.12g", + Sprintf (buf, "translation %.12g %.12g %.12g", aTrans.X(), aTrans.Y(), aTrans.Z()); aStatus = aScene.WriteLine (buf); } @@ -517,7 +517,7 @@ VrmlData_ErrorStatus VrmlData_Group::Write (const char * thePrefix) const Standard_Real anAngle; if (myTrsf.GetRotation (anAxis, anAngle)) { // output the Rotation - sprintf (buf, "rotation %.12g %.12g %.12g %.9g", + Sprintf (buf, "rotation %.12g %.12g %.12g %.9g", anAxis.X(), anAxis.Y(), anAxis.Z(), anAngle); aStatus = aScene.WriteLine (buf); } diff --git a/src/VrmlData/VrmlData_IndexedFaceSet.cxx b/src/VrmlData/VrmlData_IndexedFaceSet.cxx index a040a2b425..e172b532b0 100755 --- a/src/VrmlData/VrmlData_IndexedFaceSet.cxx +++ b/src/VrmlData/VrmlData_IndexedFaceSet.cxx @@ -371,7 +371,7 @@ VrmlData_ErrorStatus VrmlData_IndexedFaceSet::Write aStatus = aScene.WriteLine ("convex FALSE"); if (OK(aStatus) && CreaseAngle() > Precision::Confusion()) { char buf[64]; - sprintf (buf, "%.9g", CreaseAngle()); + Sprintf (buf, "%.9g", CreaseAngle()); aStatus = aScene.WriteLine ("creaseAngle", buf); } diff --git a/src/VrmlData/VrmlData_Material.cxx b/src/VrmlData/VrmlData_Material.cxx index 86fd7e2563..5681936272 100755 --- a/src/VrmlData/VrmlData_Material.cxx +++ b/src/VrmlData/VrmlData_Material.cxx @@ -202,7 +202,7 @@ VrmlData_ErrorStatus VrmlData_Material::Write (const char * thePrefix) const const Standard_Real aConf (0.001 * Precision::Confusion()); if (OK(aStatus) && fabs(myAmbientIntensity - 0.2) > aConf) { - sprintf (buf, "%.6g", myAmbientIntensity); + Sprintf (buf, "%.6g", myAmbientIntensity); aStatus = aScene.WriteLine ("ambientIntensity ", buf); } if (OK(aStatus)) { @@ -211,30 +211,30 @@ VrmlData_ErrorStatus VrmlData_Material::Write (const char * thePrefix) const (val[1] - 0.8) * (val[1] - 0.8) + (val[2] - 0.8) * (val[2] - 0.8) > 1e-7) { - sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); + Sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); aStatus = aScene.WriteLine ("diffuseColor ", buf); } } if (OK(aStatus)) { myEmissiveColor.Values (val[0], val[1], val[2], bidType); if (val[0] * val[0] + val[1] * val[1] + val[2] * val[2] > 1e-7) { - sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); + Sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); aStatus = aScene.WriteLine ("emissiveColor ", buf); } } if (OK(aStatus) && fabs(myShininess - 0.2) > aConf) { - sprintf (buf, "%.6g", myShininess); + Sprintf (buf, "%.6g", myShininess); aStatus = aScene.WriteLine ("shininess ", buf); } if (OK(aStatus)) { mySpecularColor.Values (val[0], val[1], val[2], bidType); if (val[0] * val[0] + val[1] * val[1] + val[2] * val[2] > 1e-7) { - sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); + Sprintf (buf, "%.6g %.6g %.6g", val[0], val[1], val[2]); aStatus = aScene.WriteLine ("specularColor ", buf); } } if (OK(aStatus) && myTransparency > aConf) { - sprintf (buf, "%.6g", myTransparency); + Sprintf (buf, "%.6g", myTransparency); aStatus = aScene.WriteLine ("transparency ", buf); } diff --git a/src/VrmlData/VrmlData_Scene.cxx b/src/VrmlData/VrmlData_Scene.cxx index 3c568a7067..b5d11dd1a8 100755 --- a/src/VrmlData/VrmlData_Scene.cxx +++ b/src/VrmlData/VrmlData_Scene.cxx @@ -677,7 +677,7 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadReal VrmlData_ErrorStatus aStatus; if (VrmlData_Node::OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) { char * endptr; - aResult = strtod (theBuffer.LinePtr, &endptr); + aResult = Strtod (theBuffer.LinePtr, &endptr); if (endptr == theBuffer.LinePtr) aStatus = VrmlData_NumericInputError; else if (isOnlyPositive && aResult < 0.001*Precision::Confusion()) @@ -707,7 +707,7 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadXYZ if (!VrmlData_Node::OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) break; char * endptr; - aVal[i] = strtod (theBuffer.LinePtr, &endptr); + aVal[i] = Strtod (theBuffer.LinePtr, &endptr); if (endptr == theBuffer.LinePtr) { aStatus = VrmlData_NumericInputError; break; @@ -746,7 +746,7 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadXY if (!VrmlData_Node::OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) break; char * endptr; - aVal[i] = strtod (theBuffer.LinePtr, &endptr); + aVal[i] = Strtod (theBuffer.LinePtr, &endptr); if (endptr == theBuffer.LinePtr) { aStatus = VrmlData_NumericInputError; break; @@ -871,23 +871,23 @@ VrmlData_ErrorStatus VrmlData_Scene::WriteArrIndex const Standard_Integer * arrVal = theArrIndex[iBlock]+1; switch (nVal) { case 1: - sprintf (buf, "%d,", arrVal[0]); + Sprintf (buf, "%d,", arrVal[0]); break; case 2: - sprintf (buf, "%d,%d,", arrVal[0], arrVal[1]); + Sprintf (buf, "%d,%d,", arrVal[0], arrVal[1]); break; case 3: - sprintf (buf, "%d,%d,%d,", arrVal[0], arrVal[1], arrVal[2]); + Sprintf (buf, "%d,%d,%d,", arrVal[0], arrVal[1], arrVal[2]); break; case 4: - sprintf (buf, "%d,%d,%d,%d,", + Sprintf (buf, "%d,%d,%d,%d,", arrVal[0], arrVal[1], arrVal[2], arrVal[3]); break; default: if (nVal > 0) { char * ptr = &buf[0]; for (Standard_Integer i = 0; i < nVal; i++) { - sprintf (ptr, "%d,", arrVal[i]); + Sprintf (ptr, "%d,", arrVal[i]); ptr = strchr (ptr, ',') + 1; if ((ptr - &buf[0]) > (ptrdiff_t)aLineLimit) { WriteLine(buf); @@ -918,11 +918,11 @@ VrmlData_ErrorStatus VrmlData_Scene::WriteXYZ char buf[240]; if (IsDummyWrite() == Standard_False) if (isApplyScale && myLinearScale > Precision::Confusion()) - sprintf (buf, "%.12g %.12g %.12g%s", theXYZ.X() / myLinearScale, + Sprintf (buf, "%.12g %.12g %.12g%s", theXYZ.X() / myLinearScale, theXYZ.Y() / myLinearScale, theXYZ.Z() / myLinearScale, thePostfix ? thePostfix : ""); else - sprintf (buf, "%.12g %.12g %.12g%s", theXYZ.X(), theXYZ.Y(), theXYZ.Z(), + Sprintf (buf, "%.12g %.12g %.12g%s", theXYZ.X(), theXYZ.Y(), theXYZ.Z(), thePostfix ? thePostfix : ""); return WriteLine (buf); } @@ -1005,7 +1005,7 @@ VrmlData_ErrorStatus VrmlData_Scene::WriteNode Handle(VrmlData_UnknownNode) bidNode = new VrmlData_UnknownNode; char buf[32]; do { - sprintf (buf, "_%d", + Sprintf (buf, "_%d", ++const_cast(myAutoNameCounter)); bidNode->myName = &buf[0]; } while (myNamedNodes.Contains (bidNode)); @@ -1116,7 +1116,7 @@ void dumpNode (Standard_OStream& theStream, const Handle(VrmlData_Group) aGroup = Handle(VrmlData_Group)::DownCast (theNode); char buf[64]; - sprintf (buf, "Group (%s)", + Sprintf (buf, "Group (%s)", aGroup->IsTransform() ? "Transform" : "Group"); dumpNodeHeader (theStream, theIndent, buf, theNode->Name()); if (theIndent.IsEmpty() == Standard_False) { @@ -1133,7 +1133,7 @@ void dumpNode (Standard_OStream& theStream, const Standard_Size nCoord = aNode->Coordinates()->Length(); const Standard_Size nPoly = aNode->Polygons (ppDummy); char buf[64]; - sprintf (buf, "IndexedFaceSet (%d vertices, %d polygons)", nCoord, nPoly); + Sprintf (buf, "IndexedFaceSet (%d vertices, %d polygons)", nCoord, nPoly); dumpNodeHeader (theStream, theIndent, buf, theNode->Name()); } else if (theNode->IsKind(STANDARD_TYPE(VrmlData_IndexedLineSet))) { const Handle(VrmlData_IndexedLineSet) aNode = @@ -1142,7 +1142,7 @@ void dumpNode (Standard_OStream& theStream, const Standard_Size nCoord = aNode->Coordinates()->Length(); const Standard_Size nPoly = aNode->Polygons (ppDummy); char buf[64]; - sprintf (buf, "IndexedLineSet (%d vertices, %d polygons)", nCoord, nPoly); + Sprintf (buf, "IndexedLineSet (%d vertices, %d polygons)", nCoord, nPoly); dumpNodeHeader (theStream, theIndent, buf, theNode->Name()); } else if (theNode->IsKind(STANDARD_TYPE(VrmlData_Material))) { // const Handle(VrmlData_Material) aMaterial = @@ -1159,7 +1159,7 @@ void dumpNode (Standard_OStream& theStream, const Handle(VrmlData_UnknownNode) anUnknown = Handle(VrmlData_UnknownNode)::DownCast (theNode); char buf[64]; - sprintf (buf, "Unknown (%s)", anUnknown->GetTitle().ToCString()); + Sprintf (buf, "Unknown (%s)", anUnknown->GetTitle().ToCString()); dumpNodeHeader (theStream, theIndent, buf, theNode->Name()); } } diff --git a/src/VrmlData/VrmlData_WorldInfo.cxx b/src/VrmlData/VrmlData_WorldInfo.cxx index af8ea8b1b3..74a7950b23 100755 --- a/src/VrmlData/VrmlData_WorldInfo.cxx +++ b/src/VrmlData/VrmlData_WorldInfo.cxx @@ -155,7 +155,7 @@ VrmlData_ErrorStatus VrmlData_WorldInfo::Write (const char * thePrefix) const { char buf[4096]; if (myTitle) { - sprintf (buf, "title \"%s\"", myTitle); + Sprintf (buf, "title \"%s\"", myTitle); aStatus = aScene.WriteLine (buf); } @@ -163,7 +163,7 @@ VrmlData_ErrorStatus VrmlData_WorldInfo::Write (const char * thePrefix) const if (OK (aStatus, aScene.WriteLine ("info [", 0L, GlobalIndent()))) { NCollection_List::Iterator anIter (myInfo); while (anIter.More()) { - sprintf (buf, "\"%s\"", anIter.Value()); + Sprintf (buf, "\"%s\"", anIter.Value()); anIter.Next(); if (anIter.More()) aStatus = aScene.WriteLine (buf, ","); diff --git a/src/WNT/WNT_GraphicDevice.cxx b/src/WNT/WNT_GraphicDevice.cxx index d5f4330b02..5595774054 100755 --- a/src/WNT/WNT_GraphicDevice.cxx +++ b/src/WNT/WNT_GraphicDevice.cxx @@ -600,7 +600,7 @@ static int __fastcall _createColorRamp ( HPALETTE* pal ) { if ( GetEnvironmentVariable ( "CSF_GammaValue", buff, 32 ) ) { - gamma = atof ( buff ); + gamma = Atof ( buff ); if ( gamma == 0.0 ) diff --git a/src/XDEDRAW/XDEDRAW.cxx b/src/XDEDRAW/XDEDRAW.cxx index bde3e350f2..54b9510982 100755 --- a/src/XDEDRAW/XDEDRAW.cxx +++ b/src/XDEDRAW/XDEDRAW.cxx @@ -227,7 +227,7 @@ static Standard_Integer dump (Draw_Interpretor& di, Standard_Integer argc, const Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); Standard_Boolean deep = Standard_False; - if ( (argc==3) && (atoi(argv[2])==1) ) deep = Standard_True; + if ( (argc==3) && (Draw::Atoi(argv[2])==1) ) deep = Standard_True; myAssembly->Dump(deep); return 0; } @@ -483,7 +483,7 @@ static Standard_Integer show (Draw_Interpretor& di, Standard_Integer argc, const // init viewer // char string[260]; -// sprintf ( string, "AISInitViewer %s", argv[1] ); +// Sprintf ( string, "AISInitViewer %s", argv[1] ); // di.Eval ( string ); TDF_Label acces = Doc->GetData()->Root(); Handle(TPrsStd_AISViewer) viewer; @@ -589,7 +589,7 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer TDF_Tool::Label(browser->Data(),argv[2],lab); if ( lab.IsNull() ) { di << "ERROR: label is Null: " << argv[2] << "\n"; return 0; } - Standard_Integer num = atoi ( argv[3] ); + Standard_Integer num = Draw::Atoi ( argv[3] ); TDF_AttributeIterator itr(lab,Standard_False); for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next(); @@ -713,7 +713,7 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer Handle(XCAFDoc_Color) val = Handle(XCAFDoc_Color)::DownCast ( att ); Quantity_Color C = val->GetColor(); char string[260]; - sprintf ( string, "%s (%g, %g, %g)", C.StringName ( C.Name() ), + Sprintf ( string, "%s (%g, %g, %g)", C.StringName ( C.Name() ), C.Red(), C.Green(), C.Blue() ); di << string; } @@ -811,7 +811,7 @@ static Standard_Integer setviewName (Draw_Interpretor& di, Standard_Integer argc return 1; } Standard_Boolean mode = Standard_False; - if (atoi(argv[1]) == 1) mode = Standard_True; + if (Draw::Atoi(argv[1]) == 1) mode = Standard_True; XCAFPrs::SetViewNameMode(mode); return 0; } @@ -845,7 +845,7 @@ static Standard_Integer XSetTransparency (Draw_Interpretor& di, Standard_Integer DDocStd::GetDocument(argv[1], Doc); if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } - const Standard_Real aTransparency = atof(argv[2]); + const Standard_Real aTransparency = Draw::Atof(argv[2]); // collect sequence of labels Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); @@ -965,28 +965,28 @@ static Standard_Integer XShowFaceBoundary (Draw_Interpretor& di, Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID; // turn boundaries on/off - Standard_Boolean isBoundaryDraw = (atoi (argv[3]) == 1); + Standard_Boolean isBoundaryDraw = (Draw::Atoi (argv[3]) == 1); aDrawer->SetFaceBoundaryDraw (isBoundaryDraw); // set boundary color if (argc >= 7) { // Text color - aRed = atof (argv[4])/255.; - aGreen = atof (argv[5])/255.; - aBlue = atof (argv[6])/255.; + aRed = Draw::Atof (argv[4])/255.; + aGreen = Draw::Atof (argv[5])/255.; + aBlue = Draw::Atof (argv[6])/255.; } // set line width if (argc >= 8) { - aWidth = (Standard_Real)atof (argv[7]); + aWidth = (Standard_Real)Draw::Atof (argv[7]); } // select appropriate line type if (argc == 9) { - switch (atoi (argv[8])) + switch (Draw::Atoi (argv[8])) { case 1: aLineType = Aspect_TOL_DASH; break; case 2: aLineType = Aspect_TOL_DOT; break; diff --git a/src/XDEDRAW/XDEDRAW_Colors.cxx b/src/XDEDRAW/XDEDRAW_Colors.cxx index 2a7d12f079..98e5d38ae2 100755 --- a/src/XDEDRAW/XDEDRAW_Colors.cxx +++ b/src/XDEDRAW/XDEDRAW_Colors.cxx @@ -17,9 +17,9 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - #include +#include #include #include @@ -52,7 +52,7 @@ static Standard_Integer setColor (Draw_Interpretor& di, Standard_Integer argc, c TDF_Label aLabel; TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); - Quantity_Color Col ( atof(argv[3]), atof(argv[4]), atof(argv[5]), Quantity_TOC_RGB ); + Quantity_Color Col ( Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Quantity_TOC_RGB ); Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main()); XCAFDoc_ColorType ctype = ( argc <=6 ? XCAFDoc_ColorGen : @@ -154,7 +154,7 @@ static Standard_Integer addColor (Draw_Interpretor& di, Standard_Integer argc, c TDF_Label aLabel; Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main()); - Quantity_Color Col ( atof(argv[2]), atof(argv[3]), atof(argv[4]), Quantity_TOC_RGB ); + Quantity_Color Col ( Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]), Quantity_TOC_RGB ); aLabel = myColors->AddColor(Col); TCollection_AsciiString Entry; @@ -193,7 +193,7 @@ static Standard_Integer findColor (Draw_Interpretor& di, Standard_Integer argc, Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main()); - Quantity_Color Col ( atof(argv[2]), atof(argv[3]), atof(argv[4]), Quantity_TOC_RGB ); + Quantity_Color Col ( Draw::Atof(argv[2]), Draw::Atof(argv[3]), Draw::Atof(argv[4]), Quantity_TOC_RGB ); TCollection_AsciiString Entry; TDF_Tool::Entry(myColors->FindColor(Col), Entry); @@ -235,7 +235,7 @@ static Standard_Integer setVisibility (Draw_Interpretor& di, Standard_Integer ar if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } Handle(XCAFDoc_ColorTool) localTool = XCAFDoc_DocumentTool::ColorTool(Doc->Main()); Standard_Boolean isvisible = Standard_False; - if ( (argc==4) && (atoi(argv[3])==1) ) isvisible = Standard_True; + if ( (argc==4) && (Draw::Atoi(argv[3])==1) ) isvisible = Standard_True; TDF_Label aLabel; TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); @@ -341,7 +341,7 @@ static Standard_Integer setStyledcolor (Draw_Interpretor& di, Standard_Integer a TopoDS_Shape aShape; aShape = DBRep::Get(argv[2]); - Quantity_Color col ( atof(argv[3]), atof(argv[4]), atof(argv[5]), Quantity_TOC_RGB ); + Quantity_Color col ( Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Quantity_TOC_RGB ); XCAFDoc_ColorType type; if ( argv[6] && argv[6][0] == 's' ) type = XCAFDoc_ColorSurf; diff --git a/src/XDEDRAW/XDEDRAW_Common.cxx b/src/XDEDRAW/XDEDRAW_Common.cxx index 140aef3cb7..3143a721df 100755 --- a/src/XDEDRAW/XDEDRAW_Common.cxx +++ b/src/XDEDRAW/XDEDRAW_Common.cxx @@ -163,7 +163,7 @@ static Standard_Integer FromShape (Draw_Interpretor& di, Standard_Integer argc, } char command[256]; - sprintf ( command, "fromshape %.200s -1", argv[1] ); + Sprintf ( command, "fromshape %.200s -1", argv[1] ); Handle(Dico_DictionaryOfTransient) DictWS = thedictws; if ( DictWS->IsEmpty() ) return di.Eval ( command ); diff --git a/src/XDEDRAW/XDEDRAW_Layers.cxx b/src/XDEDRAW/XDEDRAW_Layers.cxx index faf20f9e37..cecddd901e 100755 --- a/src/XDEDRAW/XDEDRAW_Layers.cxx +++ b/src/XDEDRAW/XDEDRAW_Layers.cxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -108,7 +109,7 @@ static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, c return 1; } Standard_Boolean shapeInOneLayer = Standard_False; - if ( (argc==5) && (atoi(argv[4])==1) ) shapeInOneLayer = Standard_True; + if ( (argc==5) && (Draw::Atoi(argv[4])==1) ) shapeInOneLayer = Standard_True; Handle(TDocStd_Document) Doc; DDocStd::GetDocument(argv[1], Doc); if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } @@ -220,7 +221,7 @@ static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer arg return 1; } Standard_Boolean shapeInOneLayer = Standard_False; - if ( (argc==5) && (atoi(argv[4])==1) ) shapeInOneLayer = Standard_True; + if ( (argc==5) && (Draw::Atoi(argv[4])==1) ) shapeInOneLayer = Standard_True; Handle(TDocStd_Document) Doc; DDocStd::GetDocument(argv[1], Doc); if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } @@ -365,7 +366,7 @@ static Standard_Integer setVisibility (Draw_Interpretor& di, Standard_Integer ar if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } Handle(XCAFDoc_LayerTool) localLayerTool = XCAFDoc_DocumentTool::LayerTool(Doc->Main()); Standard_Boolean isvisible = Standard_False; - if ( (argc==4) && (atoi(argv[3])==1) ) isvisible = Standard_True; + if ( (argc==4) && (Draw::Atoi(argv[3])==1) ) isvisible = Standard_True; TDF_Label aLabel; TDF_Tool::Label(Doc->GetData(), argv[2], aLabel); diff --git a/src/XDEDRAW/XDEDRAW_Props.cxx b/src/XDEDRAW/XDEDRAW_Props.cxx index 3c88be1bb0..4af43fd044 100755 --- a/src/XDEDRAW/XDEDRAW_Props.cxx +++ b/src/XDEDRAW/XDEDRAW_Props.cxx @@ -21,6 +21,7 @@ #include +#include #include #include @@ -233,7 +234,7 @@ static Standard_Integer SetProps (Draw_Interpretor& di, Standard_Integer argc, c // retrieve epsilon Standard_Real anEps; - if(argc > 3 ) anEps = atof(argv[3]); + if(argc > 3 ) anEps = Draw::Atof(argv[3]); else anEps = 0.001; GProp_GProps G; @@ -288,7 +289,7 @@ static Standard_Integer SetVolume (Draw_Interpretor& di, Standard_Integer argc, } } if ( !aLabel.IsNull() ) { - res = atof(argv[3]); + res = Draw::Atof(argv[3]); Handle(XCAFDoc_Volume) aVolume = new XCAFDoc_Volume; if (!aLabel.FindAttribute (XCAFDoc_Volume::GetID(), aVolume)) aLabel.AddAttribute(aVolume); aVolume->Set(res); @@ -326,7 +327,7 @@ static Standard_Integer SetArea (Draw_Interpretor& di, Standard_Integer argc, co } } if ( !aLabel.IsNull() ) { - res = atof(argv[3]); + res = Draw::Atof(argv[3]); Handle(XCAFDoc_Area) aArea = new XCAFDoc_Area; if (!aLabel.FindAttribute (XCAFDoc_Area::GetID(), aArea)) aLabel.AddAttribute(aArea); aArea->Set(res); @@ -363,13 +364,13 @@ static Standard_Integer SetCentroid (Draw_Interpretor& di, Standard_Integer argc } } if ( !aLabel.IsNull() ) { - aPoint.SetX(atof(argv[3])); - aPoint.SetY(atof(argv[4])); - aPoint.SetZ(atof(argv[5])); + aPoint.SetX(Draw::Atof(argv[3])); + aPoint.SetY(Draw::Atof(argv[4])); + aPoint.SetZ(Draw::Atof(argv[5])); Handle(XCAFDoc_Centroid) aCentroid = new XCAFDoc_Centroid; if (!aLabel.FindAttribute (XCAFDoc_Centroid::GetID(), aCentroid)) aLabel.AddAttribute(aCentroid); aCentroid->Set(aPoint); - di << atof(argv[3])<<" "<2 && atof(argv[2]) != 0 ) withVolFix = Standard_True; + if ( argc >2 && Draw::Atof(argv[2]) != 0 ) withVolFix = Standard_True; Standard_Boolean wholeDoc = ( argc <4 ); TDF_LabelSequence seq; if ( ! wholeDoc ) { @@ -567,7 +568,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, //printf ( "%s%-12.12s", ( wholeDoc ? "" : "Label " ), str.ToCString() ); //fflush ( stdout ); char string1[260]; - sprintf (string1, "%s%-12.12s", ( wholeDoc ? "" : "Label " ), str.ToCString() ); + Sprintf (string1, "%s%-12.12s", ( wholeDoc ? "" : "Label " ), str.ToCString() ); di << string1; Handle(TDataStd_Name) N; if ( aLabel.FindAttribute ( TDataStd_Name::GetID(), N ) && ! wholeDoc ) { @@ -594,7 +595,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, // (Standard_Integer)( Abs ( G.Mass() ) > 1e-10 ? 100. * ( aArea->Get() - G.Mass() ) / G.Mass() : 999. ), // ( wholeDoc ? "" : "\n" )); char string2[260]; - sprintf (string2, "%s%9.1f (%3d%%)%s", ( wholeDoc ? "" : " Area defect: " ), + Sprintf (string2, "%s%9.1f (%3d%%)%s", ( wholeDoc ? "" : " Area defect: " ), aArea->Get() - G.Mass(), (Standard_Integer)( Abs ( G.Mass() ) > 1e-10 ? 100. * ( aArea->Get() - G.Mass() ) / G.Mass() : 999. ), ( wholeDoc ? "" : "\n" )); @@ -603,14 +604,14 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, catch (Standard_Failure) { //printf ( "%-16.16s", "exception" ); char string3[260]; - sprintf (string3, "%-16.16s", "exception" ); + Sprintf (string3, "%-16.16s", "exception" ); di << string3; } } else if ( wholeDoc ) { //printf ( "%16.16s", "" ); char string4[260]; - sprintf (string4, "%16.16s", "" ); + Sprintf (string4, "%16.16s", "" ); di << string4; } @@ -621,7 +622,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, Standard_Real localVolume; gp_Pnt pcg(0,0,0); if ( withVolFix ) { - Standard_Real tol = atof(argv[2]); + Standard_Real tol = Draw::Atof(argv[2]); Standard_Boolean withForce = Standard_False; if ( tol < 0 ) { withForce = Standard_True; @@ -641,7 +642,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, // (Standard_Integer)( Abs ( localVolume ) > 1e-10 ? 100. * ( aVolume->Get() - localVolume ) / localVolume : 999. ), // ( wholeDoc ? "" : "\n" )); char string5[260]; - sprintf (string5, "%s%9.1f (%3d%%)%s", ( wholeDoc ? "" : " Volume defect: " ), + Sprintf (string5, "%s%9.1f (%3d%%)%s", ( wholeDoc ? "" : " Volume defect: " ), aVolume->Get() - localVolume, (Standard_Integer)( Abs ( localVolume ) > 1e-10 ? 100. * ( aVolume->Get() - localVolume ) / localVolume : 999. ), ( wholeDoc ? "" : "\n" )); @@ -650,7 +651,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, else if ( wholeDoc ) { //printf ( "%16.16s", "" ); char string6[260]; - sprintf (string6, "%16.16s", "" ); + Sprintf (string6, "%16.16s", "" ); di << string6; } @@ -660,12 +661,12 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, if ( wholeDoc ) { //printf ( " %7.2f %7.2f %7.2f", // p.X() - pcg.X(), p.Y() - pcg.Y(), p.Z() - pcg.Z() ); - sprintf (string7, " %7.2f %7.2f %7.2f", + Sprintf (string7, " %7.2f %7.2f %7.2f", p.X() - pcg.X(), p.Y() - pcg.Y(), p.Z() - pcg.Z() ); } else { //printf ( " CG defect: dX=%.3f, dY=%.3f, dZ=%.3f\n", // p.X() - pcg.X(), p.Y() - pcg.Y(), p.Z() - pcg.Z() ); - sprintf (string7, " CG defect: dX=%.3f, dY=%.3f, dZ=%.3f\n", + Sprintf (string7, " CG defect: dX=%.3f, dY=%.3f, dZ=%.3f\n", p.X() - pcg.X(), p.Y() - pcg.Y(), p.Z() - pcg.Z() ); } di << string7; @@ -673,14 +674,14 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, else if ( wholeDoc ) { //printf ( "%24.24s", "" ); char string8[260]; - sprintf (string8, "%24.24s", "" ); + Sprintf (string8, "%24.24s", "" ); di << string8; } } catch (Standard_Failure) { //printf ( "%40.40s", "exception" ); char string9[260]; - sprintf (string9, "%40.40s", "exception" ); + Sprintf (string9, "%40.40s", "exception" ); di << string9; #ifdef DEB //fflush ( stdout ); @@ -693,7 +694,7 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, else if ( wholeDoc ) { //printf ( "%40.40s", "" ); char string10[260]; - sprintf (string10, "%40.40s", "" ); + Sprintf (string10, "%40.40s", "" ); di << string10; } //fflush ( stdout ); @@ -725,7 +726,7 @@ static Standard_Integer ShapeVolume (Draw_Interpretor& di, Standard_Integer argc if (aShape.IsNull()) return 1; gp_Pnt aPoint(0,0,0); Standard_Real localVolume; - Standard_Real tol = atof(argv[2]); + Standard_Real tol = Draw::Atof(argv[2]); Standard_Boolean withForce = Standard_False; if ( tol < 0 ) { withForce = Standard_True; @@ -845,7 +846,7 @@ static Standard_Integer ShapeMassProps (Draw_Interpretor& di, Standard_Integer a DDocStd::GetDocument(argv[1], Doc); Standard_Real atol = Precision::Confusion(); if(argc >2) - atol = atof(argv[2]); + atol = Draw::Atof(argv[2]); if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } Standard_Boolean wholeDoc = ( argc <4 ); TDF_LabelSequence seq; @@ -915,7 +916,7 @@ static Standard_Integer SetMaterial (Draw_Interpretor& di, Standard_Integer argc Handle(XCAFDoc_MaterialTool) MatTool = XCAFDoc_DocumentTool::MaterialTool(Doc->Main()); MatTool->SetMaterial(aLabel, new TCollection_HAsciiString(argv[3]), - new TCollection_HAsciiString(""), atof(argv[4]), + new TCollection_HAsciiString(""), Draw::Atof(argv[4]), new TCollection_HAsciiString("density measure"), new TCollection_HAsciiString("POSITIVE_RATIO_MEASURE")); diff --git a/src/XDEDRAW/XDEDRAW_Shapes.cxx b/src/XDEDRAW/XDEDRAW_Shapes.cxx index 9a547f7ccd..db0713481b 100755 --- a/src/XDEDRAW/XDEDRAW_Shapes.cxx +++ b/src/XDEDRAW/XDEDRAW_Shapes.cxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -63,7 +64,7 @@ static Standard_Integer addShape (Draw_Interpretor& di, Standard_Integer argc, c aShape = DBRep::Get(argv[2]); Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); Standard_Boolean makeAssembly = Standard_True; - if ( argc==4 && atoi(argv[3]) == 0 ) makeAssembly = Standard_False; + if ( argc==4 && Draw::Atoi(argv[3]) == 0 ) makeAssembly = Standard_False; TDF_Label aLabel; aLabel = myAssembly->AddShape(aShape, makeAssembly); if (aLabel.IsNull()) di<<"Null Label"<<"\n"; @@ -160,7 +161,7 @@ static Standard_Integer removeShape (Draw_Interpretor& di, Standard_Integer argc // myAssembly.Init(Doc); Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main()); Standard_Boolean removeCompletely = Standard_True; - if ( argc == 4 && atoi(argv[3]) == 0 ) + if ( argc == 4 && Draw::Atoi(argv[3]) == 0 ) removeCompletely = Standard_False; myAssembly->RemoveShape(aLabel, removeCompletely); @@ -238,7 +239,7 @@ static Standard_Integer getUsers (Draw_Interpretor& di, Standard_Integer argc, c return 1; } Standard_Boolean getsubchilds = Standard_False; - if ( (argc==4) && ( atoi(argv[3])==1 ) ) getsubchilds = Standard_True; + if ( (argc==4) && ( Draw::Atoi(argv[3])==1 ) ) getsubchilds = Standard_True; Handle(TDocStd_Document) Doc; DDocStd::GetDocument(argv[1], Doc); @@ -262,7 +263,7 @@ static Standard_Integer nbComponents (Draw_Interpretor& di, Standard_Integer arg return 1; } Standard_Boolean getsubchilds = Standard_False; - if ( (argc==4) && ( atoi(argv[3])==1 ) ) getsubchilds = Standard_True; + if ( (argc==4) && ( Draw::Atoi(argv[3])==1 ) ) getsubchilds = Standard_True; Handle(TDocStd_Document) Doc; DDocStd::GetDocument(argv[1], Doc); if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; } @@ -413,7 +414,7 @@ static Standard_Integer getFreeShapes (Draw_Interpretor& di, Standard_Integer ar for ( Standard_Integer i = 1; i<= Labels.Length(); i++) { TopoDS_Shape S = STool->GetShape ( Labels.Value(i) ); char string[260]; - sprintf ( string, "%s_%d", argv[2], i ); + Sprintf ( string, "%s_%d", argv[2], i ); DBRep::Set ( string, S ); di << string << " "; } diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index d653647af3..ab02f3dbc9 100755 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -130,7 +130,7 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) if (theolds->HasItem(com.ToCString())) num = theolds->Item(com.ToCString()); if (num == 0) continue; if (!IFSelect_Activator::Select(com.ToCString(),nact,act)) - sprintf (help,"type : xhelp %s for help",com.ToCString()); + Sprintf (help,"type : xhelp %s for help",com.ToCString()); else if (!act.IsNull()) strcpy(help,act->Help(nact)); if (num < 0) theCommands.Add (com.ToCString(),help,XSTEPDRAWRUN,act->Group()); else theCommands.Add (thenews->Value(num).ToCString(),help,XSTEPDRAWRUN,act->Group()); @@ -141,7 +141,7 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) (const Standard_CString command, const Standard_CString varname) { char mess[100]; - sprintf (mess,command,varname); + Sprintf (mess,command,varname); #ifdef DEB IFSelect_ReturnStatus stat = #endif diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 56a29a8c46..fba8546a23 100755 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -152,7 +152,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c // amv 26.09.2003 : this is used to avoid error of enter's simbol char str[80]; cin>>str; - modepri = atoi(str); + modepri = Draw::Atoi(str); } if (modepri == 0) { //fin @@ -187,7 +187,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c //amv 26.09.2003 char str_a[80]; cin >> str_a; - answer = atoi(str_a); + answer = Draw::Atoi(str_a); } if ( answer == 0) continue; if ( answer == 1 || answer == 3) { @@ -195,7 +195,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c // save the shape if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; } char fname[110]; - sprintf(fname, "%s", rnom.ToCString()); + Sprintf(fname, "%s", rnom.ToCString()); di << "Saving shape in variable Draw : " << fname << "\n"; if (answer == 3) IGESToBRep::WriteShape (shape,1); try { @@ -218,7 +218,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c TopoDS_Shape shape = Reader.Shape(inum); if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; } char fname[110]; - sprintf(fname, "%s_%d", rnom.ToCString(),inum); + Sprintf(fname, "%s_%d", rnom.ToCString(),inum); di << "Saving shape in variable Draw : " << fname << "\n"; if (answer == 4) IGESToBRep::WriteShape (shape,inum); try { @@ -245,7 +245,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "< DRAW Shape: "<>str_answer; - answer = atoi(str_answer); + answer = Draw::Atoi(str_answer); } if (answer <= 0 || answer > 3) continue; if (answer == 3) { @@ -358,7 +358,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "< DRAW Shape: "< DRAW Shape: "< DRAW Shape: "< DRAW Shape: "< 3) { - isASCIIMode = (atoi(argv[3]) == 0); + isASCIIMode = (Draw::Atoi(argv[3]) == 0); if (argc > 4) { - isInParallel = (atoi(argv[4]) == 1); + isInParallel = (Draw::Atoi(argv[4]) == 1); Standard::SetReentrant(isInParallel); } } @@ -222,9 +222,9 @@ static Standard_Integer storevrml } else { TopoDS_Shape shape = DBRep::Get(argv[1]); - Standard_Real defl = atof(argv[3]); + Standard_Real defl = Draw::Atof(argv[3]); Standard_Integer type = 1; - if(argc > 4) type = atoi(argv[4]); + if(argc > 4) type = Draw::Atoi(argv[4]); type = Max(0, type); type = Min(2, type); @@ -347,8 +347,7 @@ static Standard_Integer meshdm Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); if( !aMesh.IsNull() ) { - Standard_Integer DisplayMode = 0; - sscanf( argv[2], "%i", &DisplayMode ); + Standard_Integer DisplayMode = Draw::Atoi (argv[2]); Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); @@ -381,8 +380,7 @@ static Standard_Integer meshsm Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); if( !aMesh.IsNull() ) { - Standard_Integer SelMode = 0; - sscanf( argv[2], "%i", &SelMode ); + Standard_Integer SelMode = Draw::Atoi (argv[2]); Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); @@ -438,10 +436,9 @@ static Standard_Integer setcolor Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); if( !aMesh.IsNull() ) { - Standard_Real r, g, b; - sscanf( argv[2], "%lf", &r ); - sscanf( argv[3], "%lf", &g ); - sscanf( argv[4], "%lf", &b ); + Standard_Real r = Draw::Atof (argv[2]); + Standard_Real g = Draw::Atof (argv[3]); + Standard_Real b = Draw::Atof (argv[4]); aMesh->GetDrawer()->SetColor( (MeshVS_DrawerAttribute)Param, Quantity_Color( r, g, b, Quantity_TOC_RGB ) ); Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); @@ -477,8 +474,7 @@ static Standard_Integer meshmat Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); if( !aMesh.IsNull() ) { - Standard_Integer mat; - sscanf( argv[2], "%i", &mat ); + Standard_Integer mat = Draw::Atoi (argv[2]); Graphic3d_MaterialAspect aMatAsp = (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)mat; @@ -507,8 +503,7 @@ static Standard_Integer shrink Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di ); if( !aMesh.IsNull() ) { - Standard_Real sh; - sscanf( argv[2], "%lf", &sh ); + Standard_Real sh = Draw::Atof (argv[2]); aMesh->GetDrawer()->SetDouble( MeshVS_DA_ShrinkCoeff, sh ); Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext(); @@ -773,7 +768,7 @@ static Standard_Integer meshcolors( Draw_Interpretor& di, if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none") ) { Handle(MeshVS_PrsBuilder) aTempBuilder; - Standard_Integer reflection = atoi(argv[3]); + Standard_Integer reflection = Draw::Atoi(argv[3]); for (int count = 0 ; count < aMesh->GetBuildersCount(); count++ ){ aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder")); @@ -928,13 +923,13 @@ static Standard_Integer mesh_edge_width( Draw_Interpretor& di, } const char* aWidthStr = argv[ 2 ]; - if ( aWidthStr == 0 || atof( aWidthStr ) <= 0 ) + if ( aWidthStr == 0 || Draw::Atof( aWidthStr ) <= 0 ) { di << "Width must be real value more than zero" << "\n"; return 0; } - double aWidth = atof( aWidthStr ); + double aWidth = Draw::Atof( aWidthStr ); Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext(); if ( anIC.IsNull() ) diff --git a/src/XmlLDrivers/XmlLDrivers.cxx b/src/XmlLDrivers/XmlLDrivers.cxx index edfa945669..8d4fc6f217 100755 --- a/src/XmlLDrivers/XmlLDrivers.cxx +++ b/src/XmlLDrivers/XmlLDrivers.cxx @@ -76,10 +76,6 @@ Handle(Standard_Transient) XmlLDrivers::Factory(const Standard_GUID& theGUID) //======================================================================= TCollection_AsciiString XmlLDrivers::CreationDate () { - const TCollection_AsciiString anOldNumLocale = - (Standard_CString) setlocale (LC_NUMERIC, NULL); - setlocale(LC_NUMERIC, "C"); - Standard_Character nowstr[SLENGTH]; time_t nowbin; struct tm *nowstruct; @@ -92,7 +88,6 @@ TCollection_AsciiString XmlLDrivers::CreationDate () if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0) cerr << "Storage ERROR : Could not get string from strftime()" << endl; - setlocale(LC_NUMERIC, (char *) anOldNumLocale.ToCString()) ; return nowstr; } diff --git a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx index eb48b03a22..f8e5fb564c 100755 --- a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx +++ b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx @@ -195,10 +195,6 @@ void XmlLDrivers_DocumentRetrievalDriver::Read { myReaderStatus = PCDM_RS_DriverFailure; myFileName = theFileName; - const TCollection_AsciiString anOldNumLocale = - (Standard_CString) setlocale (LC_NUMERIC, NULL); - setlocale(LC_NUMERIC, "C"); - Handle(CDM_MessageDriver) aMessageDriver = theApplication -> MessageDriver(); ::take_time (~0, " +++++ Start RETRIEVE procedures ++++++", aMessageDriver); @@ -216,8 +212,6 @@ void XmlLDrivers_DocumentRetrievalDriver::Read ::take_time (0, " +++++ Fin parsing XML : ", aMessageDriver); ReadFromDomDocument (anElement, theNewDocument, theApplication); - - setlocale(LC_NUMERIC, (char *) anOldNumLocale.ToCString()) ; } //======================================================================= @@ -497,7 +491,7 @@ static void take_time (const Standard_Integer isReset, const char * aHeader, if (isReset) tmbuf0 = tmbuf; else { char take_tm_buf [64]; - sprintf (take_tm_buf, "%9.2f s ++++", + Sprintf (take_tm_buf, "%9.2f s ++++", double(tmbuf.time - tmbuf0.time) + double(tmbuf.millitm - tmbuf0.millitm)/1000.); aMessage += take_tm_buf; diff --git a/src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx b/src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx index 7a45f9889e..38257068de 100755 --- a/src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx +++ b/src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx @@ -108,10 +108,6 @@ void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument, const TCollection_ExtendedString& theFileName) { - const TCollection_AsciiString anOldNumLocale = - (Standard_CString) setlocale (LC_NUMERIC, NULL); - setlocale(LC_NUMERIC, "C"); - Handle(CDM_MessageDriver) aMessageDriver = theDocument -> Application() -> MessageDriver(); ::take_time (~0, " +++++ Start STORAGE procedures ++++++", aMessageDriver); @@ -143,7 +139,6 @@ void XmlLDrivers_DocumentStorageDriver::Write Standard_Failure::Raise("File cannot be opened for writing"); } } - setlocale(LC_NUMERIC, (char *) anOldNumLocale.ToCString()) ; } //======================================================================= @@ -402,7 +397,7 @@ static void take_time (const Standard_Integer isReset, const char * aHeader, if (isReset) tmbuf0 = tmbuf; else { char take_tm_buf [64]; - sprintf (take_tm_buf, "%9.2f s ++++", + Sprintf (take_tm_buf, "%9.2f s ++++", double(tmbuf.time - tmbuf0.time) + double(tmbuf.millitm - tmbuf0.millitm)/1000.); aMessage += take_tm_buf; diff --git a/src/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx b/src/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx index 9193e2cf86..eb4cfef45e 100755 --- a/src/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx +++ b/src/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx @@ -767,7 +767,7 @@ void XmlMDataStd_NamedDataDriver::Paste(const Handle(TDF_Attribute)& theSource, aValueStr2 += TCollection_AsciiString(anArr1.Value(j)); #else char aValueChar[32]; - sprintf(aValueChar, "%.15g", anArr1.Value(j)); + Sprintf(aValueChar, "%.15g", anArr1.Value(j)); TCollection_AsciiString aValueStr(aValueChar); aValueStr2 += aValueStr; #endif diff --git a/src/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx b/src/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx index bd63f93330..d0edf72ed9 100755 --- a/src/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx +++ b/src/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx @@ -172,7 +172,7 @@ void XmlMDataStd_RealArrayDriver::Paste (const Handle(TDF_Attribute)& theSource, aValueStr += TCollection_AsciiString(aRealArray->Value(i)); #else char aValueChar[32]; - sprintf(aValueChar, "%.15g", aRealArray->Value(i)); + Sprintf(aValueChar, "%.15g", aRealArray->Value(i)); aValueStr += aValueChar; #endif if (i >= anU) break; diff --git a/src/XmlMDataStd/XmlMDataStd_RealDriver.cxx b/src/XmlMDataStd/XmlMDataStd_RealDriver.cxx index 34222f2b65..582f2d481e 100755 --- a/src/XmlMDataStd/XmlMDataStd_RealDriver.cxx +++ b/src/XmlMDataStd/XmlMDataStd_RealDriver.cxx @@ -84,7 +84,7 @@ void XmlMDataStd_RealDriver::Paste (const Handle(TDF_Attribute)& theSource, TCollection_AsciiString aValueStr (anInt->Get()); #else char aValueChar[32]; - sprintf(aValueChar, "%.15g", anInt->Get()); + Sprintf(aValueChar, "%.15g", anInt->Get()); TCollection_AsciiString aValueStr(aValueChar); #endif // No occurrence of '&', '<' and other irregular XML characters diff --git a/src/XmlMNaming/XmlMNaming_Shape1.cxx b/src/XmlMNaming/XmlMNaming_Shape1.cxx index cbfef6fd58..01aa1f6864 100755 --- a/src/XmlMNaming/XmlMNaming_Shape1.cxx +++ b/src/XmlMNaming/XmlMNaming_Shape1.cxx @@ -144,7 +144,7 @@ void XmlMNaming_Shape1::SetShape (const Standard_Integer theID, case TopAbs_EXTERNAL : anOr = 'e'; break; default : anOr = '\0'; } - sprintf (aBuffer, "%c%i", anOr, theID); + Sprintf (aBuffer, "%c%i", anOr, theID); Element().setAttribute (::TShapeString(), aBuffer); if (theLocID > 0) Element().setAttribute (::LocationString(), theLocID); @@ -160,12 +160,12 @@ void XmlMNaming_Shape1::SetVertex (const TopoDS_Shape& theVertex) gp_Pnt aPos = BRep_Tool::Pnt(aV); char buf [16]; - sprintf (buf, "%.8g", aPos.X()); + Sprintf (buf, "%.8g", aPos.X()); Element().setAttribute (::XCoordString(), buf); - sprintf (buf, "%.8g", aPos.Y()); + Sprintf (buf, "%.8g", aPos.Y()); Element().setAttribute (::YCoordString(), buf); - sprintf (buf, "%.8g", aPos.Z()); + Sprintf (buf, "%.8g", aPos.Z()); Element().setAttribute (::ZCoordString(), buf); } diff --git a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx b/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx index 350e416ca0..01a91afe31 100755 --- a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx +++ b/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx @@ -122,7 +122,7 @@ void XmlMPrsStd_PositionDriver::Paste { gp_Pnt aPos = aTPos->GetPosition(); char buf [64]; - sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z()); + Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z()); XmlObjMgt::SetStringValue(theTarget.Element(), buf); } } diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_CentroidDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_CentroidDriver.cxx index 1e7fc768f6..4430b98434 100755 --- a/src/XmlMXCAFDoc/XmlMXCAFDoc_CentroidDriver.cxx +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc_CentroidDriver.cxx @@ -122,7 +122,7 @@ void XmlMXCAFDoc_CentroidDriver::Paste { gp_Pnt aPos = aTPos->Get(); char buf [64]; - sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z()); + Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z()); XmlObjMgt::SetStringValue(theTarget.Element(), buf); } } diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_DimTolDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_DimTolDriver.cxx index 29563e59d1..79fb481543 100755 --- a/src/XmlMXCAFDoc/XmlMXCAFDoc_DimTolDriver.cxx +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc_DimTolDriver.cxx @@ -166,7 +166,7 @@ void XmlMXCAFDoc_DimTolDriver::Paste (const Handle(TDF_Attribute)& theSource, for ( Standard_Integer i = aFirstInd; i <= aLastInd; i++ ) { char aValueChar[256]; - sprintf(aValueChar, "%.15g", aHArr->Value(i)); + Sprintf(aValueChar, "%.15g", aHArr->Value(i)); aValueStr += aValueChar; if ( i < aLastInd ) aValueStr += ' '; diff --git a/src/XmlObjMgt/XmlObjMgt.cxx b/src/XmlObjMgt/XmlObjMgt.cxx index ee9501a884..86c8ed2479 100755 --- a/src/XmlObjMgt/XmlObjMgt.cxx +++ b/src/XmlObjMgt/XmlObjMgt.cxx @@ -120,16 +120,16 @@ Standard_Boolean XmlObjMgt::SetExtendedString const Standard_Integer aLen = theString.Length(); // const Standard_ExtCharacter * aString = theString.ToExtString(); char * buf0 = new char [4 * (aLen + 1) + 3]; - sprintf (&buf0[0], "##%04x", 0xfeff); // set UNICODE header + Sprintf (&buf0[0], "##%04x", 0xfeff); // set UNICODE header char * buf = &buf0[6]; // Standard_Integer i = 0; // while (i <= (aLen - 4)) { -// sprintf (&buf[i*4], "%04x%04x%04x%04x", aString[i], aString[i+1], +// Sprintf (&buf[i*4], "%04x%04x%04x%04x", aString[i], aString[i+1], // aString[i+2], aString[i+3]); // i += 4; // } // while (i < aLen) { -// sprintf (&buf[i*4], "%04x", aString[i]); +// Sprintf (&buf[i*4], "%04x", aString[i]); // ++i; // } // buf[4*aLen] = '\0'; @@ -346,7 +346,7 @@ Standard_Boolean XmlObjMgt::GetReal (Standard_CString& theString, { char * ptr; errno = 0; - double aValue = strtod (theString, &ptr); + double aValue = Strtod (theString, &ptr); if (ptr == theString || errno == ERANGE || errno == EINVAL) return Standard_False; theValue = Standard_Real (aValue); @@ -376,7 +376,7 @@ Standard_Boolean XmlObjMgt::GetReal (const XmlObjMgt_DOMString& theString, char * ptr; const char * aString = theString.GetString(); errno = 0; - double aValue = strtod (aString, &ptr); + double aValue = Strtod (aString, &ptr); if (ptr == aString || errno == ERANGE || errno == EINVAL) return Standard_False; theValue = Standard_Real (aValue); diff --git a/src/XmlObjMgt/XmlObjMgt_GP.cxx b/src/XmlObjMgt/XmlObjMgt_GP.cxx index 694d8895dd..acca8e94b7 100755 --- a/src/XmlObjMgt/XmlObjMgt_GP.cxx +++ b/src/XmlObjMgt/XmlObjMgt_GP.cxx @@ -36,7 +36,7 @@ XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_Trsf& aTrsf) char buf [256]; XmlObjMgt_DOMString S1 (Translate(aTrsf.HVectorialPart())), S2 (Translate(aTrsf.TranslationPart())); - sprintf (buf, "%.17g %d %s %s", aTrsf.ScaleFactor(), aTrsf.Form(), + Sprintf (buf, "%.17g %d %s %s", aTrsf.ScaleFactor(), aTrsf.Form(), S1.GetString(), S2.GetString()); return XmlObjMgt_DOMString (buf); @@ -52,7 +52,7 @@ XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_Mat& aMat) XmlObjMgt_DOMString S1 (Translate(aMat.Row(1))), S2 (Translate(aMat.Row(2))), S3 (Translate(aMat.Row(3))); - sprintf (buf, "%s %s %s", S1.GetString(), S2.GetString(), S3.GetString()); + Sprintf (buf, "%s %s %s", S1.GetString(), S2.GetString(), S3.GetString()); return XmlObjMgt_DOMString (buf); } @@ -63,7 +63,7 @@ XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_Mat& aMat) XmlObjMgt_DOMString XmlObjMgt_GP::Translate (const gp_XYZ& anXYZ) { char buf [64]; - sprintf (buf, "%.17g %.17g %.17g", anXYZ.X(), anXYZ.Y(), anXYZ.Z()); + Sprintf (buf, "%.17g %.17g %.17g", anXYZ.X(), anXYZ.Y(), anXYZ.Z()); return XmlObjMgt_DOMString (buf); } @@ -80,7 +80,7 @@ Standard_Boolean XmlObjMgt_GP::Translate const char * aStr = theStr.GetString(); char * ptr; errno = 0; - Standard_Real aScaleFactor = Standard_Real(strtod (aStr, &ptr)); + Standard_Real aScaleFactor = Standard_Real(Strtod (aStr, &ptr)); if (ptr != aStr && errno != ERANGE && errno != EINVAL) { T._CSFDB_Setgp_Trsfscale(aScaleFactor); @@ -154,15 +154,15 @@ static const char * Translate (const char * theStr, gp_XYZ& P) char * ptr; if (theStr) { errno = 0; - Standard_Real aC = strtod (theStr, &ptr); + Standard_Real aC = Strtod (theStr, &ptr); if (ptr != theStr && errno != ERANGE && errno != EINVAL) { P.SetX(aC); theStr = ptr; - aC = strtod (theStr, &ptr); + aC = Strtod (theStr, &ptr); if (ptr != theStr && errno != ERANGE && errno != EINVAL) { P.SetY(aC); theStr = ptr; - aC = strtod (theStr, &ptr); + aC = Strtod (theStr, &ptr); if (ptr != theStr && errno != ERANGE && errno != EINVAL) { P.SetZ(aC); theStr = ptr; diff --git a/tests/bugs/begin b/tests/bugs/begin index c9605c565a..4f81908102 100755 --- a/tests/bugs/begin +++ b/tests/bugs/begin @@ -26,6 +26,7 @@ if { [info exists test_image] == 0 } { } # Procedure to check equality of two reals with tolerance (relative and absolute) +help checkreal {name value expected tol_abs tol_rel} proc checkreal {name value expected tol_abs tol_rel} { if { abs ($value - $expected) > $tol_abs + $tol_rel * abs ($expected) } { puts "Error: $name = $value is not equal to expected $expected" @@ -35,7 +36,22 @@ proc checkreal {name value expected tol_abs tol_rel} { return } +# Procedure to check equality of two reals with tolerance (relative and absolute) +help checkarea {shape area_expected tol_abs tol_rel} +proc checkarea {shape area_expected tol_abs tol_rel} { + # compute area with half of the relative tolerance + # to be used in comparison; 0.001 is added to avoid zero value + set prop [uplevel sprops $shape [expr 0.5 * abs($tol_rel) + 0.001]] + + # get te value + if { ! [regexp {Mass\s*:\s*([0-9.e+-]+)} $prop res area] } { + puts "Error: cannot get area of the shape $shape" + return + } + # compare with expected value + checkreal "area of $shape" $area $area_expected $tol_abs $tol_rel +} # Procedure to check color in the point near default coordinate diff --git a/tests/bugs/parse.rules b/tests/bugs/parse.rules index e00d71107a..eab3eb5026 100755 --- a/tests/bugs/parse.rules +++ b/tests/bugs/parse.rules @@ -1,3 +1,4 @@ FAILED /\bFaulty\b/ bad shape IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command +SKIPPED /Error: unsupported locale specification/ locale is unavailable on tested system OK /Relative error of mass computation/ message from vprops diff --git a/tests/bugs/xde/bug22898 b/tests/bugs/xde/bug22898 new file mode 100644 index 0000000000..ae19c8a696 --- /dev/null +++ b/tests/bugs/xde/bug22898 @@ -0,0 +1,53 @@ +# Test for issue #22898 and other functionality that can be affected by locale. +# Just run multiple conversions of the shape to and from diferent formats and +# check that the result is good shape with expected area + +set anOS $tcl_platform(os) +if { ${anOS} == "Darwin" } { + dlocale LC_ALL fr_FR +} else { + dlocale LC_ALL French +} + +pload MODELING +pload XSTEP + +# original shape +restore [locate_data_file hammer.brep] hammer +checkshape hammer +tolerance hammer +checkarea hammer 3.978e8 1e6 0.001 + +# BREP +save hammer $imagedir/hammer.brep +restore $imagedir/hammer.brep brep +checkshape brep +tolerance brep +checkarea brep 3.978e8 1e6 0.001 + +# IGES +brepiges hammer $imagedir/hammer.igs +igesbrep $imagedir/hammer.igs iges * +checkshape iges +tolerance iges +checkarea iges 3.978e8 1e6 0.001 + +# STEP +stepwrite a hammer $imagedir/hammer.stp +stepread $imagedir/hammer.stp step * +checkshape step_1 +tolerance step_1 +checkarea step_1 3.978e8 1e6 0.001 + +# STL +writestl hammer $imagedir/hammer.stl +readstl stl $imagedir/hammer.stl +checkshape stl +tolerance stl +checkarea stl 3.978e8 1e6 0.001 + +# VRML: reading does not work regardless of locale... +writevrml hammer $imagedir/hammer.vrml +#loadvrml vrml $imagedir/hammer.vrml +#checkshape vrml +#tolerance vrml -- 2.20.1