0022898: IGES import fails in german environment
[occt.git] / src / TestTopOpe / TestTopOpe_HDSCommands.cxx
index b5e0cb2..37834cc 100755 (executable)
@@ -1,7 +1,23 @@
-// File:       TestTopOpe_HDSCommands.cxx
-// Created:    Mon Oct 24 10:33:48 1994
-// Author:     Jean Yves LEBEY
-//             <jyl@bravox>
+// Created on: 1994-10-24
+// Created by: Jean Yves LEBEY
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-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.
+
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -98,8 +114,8 @@ public:
 
 #define ISINTEGER(MMstr) ((strspn((MMstr),"0123456789") == strlen((MMstr))))
 
-Standard_EXPORT TestTopOpe_HDSDisplayer* PHDSD = NULL;
-Standard_EXPORT TestTopOpeDraw_Displayer* POCD = NULL;
+TestTopOpe_HDSDisplayer* PHDSD = NULL;
+static TestTopOpeDraw_Displayer* POCD = NULL;
 //Standard_IMPORT extern Standard_Integer TopOpeBRepDS_GLOBALHDSinterfselector;
 Standard_IMPORT Standard_Integer TopOpeBRepDS_GLOBALHDSinterfselector;
 
@@ -149,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;
   
@@ -364,10 +380,6 @@ static Standard_Integer SeeSectionEdge(const Standard_Integer ISE)
   if ( ISE < 1 || ISE > nse ) return 0;
   const TopoDS_Shape& SE  = PHDSD->CurrentBDS().SectionEdge(ISE);
   if (SE.IsNull()) return 0;
-#ifdef DEB
-  Standard_Integer ids =
-#endif
-                         PHDSD->CurrentBDS().Shape(SE,SFindKeep);
   
   TCollection_AsciiString namedbrep; PHDSD->SectionEdgeName(ISE,SE,namedbrep); 
   TCollection_AsciiString namedisp; PHDSD->SectionEdgeDisplayName(ISE,SE,namedisp);
@@ -534,9 +546,6 @@ static Standard_Integer SeeGeometry(const TopOpeBRepDS_Kind TK)
   
   const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
 
-#ifdef DEB  
-  Standard_Integer ig,ng = 0;
-#endif
   if      (TK == TopOpeBRepDS_POINT) {
     TopOpeBRepDS_PointExplorer pex(BDS,GFindKeep);
     for (; pex.More(); pex.Next()) {
@@ -578,7 +587,7 @@ static void decalargs(Standard_Integer& na,const char** a,const Standard_Integer
 //-----------------------------------------------------------------------
 // suppressarg : remove a[d],modify na--
 //-----------------------------------------------------------------------
-Standard_EXPORT void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d) 
+void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d) 
 {
   for(Standard_Integer i=d;i<na;i++) {
     a[i]=a[i+1];
@@ -640,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;
       }
@@ -729,7 +738,7 @@ static void tds_help(Draw_Interpretor& di)
 }
 
 typedef Standard_Integer (*tf_SeeShape)(const Standard_Integer I,const TopoDS_Shape& S);
-Standard_IMPORT void OthersCommands_flags(Standard_Integer& na,const char** a,TestTopOpeDraw_Displayer& TD);
+extern void OthersCommands_flags(Standard_Integer& na,const char** a,TestTopOpeDraw_Displayer& TD);
 void COUTNOHDS(Draw_Interpretor& di) {di<<"no current HDS"<<"\n";}
 Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,const char** a,tf_SeeShape SeeShapefunc)
 {
@@ -779,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());
@@ -800,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()));
          }
        }
@@ -808,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()));
        }
       }
@@ -817,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() ) {
@@ -832,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));
       }
     }
@@ -848,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<na; ia++) SeeSectionEdge(atoi(a[ia]));
+    else         for (ia = i1arg+1; ia<na; ia++) SeeSectionEdge(Draw::Atoi(a[ia]));
   }
 
   else if (Tpar.isdege()) {      
@@ -879,11 +888,7 @@ Standard_Integer tsee(Draw_Interpretor& di,Standard_Integer na_in,const char** a
 // SeeAnyKI
 //-----------------------------------------------------------------------
 Standard_Integer SeeAnyKI(const TopOpeBRepDS_Kind TK,const Standard_Integer I) {
-#ifndef DEB
   TopAbs_ShapeEnum TS = TopAbs_COMPOUND;
-#else
-  TopAbs_ShapeEnum TS;
-#endif
   Standard_Boolean isshape,isgeome; isshape = isgeome = Standard_False;
   isshape = TopOpeBRepDS::IsTopology(TK);
   if (isshape) TS = TopOpeBRepDS::KindToShape(TK);
@@ -1133,10 +1138,7 @@ Standard_Integer tds(Draw_Interpretor& di,Standard_Integer na,const char** a)
   if (PHDSD == NULL) return 0;
   const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
   if (HDS.IsNull()) {COUTNOHDS(di);return 0;}
-#ifdef DEB
-  const TopOpeBRepDS_DataStructure& BDS =
-#endif
-                                          PHDSD->CurrentBDS();
+  PHDSD->CurrentBDS();
   
   TopOpeBRepDS_Dumper Dumper(HDS);
   if ( na == 1 ) { Dumper.Dump(cout,TDSkeep,TDScompact); return 0; }
@@ -1171,7 +1173,7 @@ Standard_Integer tds(Draw_Interpretor& di,Standard_Integer na,const char** a)
     return 0;
   } // (na == 2)
   
-  // nna  > 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
@@ -1181,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 {
@@ -1214,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";
@@ -1369,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;
@@ -1394,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);
@@ -1411,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