973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | |
7fd59977 |
15 | #include <IFSelect_Activator.hxx> |
16 | #include <IFSelect_Selection.hxx> |
42cf5bc1 |
17 | #include <IFSelect_SessionPilot.hxx> |
18 | #include <IFSelect_SignCounter.hxx> |
19 | #include <IFSelect_WorkLibrary.hxx> |
20 | #include <IFSelect_WorkSession.hxx> |
7fd59977 |
21 | #include <Interface_EntityIterator.hxx> |
22 | #include <Interface_InterfaceModel.hxx> |
7fd59977 |
23 | #include <Interface_Macros.hxx> |
7fd59977 |
24 | #include <Message.hxx> |
42cf5bc1 |
25 | #include <Message_Messenger.hxx> |
94708556 |
26 | #include <OSD_OpenFile.hxx> |
42cf5bc1 |
27 | #include <Standard_Stream.hxx> |
28 | #include <Standard_Transient.hxx> |
29 | #include <Standard_Type.hxx> |
30 | #include <TCollection_AsciiString.hxx> |
31 | #include <TColStd_HSequenceOfAsciiString.hxx> |
7fd59977 |
32 | |
33 | #include <stdio.h> |
7fd59977 |
34 | #define MAXWORDS 200 |
35 | #define MAXCARS 1000 |
36 | |
37 | static int initactor = 0; |
38 | static char* trace; |
39 | |
40 | static TCollection_AsciiString nulword; |
41 | |
42 | // Nb Maxi de words : cf thewords et method SetCommandLine |
43 | |
44 | IFSelect_SessionPilot::IFSelect_SessionPilot (const Standard_CString prompt) |
45 | : theprompt (prompt) , thewords (0,MAXWORDS-1) , thewordeb (0,MAXWORDS-1) |
46 | { |
47 | if (theprompt.Length() == 0) theprompt.AssignCat ("Test-XSTEP>"); |
48 | therecord = Standard_False; thenbwords = 0; |
49 | if (initactor) return; initactor = 1; |
50 | Add (1,"x"); |
51 | Add (1,"exit"); |
52 | Add (2,"?"); |
53 | Add (2,"xhelp"); |
54 | Add (3,"xcommand"); |
55 | Add (4,"xsource"); |
56 | Add (5,"xstep"); |
57 | Add (6,"xnew"); |
58 | trace = getenv("DEBUGMODE"); |
59 | } |
60 | |
61 | |
62 | Handle(IFSelect_WorkSession) IFSelect_SessionPilot::Session () const |
63 | { return thesession; } |
64 | |
65 | Handle(IFSelect_WorkLibrary) IFSelect_SessionPilot::Library () const |
66 | { return thesession->WorkLibrary(); } |
67 | |
68 | Standard_Boolean IFSelect_SessionPilot::RecordMode () const |
69 | { return therecord; } |
70 | |
71 | void IFSelect_SessionPilot::SetSession |
72 | (const Handle(IFSelect_WorkSession)& WS) |
73 | { thesession = WS; } |
74 | |
75 | void IFSelect_SessionPilot::SetLibrary |
76 | (const Handle(IFSelect_WorkLibrary)& WL) |
77 | { if (!thesession.IsNull()) thesession->SetLibrary(WL); } |
78 | |
79 | void IFSelect_SessionPilot::SetRecordMode (const Standard_Boolean mode) |
80 | { therecord = mode; } |
81 | |
82 | |
83 | void IFSelect_SessionPilot::SetCommandLine |
84 | (const TCollection_AsciiString& command) |
85 | { |
86 | Standard_Integer lc = command.Length(); |
87 | if (lc > 200) cout<<" Commande TRES LONGUE : "<<lc<<" caracteres :"<<endl |
88 | <<command.ToCString()<<endl; |
89 | thecommand = command; |
90 | if (thecommand.Value(lc) <= ' ') { thecommand.Remove(lc); lc --; } |
91 | thenbwords = 0; |
92 | Standard_Integer i, nc = 0; |
93 | char unarg[MAXCARS]; |
94 | for (i = 1; i <= lc; i ++) { |
95 | char val = command.Value(i); |
96 | if (val <= ' ') { |
97 | if (nc == 0) continue; |
98 | if (thenbwords >= MAXWORDS) { unarg[nc] = val; nc ++; continue; } |
99 | unarg[nc] = '\0'; |
100 | thewords(thenbwords).Clear(); thewords(thenbwords).AssignCat(unarg); |
101 | if (trace) cout<<"thewords("<<thenbwords<<") ="<<unarg<<endl; |
102 | thenbwords ++; nc = 0; |
103 | continue; |
104 | } |
105 | if (nc == 0) thewordeb.SetValue (thenbwords,i); |
106 | if (nc > MAXCARS) { cout<<"Arg."<<thenbwords<<" > "<<MAXCARS<<" car.s, tronque"<<endl; continue; } |
107 | unarg[nc] = val; nc ++; |
108 | } |
109 | if (nc > 0) { |
110 | unarg[nc] = '\0'; thewords(thenbwords).Clear(); |
111 | thewords(thenbwords).AssignCat(unarg); |
112 | if (trace) cout<<"thewords("<<thenbwords<<")="<<unarg<<endl<<" .. Fin avec thenbwords="<<thenbwords+1<<endl; |
113 | thenbwords ++; |
114 | } |
115 | /* |
116 | aligner sur MAXWORDS |
117 | char l0[80],l1[80],l2[80],l3[80],l4[80],l5[80],l6[80],l7[80],l8[80],l9[80]; |
118 | char m0[80],m1[80],m2[80],m3[80],m4[80],m5[80],m6[80],m7[80],m8[80],m9[80]; |
119 | thenbwords = sscanf |
120 | (thecommand.ToCString(),"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", |
121 | l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,m0,m1,m2,m3,m4,m5,m6,m7,m8,m9); |
122 | if (thenbwords < 0) thenbwords = 0; |
123 | if (thenbwords > MAXWORDS) thenbwords = MAXWORDS; |
124 | Standard_Integer nb = thewords.Upper(); |
125 | for (i = 0; i <= nb; i ++) thewords(i).Clear(); |
126 | switch (thenbwords) { |
127 | case 20 : thewords(19).AssignCat(m9); |
128 | case 19 : thewords(18).AssignCat(m8); |
129 | case 18 : thewords(17).AssignCat(m7); |
130 | case 17 : thewords(16).AssignCat(m6); |
131 | case 16 : thewords(15).AssignCat(m5); |
132 | case 15 : thewords(14).AssignCat(m4); |
133 | case 14 : thewords(13).AssignCat(m3); |
134 | case 13 : thewords(12).AssignCat(m2); |
135 | case 12 : thewords(11).AssignCat(m1); |
136 | case 11 : thewords(10).AssignCat(m0); |
137 | case 10 : thewords(9).AssignCat(l9); |
138 | case 9 : thewords(8).AssignCat(l8); |
139 | case 8 : thewords(7).AssignCat(l7); |
140 | case 7 : thewords(6).AssignCat(l6); |
141 | case 6 : thewords(5).AssignCat(l5); |
142 | case 5 : thewords(4).AssignCat(l4); |
143 | case 4 : thewords(3).AssignCat(l3); |
144 | case 3 : thewords(2).AssignCat(l2); |
145 | case 2 : thewords(1).AssignCat(l1); |
146 | case 1 : thewords(0).AssignCat(l0); |
147 | default : break; |
148 | } |
149 | */ |
150 | thenumrec = 0; |
151 | theobjrec.Nullify(); |
152 | } |
153 | |
154 | const TCollection_AsciiString& IFSelect_SessionPilot::CommandLine () const |
155 | { return thecommand; } |
156 | |
157 | Standard_CString IFSelect_SessionPilot::CommandPart |
158 | (const Standard_Integer numarg) const |
159 | { |
160 | if (numarg <= 0) return thecommand.ToCString(); |
161 | if (numarg >= thenbwords) return ""; |
162 | return &(thecommand.ToCString())[thewordeb(numarg)-1]; |
163 | } |
164 | |
165 | Standard_Integer IFSelect_SessionPilot::NbWords () const |
166 | { return thenbwords; } |
167 | |
168 | const TCollection_AsciiString& IFSelect_SessionPilot::Word |
169 | (const Standard_Integer num) const |
170 | { if (num < thenbwords) return thewords(num); return nulword; } |
171 | |
172 | Standard_CString IFSelect_SessionPilot::Arg |
173 | (const Standard_Integer num) const |
174 | { return Word(num).ToCString(); } |
175 | |
176 | Standard_Boolean IFSelect_SessionPilot::RemoveWord |
177 | (const Standard_Integer num) |
178 | { |
179 | if (num < 0 || num > thenbwords) return Standard_False; |
180 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
181 | for (i = num; i < thenbwords; i ++) { |
182 | thewords(i).Clear(); |
183 | thewords(i).AssignCat(thewords(i+1).ToCString()); |
184 | } |
185 | thewords(thenbwords).Clear(); |
186 | thenbwords --; |
187 | // Et refaire thecommand. Si num = 0, on supprime le debut (facile) |
188 | if (num == 0) { |
189 | thecommand.Remove(1,thewordeb(1)); |
190 | } else { |
191 | // Sinon, reconstituer, a partir des words |
192 | thecommand.Clear(); |
193 | for (i = 0; i < thenbwords; i ++) { |
194 | if (i > 0) thecommand.AssignCat(" "); |
195 | thecommand.AssignCat(thewords(i)); |
196 | } |
197 | } |
198 | |
199 | return Standard_True; |
200 | } |
201 | |
202 | Standard_Integer IFSelect_SessionPilot::NbCommands () const |
203 | { return thecomlist.Length(); } |
204 | |
205 | const TCollection_AsciiString& IFSelect_SessionPilot::Command |
206 | (const Standard_Integer num) const |
207 | { return thecomlist(num); } |
208 | |
209 | |
210 | IFSelect_ReturnStatus IFSelect_SessionPilot::RecordItem |
211 | (const Handle(Standard_Transient)& item) |
212 | { |
213 | theobjrec = item; |
214 | return (item.IsNull() ? IFSelect_RetFail : IFSelect_RetDone); |
215 | } |
216 | |
217 | Handle(Standard_Transient) IFSelect_SessionPilot::RecordedItem () const |
218 | { return theobjrec; } |
219 | |
220 | void IFSelect_SessionPilot::Clear () |
221 | { thecomlist.Clear(); } |
222 | |
223 | |
224 | // ####################################################################### |
225 | // ######## CONTROLE D EXECUTION |
226 | |
227 | |
228 | IFSelect_ReturnStatus IFSelect_SessionPilot::ReadScript |
229 | (const Standard_CString file) |
230 | { |
231 | FILE* fic; int lefic = 0; |
232 | if (file != NULL && file[0] != '\0') { |
94708556 |
233 | fic = OSD_OpenFile (file,"r"); |
7fd59977 |
234 | if (fic) lefic = 1; |
235 | else { cout<<" ... Script File "<<file<<" not found"<<endl; return IFSelect_RetFail; } |
236 | cout << " ... Reading Script File " << file << endl; |
237 | } |
238 | else fic = stdin; |
239 | IFSelect_ReturnStatus stat = IFSelect_RetVoid; |
240 | |
241 | for (;;) { |
242 | char ligne[100]; |
64531d9c |
243 | if (!lefic) std::cout << theprompt.ToCString(); |
7fd59977 |
244 | ligne[0] = '\0'; |
98160038 |
245 | if (fgets(ligne,100,fic) == NULL |
246 | || feof(fic) != 0) |
247 | { |
248 | break; |
249 | } |
7fd59977 |
250 | if (ligne[0] == '\0') continue; |
251 | // On interprete cette commande |
252 | TCollection_AsciiString command(ligne); |
253 | if (lefic) cout<<file<<":"<<command; // le return est dans la ligne ... ! |
254 | stat = Execute(command); |
255 | if (stat == IFSelect_RetStop) break; |
256 | if ((stat == IFSelect_RetError || stat == IFSelect_RetFail) && lefic) |
257 | { cout << " ... Error in Script File, abandon"<<endl; break; } |
258 | } |
259 | if (!lefic) return IFSelect_RetStop; |
260 | fclose(fic); |
261 | cout<<"End of Reading Script File " << file << endl; |
262 | if (stat == IFSelect_RetError || stat == IFSelect_RetFail) return stat; |
263 | return IFSelect_RetVoid; // fin fichier : depiler |
264 | } |
265 | |
266 | |
267 | // On boucle sur la lecture jusqu a une commande de fin ou un EOF |
268 | |
269 | IFSelect_ReturnStatus IFSelect_SessionPilot::Perform () |
270 | { |
271 | IFSelect_ReturnStatus stat = IFSelect_RetVoid; |
272 | if (thenbwords == 0) return stat; |
273 | if (thewords(0).Value(1) == '#') return stat; // commentaire |
274 | |
275 | theobjrec.Nullify(); |
276 | // Est-ce un nom ? |
277 | |
278 | // Commande pour un Acteur |
279 | Handle(IFSelect_Activator) actor; Standard_Integer num; |
280 | if (IFSelect_Activator::Select(thewords(0).ToCString(),num,actor)) { |
281 | stat = actor->Do(num,this); |
282 | // Prise en compte des commandes a resultat |
283 | // Ici, resultat non nomme; Resultat nomme par commande x (plus loin) |
284 | if (!theobjrec.IsNull()) { |
285 | thesession->RemoveItem(theobjrec); //// depannage ? |
286 | Standard_Boolean addws = thesession->AddItem(theobjrec); |
287 | if (!addws) { cout<<"Could not add item to session, sorry"<<endl; return IFSelect_RetFail; } |
288 | } |
289 | |
290 | if (stat == IFSelect_RetVoid || stat == IFSelect_RetDone) { |
291 | if (therecord) thecomlist.Append(thecommand); |
292 | } |
293 | else if (stat == IFSelect_RetError) cout<<"Error in Command : "<<thecommand<<endl; |
294 | else if (stat == IFSelect_RetFail) cout << "Execution Failure for : " <<thecommand<<endl; |
295 | return stat; |
296 | } |
297 | cout << " Command : " << thewords(0) << " unknown" << endl; |
298 | return IFSelect_RetError; // pas reconnu donc incorrect |
299 | } |
300 | |
301 | IFSelect_ReturnStatus IFSelect_SessionPilot::ExecuteAlias |
302 | (const TCollection_AsciiString& alias) |
303 | { |
304 | if (alias.Length() > 0) thewords(0) = alias; |
305 | return Perform(); |
306 | } |
307 | |
308 | IFSelect_ReturnStatus IFSelect_SessionPilot::Execute |
309 | (const TCollection_AsciiString& command) |
310 | { |
311 | SetCommandLine(command); |
312 | return Perform(); |
313 | } |
314 | |
315 | IFSelect_ReturnStatus IFSelect_SessionPilot::ExecuteCounter |
316 | (const Handle(IFSelect_SignCounter)& counter, const Standard_Integer numword, |
317 | const IFSelect_PrintCount mode) |
318 | { |
319 | if (counter.IsNull()) return IFSelect_RetError; |
320 | counter->Clear(); |
321 | if (NbWords() <= numword) counter->AddModel (thesession->Model()); |
322 | else { |
323 | // on demande un givelist |
324 | Handle(TColStd_HSequenceOfTransient) list = thesession->GiveList (CommandPart(numword)); |
325 | if (list.IsNull()) { |
326 | cout<<"Nothing selected from : "<<CommandPart(numword)<<endl; |
327 | return IFSelect_RetError; |
328 | } |
329 | counter->AddWithGraph (list,thesession->Graph()); |
330 | } |
331 | counter->PrintList(Message::DefaultMessenger(),thesession->Model(),mode); |
332 | return IFSelect_RetVoid; |
333 | } |
334 | |
335 | Standard_Integer IFSelect_SessionPilot::Number |
336 | (const Standard_CString val) const |
337 | { |
338 | Standard_Integer num = thesession->NumberFromLabel (val); |
339 | if (num < 0) cout<<" Label:"<<val<<" ->"<<-num<<" ent.s, refus"<<endl; |
340 | return num; |
341 | } |
342 | |
343 | |
344 | // ######################################################################### |
345 | // ######## ACTIONS SPECIFIQUES DU PILOTE |
346 | |
347 | #define MAXCOMPERLINE 5 |
348 | #define LENGTHFORCOM 15 |
349 | |
350 | IFSelect_ReturnStatus IFSelect_SessionPilot::Do |
351 | (const Standard_Integer number, |
352 | const Handle(IFSelect_SessionPilot)& session) |
353 | { |
354 | // Commandes Propres : x, exit, undo, redo, ?, help |
355 | IFSelect_ReturnStatus stat = IFSelect_RetVoid; |
356 | Standard_Integer argc = NbWords(); |
357 | const Standard_CString arg1 = Word(1).ToCString(); |
358 | Standard_Integer modhelp = -1; |
359 | switch (number) { |
360 | case -1 : // **** HELP-XSNEW |
361 | modhelp = 1; |
362 | cout<<" -- Commands candidate for xsnew --"<<endl; |
363 | // HELP : soit complet (par defaut) soit limite a xsnew |
364 | case 0 : { // **** HELP |
365 | Handle(TColStd_HSequenceOfAsciiString) list; |
366 | // Help complet : on donne la liste des commandes, sans plus (deja pas mal) |
367 | if (thenbwords <= 1) { |
368 | list = IFSelect_Activator::Commands(modhelp); |
369 | Standard_Integer nbcom = 0; |
370 | Standard_Integer nb = list->Length(); |
371 | cout << " -- Liste des Commands Disponibles --"<<endl; |
372 | for (Standard_Integer i = 1; i <= nb; i ++) { |
373 | const TCollection_AsciiString& uncom = list->Value(i); |
374 | Standard_Integer loncom = uncom.Length(); |
375 | nbcom ++; |
376 | if (nbcom > MAXCOMPERLINE) { cout<<endl; nbcom = 1; } |
377 | cout<<" "<<uncom; |
378 | if (nbcom == MAXCOMPERLINE) continue; |
379 | for (Standard_Integer j = loncom; j < LENGTHFORCOM; j ++) cout<<" "; |
380 | } |
381 | if (nbcom > 0) cout<<endl; |
382 | cout<<"\nhelp * liste toutes les commandes avec un help sur chacune\n" |
383 | <<"help <com> liste la ou les commande debutant par <com>" |
384 | <<" avec un help sur chacune"<<endl; |
385 | |
386 | // Un Help particulier |
387 | } else { |
388 | if (thewords(1).IsEqual("*")) list = IFSelect_Activator::Commands(modhelp); |
389 | |
390 | else list = IFSelect_Activator::Commands(modhelp,thewords(1).ToCString()); |
391 | |
392 | Standard_Integer nb = list->Length(); |
393 | for (Standard_Integer i = 1; i <= nb; i ++) { |
394 | Handle(IFSelect_Activator) actor; Standard_Integer num; |
395 | if (IFSelect_Activator::Select |
396 | (list->Value(i).ToCString(),num,actor)) { |
397 | if (IFSelect_Activator::Mode (list->Value(i).ToCString()) == 1) |
398 | cout<<"[xsnew name] "; |
399 | cout << list->Value(i) << " : " << actor->Help(num) << endl; |
400 | } |
401 | } |
402 | if (nb == 0 && thenbwords > 1) cout<<" Command "<<Word(1)<<" unknown. " |
403 | << " help (without command) lists all the commands" << endl; |
404 | } |
405 | return IFSelect_RetVoid; |
406 | } |
407 | case 1 : return IFSelect_RetStop; // **** Fin de session |
408 | case 2 : { // **** HELP |
409 | return Do(0,this); |
410 | } |
411 | case 3 : { // **** COMMAND |
412 | if (argc < 2) { cout << "Donner une option :\n" |
413 | <<"a : analyse une ligne r : toggle record mode\n" |
414 | <<"l : list recorded c : clear f nom : sauver dans fichier de nom" |
415 | << endl; return IFSelect_RetVoid; } |
416 | switch (arg1[0]) { |
417 | case 'a' : { // **** command analyse |
418 | cout<<"Command n0 " << number <<" : "<< session->CommandLine()<<endl; |
419 | cout<<"Nb Words : " << argc-2 << " :\n"; |
420 | for (Standard_Integer i = 2; i < argc; i ++) { |
421 | cout << " Word." << i-1 << " : " << session->Word(i) <<endl; |
422 | } |
423 | break; |
424 | } |
425 | case 'c' : session->Clear(); break; // **** command clear |
426 | case 'f' : { |
427 | if (argc < 3) { cout<<"Donner nom de fichier"<<endl; return IFSelect_RetError; } |
428 | Standard_Integer nb = session->NbCommands(); |
429 | if (nb == 0) { cout<<"Aucune commande enregistree"<<endl; break; } |
430 | cout << "Nb Commandes enregistrees : " << nb <<endl; |
431 | ofstream fout(Word(2).ToCString(),ios::out); |
432 | for (Standard_Integer i = 1; i <= nb; i ++) |
433 | fout<<session->Command(i)<<endl; |
434 | break; |
435 | } |
436 | case 'l' : { // **** command list |
437 | if (session->RecordMode()) cout<<" -- Record Mode Actif"<<endl; |
438 | else cout<<" -- Record Mode Inactif"<<endl; |
439 | Standard_Integer nb = session->NbCommands(); |
440 | cout << "Nb Commandes enregistrees : " << nb << " :"<<endl; |
441 | for (Standard_Integer i = 1; i <= nb; i ++) { |
442 | cout<<" "<<i<<" "<<session->Command(i)<<endl; |
443 | } |
444 | break; |
445 | } |
446 | case 'r' : { // **** command record |
447 | Standard_Boolean mode = session->RecordMode(); |
448 | if (mode) cout << " -- Record Mode a present Inactif" <<endl; |
449 | else cout << " -- Record Mode a present Actif" <<endl; |
450 | session->SetRecordMode(!mode); |
451 | break; |
452 | } |
453 | default : cout << "Option de controle de commande non comprise"<<endl; |
454 | } |
455 | return IFSelect_RetVoid; |
456 | } |
457 | |
458 | case 4 : { // **** FILE |
459 | if (argc < 2) { cout<<"Donner nom de fichier"<<endl; return IFSelect_RetError; } |
460 | return session->ReadScript |
461 | (TCollection_AsciiString(session->Word(1)).ToCString()); |
462 | // On recopie la string parce que Word(1) change tout le temps ! |
463 | } |
464 | |
465 | case 5 : { // **** XSTEP |
466 | if (argc < 2) { |
467 | cout<<"xstep : prefixe neutre pour toute commande xstep-draw"<<endl |
468 | <<"xstep command args equivaut a command args"<<endl; |
469 | return Do(2,this); |
470 | } else { |
471 | RemoveWord(0); |
472 | return Perform(); |
473 | } |
474 | } |
475 | case 6 : { // **** XSNEW(variable) |
476 | if (argc < 3) { |
477 | cout<<"xsnew nomvar command [args] creates an item"<<endl |
478 | <<" nomvar : name of item (must be a new name) in the session"<<endl; |
479 | return Do (-1,this); |
480 | } else { |
481 | |
482 | theobjrec.Nullify(); |
483 | TCollection_AsciiString name = Word(1); |
484 | // Le nom ne doit pas etre deja pris ! |
485 | if (thesession.IsNull()) { cout<<"Command with a Name and no Session defined !"<<endl; return IFSelect_RetFail; } |
486 | ////// if (thesession->NameIdent(thewords(0).ToCString()) > 0) |
487 | ////// { cout<<"Command with name:"<<thewords(0)<<", already taken"<<endl; return IFSelect_RetFail; } |
488 | RemoveWord(0); RemoveWord(0); |
489 | |
490 | // Commande pour un Acteur |
491 | Handle(IFSelect_Activator) actor; Standard_Integer num; |
492 | if (IFSelect_Activator::Select(thewords(0).ToCString(),num,actor)) { |
493 | theobjrec.Nullify(); |
494 | stat = actor->Do(num,this); |
495 | // Prise en compte des commandes a resultat |
496 | if (!theobjrec.IsNull()) { |
497 | thesession->RemoveItem(theobjrec); //// depannage ? |
498 | Standard_Boolean addws = |
499 | thesession->AddNamedItem(name.ToCString(),theobjrec); |
500 | theobjrec.Nullify(); |
501 | if (!addws) { cout<<"Could not add named item:"<<name<<", sorry"<<endl; return IFSelect_RetFail; } |
502 | } |
503 | else cout<<"Remark : xsnew with name:"<<name<<" and no result"<<endl; |
504 | |
505 | return stat; |
506 | } |
507 | cout << " Command : " << thewords(0) << " unknown" << endl; |
508 | return IFSelect_RetError; // pas reconnu donc incorrect |
509 | } |
510 | } |
511 | default : return IFSelect_RetError; |
512 | } |
513 | } |
514 | |
515 | |
516 | |
517 | Standard_CString IFSelect_SessionPilot::Help |
518 | (const Standard_Integer number) const |
519 | { |
520 | switch (number) { |
521 | case 1 : return "exit ou x : Fin de session"; |
522 | case 2 : return "Liste les commandes. ? <titre> : commandes debutant par <titre>"; |
523 | case 3 : return "controle de commande. command tout court pour help complet"; |
524 | case 4 : return "lit les commandes depuis un fichier"; |
525 | case 5 : return "prefixe neutre pour xstep-draw"; |
526 | case 6 : return "creation item : donner nom_item puis commande args"; |
527 | default : return ""; |
528 | } |
529 | } |