]> OCCT Git - occt.git/commitdiff
0032684: Draw Harness - fix Draw_Interpretor::Add() misuse due to overloaded syntax
authorkgv <kgv@opencascade.com>
Tue, 23 Nov 2021 17:35:58 +0000 (20:35 +0300)
committersmoskvin <smoskvin@opencascade.com>
Thu, 25 Nov 2021 16:56:06 +0000 (19:56 +0300)
src/BRepTest/BRepTest_CurveCommands.cxx
src/BRepTest/BRepTest_FeatureCommands.cxx
src/BRepTest/BRepTest_FilletCommands.cxx
src/DBRep/DBRep.cxx
src/Draw/Draw_Interpretor.cxx
src/GeometryTest/GeometryTest_CurveCommands.cxx
src/QABugs/QABugs_3.cxx
src/ViewerTest/ViewerTest.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
src/XDEDRAW/XDEDRAW_GDTs.cxx
src/XSDRAW/XSDRAW.cxx

index 3bc29731b6bf81ed9d75527141cdd9a4ab802fc0..3039254739c6050032e903bdd635ed07efa98f27 100644 (file)
@@ -1915,11 +1915,11 @@ void  BRepTest::CurveCommands(Draw_Interpretor& theCommands)
 
   theCommands.Add("mkoffset",
     "mkoffset result face/compound of wires  nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
-    mkoffset);
+    mkoffset,g);
 
   theCommands.Add("openoffset",
     "openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
-    openoffset);
+    openoffset,g);
 
   theCommands.Add("mkedge",
     "mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] ",__FILE__,
@@ -1967,11 +1967,11 @@ void  BRepTest::CurveCommands(Draw_Interpretor& theCommands)
     edgeintersector,g);
 
   theCommands.Add("build3d",
-    "build3d S [tol]",
+    "build3d S [tol]",__FILE__,
     build3d, g);
 
   theCommands.Add("reducepcurves",
-    "reducepcurves shape1 shape2 ...",
+    "reducepcurves shape1 shape2 ...",__FILE__,
     reducepcurves, g);
 
   theCommands.Add("concatC0wire",
index ccccc457f615092dff5a52fa81481abc5679b2c9..c3ebfcc7345101f447292d3199fe1cd8323d39da 100644 (file)
@@ -2502,7 +2502,7 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
 
   theCommands.Add("offsetparameter",
     "offsetparameter Tol Inter(c/p) JoinType(a/i/t) [RemoveInternalEdges(r/k)]",
-    __FILE__, offsetparameter);
+    __FILE__, offsetparameter, g);
 
   theCommands.Add("offsetload",
     "offsetload shape offset bouchon1 bouchon2 ...",
@@ -2523,53 +2523,53 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
 
   theCommands.Add("featprism",
     "Defines the arguments for a prism : featprism shape element skface  Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("featrevol",
     "Defines the arguments for a revol : featrevol shape element skface  Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("featpipe",
     "Defines the arguments for a pipe : featpipe shape element skface  spine Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("featdprism",
     "Defines the arguments for a drafted prism : featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("featlf",
     "Defines the arguments for a linear rib or slot : featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("featrf",
     "Defines the arguments for a rib or slot of revolution : featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)",
-    __FILE__, DEFIN);
+    __FILE__, DEFIN, g);
 
   theCommands.Add("addslide",
     " Adds sliding elements : addslide prism/revol/pipe edge face [edge face...]",
-    __FILE__, ADD);
+    __FILE__, ADD, g);
 
   theCommands.Add("featperform",
     " Performs the prism revol dprism linform or pipe :featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]",
-    __FILE__, PERF);
+    __FILE__, PERF, g);
 
   theCommands.Add("featperformval",
     " Performs the prism revol dprism or linform with a value :featperformval prism/revol/dprism/lf result value",
-    __FILE__, PERF);
+    __FILE__, PERF, g);
 
   theCommands.Add("endedges",
     " Return top and bottom edges of dprism :endedges dprism shapetop shapebottom First/LastShape (1/2)",
-    __FILE__, BOSS);
+    __FILE__, BOSS, g);
 
   theCommands.Add("fillet",
     " Perform fillet on compounds of edges :fillet result object rad1 comp1 rad2 comp2 ...",
-    __FILE__, BOSS);
+    __FILE__, BOSS, g);
 
   theCommands.Add("bossage",
     " Perform fillet on top and bottom edges of dprism :bossage dprism result radtop radbottom First/LastShape (1/2)",
-    __FILE__, BOSS);
+    __FILE__, BOSS, g);
 
   theCommands.Add("offsetshapesimple",
     "offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
-    __FILE__, ComputeSimpleOffset);
+    __FILE__, ComputeSimpleOffset, g);
 }
