0023265: cppcheck warning: Mismatching allocation and deallocation
[occt.git] / src / TestTopOpeTools / TestTopOpeTools_TraceCommands.cxx
CommitLineData
b311480e 1// Created on: 1994-10-24
2// Created by: Jean Yves LEBEY
3// Copyright (c) 1994-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22#ifdef HAVE_CONFIG_H
23# include <config.h>
24#endif
25#include <TestTopOpeTools.hxx>
26#include <TestTopOpeTools_Trace.hxx>
27#include <Draw_Interpretor.hxx>
28#include <Draw_Appli.hxx>
29#include <TopOpeBRepTool_define.hxx>
30
31#ifdef HAVE_STRINGS_H
32# include <strings.h>
33#endif
34
35#ifdef DEB
36TestTopOpeTools_Trace theTrace(100,"trace");
37TestTopOpeTools_Trace theContext(100,"context");
38
39Standard_IMPORT void TopClass_SettraceFC(const Standard_Boolean);
40Standard_IMPORT void TopOpeBRepTool_SettraceEND(const Standard_Boolean);
41Standard_IMPORT void TopOpeBRepTool_SettraceKRO(const Standard_Boolean);
42Standard_IMPORT void TopOpeBRepTool_SetcontextNOSEW(const Standard_Boolean);
43Standard_IMPORT void TopOpeBRepDS_SetcontextNOPNC(const Standard_Boolean);
44Standard_IMPORT void TopOpeBRepDS_SettraceEDSF(const Standard_Boolean);
45Standard_IMPORT void TopOpeBRepDS_SettraceDSP(const Standard_Boolean);
46Standard_IMPORT void TopOpeBRepDS_SettraceDSF(const Standard_Boolean);
47Standard_IMPORT void TopOpeBRepDS_SettraceDSFK(const Standard_Boolean);
48Standard_IMPORT void TopOpeBRepDS_SettraceDSNC(const Standard_Boolean);
49Standard_IMPORT void TopOpeBRepDS_SettraceDSLT(const Standard_Boolean);
50Standard_IMPORT void TopOpeBRepDS_SettraceDEGEN(const Standard_Boolean);
51Standard_IMPORT void TopOpeBRepDS_SettraceDSFD(const Standard_Boolean);
52Standard_IMPORT void TopOpeBRepDS_SettracePCI(const Standard_Boolean);
53Standard_IMPORT void TopOpeBRepDS_SettracePEI(const Standard_Boolean);
54Standard_IMPORT void TopOpeBRepDS_SettracePFI(const Standard_Boolean);
55Standard_IMPORT void TopOpeBRepDS_SettracePI(const Standard_Boolean);
56Standard_IMPORT void TopOpeBRepDS_SettraceSTRANGE(const Standard_Boolean);
57Standard_IMPORT void TopOpeBRepDS_SettraceGAP(const Standard_Boolean);
58Standard_IMPORT void TopOpeBRepDS_SetcontextNOGAP(const Standard_Boolean);
59Standard_IMPORT void TopOpeBRep_SettraceFITOL(const Standard_Boolean);
60Standard_IMPORT void TopOpeBRep_SettraceBIPS(const Standard_Boolean);
61Standard_IMPORT void TopOpeBRep_SettraceSI(const Standard_Boolean);
62Standard_IMPORT void TopOpeBRep_SettraceSIFF(const Standard_Boolean, Standard_Integer, char**);
63Standard_IMPORT void TopOpeBRep_SettraceSAVFF(const Standard_Boolean);
64Standard_IMPORT Standard_Integer TopOpeBRep_SettraceNVP(const Standard_Boolean, Standard_Integer, char**);
65Standard_IMPORT Standard_Integer TopOpeBRep_SettraceEEFF(const Standard_Boolean, Standard_Integer, char**);
66Standard_IMPORT Standard_Integer TopOpeBRep_SettraceSHA(const Standard_Boolean, Standard_Integer, char**);
67Standard_IMPORT void TopOpeBRep_SetcontextREST1(const Standard_Boolean);
68Standard_IMPORT void TopOpeBRep_SetcontextREST2(const Standard_Boolean);
69Standard_IMPORT void TopOpeBRep_SetcontextINL(const Standard_Boolean);
70Standard_IMPORT void TopOpeBRep_SetcontextNEWKP(const Standard_Boolean);
71Standard_IMPORT void TopOpeBRep_SetcontextTOL0(const Standard_Boolean);
72Standard_IMPORT void TopOpeBRep_SetcontextNONOG(const Standard_Boolean);
73Standard_IMPORT void TopOpeBRepBuild_SettraceCHK(const Standard_Boolean);
74Standard_IMPORT void TopOpeBRepBuild_SettraceCHKOK(const Standard_Boolean);
75Standard_IMPORT void TopOpeBRepBuild_SettraceCHKNOK(const Standard_Boolean);
76Standard_IMPORT void TopOpeBRepBuild_SettraceCU(const Standard_Boolean);
77Standard_IMPORT void TopOpeBRepBuild_SettraceCUV(const Standard_Boolean);
78Standard_IMPORT void TopOpeBRepDS_SettraceSPSX(const Standard_Boolean, Standard_Integer, char**);
79Standard_IMPORT void TopOpeBRepDS_SettraceCX(const Standard_Boolean, Standard_Integer, char**);
80Standard_IMPORT void TopOpeBRepDS_SettraceSPSXX(const Standard_Boolean, Standard_Integer, char**);
81Standard_IMPORT void TopOpeBRepBuild_SettraceSPF(const Standard_Boolean);
82Standard_IMPORT void TopOpeBRepBuild_SettraceSPS(const Standard_Boolean);
83Standard_IMPORT void TopOpeBRepBuild_SettraceSHEX(const Standard_Boolean);
84Standard_IMPORT void TopOpeBRepBuild_SettraceSS(const Standard_Boolean);
85Standard_IMPORT void TopOpeBRepBuild_SettraceAREA(const Standard_Boolean);
86Standard_IMPORT void TopOpeBRepBuild_SettraceKPB(const Standard_Boolean);
87Standard_IMPORT void TopOpeBRepBuild_SettracePURGE(const Standard_Boolean);
88Standard_IMPORT void TopOpeBRepBuild_SettraceSAVFREGU(const Standard_Boolean);
89Standard_IMPORT void TopOpeBRepBuild_SettraceSAVSREGU(const Standard_Boolean);
90Standard_IMPORT void TopOpeBRepBuild_SetcontextNOSG(const Standard_Boolean);
91Standard_IMPORT void TopOpeBRepBuild_SettraceFE(const Standard_Boolean);
92Standard_IMPORT void TopOpeBRepBuild_SetcontextSSCONNEX(const Standard_Boolean);
93Standard_IMPORT void TopOpeBRepBuild_SetcontextSF2(const Standard_Boolean);
94Standard_IMPORT void TopOpeBRepBuild_SetcontextSPEON(const Standard_Boolean);
95Standard_IMPORT void TopOpeBRepBuild_SetcontextNOPURGE(const Standard_Boolean);
96Standard_IMPORT void TopOpeBRepBuild_SetcontextNOREGUFA(const Standard_Boolean);
97Standard_IMPORT void TopOpeBRepBuild_SetcontextNOREGUSO(const Standard_Boolean);
98Standard_IMPORT void TopOpeBRepBuild_SetcontextREGUXPU(const Standard_Boolean);
99Standard_IMPORT void TopOpeBRepBuild_SetcontextNOCORRISO(const Standard_Boolean);
100Standard_IMPORT void TopOpeBRepBuild_SetcontextNOFUFA(const Standard_Boolean);
101Standard_IMPORT void TopOpeBRepBuild_SetcontextNOFE(const Standard_Boolean);
102Standard_IMPORT void TopOpeBRepBuild_SetcontextEINTERNAL(const Standard_Boolean);
103Standard_IMPORT void TopOpeBRepBuild_SetcontextEEXTERNAL(const Standard_Boolean);
104Standard_IMPORT void TopOpeBRepTool_SettraceNYI(const Standard_Boolean);
105Standard_IMPORT void TopOpeBRepTool_SettraceVC(const Standard_Boolean);
106Standard_IMPORT void TopOpeBRepTool_SettracePCURV(const Standard_Boolean);
107Standard_IMPORT void TopOpeBRepTool_SettraceBOXPERSO(const Standard_Boolean);
108Standard_IMPORT void TopOpeBRepTool_SettraceBOX(const Standard_Boolean);
109Standard_IMPORT void TopOpeBRepTool_SettraceCLOV(const Standard_Boolean);
110Standard_IMPORT void TopOpeBRepTool_SettraceCHKBSPL(const Standard_Boolean);
111Standard_IMPORT void TopOpeBRepTool_SettraceREGUFA(const Standard_Boolean);
112Standard_IMPORT void TopOpeBRepTool_SettraceREGUSO(const Standard_Boolean);
113Standard_IMPORT void TopOpeBRepTool_SettraceC2D(const Standard_Boolean);
114Standard_IMPORT void TopOpeBRepTool_SettraceCORRISO(const Standard_Boolean);
115Standard_IMPORT void TopOpeBRep_SettraceCONIC(const Standard_Boolean);
116Standard_IMPORT void TopOpeBRep_SettracePROEDG(const Standard_Boolean);
117Standard_IMPORT void TopOpeBRep_SetcontextNOPROEDG(const Standard_Boolean);
118Standard_IMPORT void TopOpeBRep_SetcontextFFOR(const Standard_Boolean);
119Standard_IMPORT void TopOpeBRep_SetcontextNOPUNK(const Standard_Boolean);
120Standard_IMPORT void TopOpeBRep_SetcontextNOFEI(const Standard_Boolean);
121Standard_IMPORT void TopOpeBRepTool_SettraceCL2DDR(const Standard_Boolean, Standard_Integer, char**);
122Standard_IMPORT void TopOpeBRepTool_SettraceCL2DPR(const Standard_Boolean, Standard_Integer, char**);
123Standard_IMPORT void TopOpeBRepTool_SettraceCL3DDR(const Standard_Boolean, Standard_Integer, char**);
124Standard_IMPORT void TopOpeBRepTool_SettraceCL3DPR(const Standard_Boolean, Standard_Integer, char**);
125Standard_IMPORT void TopOpeBRepDS_SettraceBUTO(const Standard_Boolean);
126Standard_IMPORT void TopOpeBRepDS_SettraceTRPE(const Standard_Boolean);
127Standard_IMPORT void TopOpeBRepDS_SettraceEDPR(const Standard_Boolean);
128Standard_IMPORT void TopOpeBRepDS_SettraceISTO(const Standard_Boolean);
129Standard_IMPORT void TopOpeBRepDS_SettraceSANTRAN(const Standard_Boolean);
130Standard_IMPORT void TopOpeBRepDS_SetcontextNOPFI(const Standard_Boolean);
131Standard_IMPORT void TopOpeBRepDS_SetcontextMKTONREG(const Standard_Boolean);
132#endif
133
134#ifdef DEB
135//----------------------------------------------------------------------------
136static Standard_Integer InitTraceTopOpeKernel (TestTopOpeTools_Trace& T)
137//----------------------------------------------------------------------------
138{
139 if (T.Add("tfc",(tf_value)TopClass_SettraceFC)) return 1;
140 if (T.Add("tend",(tf_value)TopOpeBRepTool_SettraceEND)) return 1;
141 if (T.Add("tkro",(tf_value)TopOpeBRepTool_SettraceKRO)) return 1;
142 if (T.Add("tdsfk",(tf_value)TopOpeBRepDS_SettraceDSFK)) return 1;
143 if (T.Add("tedsf",(tf_value)TopOpeBRepDS_SettraceEDSF)) return 1;
144 if (T.Add("tdsp",(tf_value)TopOpeBRepDS_SettraceDSP)) return 1;
145 if (T.Add("tdsf",(tf_value)TopOpeBRepDS_SettraceDSF)) return 1;
146 if (T.Add("tdsnc",(tf_value)TopOpeBRepDS_SettraceDSNC)) return 1;
147 if (T.Add("tdegen",(tf_value)TopOpeBRepDS_SettraceDEGEN)) return 1;
148 if (T.Add("tdslt",(tf_value)TopOpeBRepDS_SettraceDSLT)) return 1;
149 if (T.Add("tdsfd",(tf_value)TopOpeBRepDS_SettraceDSFD)) return 1;
150 if (T.Add("tpci",(tf_value)TopOpeBRepDS_SettracePCI)) return 1;
151 if (T.Add("tpei",(tf_value)TopOpeBRepDS_SettracePEI)) return 1;
152 if (T.Add("tpfi",(tf_value)TopOpeBRepDS_SettracePFI)) return 1;
153 if (T.Add("tpi",(tf_value)TopOpeBRepDS_SettracePI)) return 1;
154 if (T.Add("tstrange",(tf_value)TopOpeBRepDS_SettraceSTRANGE)) return 1;
155 if (T.Add("tgap",(tf_value)TopOpeBRepDS_SettraceGAP)) return 1;
156 if (T.Add("tfitol",(tf_value)TopOpeBRep_SettraceFITOL)) return 1;
157 if (T.Add("tbips",(tf_value)TopOpeBRep_SettraceBIPS)) return 1;
158 if (T.Add("tsi",(tf_value)TopOpeBRep_SettraceSI)) return 1;
159 if (T.Add("tsiff",(tf_intarg)TopOpeBRep_SettraceSIFF)) return 1; // tsiff 0|[1 s1 s2 name]
160 if (T.Add("tsavff",(tf_value)TopOpeBRep_SettraceSAVFF)) return 1;
161 if (T.Add("tnvp",(tf_int_intarg)TopOpeBRep_SettraceNVP)) return 1; // tnvp 0|1 if1 if2 ili ivp isi
162 if (T.Add("teeff",(tf_int_intarg)TopOpeBRep_SettraceEEFF)) return 1; // teeff 0|1 ie1 ie2 if1 if2
163 if (T.Add("tsha",(tf_int_intarg)TopOpeBRep_SettraceSHA)) return 1; // tsha 0|1 isha
164 if (T.Add("tchk",(tf_value)TopOpeBRepBuild_SettraceCHK)) return 1;
165 if (T.Add("tok",(tf_value)TopOpeBRepBuild_SettraceCHKOK)) return 1;
166 if (T.Add("tnok",(tf_value)TopOpeBRepBuild_SettraceCHKNOK)) return 1;
167 if (T.Add("tcu",(tf_value)TopOpeBRepBuild_SettraceCU)) return 1;
168 if (T.Add("tcuv",(tf_value)TopOpeBRepBuild_SettraceCUV)) return 1;
169 if (T.Add("tcx",(tf_intarg)TopOpeBRepDS_SettraceCX)) return 1; // tcx 0|1 [i1 ...]
170 if (T.Add("tspsx",(tf_intarg)TopOpeBRepDS_SettraceSPSX)) return 1; // tspsx 0|1 [i1 ...]
171 if (T.Add("tspsxx",(tf_intarg)TopOpeBRepDS_SettraceSPSXX)) return 1; // tspsxx 0|1 [i1 i2]
172 if (T.Add("tspf",(tf_value)TopOpeBRepBuild_SettraceSPF)) return 1; // splitface
173 if (T.Add("tsps",(tf_value)TopOpeBRepBuild_SettraceSPS)) return 1; // splitsolid
174 if (T.Add("tshex",(tf_value)TopOpeBRepBuild_SettraceSHEX)) return 1;
175 if (T.Add("tss",(tf_value)TopOpeBRepBuild_SettraceSS)) return 1;
176 if (T.Add("tarea",(tf_value)TopOpeBRepBuild_SettraceAREA)) return 1;
177 if (T.Add("tkpb",(tf_value)TopOpeBRepBuild_SettraceKPB)) return 1;
178 if (T.Add("tpurge",(tf_value)TopOpeBRepBuild_SettracePURGE)) return 1;
179 if (T.Add("tsavfregu",(tf_value)TopOpeBRepBuild_SettraceSAVFREGU)) return 1;
180 if (T.Add("tsavsregu",(tf_value)TopOpeBRepBuild_SettraceSAVSREGU)) return 1;
181 if (T.Add("tfe",(tf_value)TopOpeBRepBuild_SettraceFE)) return 1;
182 if (T.Add("tnyi",(tf_value)TopOpeBRepTool_SettraceNYI)) return 1;
183 if (T.Add("tvc",(tf_value)TopOpeBRepTool_SettraceVC)) return 1;
184 if (T.Add("tpcurv",(tf_value)TopOpeBRepTool_SettracePCURV)) return 1;
185 if (T.Add("tbp",(tf_value)TopOpeBRepTool_SettraceBOXPERSO)) return 1;
186 if (T.Add("tbox",(tf_value)TopOpeBRepTool_SettraceBOX)) return 1;
187 if (T.Add("tclov",(tf_value)TopOpeBRepTool_SettraceCLOV)) return 1;
188 if (T.Add("tchkbspl",(tf_value)TopOpeBRepTool_SettraceCHKBSPL)) return 1;
189 if (T.Add("tregufa",(tf_value)TopOpeBRepTool_SettraceREGUFA)) return 1;
190 if (T.Add("treguso",(tf_value)TopOpeBRepTool_SettraceREGUSO)) return 1;
191 if (T.Add("tc2d",(tf_value)TopOpeBRepTool_SettraceC2D)) return 1;
192 if (T.Add("tcorriso",(tf_value)TopOpeBRepTool_SettraceCORRISO)) return 1;
193 if (T.Add("tcl2ddr",(tf_intarg)TopOpeBRepTool_SettraceCL2DDR)) return 1;
194 if (T.Add("tcl2dpr",(tf_intarg)TopOpeBRepTool_SettraceCL2DPR)) return 1;
195 if (T.Add("tcl3ddr",(tf_intarg)TopOpeBRepTool_SettraceCL3DDR)) return 1;
196 if (T.Add("tcl3dpr",(tf_intarg)TopOpeBRepTool_SettraceCL3DPR)) return 1;
197 if (T.Add("tbuto",(tf_value)TopOpeBRepDS_SettraceBUTO)) return 1;
198 if (T.Add("ttrpe",(tf_value)TopOpeBRepDS_SettraceTRPE)) return 1;
199 if (T.Add("tedpr",(tf_value)TopOpeBRepDS_SettraceEDPR)) return 1;
200 if (T.Add("tisto",(tf_value)TopOpeBRepDS_SettraceISTO)) return 1;
201 if (T.Add("tproedg",(tf_value)TopOpeBRep_SettracePROEDG)) return 1;
202 if (T.Add("tconic",(tf_value)TopOpeBRep_SettraceCONIC)) return 1;
203 return 0;
204}
205#endif
206
207//----------------------------------------------------------------------------
208Standard_Integer InitContextTopOpeKernel (TestTopOpeTools_Trace& T)
209//----------------------------------------------------------------------------
210{
211#ifdef DEB
212 if (T.Add("nosew",(tf_value)TopOpeBRepTool_SetcontextNOSEW)) return 1;
213 if (T.Add("nopnc",(tf_value)TopOpeBRepDS_SetcontextNOPNC)) return 1;
214 if (T.Add("nosg",(tf_value)TopOpeBRepBuild_SetcontextNOSG)) return 1;
215 if (T.Add("ssconnex",(tf_value)TopOpeBRepBuild_SetcontextSSCONNEX)) return 1;
216 if (T.Add("sf2",(tf_value)TopOpeBRepBuild_SetcontextSF2)) return 1;
217 if (T.Add("speon",(tf_value)TopOpeBRepBuild_SetcontextSPEON)) return 1;
218 if (T.Add("nopurge",(tf_value)TopOpeBRepBuild_SetcontextNOPURGE)) return 1;
219 if (T.Add("noregufa",(tf_value)TopOpeBRepBuild_SetcontextNOREGUFA)) return 1;
220 if (T.Add("noreguso",(tf_value)TopOpeBRepBuild_SetcontextNOREGUSO)) return 1;
221 if (T.Add("reguxpu",(tf_value)TopOpeBRepBuild_SetcontextREGUXPU)) return 1;
222 if (T.Add("nocorriso",(tf_value)TopOpeBRepBuild_SetcontextNOCORRISO)) return 1;
223 if (T.Add("nofe",(tf_value)TopOpeBRepBuild_SetcontextNOFE)) return 1;
224 if (T.Add("nofufa",(tf_value)TopOpeBRepBuild_SetcontextNOFUFA)) return 1;
225 if (T.Add("einternal",(tf_value)TopOpeBRepBuild_SetcontextEINTERNAL)) return 1;
226 if (T.Add("eexternal",(tf_value)TopOpeBRepBuild_SetcontextEEXTERNAL)) return 1;
227 if (T.Add("santran",(tf_value)TopOpeBRepDS_SettraceSANTRAN)) return 1;
228 if (T.Add("noproedg",(tf_value)TopOpeBRep_SetcontextNOPROEDG)) return 1;
229 if (T.Add("rest1",(tf_value)TopOpeBRep_SetcontextREST1)) return 1;
230 if (T.Add("rest2",(tf_value)TopOpeBRep_SetcontextREST2)) return 1;
231 if (T.Add("inl",(tf_value)TopOpeBRep_SetcontextINL)) return 1;
232 if (T.Add("newkp",(tf_value)TopOpeBRep_SetcontextNEWKP)) return 1;
233 if (T.Add("tol0",(tf_value)TopOpeBRep_SetcontextTOL0)) return 1;
234 if (T.Add("nonog",(tf_value)TopOpeBRep_SetcontextNONOG)) return 1;
235 if (T.Add("ffor",(tf_value)TopOpeBRep_SetcontextFFOR)) return 1;
236 if (T.Add("nopunk",(tf_value)TopOpeBRep_SetcontextNOPUNK)) return 1;
237 if (T.Add("nofei",(tf_value)TopOpeBRep_SetcontextNOFEI)) return 1;
238 if (T.Add("nopfi",(tf_value)TopOpeBRepDS_SetcontextNOPFI)) return 1;
239 if (T.Add("mktonreg",(tf_value)TopOpeBRepDS_SetcontextMKTONREG)) return 1;
240 if (T.Add("nogap",(tf_value)TopOpeBRepDS_SetcontextNOGAP)) return 1;
241#endif
242 return 0;
243}
244
245Standard_EXPORT Standard_Integer TestTopOpeTools_SetFlags
246(TestTopOpeTools_Trace& theFlags, Standard_Integer mute, Standard_Integer n , const char** a)
247{
248 if (n == 1) {
249 theFlags.Dump();
250 return 0;
251 }
252 if (n < 2) {
253 return 1;
254 }
255 const char* flag = a[1];
256 t_value value; // new value of flag
257 if (n == 2) value = Standard_True;
258 else value = (atoi(a[2]) ? Standard_True : Standard_False);
259
260 if (mute == 0) {
261 if ( n == 2 ) {
262 if (!strcasecmp(a[1],"0")) {
263 theFlags.Reset(Standard_False);
264 cout<<theFlags.Genre()<<"s desactivated"<<endl;
265 return 0;
266 }
267 else if (!strcasecmp(a[1],"1")) {
268 theFlags.Reset(Standard_True);
269 cout<<theFlags.Genre()<<"s activated"<<endl;
270 return 0;
271 }
272 }
273 }
274
275 Standard_Integer res = 1;
276 if (res) res=theFlags.Set(mute,flag,value,(n>3)?(n-3):0,(n>3)?&a[3]:NULL);
277 if (res) res=theFlags.Set(mute,flag,value);
278 return res;
279}
280
281//=========================================================================
282// a1 = flag (for example tbs) <a2> = value, if omitted flag becomes True
283//=========================================================================
284
285Standard_Integer TestTopOpeTools_SetTrace(Draw_Interpretor&, Standard_Integer n , const char** a)
286{
287 Standard_Integer ok = Standard_True;
288#ifdef DEB
289 InitTraceTopOpeKernel(theTrace);
290 Standard_Integer mute = 0; if (!strcasecmp(a[0],"trcmute")) mute = 1;
291 ok = TestTopOpeTools_SetFlags(theTrace,mute,n,a);
292#endif
293 return ok;
294}
295
296//=========================================================================
297// a1 = flag (for example tbs) <a2> = value, if omitted flag becomes True
298//=========================================================================
299
300Standard_Integer TestTopOpeTools_SetContext(Draw_Interpretor&, Standard_Integer n , const char** a)
301{
302 Standard_Integer ok = Standard_True;
303#ifdef DEB
304 InitContextTopOpeKernel(theContext);
305 Standard_Integer mute = 0; if (!strcasecmp(a[0],"ctxmute")) mute = 1;
306 ok = TestTopOpeTools_SetFlags(theContext,mute,n,a);
307#endif
308 return ok;
309}
310
311Standard_Integer dstrace(Draw_Interpretor& di, Standard_Integer n , const char** a) {
312 const char ** pa = NULL; TCollection_AsciiString a1;
313 if (!strcasecmp(a[0],"tsx")) a1 = "tspsx";
314 else if (!strcasecmp(a[0],"tcx")) a1 = "tcx";
315 else return 0;
316 TCollection_AsciiString a0("trc");
317 Standard_Integer npa = n+1;pa = (const char**) malloc((size_t)((npa)*sizeof(char*)));
318 pa[0] = (char *)a0.ToCString();
319 pa[1] = (char *)a1.ToCString();
320 for (Standard_Integer i=1;i<n;i++) pa[i+1] = a[i];
321 TestTopOpeTools_SetTrace(di,npa,pa);
b1ea14b6 322 if (pa) free(pa);
7fd59977 323 return 0;
324}
325
326//=======================================================================
327//function : TraceCommands
328//purpose :
329//=======================================================================
330
331void TestTopOpeTools::TraceCommands(Draw_Interpretor& theCommands)
332{
333 static Standard_Boolean done = Standard_False;
334 if (done) return;
335 done = Standard_True;
336
337 const char* g = "trace commands";
338
339 theCommands.Add("tsx","tsx 0|1 [{shape index}]",__FILE__,dstrace,g);
340 theCommands.Add("tsxx","tsxx 0|1 is1 is2",__FILE__,dstrace,g);
341 theCommands.Add("tcx","tcx 0|1 [{curve index}]",__FILE__,dstrace,g);
342
343 theCommands.Add("trc","Trace <flag> <value>",__FILE__,TestTopOpeTools_SetTrace,g);
344 theCommands.Add("trcmute","Trace <flag> <value>",__FILE__,TestTopOpeTools_SetTrace,g);
345 theCommands.Add("ctx","Context <flag> <value>",__FILE__,TestTopOpeTools_SetContext,g);
346 theCommands.Add("ctxmute","Context <flag> <value>",__FILE__,TestTopOpeTools_SetContext,g);
347}