index 18d39c18008c1726430fce3ee993b19b030cdda3..281f58e5666fc93c4ccfa67c654e25caa762a314 100644 (file)
@@ -757,15 +757,15 @@ void  BRepTest::FilletCommands(Draw_Interpretor& theCommands)
   theCommands.Add("rollingball",
                  "rollingball  r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
                  __FILE__,
-                 rollingball);
+                 rollingball, g);
 
   theCommands.Add("brollingball",
                  "brollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
                  __FILE__,
-                 rollingball);
+                 rollingball, g);
 
   theCommands.Add("trollingball",
                  "trollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
                  __FILE__,
-                 rollingball);
+                 rollingball, g);
 }
index 6e2662b85068d7cc5a58c30745270a2dafc75b34..e2e03fff0dc4fdf4795eb0f995f9fca31810f731 100644 (file)
@@ -1709,8 +1709,6 @@ void  DBRep::BasicCommands(Draw_Interpretor& theCommands)
                   "setflags shape_name flag1[flag2...]\n sets flags for shape(free, modified, checked, orientable, closed, infinite, convex, locked), for example <setflags a free> or <setflags a -free> if necessary unflag ",
                   __FILE__,setFlags,g);
 
-//  theCommands.Add("dumpmmgt",
-//               "dump le contenu du gestionnaire de memoire",__FILE__,dumpmmgt,g);
   theCommands.Add("purgemmgt",
                  "returns the free memory from the system to the memory manager",
                  __FILE__,purgemmgt,g);
@@ -1722,7 +1720,7 @@ void  DBRep::BasicCommands(Draw_Interpretor& theCommands)
                     "\n\t\t   +|-t :  switch on/off output to tcl of Progress Indicator"
                     "\n\t\t   +|-c :  switch on/off output to cout of Progress Indicator"
                     "\n\t\t   +|-g :  switch on/off graphical mode of Progress Indicator",
-                    XProgress,"DE: General");
+                   __FILE__, XProgress,"DE: General");
   theCommands.Add("writebrep",
                   "writebrep shape filename [-binary {0|1}]=0 [-version Version]=4"
                   "\n\t\t:                          [-triangles {0|1}]=1 [-normals {0|1}]=0"
index 04f8370815f71fb7ee3c3f8eeafe5ef5947fa1d9..c797aa471eabfb356b678f67510f29d82c1798d0 100644 (file)
@@ -316,14 +316,11 @@ void Draw_Interpretor::add (const Standard_CString          theCommandName,
 {
   Standard_ASSERT_RAISE (myInterp != NULL, "Attempt to add command to Null interpretor");
 
-  Standard_PCharacter aName  = (Standard_PCharacter )theCommandName;
-  Standard_PCharacter aHelp  = (Standard_PCharacter )theHelp;
-  Standard_PCharacter aGroup = (Standard_PCharacter )theGroup;
-  Tcl_CreateCommand (myInterp, aName, CommandCmd, (ClientData )theCallback, CommandDelete);
+  Tcl_CreateCommand (myInterp, theCommandName, CommandCmd, (ClientData )theCallback, CommandDelete);
 
   // add the help
-  Tcl_SetVar2 (myInterp, "Draw_Helps",  aName,  aHelp, TCL_GLOBAL_ONLY);
-  Tcl_SetVar2 (myInterp, "Draw_Groups", aGroup, aName,
+  Tcl_SetVar2 (myInterp, "Draw_Helps",  theCommandName,  theHelp, TCL_GLOBAL_ONLY);
+  Tcl_SetVar2 (myInterp, "Draw_Groups", theGroup, theCommandName,
                     TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
 
   // add path to source file (keep not more than two last subdirectories)
@@ -344,8 +341,10 @@ void Draw_Interpretor::add (const Standard_CString          theCommandName,
   TCollection_AsciiString aSrcPath;
   aPath.SystemName (aSrcPath);
   if (aSrcPath.Value(1) == '/')
+  {
     aSrcPath.Remove(1);
-  Tcl_SetVar2 (myInterp, "Draw_Files", aName, aSrcPath.ToCString(), TCL_GLOBAL_ONLY);
+  }
+  Tcl_SetVar2 (myInterp, "Draw_Files", theCommandName, aSrcPath.ToCString(), TCL_GLOBAL_ONLY);
 }
 
 //=======================================================================
index fc26d2d15805732dffc5d54075225ab886c4cc7b..cfc04e62b152aabba7f88b3ddf44f27aaf895fdf 100644 (file)
@@ -1819,7 +1819,8 @@ void  GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
   
   theCommands.Add("projonplane",
                  "projonplane r C3d Plane [dx dy dz] [0/1]",
-                 projonplane);
+                 __FILE__,
+                 projonplane, g);
 
   theCommands.Add("bisec",
                  "bisec result line/circle/point line/circle/point",
index 9250364b108e170b91361fdabaaa56629a29a210..4ade95449825ac4b0338bfcadf13a5a6aaa3f95a 100644 (file)
@@ -1267,7 +1267,7 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) {
 
   theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
 
-  theCommands.Add("coordload","load coord from file",__FILE__,coordload);
+  theCommands.Add("coordload","load coord from file",__FILE__,coordload,group);
 
   theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
   theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);
index cbaed8bacde4dc6d7ea5ff6f2ff4aa9bc9ea6e6a..acfb950601321e59eab97ca87d497270ed39cae1 100644 (file)
@@ -6590,7 +6590,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:  -highmode    Sets hilight mode for objects."
       "\n\t\t:  -redisplay   Recomputes presentation of objects."
       "\n\t\t:  -noecho      Avoid printing of command results."
-      "\n\t\t:  -autoTriang  Enable/disable auto-triangulation for displayed shape."
+      "\n\t\t:  -autoTriang  Enable/disable auto-triangulation for displayed shape.",
       __FILE__, VDisplay2, group);
 
   theCommands.Add ("vnbdisplayed",
@@ -6863,12 +6863,12 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
   theCommands.Add("vtexrepeat",
                   "vtexrepeat name RepeatU RepeatV"
                   "\n\t\t: Alias for vtexture name -setRepeat RepeatU RepeatV.",
-                 VTexture,group);
+                 __FILE__, VTexture, group);
 
   theCommands.Add("vtexdefault",
                   "vtexdefault name"
                   "\n\t\t: Alias for vtexture name -default.",
-                 VTexture,group);
+                 __FILE__, VTexture, group);
 
   theCommands.Add("vstate",
       "vstate [-entities] [-hasSelected] [name1] ... [nameN]"
@@ -6885,7 +6885,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
 
   theCommands.Add("vtypes",
                  "vtypes : list of known types and signatures in AIS - To be Used in vpickobject command for selection with filters",
-                 VIOTypes,group);
+                 __FILE__, VIOTypes, group);
 
   theCommands.Add("vselfilter",
     "vselfilter [-contextfilter {AND|OR}]"
index 3851a1b211b4ad5fe1c42e5c3e12ecb241d3b4b2..9c5194ac71c19ed833990024b4ad2a6ee2234135 100644 (file)
@@ -13729,7 +13729,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "\n\t\t:             for example '+Z' will show front of the model,"
     "\n\t\t:             '-X-Y+Z' will define left axonometrical view."
     "\n\t\t:   -frame    define camera Up and Right directions (regardless Up convention);"
-    "\n\t\t:             for example '+X+Z' will show front of the model with Z-up."
+    "\n\t\t:             for example '+X+Z' will show front of the model with Z-up.",
     __FILE__,VViewProj,group);
   theCommands.Add("vtop" ,
     "vtop or <T>      : Top view. Orientation +X+Y" ,
@@ -13754,7 +13754,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     __FILE__,VViewProj,group);
   theCommands.Add("vpick" ,
     "vpick           : vpick X Y Z [shape subshape] ( all variables as string )",
-    VPick,group);
+    __FILE__, VPick, group);
   theCommands.Add("vfit",
     "vfit or <F> [-selected] [-noupdate]"
     "\n\t\t: [-selected] fits the scene according to bounding box of currently selected objects",
index ccb5cdf64c3d77f833482d193236bbc76e126b9d..e338b354f76520ea408730210a769d18f2c5451b 100644 (file)
@@ -3075,7 +3075,7 @@ void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di)
   di.Add("XGetGDTAffectedPlane", "XGetGDTAffectedPlane Doc GDT_Label Plane"
     "Returns affected plane into Plane",
     __FILE__, getGDTAffectedPlane, g);
-  di.Add("XGetGDTSemanticName", "XGetGDTSemanticName Doc GDT_Label"
+  di.Add("XGetGDTSemanticName", "XGetGDTSemanticName Doc GDT_Label",
     __FILE__, getGDTSemanticName, g);
 
   di.Add("XSetGDTSemanticName", "XSetGDTSemanticName Doc GDT_Label Name"
index da26af4e59cbb940bd4d64db26fc71cfb3083046..27f24e5b652bd749ffc17f7cae1786b92f8dc692 100644 (file)
@@ -123,23 +123,34 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
   XSDRAW::RemoveCommand("exit");
 
 //  if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
-  Handle(TColStd_HSequenceOfAsciiString) list =
-    IFSelect_Activator::Commands(0);
-  TCollection_AsciiString com;
-  Standard_Integer i, nb = list->Length();
-  for (i = 1; i <= nb; i ++) {
-    Handle(IFSelect_Activator) act;
-    Standard_Integer nact, num = -1;
-    char help[200];
-    com = list->Value(i);
+  Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands (0);
+  for (TColStd_HSequenceOfAsciiString::Iterator aCmdIter (*list); aCmdIter.More(); aCmdIter.Next())
+  {
+    Standard_Integer num = -1;
+    const TCollection_AsciiString& aCmd = aCmdIter.Value();
     if (!theolds.IsEmpty())
-      theolds.Find(com, num);
-    if (num == 0) continue;
-    if (!IFSelect_Activator::Select(com.ToCString(),nact,act))
-      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());
+    {
+      theolds.Find (aCmd, num);
+    }
+    if (num == 0)
+    {
+      continue;
+    }
+
+    Standard_Integer nact = 0;
+    Handle(IFSelect_Activator) anAct;
+    TCollection_AsciiString aHelp;
+    if (!IFSelect_Activator::Select (aCmd.ToCString(), nact, anAct))
+    {
+      aHelp = TCollection_AsciiString("type :  xhelp ") + aCmd + " for help";
+    }
+    else if (!anAct.IsNull())
+    {
+      aHelp = anAct->Help (nact);
+    }
+
+    const TCollection_AsciiString& aCmdName = num < 0 ? aCmd : thenews->Value (num);
+    theCommands.Add (aCmdName.ToCString(), aHelp.ToCString(), "", XSTEPDRAWRUN, anAct->Group());
   }
 }