source: Sophya/trunk/SophyaPI/PIext/basexecut.cc@ 2536

Last change on this file since 2536 was 2536, checked in by ansari, 21 years ago

Correction bug ds PIACmd : remplacement stack<string> par queue<string> pour empilement de commandes soumises a l'interpreteur et ajout commande bargraph pour drawer PIBarGraph - Reza 13 Mai 2004

File size: 82.7 KB
Line 
1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11#include "strutilxx.h"
12
13#include "pistdimgapp.h"
14#include "nobjmgr.h"
15#include "servnobjm.h"
16#include "nomgadapter.h"
17#include "piyfxdrw.h"
18#include "pibargraph.h"
19
20#include "histos.h"
21#include "histos2.h"
22#include "hisprof.h"
23#include "ntuple.h"
24#include "generaldata.h"
25
26#ifdef SANS_EVOLPLANCK
27#include "cvector.h"
28#else
29#include "tvector.h"
30#endif
31
32
33/* --Methode-- */
34PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
35{
36mpiac = piac;
37mObjMgr = omg;
38mImgApp = app;
39dynlink = NULL;
40dynlink2 = NULL;
41RegisterCommands();
42}
43
44PIABaseExecutor::~PIABaseExecutor()
45{
46 if (dynlink) delete dynlink;
47 if (dynlink2) delete dynlink2;
48}
49
50
51/* Macro pour tester si flag normalized coordinate est present */
52#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
53
54/* --Methode-- */
55int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
56{
57Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
58// >>>>> Chargement de modules
59if (kw == "loadmodule") {
60 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
61 mpiac->LoadModule(tokens[0], tokens[1]);
62 }
63// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
64else if (kw == "zone") {
65 while (tokens.size() < 2) tokens.push_back("1");
66 int nx, ny;
67 nx = ny = 1;
68 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
69 if (mImgApp) {
70 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
71 mImgApp->SetZone(nx, ny);
72 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
73 }
74}
75else if (kw == "newwin") {
76 int nx=1, ny=1;
77 int sx=0, sy=0;
78 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
79 if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
80 if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
81 if(tokens.size() > 3) {
82 sx = atoi(tokens[2].c_str());
83 sy = atoi(tokens[3].c_str());
84 }
85 if (mImgApp) {
86 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
87 mImgApp->CreateGraphWin(nx, ny, sx, sy);
88 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
89 }
90}
91else if (kw == "stacknext") {
92 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
93 mImgApp->StackWinNext();
94 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
95}
96else if (kw == "graphicatt") {
97 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
98 string opts = tokens[0];
99 if (tokens.size() > 1)
100 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
101 if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts);
102 }
103else if (kw == "setaxesatt") {
104 if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl; return(0); }
105 string opts = tokens[0];
106 if (tokens.size() > 1)
107 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
108 if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts);
109 }
110else if (kw == "setinsetlimits") {
111 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
112 double xmin = atof(tokens[0].c_str());
113 double xmax = atof(tokens[1].c_str());
114 double ymin = atof(tokens[2].c_str());
115 double ymax = atof(tokens[3].c_str());
116 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
117 }
118else if (kw == "drpanel") {
119 if (tokens.size() < 4) {
120 cout << "Usage: drpanel xmin xmax ymin ymax [gratt] [name]" << endl;
121 return(0);
122 }
123 double xmin = atof(tokens[0].c_str());
124 double xmax = atof(tokens[1].c_str());
125 double ymin = atof(tokens[2].c_str());
126 double ymax = atof(tokens[3].c_str());
127 char buff[128];
128 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g ", xmin, xmax, ymin, ymax);
129 string sop = buff;
130 if (tokens.size() > 4) sop += tokens[4];
131 string name;
132 if (tokens.size() > 5) name = tokens[5];
133 PIFuncDrawer* gdr = new PIFuncDrawer(NULL);
134 mImgApp->DispScDrawer(gdr, name, sop);
135}
136else if (kw == "addtext") {
137 if (tokens.size() < 3) {
138 cout << "Usage: addtext x y txt [colfontatt] [fgnc]" << endl;
139 return(0);
140 }
141 double xp = atof(tokens[0].c_str());
142 double yp = atof(tokens[1].c_str());
143 string txt = tokens[2];
144 string sop;
145 if (tokens.size() > 3) sop = tokens[3];
146 bool fgnc = _CkBoolNC_(4);
147 mImgApp->AddText(txt, xp, yp, sop, fgnc);
148 }
149else if (kw == "addctext") {
150 if (tokens.size() < 5) {
151 cout << "Usage: addctext x y txt s_up s_dn [colfontatt] [updnfatt] [fgnc] " << endl;
152 return(0);
153 }
154 double xp = atof(tokens[0].c_str());
155 double yp = atof(tokens[1].c_str());
156 string sop;
157 if (tokens.size() > 5) sop = tokens[5];
158 string sopfss;
159 if (tokens.size() > 6) sopfss = tokens[6];
160 bool fgnc = _CkBoolNC_(7);
161 mImgApp->AddCompText(tokens[2], tokens[3], tokens[4], xp, yp, sop, sopfss, fgnc);
162 }
163else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
164 (kw == "addarrow") ) {
165 if (tokens.size() < 4) {
166 cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt] [fgnc]" << endl;
167 return(0);
168 }
169 double xp1 = atof(tokens[0].c_str());
170 double yp1 = atof(tokens[1].c_str());
171 double xp2 = atof(tokens[2].c_str());
172 double yp2 = atof(tokens[3].c_str());
173 string sop;
174 if (tokens.size() > 4) sop = tokens[4];
175 bool fgnc = _CkBoolNC_(5);
176 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
177 else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
178 else {
179 bool fgfill = (kw == "addrect") ? false : true;
180 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
181 }
182}
183else if ((kw == "addcirc") || (kw == "addfcirc")) {
184 if (tokens.size() < 3) {
185 cout << "Usage: addcirc/addfcirc xc yc r [colatt] [fgnc]" << endl;
186 return(0);
187 }
188 double xc = atof(tokens[0].c_str());
189 double yc = atof(tokens[1].c_str());
190 double rad = atof(tokens[2].c_str());
191 string sop;
192 if (tokens.size() > 3) sop = tokens[3];
193 bool fgnc = _CkBoolNC_(4);
194 bool fgfill = (kw == "addcirc") ? false : true;
195 mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc);
196 }
197else if ((kw == "addarca") || (kw == "addfarca")) {
198 if (tokens.size() < 5) {
199 cout << "Usage: addarca/addfarca xc yc r a da [colatt] [fgnc]" << endl;
200 return(0);
201 }
202 double xc = atof(tokens[0].c_str());
203 double yc = atof(tokens[1].c_str());
204 double rad = atof(tokens[2].c_str());
205 double ang = atof(tokens[3].c_str());
206 double dang = atof(tokens[4].c_str());
207 string sop;
208 if (tokens.size() > 5) sop = tokens[5];
209 bool fgnc = _CkBoolNC_(6);
210 bool fgfill = (kw == "addarca") ? false : true;
211 mImgApp->AddArc(xc, yc, rad, ang, dang, sop, fgfill, fgnc);
212 }
213else if (kw == "addmarker") {
214 if (tokens.size() < 2) {
215 cout << "Usage: addmarker x y [gratt] [fgnc]" << endl;
216 return(0);
217 }
218 double xm = atof(tokens[0].c_str());
219 double ym = atof(tokens[1].c_str());
220 string sop;
221 if (tokens.size() > 2) sop = tokens[2];
222 bool fgnc = _CkBoolNC_(3);
223 mImgApp->AddCircle(xm, ym, -1, sop, false, fgnc);
224}
225else if ((kw == "addarc") || (kw == "addfarc") ) {
226 if (tokens.size() < 6) {
227 cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt] [fgnc]" << endl;
228 return(0);
229 }
230 double x1 = atof(tokens[0].c_str());
231 double y1 = atof(tokens[1].c_str());
232 double x2 = atof(tokens[2].c_str());
233 double y2 = atof(tokens[3].c_str());
234 double x3 = atof(tokens[4].c_str());
235 double y3 = atof(tokens[5].c_str());
236 string sop;
237 if (tokens.size() > 6) sop = tokens[6];
238 bool fgnc = _CkBoolNC_(7);
239 bool fgfill = (kw == "addarc") ? false : true;
240 mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill, fgnc);
241}
242else if ((kw == "addpoly") || (kw == "addfpoly")) {
243 if (tokens.size() < 1) {
244 cout << "Usage: addpoly/addfpoly 'x1,y1 x2,y2 x3,y3 ...' [gratt] [fgnc]" << endl;
245 return(0);
246 }
247 vector<string> sxy;
248 vector<double> xpol, ypol;
249 double xp, yp;
250 FillVStringFrString(tokens[0], sxy);
251 for(int jkk=0; jkk<sxy.size(); jkk++) {
252 xp = yp = 0;
253 if (sscanf(sxy[jkk].c_str(), "%lg,%lg", &xp, &yp) == 2) {
254 xpol.push_back(xp);
255 ypol.push_back(yp);
256 }
257 }
258 string sop;
259 if (tokens.size() > 1) sop = tokens[1];
260 bool fgnc = _CkBoolNC_(2);
261 bool fgfill = (kw == "addpoly") ? false : true;
262 mImgApp->AddPoly(xpol, ypol, sop, fgfill, fgnc);
263 }
264
265
266else if ((kw == "settitle") || (kw == "addtitle")) {
267 if (tokens.size() < 1) { cout << "Usage: settitle/addtitle TopTitle [BotTitle] [fontatt]" << endl; return(0); }
268 if(tokens.size()<2) tokens.push_back("");
269 string gropt;
270 if(tokens.size()>2) gropt = tokens[2];
271 mImgApp->SetTitle(tokens[0], tokens[1], gropt);
272}
273
274else if ((kw == "setaxelabels") || (kw == "addaxelabels")) {
275 if (tokens.size() < 2) { cout << "Usage: setaxelabels/addaxelabels xLabel yLabel [fontatt]" << endl; return(0); }
276 string gropt;
277 if(tokens.size()>2) gropt = tokens[2];
278 mImgApp->SetAxeLabels(tokens[0], tokens[1], gropt);
279}
280
281// >>>>>>>>>>> Link dynamique de fonctions C++
282else if (kw == "link" ) {
283 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
284 string sph = "";
285 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
286 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
287 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
288}
289else if (kw == "linkff2" ) {
290 if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
291 string sph = "";
292 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
293 int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
294 if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
295}
296else if (kw == "call" ) {
297 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
298 UsFmap::iterator it;
299 UsFmap::iterator it1 = usfmap.find(tokens[0]);
300 UsFmap::iterator it2 = usfmap2.find(tokens[0]);
301 if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
302 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
303 return(0);
304 }
305 if (it1 == usfmap.end()) it = it2;
306 else it = it1;
307 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
308// on est oblige de faire un cast etant donne qu'on
309// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
310 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
311/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
312// On redirige la sortie sur le terminal
313 bool red = mImgApp->HasRedirectedStdOutErr();
314 mImgApp->RedirectStdOutErr(false);
315 --------DEL */
316#ifdef SANS_EVOLPLANCK
317 TRY {
318 tokens.erase(tokens.begin());
319 fuf(tokens);
320 } CATCH(merr) {
321 fflush(stdout);
322 string es = PeidaExc(merr);
323 cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
324 cout << endl;
325 }
326#else
327 try {
328 tokens.erase(tokens.begin());
329 fuf(tokens);
330 }
331 catch ( PThrowable & exc ) {
332 cerr << "\n PIABaseExecutor: Call / Catched Exception :"
333 << (string)typeid(exc).name() << " Msg= "
334 << exc.Msg() << endl;
335 cout << endl;
336 }
337 catch ( ... ) {
338 cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
339 << endl;
340 cout << endl;
341 }
342#endif
343/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
344 mImgApp->RedirectStdOutErr(red);
345 --------DEL */
346}
347
348// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
349else if (kw == "openfits" ) {
350 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
351 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
352}
353else if (kw == "savefits" ) {
354 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
355 else mObjMgr->SaveFits(tokens[0], tokens[1]);
356}
357else if (kw == "openppf" ) {
358 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
359 mObjMgr->ReadAll(tokens[0]);
360}
361else if ((kw == "saveobjs") || (kw == "saveppf")) {
362 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
363 mObjMgr->SaveObjects(tokens[0], tokens[1]);
364}
365else if (kw == "saveall" ) {
366 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
367 mObjMgr->SaveAll(tokens[0]);
368}
369else if (kw == "print" ) {
370 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
371 mObjMgr->PrintObj(tokens[0]);
372}
373else if ( (kw == "rename" ) || (kw == "mv") ) {
374 if (tokens.size() < 2) { cout << "Usage: rename/mv nameobj namenew" << endl; return(0); }
375 mObjMgr->RenameObj(tokens[0], tokens[1]);
376}
377else if ( (kw == "del" ) || (kw == "rm") ) {
378 if (tokens.size() < 1) { cout << "Usage: del nameobj [nameobj2 ...]" << endl; return(0); }
379 if (tokens.size()>0)
380 for(uint_4 i=0;i<tokens.size();i++) mObjMgr->DelObj(tokens[i]);
381}
382else if (kw == "delobjs" ) {
383 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
384 mObjMgr->DelObjects(tokens[0]);
385}
386else if ( (kw == "listobjs") || (kw == "ls") ) {
387 if (tokens.size() < 1) tokens.push_back("*");
388 if (tokens.size() < 2) mObjMgr->ListObjs(tokens[0]);
389 else {
390 vector<string> olv;
391 mObjMgr->GetObjList(tokens[0], olv);
392 mpiac->SetVar(tokens[1], olv);
393 }
394}
395
396// Gestion des repertoires
397else if (kw == "mkdir" ) {
398 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
399 bool crd = mObjMgr->CreateDir(tokens[0]);
400 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
401 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
402 }
403else if (kw == "rmdir" ) {
404 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
405 mObjMgr->DeleteDir(tokens[0]);
406 }
407else if (kw == "setdiratt" ) {
408 if (tokens.size() < 2) { cout << "Usage: setdiratt dirname true/false" << endl; return(0); }
409 if (tokens[1] == "true") mObjMgr->SetKeepOldDirAtt(tokens[0], true);
410 else mObjMgr->SetKeepOldDirAtt(tokens[0], false);
411}
412else if (kw == "cd") {
413 if (tokens.size() < 1) tokens.push_back("home");
414 mObjMgr->SetCurrentDir(tokens[0]);
415 }
416else if (kw == "pwd") {
417 string dirn;
418 mObjMgr->GetCurrentDir(dirn);
419 cout << "CurrentDirectory: " << dirn << endl;
420 }
421else if (kw == "listdirs") {
422 if (tokens.size() < 1) tokens.push_back("*");
423 mObjMgr->ListDirs(tokens[0]);
424 }
425
426// >>>>>>>>>>> Creation d'histos 1D-2D
427else if (kw == "newh1d") {
428 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
429 int_4 nbx = 100;
430 r_8 xmin = 0., xmax = 1.;
431 nbx = atoi(tokens[3].c_str());
432 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
433 Histo* h = new Histo(xmin, xmax, nbx);
434 mObjMgr->AddObj(h, tokens[0]);
435 }
436else if (kw == "newh2d") {
437 if (tokens.size() < 7) {
438 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
439 return(0);
440 }
441 int_4 nbx = 50, nby = 50;
442 r_8 xmin = 0., xmax = 1.;
443 r_8 ymin = 0., ymax = 1.;
444 nbx = atoi(tokens[3].c_str());
445 nby = atoi(tokens[6].c_str());
446 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
447 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
448 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
449 mObjMgr->AddObj(h, tokens[0]);
450 }
451else if (kw == "newprof" || kw == "newprofe") {
452 if (tokens.size() < 4)
453 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
454 int_4 nbx = 100;
455 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
456 if(tokens.size() > 5)
457 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
458 nbx = atoi(tokens[3].c_str());
459 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
460 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
461 if(kw == "newprofe") h->SetErrOpt(false);
462 mObjMgr->AddObj(h, tokens[0]);
463 }
464
465// Creation de NTuple
466else if (kw == "newnt") {
467 if(tokens.size() < 2)
468 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
469 vector<string> varname;
470 int nvar = 0;
471 const char *c = tokens[1].c_str();
472 if(isdigit(c[0])) {
473 nvar = atoi(tokens[1].c_str());
474 if(nvar<=0 || nvar>=10000)
475 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
476 return(0);}
477 for(int i=0;i<nvar;i++) {
478 char str[16]; sprintf(str,"%d",i);
479 string dum = "v"; dum += str;
480 varname.push_back(dum.c_str());
481 }
482 } else if( islower(c[0]) || isupper(c[0]) ) {
483 for(int i=1;i<(int)tokens.size();i++) {
484 varname.push_back(tokens[i].c_str());
485 nvar++;
486 }
487 } else {
488 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
489 <<"newnt name nvar : nvar must be an positive integer"<<endl;
490 return(0);
491 }
492 char **noms = new char*[nvar];
493 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
494 NTuple* nt = new NTuple(nvar,noms);
495 delete [] noms;
496 mObjMgr->AddObj(nt,tokens[0]);
497 }
498
499// Creation de GeneralFitData
500else if (kw == "newgfd") {
501 if (tokens.size() < 3)
502 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
503 int nvar, nalloc, errx=0;
504 if (tokens.size() > 3)
505 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
506 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
507 if(nvar>0 && nalloc>0) {
508 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
509 mObjMgr->AddObj(gfd, tokens[0]);
510 }
511 }
512
513// Creation/remplissage de vecteur et de matrice
514else if (kw == "newvec") {
515 if (tokens.size() < 2) {
516 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
517 }
518 int n = atoi(tokens[1].c_str());
519 double xmin, xmax;
520 xmin = 0.; xmax = n;
521 if (tokens.size() < 3) {
522 Vector* v = new Vector(n);
523 mObjMgr->AddObj(v, tokens[0]);
524 }
525 else {
526 if (tokens.size() < 4) tokens.push_back("");
527 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
528 }
529 }
530else if (kw == "newmtx") {
531 if (tokens.size() < 3) {
532 cout << "Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
533 }
534 int nx = atoi(tokens[1].c_str());
535 int ny = atoi(tokens[2].c_str());
536 double xmin, xmax, ymin, ymax;
537 xmin = 0.; xmax = nx;
538 ymin = 0.; ymax = ny;
539 if (tokens.size() < 4) {
540 Matrix* mtx = new Matrix(ny,nx);
541 mObjMgr->AddObj(mtx, tokens[0]);
542 }
543 else {
544 if (tokens.size() < 5) tokens.push_back("next");
545 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
546 nx, ny, tokens[4]);
547 }
548 }
549// ----- Vecteur/NTuple <> Lignes/variables interpreteur
550// Creation de vecteur depuis le contenu de la ligne
551else if (kw == "line2vec") {
552 if (tokens.size() < 2) {
553 cout << "Usage: line2vec vecname v0 v1 v2 ... " << endl; return(0);
554 }
555 int vsz = tokens.size()-1;
556 Vector* v = new Vector(vsz);
557 for(int kkv=0; kkv<vsz; kkv++) (*v)(kkv) = atof(tokens[kkv+1].c_str());
558 mObjMgr->AddObj(v, tokens[0]);
559 }
560// Remplissage de NTuple depuis la ligne
561else if (kw == "line2nt") {
562 if (tokens.size() < 2) {
563 cout << "Usage: line2nt ntname col0 col1 ..." << endl; return(0);
564 }
565 AnyDataObj* obj;
566 obj = mObjMgr->GetObj(tokens[0]);
567 if(obj == NULL) {
568 cerr << "line2nt Error , No such object " << tokens[0] << endl;
569 return(0);
570 }
571 NTuple* nt = dynamic_cast<NTuple *>(obj);
572 if(nt == NULL) {
573 cerr << "line2nt Error " << tokens[0] << " not an NTuple ! " << endl;
574 return(0);
575 }
576 if (nt->NbColumns() < 1) {
577 cerr << "line2nt Error: NbColumns < 1" << endl;
578 return(0);
579 }
580 r_4* xnt = new r_4[ nt->NbColumns() ];
581 int kkx;
582 for(kkx=0; kkx<nt->NbColumns(); kkx++) {
583 if (kkx < tokens.size()-1) xnt[kkx] = atof(tokens[kkx+1].c_str());
584 else xnt[kkx] = 0.;
585 }
586 nt->Fill(xnt);
587 delete[] xnt;
588}
589// Contenu du vecteur vers variable interpreteur
590#define MAXNWORDSO2V 32768
591else if (kw == "vec2var") {
592 if (tokens.size() < 2) {
593 cout << "Usage: vec2var vecname varname [loop_param start:end:step] " << endl; return(0);
594 }
595 AnyDataObj* obj;
596 obj = mObjMgr->GetObj(tokens[0]);
597 if(obj == NULL) {
598 cerr << "vec2var Error , No such object " << tokens[0] << endl;
599 return(0);
600 }
601 Vector* v = dynamic_cast<Vector *>(obj);
602 if(v == NULL) {
603 cerr << "vec2var Error " << tokens[0] << " not a Vector ! " << endl;
604 return(0);
605 }
606 int_8 kks = 0;
607 int_8 kke = v->NElts();
608 int_8 kkp = 1;
609 if (tokens.size() > 2) Services2NObjMgr::DecodeLoopParameters(tokens[2], kks, kke, kkp);
610 if (kks < 0) kks = 0;
611 if (kke > (int_8)v->NElts()) kke = v->NElts();
612 if (kkp < 1) kkp = 1;
613 int nelt = (kke-kks-1)/kkp;
614 if (nelt > MAXNWORDSO2V) {
615 nelt = MAXNWORDSO2V;
616 cout << "vec2var Warning: Only " << nelt
617 << " elements will be converted to string" << endl;
618 kke = kks+nelt*kkp;
619 }
620 string v2str;
621 char buff[64];
622 for(int kkv=kks; kkv<kke; kkv+=kkp) {
623 sprintf(buff, "%lg ", (*v)(kkv));
624 v2str += buff;
625 }
626
627 mObjMgr->SetVar(tokens[1], v2str);
628}
629// Une ligne du NTuple/NTupleInterface -> variable interpreteur
630else if ((kw == "ntline2var") || (kw == "ntcol2var")) {
631 if (tokens.size() < 3) {
632 cout << "Usage: ntline/col2var objname line_number varname" << endl;
633 return(0);
634 }
635 NObjMgrAdapter* oa = mObjMgr->GetObjAdapter(tokens[0]);
636 if(oa == NULL) {
637 cerr << "ntline/col2var Error , No such object " << tokens[0] << endl;
638 return(0);
639 }
640 bool adel = false;
641 NTupleInterface* nti = oa->GetNTupleInterface(adel);
642 if(nti == NULL) {
643 cerr << "ntline/col2var Error: objet" << tokens[0] << " has no NTupleInterface" << endl;
644 return(0);
645 }
646
647 if (nti->NbColumns() < 1 || nti->NbLines() < 1) {
648 cerr << "ntline/col2var Error: NbColumns or NbLines < 1" << endl;
649 return(0);
650 }
651 string v2str;
652 char buff[64];
653 if (kw == "ntline2var") {
654 int numline = atoi(tokens[1].c_str());
655 if ( (numline >= nti->NbLines()) || (numline < 0) ) {
656 cerr << "ntline2var Error: numline" << tokens[1] << " out of bounds" << endl;
657 return(0);
658 }
659 r_8* dline = nti->GetLineD(numline);
660 for(int kkv=0; kkv<nti->NbColumns(); kkv++) {
661 sprintf(buff, "%lg ", dline[kkv]);
662 v2str += buff;
663 }
664 }
665 else {
666 int numcol = atoi(tokens[1].c_str());
667 if ( (numcol >= nti->NbColumns()) || (numcol < 0) ) {
668 cerr << "ntcol2var Error: numcol" << tokens[1] << " out of bounds" << endl;
669 return(0);
670 }
671 int_8 kks = 0;
672 int_8 kke = nti->NbLines();
673 int_8 kkp = 1;
674 if (tokens.size() > 3) Services2NObjMgr::DecodeLoopParameters(tokens[3], kks, kke, kkp);
675 if (kks < 0) kks = 0;
676 if (kke > (int_8)nti->NbLines()) kke = nti->NbLines();
677 if (kkp < 1) kkp = 1;
678 int nelt = (kke-kks-1)/kkp;
679 if (nelt > MAXNWORDSO2V) {
680 nelt = MAXNWORDSO2V;
681 cout << "ntcol2var Warning: Only " << nelt
682 << " lines " << " will be converted to string" << endl;
683 kke = kks+nelt*kkp;
684 }
685 r_8* dline;
686 for(int kkl=kks; kkl<kke; kkl+=kkp) {
687 dline = nti->GetLineD(kkl);
688 sprintf(buff, "%lg ", dline[numcol]);
689 v2str += buff;
690 }
691 }
692 mObjMgr->SetVar(tokens[2], v2str);
693 if (adel) delete nti;
694}
695
696// -------------------------------------------------------
697// Copie d'objets
698else if ( (kw == "copy") || (kw == "cp") ) {
699 if(tokens.size()<2) {
700 cout<<"Usage: copy name_from name_to"<<endl;return(0);
701 }
702 mObjMgr->CopyObj(tokens[0],tokens[1]);
703}
704
705
706// >>>>>>>>>>> Affichage des objets
707else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
708 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
709 string opt = "next";
710 if (tokens.size() > 1) opt = tokens[1];
711 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
712 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
713 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
714 }
715
716else if (kw == "nt2d") {
717 if (tokens.size() < 3) {
718 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
719 return(0);
720 }
721 while (tokens.size() < 8) tokens.push_back("");
722 string ph = "";
723 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
724 tokens[5], tokens[6], tokens[7], false);
725 }
726else if (kw == "nt3d") {
727 if (tokens.size() < 7) {
728 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
729 return(0);
730 }
731 while (tokens.size() < 10) tokens.push_back("");
732 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
733 tokens[6], tokens[7], tokens[8], tokens[9], true);
734 }
735else if (kw == "vecplot") {
736 if (tokens.size() < 2) {
737 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
738 return(0);
739 }
740 while (tokens.size() < 3) tokens.push_back("");
741 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
742}
743else if (kw == "bargraph") {
744 if (tokens.size() < 2) {
745 cout << "Usage: bargraph gr_opt v1 [v2 ...]" << endl;
746 return(0);
747 }
748 PIBarGraph* bgd = new PIBarGraph;
749 for(int k=1; k<tokens.size(); k++)
750 bgd->AddBar(atof(tokens[k].c_str()));
751 string grname = "BarGraph";
752 mImgApp->DispScDrawer(bgd, grname, tokens[0]);
753}
754
755// Obsolete : ne pas virer SVP, cmv 26/7/99
756else if (kw == "gfd2d") {
757 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
758 if(tokens.size()<2)
759 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
760 return(0);}
761 string numvary = "";
762 string err = "";
763 string opt = "next";
764 if(tokens.size()>2) err = tokens[2];
765 if(tokens.size()>3) opt = tokens[3];
766 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
767 }
768else if (kw == "gfd3d") {
769 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
770 if(tokens.size()<3)
771 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
772 return(0);}
773 string err = "";
774 string opt = "next";
775 if(tokens.size()>3) err = tokens[3];
776 if(tokens.size()>4) opt = tokens[4];
777 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
778 }
779
780// >>>>>>>>>>> Trace de fonctions
781else if ( (kw == "func") ) {
782 if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
783 int np = 100;
784 double xmin=0., xmax=1.;
785 string opt = "", nom = "";
786 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
787 if (tokens.size() > 3) np = atoi(tokens[3].c_str());
788 if (tokens.size() > 4) opt = tokens[4];
789 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
790 }
791else if ( (kw == "funcff") ) {
792 if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
793 int np = 100;
794 double xmin=0., xmax=1.;
795 string opt = "", nom = "";
796 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
797 if(tokens.size()>4) np = atoi(tokens[4].c_str());
798 if(tokens.size()>5) opt = tokens[5];
799 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
800 }
801else if ( (kw == "func2d") ) {
802 if (tokens.size() < 7) {
803 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
804 return(0);
805 }
806 int npx, npy;
807 double xmin, xmax;
808 double ymin, ymax;
809 npx = npy = 50;
810 xmin = 0.; xmax = 1.;
811 ymin = 0.; ymax = 1.;
812 npx = atoi(tokens[3].c_str());
813 npy = atoi(tokens[6].c_str());
814 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
815 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
816 string opt = "";
817 if (tokens.size() > 7) opt = tokens[7];
818 string nom = "";
819 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
820 }
821else if ( (kw == "func2dff") ) {
822 if (tokens.size() < 8) {
823 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
824 return(0);
825 }
826 int npx, npy;
827 double xmin, xmax;
828 double ymin, ymax;
829 npx = npy = 50;
830 xmin = 0.; xmax = 1.;
831 ymin = 0.; ymax = 1.;
832 npx = atoi(tokens[4].c_str());
833 npy = atoi(tokens[7].c_str());
834 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
835 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
836 string opt = "";
837 if (tokens.size() > 8) opt = tokens[8];
838 string nom = "";
839 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
840 }
841
842// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
843else if (kw == "plot2d" ) {
844 if (tokens.size() < 3) {
845 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
846 return(0);
847 }
848 string errx = ""; string erry = "";
849 if (tokens.size() < 4) tokens.push_back("1");
850 while (tokens.size() < 6) tokens.push_back("");
851 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
852 }
853
854else if (kw == "plot2de" ) { // Plot2D avec les erreurs
855 if (tokens.size() < 5) {
856 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
857 return(0);
858 }
859 if (tokens.size() < 6) tokens.push_back("1");
860 while (tokens.size() < 8) tokens.push_back("");
861 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
862 tokens[5],tokens[6],tokens[7]);
863 }
864
865else if (kw == "plot2dw" ) { // Plot2d avec poids
866 if (tokens.size() < 4) {
867 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
868 return(0);
869 }
870 if (tokens.size() < 5) tokens.push_back("1");
871 while (tokens.size() < 7) tokens.push_back("");
872 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
873 }
874else if (kw == "plot3d" ) {
875 if (tokens.size() < 4) {
876 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
877 return(0);
878 }
879 if (tokens.size() < 5) tokens.push_back("1");
880 while (tokens.size() < 7) tokens.push_back("");
881 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
882 }
883
884else if (kw == "projh1d" ) {
885 if (tokens.size() < 3) {
886 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
887 return(0);
888 }
889 if (tokens.size() < 4) tokens.push_back("1.");
890 if (tokens.size() < 5) tokens.push_back("1");
891 while (tokens.size() < 7) tokens.push_back("");
892 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
893 }
894
895
896// Projection dans histogrammes
897else if (kw == "projh2d" ) {
898 if (tokens.size() < 4) {
899 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
900 return(0);
901 }
902 if (tokens.size() < 5) tokens.push_back("1.");
903 if (tokens.size() < 6) tokens.push_back("1");
904 while (tokens.size() < 8) tokens.push_back("");
905 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
906 tokens[6], tokens[7] );
907 }
908
909else if (kw == "projprof" ) {
910 if (tokens.size() < 4) {
911 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
912 return(0);
913 }
914 if (tokens.size() < 5) tokens.push_back("1.");
915 if (tokens.size() < 6) tokens.push_back("1");
916 while (tokens.size() < 8) tokens.push_back("");
917 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
918 tokens[6], tokens[7] );
919 }
920
921// Projection dans vector/matrix
922else if (kw == "fillvec" ) {
923 if (tokens.size() < 4) {
924 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
925 return(0);
926 }
927 if (tokens.size() < 5) tokens.push_back("1");
928 while (tokens.size() < 7) tokens.push_back("");
929 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
930 }
931
932else if (kw == "fillmtx" ) {
933 if (tokens.size() < 5) {
934 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
935 return(0);
936 }
937 if (tokens.size() < 6) tokens.push_back("1");
938 while (tokens.size() < 8) tokens.push_back("");
939 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
940 tokens[6], tokens[7] );
941 }
942
943// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
944else if (kw == "ntfrascii" ) {
945 if(tokens.size() < 2) {
946 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
947 return(0);
948 }
949 double def_val = 0.;
950 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
951 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
952 }
953
954#ifndef SANS_EVOLPLANCK
955/* Lecture matrice/vecteur depuis fichier ASCII */
956else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
957 if(tokens.size() < 2) {
958 cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name [CommLine Separator]"<<endl;
959 return(0);
960 }
961 TMatrix<r_8> mtx;
962 TVector<r_8> vec;
963 FILE* fip = fopen(tokens[1].c_str(), "r");
964 if (fip == NULL) {
965 cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
966 return(0);
967 }
968 fclose(fip);
969 ifstream is(tokens[1].c_str());
970 sa_size_t nr, nc;
971 char clm = '#';
972 string sep = " \t";
973 if (tokens.size()>2) clm = tokens[2][0];
974 if (tokens.size()>3) sep = tokens[3];
975 if (kw == "mtxfrascii") {
976 mtx.ReadASCII(is, nr, nc, clm, sep.c_str());
977 mObjMgr->AddObj(mtx, tokens[0]);
978 cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
979 << tokens[1] << endl;
980 }
981 else {
982 vec.ReadASCII(is, nr, nc, clm, sep.c_str());
983 mObjMgr->AddObj(vec, tokens[0]);
984 cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
985 << tokens[1] << endl;
986 }
987}
988else if (kw == "arrtoascii") {
989 if(tokens.size() < 2) {
990 cout<<"Usage: arrtoascii array_name file_name "<<endl;
991 return(0);
992 }
993
994 AnyDataObj* obj;
995 obj = mObjMgr->GetObj(tokens[0]);
996 if(obj == NULL) {
997 cerr << "arrtoascii Error , No such object " << tokens[0] << endl;
998 return(0);
999 }
1000 BaseArray* ba = dynamic_cast<BaseArray *>(obj);
1001 if(ba == NULL) {
1002 cerr << "arrtoascii Error " << tokens[0] << " not a BaseArray ! " << endl;
1003 return(0);
1004 }
1005 ofstream os(tokens[1].c_str());
1006 ba->WriteASCII(os);
1007 cout << "arrtoascii: Array " << tokens[0] << " written to file " << tokens[1] << endl;
1008}
1009
1010#endif
1011
1012else if (kw == "fillnt" ) {
1013 if (tokens.size() < 5) {
1014 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
1015 return(0);
1016 }
1017 while (tokens.size() < 8) tokens.push_back("");
1018 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
1019 }
1020
1021else if (kw == "ntloop" ) {
1022 if (tokens.size() < 3) {
1023 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
1024 return(0);
1025 }
1026 while (tokens.size() < 5) tokens.push_back("");
1027 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
1028 }
1029
1030else if (kw == "ntexpcfile" ) {
1031 if (tokens.size() < 3) {
1032 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
1033 return(0);
1034 }
1035 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
1036 }
1037
1038else if (kw == "exptovec" ) {
1039 if (tokens.size() < 3) {
1040 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
1041 return(0);
1042 }
1043 while (tokens.size() < 6) tokens.push_back("");
1044 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
1045 }
1046
1047else if (kw == "fillgd1" ) {
1048 if (tokens.size() < 5) {
1049 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
1050 return(0);
1051 }
1052 if (tokens.size() < 6) tokens.push_back("1");
1053 if (tokens.size() < 7) tokens.push_back("");
1054 string expy = "";
1055 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
1056 }
1057
1058else if (kw == "fillgd2" ) {
1059 if (tokens.size() < 6) {
1060 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
1061 return(0);
1062 }
1063 if (tokens.size() < 7) tokens.push_back("1");
1064 if (tokens.size() < 8) tokens.push_back("");
1065 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
1066 }
1067
1068else if (kw == "gdfrvec" ) {
1069 if(tokens.size()<3) {
1070 cout<<"Usage: gdfrvec namegfd X Y\n"
1071 <<" gdfrvec namegfd X Y"
1072 <<" gdfrvec namegfd X Y ! EY\n"
1073 <<" gdfrvec namegfd X Y Z\n"
1074 <<" gdfrvec namegfd X Y Z EZ"<<endl;
1075 return(0);
1076 }
1077 while(tokens.size()<5) tokens.push_back("!");
1078 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
1079 }
1080
1081// >>>>>>>>>>> Calcul d'expression arithmetique
1082else if ( (kw == "eval") ) {
1083 if(tokens.size()<2)
1084 {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
1085 string expval = "";
1086 for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
1087 string resultvarname = "";
1088 if(isalpha(tokens[0][0])) resultvarname=tokens[0];
1089 mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
1090 }
1091
1092else {
1093 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
1094 return(-1);
1095 }
1096
1097return(0);
1098}
1099
1100// Fonction pour enregistrer le Help des Widgets et Windows de piapp
1101static void RegisterPIGraphicsHelp(PIACmd* piac);
1102
1103/* --Methode-- */
1104void PIABaseExecutor::RegisterCommands()
1105{
1106string kw, usage, grp;
1107grp = "External Modules";
1108string gdesc = "Dynamic load (shared object modules) management command group";
1109mpiac->AddHelpGroup(grp, gdesc);
1110kw = "loadmodule";
1111usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
1112usage += "\n Related commands: link";
1113mpiac->RegisterCommand(kw, usage, this, grp);
1114kw = "link";
1115usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
1116usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
1117usage += "\n Related commands: call loadmodule linkff2";
1118mpiac->RegisterCommand(kw, usage, this, grp);
1119kw = "linkff2";
1120usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
1121usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
1122usage += "\n Related commands: call link loadmodule";
1123mpiac->RegisterCommand(kw, usage, this, grp);
1124kw = "call";
1125usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
1126usage += "\n User function : f(vector<string>& args)";
1127usage += "\n Related commands: link";
1128mpiac->RegisterCommand(kw, usage, this, grp);
1129
1130grp = "Graphics";
1131gdesc = "Basic graphics and object display commands";
1132mpiac->AddHelpGroup(grp, gdesc);
1133kw = "zone";
1134usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
1135usage += "\n Related commands: newwin";
1136mpiac->RegisterCommand(kw, usage, this, grp);
1137kw = "newwin";
1138usage = "To Create a New Graphic window, with zones \n";
1139usage += " Window size can be specified \n";
1140usage += " Usage: newwin [nx ny [sizeX sizeY]] ";
1141usage += "\n Related commands: zone";
1142mpiac->RegisterCommand(kw, usage, this, grp);
1143kw = "stacknext";
1144usage = "Displays the next widget on stack window \n Usage: stacknext";
1145mpiac->RegisterCommand(kw, usage, this, grp);
1146
1147kw = "graphicatt";
1148usage = "To change default graphic options \n Usage: graphicatt att_list \n";
1149usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
1150usage += "\n ------------------ Graphic attribute list ------------------ \n";
1151usage += ">> Colors: defcol black white grey red blue green yellow \n";
1152usage += " magenta cyan turquoise navyblue orange siennared purple \n";
1153usage += " limegreen gold violet violetred blueviolet darkviolet \n";
1154usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
1155usage += " thickdashedline dottedline thindottedline thickdottedline \n";
1156usage += ">> Font Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
1157usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont \n";
1158usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont \n";
1159usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont \n";
1160usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont \n";
1161usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T> \n";
1162usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
1163usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
1164usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n";
1165usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T> \n";
1166usage += " arrowshapedarrow<T> farrowshapedarrow<T> \n";
1167usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n";
1168usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
1169usage += " grey128 invgrey128 colrj128 colbr128 \n";
1170usage += " red32cm green32cm blue32cm yellow32cm \n";
1171usage += " orange32cm cyan32cm violet32cm \n";
1172usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
1173usage += " midas_bluewhite midas_redwhite \n";
1174usage += " multicol16 multicol64 \n";
1175usage += " revcmap : This flag reverses ColorMap indexing \n";
1176usage += "--- For image displays: \n";
1177usage += ">> ZoomFactors zoomxN zoomx1 zoomx2 zoomx3 ... \n";
1178usage += " zoom/N zoom/2 zoom/3 zoom/4 ...\n";
1179usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
1180usage += ">> lut=ltyp,min,max -> Sets LUT type and min/max for image display \n";
1181usage += " (ltyp=lin/log/sqrt/square) \n";
1182usage += ">> image axes configuration: invx invy exchxy \n";
1183usage += ">> Axes / Axe labels / LogScale / xylimits / defdrrect \n";
1184usage += " See setaxesatt command \n";
1185usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
1186usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
1187usage += ">> DisplayWindow: next same win stack inset \n";
1188usage += " Related commands: setaxesatt setinsetlimits ";
1189mpiac->RegisterCommand(kw, usage, this, grp);
1190
1191kw = "setaxesatt";
1192usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
1193usage += "Color/Line/Font attributes and axes attributes \n";
1194usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n";
1195usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n";
1196usage += " centeredaxesgrid finecenteredaxesgrid\n";
1197usage += " axescenter=x0,y0 (only with centered axes, default \"axescenter=\")\n";
1198usage += " grid nogrid labels nolabels \n";
1199usage += " ticks noticks minorticks nominorticks \n";
1200usage += " extticks intticks extintticks \n";
1201usage += " nbticks=X_NTicks,Y_NTicks \n";
1202usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n";
1203usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n";
1204usage += " autofontsize=fsizef: Font size computed automatically \n";
1205usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
1206usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
1207usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
1208usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
1209usage += " The rectangle is defined as a fraction of the widget size\n";
1210mpiac->RegisterCommand(kw, usage, this, grp);
1211
1212kw = "setinsetlimits";
1213usage = "Define the display rectangle for drawers added as insets \n";
1214usage += " over existing graphic objects - limits expressed as fraction \n";
1215usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
1216usage += " Usage: setinsetlimits xmin xmax ymin ymax";
1217usage += "\n Related commands: graphicatt /inset";
1218mpiac->RegisterCommand(kw, usage, this, grp);
1219
1220kw = "drpanel";
1221usage = "Creates a new 2D drawing zone for addtext, addline \n";
1222usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
1223usage += "\n Related commands: addtext addline addrect addcirc ...";
1224mpiac->RegisterCommand(kw, usage, this, grp);
1225
1226kw = "addtext";
1227usage = "Adds a text string to the current graphic object";
1228usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1229usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
1230usage += "\n Alt<E> to remove the added element";
1231usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
1232usage += "\n (use quotes '' for multi word text strings) ";
1233usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1234usage += "\n Text position/direction attribute: ";
1235usage += "\n horizleft horizcenter horizright";
1236usage += "\n vertbottom vertcenter verttop ";
1237usage += "\n textdirhoriz textdirvertup textdirvertdown ";
1238usage += "\n Related commands: addctext addline addarrow addrect addfrect";
1239usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
1240mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1241
1242kw = "addctext";
1243usage = "Adds a composite text string with superscript and subscripts ";
1244usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1245usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
1246usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1247usage += "\n Related commands: addtext addline addrect ...";
1248usage += "\n (See command addtext and graphicatt for more details)";
1249mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1250
1251kw = "addline";
1252usage = "Adds a line to the current graphic object";
1253usage += "\n at the specified position (+ graphic attribute)";
1254usage += "\n The Base/AxesDrawer is used to handle added lines";
1255usage += "\n Alt<E> to remove the added element";
1256usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1257usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1258usage += "\n Related commands: addarrow addtext addrect addfrect ";
1259usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1260mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1261
1262kw = "addarrow";
1263usage = "Adds an arrow to the current graphic object";
1264usage += "\n at the specified position (+ graphic attribute)";
1265usage += "\n The Base/AxesDrawer is used to handle added lines";
1266usage += "\n Alt<E> to remove the added element";
1267usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1268usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1269usage += "\n Related commands: addline addtext addrect addfrect ";
1270usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1271mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1272kw = "addarrow_nc";
1273
1274kw = "addrect";
1275usage = "Adds a rectangle to the current graphic object";
1276usage += "\n between the specified positions (+ graphic attribute)";
1277usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1278usage += "\n Alt<E> to remove added element";
1279usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1280usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1281usage += "\n Related commands: addtext addline addarrow addfrect";
1282usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1283mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1284
1285kw = "addfrect";
1286usage = "Adds a filled rectangle to the current graphic object";
1287usage += "\n between the specified positions (+ graphic attribute)";
1288usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1289usage += "\n Alt<E> to remove added element";
1290usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1291usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1292usage += "\n Related commands: addtext addline addarrow addrect";
1293usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
1294mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1295
1296kw = "addmarker";
1297usage = "Adds a marker to the current graphic object";
1298usage += "\n at the specified position (+ graphic attribute)";
1299usage += "\n The Base/AxesDrawer is used to handle added circles";
1300usage += "\n Alt<E> to remove added element";
1301usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
1302usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1303usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1304usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1305mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1306
1307kw = "addcirc";
1308usage = "Adds a circle to the current graphic object";
1309usage += "\n with the specified center and radius (+ graphic attribute)";
1310usage += "\n The Base/AxesDrawer is used to handle added circles";
1311usage += "\n Alt<E> to remove added element";
1312usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1313usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1314usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1315usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
1316mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1317
1318kw = "addfcirc";
1319usage = "Adds a filled circle to the current graphic object";
1320usage += "\n with the specified center and radius (+ graphic attribute)";
1321usage += "\n The Base/AxesDrawer is used to handle added circles";
1322usage += "\n Alt<E> to remove added element";
1323usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1324usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1325usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1326usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
1327mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1328
1329kw = "addarca";
1330usage = "Adds an arc to the current graphic object";
1331usage += "\n defined by the circle (center+radius), start angle and angular extension";
1332usage += "\n Angles are specified in degrees";
1333usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1334usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1335usage += "\n Related commands: addtext addline addfarca addarc ...";
1336mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1337
1338kw = "addfarca";
1339usage = "Adds a filled arc to the current graphic object";
1340usage += "\n defined by the circle (center+radius), start angle and angular extension";
1341usage += "\n Angles are specified in degrees";
1342usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1343usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1344usage += "\n Related commands: addtext addline addarca addarc ...";
1345mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1346
1347kw = "addarc";
1348usage = "Adds an arc to the current graphic object";
1349usage += "\n defined by 3 points (+ graphic attribute)";
1350usage += "\n The Base/AxesDrawer is used to handle added arcs";
1351usage += "\n Alt<E> to remove the added element";
1352usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1353usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1354usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1355usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
1356mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1357
1358kw = "addfarc";
1359usage = "Adds a filled arc to the current graphic object";
1360usage += "\n defined by 3 points (+ graphic attribute)";
1361usage += "\n The Base/AxesDrawer is used to handle added arcs";
1362usage += "\n Alt<E> to remove added element";
1363usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1364usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1365usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1366usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
1367mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1368
1369kw = "addpoly";
1370usage = "Adds a polyline/polygon to the current graphic object";
1371usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1372usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1373usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1374usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1375usage += "\n addcirc addfcirc addfarc graphicatt";
1376mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1377
1378kw = "addfpoly";
1379usage = "Adds a filled polygon to the current graphic object";
1380usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1381usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1382usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1383usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1384usage += "\n addcirc addfcirc addfarc graphicatt";
1385mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1386
1387kw = "settitle";
1388usage = "Set the title string (top title / bottom title) for the current graphic object";
1389usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
1390usage += "\n Related commands: addtext graphicatt";
1391mpiac->RegisterCommand(kw, usage, this, grp);
1392
1393kw = "addtitle";
1394usage = "Set the title string (top title / bottom title) \n";
1395usage += " alias for settitle ";
1396mpiac->RegisterCommand(kw, usage, this, grp);
1397
1398kw = "setaxelabels";
1399usage = "Set the X and Y axis labels for the current 2D graphic object \n";
1400usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
1401usage += "\n Related commands: settitle addtext graphicatt";
1402mpiac->RegisterCommand(kw, usage, this, grp);
1403
1404kw = "addaxelabels";
1405usage = "Set the X and Y axis labels for the current 2D graphic object";
1406usage += " alias for setaxelabels ";
1407mpiac->RegisterCommand(kw, usage, this, grp);
1408
1409RegisterPIGraphicsHelp(mpiac);
1410
1411kw = "openfits";
1412usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
1413usage += "\n Related commands: savefits openppf";
1414mpiac->RegisterCommand(kw, usage, this, "FileIO");
1415kw = "savefits";
1416usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
1417usage += "\n Related commands: openfits saveobjs saveall";
1418mpiac->RegisterCommand(kw, usage, this, "FileIO");
1419kw = "openppf";
1420usage = "Reads all objects from a PPF file \n Usage: openppf filename";
1421usage += "\n Related commands: saveall openfits";
1422mpiac->RegisterCommand(kw, usage, this, "FileIO");
1423kw = "saveppf";
1424usage = "Saves objects with names matching a pattern into a\n";
1425usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1426usage += "Usage: saveppf nameobjpattern filename";
1427usage += "\n Related commands: saveobjs saveall openppf savefits";
1428mpiac->RegisterCommand(kw, usage, this, "FileIO");
1429kw = "saveobjs";
1430usage = "Saves objects with names matching a pattern into a\n";
1431usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1432usage += "Usage: saveobjs nameobjpattern filename";
1433usage += "\n Related commands: saveppf saveall openppf savefits";
1434mpiac->RegisterCommand(kw, usage, this, "FileIO");
1435kw = "saveall";
1436usage = "Saves all objects into a PPF file \n Usage: saveall filename";
1437usage += "\n Related commands: saveobj openppf savefits";
1438mpiac->RegisterCommand(kw, usage, this, "FileIO");
1439kw = "ntfrascii";
1440usage = "Fills an existing NTuple from ASCII table file";
1441usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
1442usage += "\n Related commands: ntloop fillnt ";
1443mpiac->RegisterCommand(kw, usage, this, "FileIO");
1444#ifndef SANS_EVOLPLANCK
1445kw = "mtxfrascii";
1446usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
1447usage += "\n Usage: mtxfrascii mtx_name file_name [CommChar Separator]";
1448usage += "\n Related commands: arrtoascii vecfrascii ntfrascii ";
1449mpiac->RegisterCommand(kw, usage, this, "FileIO");
1450kw = "vecfrascii";
1451usage = "Reads a vector from an ASCII file (TVector<r_8>)";
1452usage += "\n Usage: vecfrascii vec_name file_name";
1453usage += "\n Related commands: arrtoascii mtxfrascii ntfrascii [CommChar Separator]";
1454mpiac->RegisterCommand(kw, usage, this, "FileIO");
1455kw = "arrtoascii";
1456usage = "Writes an array (TArray<T>) to an ASCII file ";
1457usage += "\n Usage: arrtoascii array_name file_name";
1458usage += "\n Related commands: mtxfrascii vecfrascii ntfrascii ";
1459mpiac->RegisterCommand(kw, usage, this, "FileIO");
1460#endif
1461
1462kw = "print";
1463usage = "Prints an object \n Usage: print nameobj";
1464mpiac->RegisterCommand(kw, usage, this, "FileIO");
1465
1466kw = "mkdir";
1467usage = "Create a directory";
1468usage += "\n Usage: mkdir dirname [true]";
1469usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
1470mpiac->RegisterCommand(kw, usage, this, "Object Management");
1471kw = "rmdir";
1472usage = "Removes an empty directory";
1473usage += "\n Usage: remove dirname";
1474mpiac->RegisterCommand(kw, usage, this, "Object Management");
1475kw = "setdiratt";
1476usage = "Sets directory attributes";
1477usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
1478usage += "\n KeepOldFlag=true Object with the same name is moved to old";
1479usage += "\n when adding objects";
1480mpiac->RegisterCommand(kw, usage, this, "Object Management");
1481kw = "cd";
1482usage = "Change current directory";
1483usage += "\n Usage: cd [dirname]";
1484mpiac->RegisterCommand(kw, usage, this, "Object Management");
1485kw = "pwd";
1486usage = "Prints current directory";
1487usage += "\n Usage: pwd";
1488mpiac->RegisterCommand(kw, usage, this, "Object Management");
1489kw = "listdirs";
1490usage = "Prints the list of directories";
1491usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
1492mpiac->RegisterCommand(kw, usage, this, "Object Management");
1493kw = "listobjs";
1494usage = "Prints the list of objects (Alias: ls)";
1495 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
1496mpiac->RegisterCommand(kw, usage, this, "Object Management");
1497kw = "rename";
1498usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
1499usage += "\n Related commands: mv del delobjs";
1500mpiac->RegisterCommand(kw, usage, this, "Object Management");
1501kw = "mv";
1502usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1503usage += "\n Related commands: rename del delobjs";
1504mpiac->RegisterCommand(kw, usage, this, "Object Management");
1505kw = "copy";
1506usage = "Copy objects (Alias cp) \n";
1507usage +=" Usage: copy name_from name_to";
1508usage += "\n Related commands: cp new...";
1509mpiac->RegisterCommand(kw, usage, this, "Object Management");
1510kw = "cp";
1511usage = "Copy objects (Alias copy) \n";
1512usage +=" Usage: cp name_from name_to";
1513usage += "\n Related commands: copy new...";
1514mpiac->RegisterCommand(kw, usage, this, "Object Management");
1515kw = "del";
1516usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
1517usage += "\n Related commands: rm delobjs rename";
1518mpiac->RegisterCommand(kw, usage, this, "Object Management");
1519kw = "rm";
1520usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1521usage += "\n Related commands: del delobjs rename";
1522mpiac->RegisterCommand(kw, usage, this, "Object Management");
1523kw = "delobjs";
1524usage = "Delete a set of objects with names matching a pattern (x?y*)";
1525usage += "\n Usage: delobjs nameobjpattern \n";
1526usage += "\n Related commands: del rename";
1527mpiac->RegisterCommand(kw, usage, this, "Object Management");
1528
1529kw = "newh1d";
1530usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
1531usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
1532mpiac->RegisterCommand(kw, usage, this, "Objects");
1533kw = "newh2d";
1534usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
1535usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
1536mpiac->RegisterCommand(kw, usage, this, "Objects");
1537kw = "newprof";
1538usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
1539usage += "\n Errors represent the data spread in the X bin ";
1540usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
1541mpiac->RegisterCommand(kw, usage, this, "Objects");
1542kw = "newprofe";
1543usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1544usage += "\n Errors represent the error on the data mean in the X bin ";
1545usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
1546mpiac->RegisterCommand(kw, usage, this, "Objects");
1547kw = "newnt";
1548usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1549usage += "\n newnt name nvar";
1550usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
1551mpiac->RegisterCommand(kw, usage, this, "Objects");
1552kw = "newgfd";
1553usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
1554usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
1555mpiac->RegisterCommand(kw, usage, this, "Objects");
1556kw = "newvec";
1557usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
1558usage += "\n Related commands: newmtx line2vec";
1559mpiac->RegisterCommand(kw, usage, this, "Objects");
1560kw = "newmtx";
1561usage = "Creates (and optionaly fills) a matrix \n";
1562usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
1563usage += "\n Related commands: newvec";
1564mpiac->RegisterCommand(kw, usage, this, "Objects");
1565kw = "line2vec";
1566usage = "Creates a vector from the line \n";
1567usage += " Usage: line2vec vecname v0 v1 v2 ... \n";
1568usage += " Related commands: newvec line2nt";
1569mpiac->RegisterCommand(kw, usage, this, "Objects");
1570kw = "line2nt";
1571usage = "Fills (append) an NTuple from the line content \n";
1572usage += " Usage: line2nt ntname col0 col1 ... \n";
1573usage += " Related commands: newnt line2vec ntline2var ntcol2var";
1574mpiac->RegisterCommand(kw, usage, this, "Objects");
1575kw = "vec2var";
1576usage = "Vector content to an interpreter variable varname = 'v0 v1 v2 ...' \n";
1577usage += " Usage: line2vec vecname varname [LoopParam start:end[:step] ]\n";
1578usage += " Related commands: line2vec ntline2var";
1579mpiac->RegisterCommand(kw, usage, this, "Objects");
1580kw = "ntline2var";
1581usage = "Object NTupleInterface line to an interpreter variable \n";
1582usage += " Usage: ntline2var objname line_number varname \n";
1583usage += " Related commands: vec2var ntcol2var";
1584mpiac->RegisterCommand(kw, usage, this, "Objects");
1585kw = "ntcol2var";
1586usage = "Object NTupleInterface column to an interpreter variable \n";
1587usage += " Usage: ntline2var objname column_number varname [LoopParam start:end[:step] ] \n";
1588usage += " Related commands: vec2var ntline2var";
1589mpiac->RegisterCommand(kw, usage, this, "Objects");
1590
1591kw = "disp";
1592usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
1593usage += "\n Related commands: surf nt2d nt3d vecplot";
1594mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1595kw = "imag";
1596usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
1597usage += "\n Related commands: disp surf nt2d nt3d vecplot";
1598mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1599kw = "surf";
1600usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
1601usage += "\n Related commands: disp nt2d nt3d vecplot";
1602mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1603kw = "nt2d";
1604usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
1605usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
1606usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
1607mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1608kw = "nt3d";
1609usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
1610usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
1611usage += "\n Related commands: disp surf nt2d gfd3d ";
1612mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1613kw = "vecplot";
1614usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
1615usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
1616usage += "\n Related commands: disp nt2d ";
1617mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1618kw = "bargraph";
1619usage = "Bar-Graph view of a sequence of values ";
1620usage += "\n Usage : bargraph graphic_attributes v1 [v2 v3 ...] ";
1621usage += "\n Related commands: disp nt2d vecplot";
1622mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1623
1624// Ceci est maintenant obsolete, on garde pour info.
1625kw = "gfd2d";
1626usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
1627usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
1628usage += "\n Related commands: gfd3d nt2d nt3d ";
1629usage += "\n ----- OBSOLETE: utilisez nt2d -----";
1630mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1631kw = "gfd3d";
1632usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
1633usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
1634usage += "\n Related commands: gfd2d nt2d nt3d ";
1635usage += "\n ----- OBSOLETE: utilisez nt3d -----";
1636mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1637
1638kw = "func";
1639usage = "Displays a function y=f(x) (Fills a vector with function values)";
1640usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
1641usage += "\n Related commands: funcff func2d func2dff ";
1642mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1643kw = "funcff";
1644usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
1645usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
1646usage += "\n Related commands: func func2d func2dff ";
1647mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1648kw = "func2d";
1649usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1650usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1651usage += "\n Related commands: func";
1652mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1653kw = "func2dff";
1654usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1655usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1656usage += "\n Related commands: func funcff func2d ";
1657mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1658
1659kw = "ObjectExpressions";
1660usage = "Any mathematical expression (math.h) with object variables can be used";
1661usage += "\n ------ Object Variable names (double) -------- ";
1662usage += "\n (_nl is the table line number or the sequential index)";
1663usage += "\n- NTuple: ntuple variable names,_nl";
1664usage += "\n- Histo1D/HProf: i,x,val,err,_nl";
1665usage += "\n- Histo2D: i,j,x,y,val,err,_nl";
1666usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl";
1667usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl";
1668usage += "\n- Image: i,j,x,y,val(=pix),_nl";
1669usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok ,_nl";
1670usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
1671usage += "\n- i,k,val,real,imag,mod,phas,teta,phi,_nl";
1672usage += "\n- FITS Binary/ASCII table: fits column names,_nl";
1673#ifdef SANS_EVOLPLANCK
1674usage += "\n ------ Eros Variable names (double) -------- ";
1675usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
1676usage += "\n- xref,yref,fluxref,fondref,pixmaxref,_nl";
1677#endif
1678usage += "\n ------ Other parameters -------- ";
1679usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1680usage += "\nThe default Cut() expression in true (=1) for all";
1681usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d ";
1682usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1683usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
1684grp = "Expr. Plotting";
1685mpiac->RegisterHelp(kw, usage, grp);
1686kw = "plot2d";
1687usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
1688usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
1689usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
1690mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1691kw = "plot2de";
1692usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1693usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1694usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1695mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1696kw = "plot2dw";
1697usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
1698usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1699usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1700mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1701kw = "plot3d";
1702usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
1703usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1704usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
1705mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1706
1707kw = "projh1d";
1708usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
1709usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
1710usage += "\n Histo1D nameh1d is created if necessary ";
1711usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
1712mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1713kw = "projh2d";
1714usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
1715usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1716usage += "\n Histo2D nameh2d is created if necessary ";
1717usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
1718mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1719kw = "projprof";
1720usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
1721usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1722usage += "\n HProf nameprof is created if necessary ";
1723usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
1724mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1725kw = "fillvec";
1726usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1727usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1728usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1729mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1730kw = "fillmtx";
1731usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1732usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1733usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1734mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1735
1736kw = "fillnt";
1737usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1738usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
1739usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
1740usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
1741mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1742
1743kw = "ntloop";
1744usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1745usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1746usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1747usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
1748usage += "\n Related commands: ntexpcfile fillnt";
1749mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1750
1751kw = "ntexpcfile";
1752usage = "Creates a C-File with declarations suitable to be used for ntloop";
1753usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1754usage += "\n Related commands: ntloop";
1755mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1756
1757kw = "exptovec";
1758usage = "Creates and Fills a Vector with X=f(Object)";
1759usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1760usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1761mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1762kw = "fillgd1";
1763usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1764usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1765usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1766mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1767kw = "fillgd2";
1768usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1769usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1770usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1771mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1772kw = "gdfrvec";
1773usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1774usage += "\n Usage: gdfrvec namegfd X Y";
1775usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1776usage += "\n Usage: gdfrvec namegfd X Y Z";
1777usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1778usage += "\n Related commands: fillgd1 fillgd2 ...";
1779mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1780
1781
1782kw = "eval";
1783usage = "Compute arithmetic expression\n";
1784usage += "\n Usage: eval resultvarname arithmetic expression....";
1785usage += "\n resultvarname: store result in variable resultvarname";
1786usage += "\n - If first character is not alphabetic, just print result";
1787usage += "\n arithmetic expression:";
1788usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1789usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1790usage += "\n ex: 360 * M_PI / 180.";
1791mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1792
1793}
1794
1795/* --Methode-- */
1796int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1797// string& func4, string& func5)
1798{
1799string cmd;
1800
1801if (dynlink) delete dynlink; dynlink = NULL;
1802usfmap.clear();
1803
1804dynlink = new PDynLinkMgr(fnameso, true);
1805if (dynlink == NULL) {
1806 string sn = fnameso;
1807 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1808 return(2);
1809 }
1810
1811int nok=0;
1812// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1813// DlUserProcFunction f = NULL;
1814DlFunction f = NULL;
1815if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1816// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1817f = dynlink->GetFunction(func1);
1818if (f) { nok++; usfmap[func1] = f; }
1819else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1820
1821if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1822// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1823f = dynlink->GetFunction(func2);
1824if (f) { nok++; usfmap[func2] = f; }
1825else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1826
1827if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1828// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1829f = dynlink->GetFunction(func3);
1830if (f) { nok++; usfmap[func3] = f; }
1831else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1832
1833/* Pb compile g++ 2.7.2
1834if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1835// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1836f = dynlink->GetFunction(func4);
1837if (f) { nok++; usfmap[func4] = f; }
1838else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1839
1840if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1841// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1842f = dynlink->GetFunction(func5);
1843if (f) { nok++; usfmap[func5] = f; }
1844else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1845*/
1846fin:
1847if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1848else return(0);
1849}
1850
1851/* --Methode-- */
1852int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1853{
1854string cmd;
1855
1856if (dynlink2) delete dynlink2; dynlink2 = NULL;
1857usfmap2.clear();
1858
1859dynlink2 = new PDynLinkMgr(fnameso, true);
1860if (dynlink2 == NULL) {
1861 string sn = fnameso;
1862 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1863 return(2);
1864 }
1865
1866int nok=0;
1867// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1868// DlUserProcFunction f = NULL;
1869DlFunction f = NULL;
1870if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1871f = dynlink2->GetFunction(func1);
1872if (f) { nok++; usfmap2[func1] = f; }
1873else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1874
1875if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1876f = dynlink2->GetFunction(func2);
1877if (f) { nok++; usfmap2[func2] = f; }
1878else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1879
1880if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1881f = dynlink2->GetFunction(func3);
1882if (f) { nok++; usfmap2[func3] = f; }
1883else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1884
1885fin:
1886if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1887else return(0);
1888}
1889
1890/* Nouvelle-Fonction */
1891void RegisterPIGraphicsHelp(PIACmd* piac)
1892{
1893string kw,grp,usage;
1894
1895grp = "Graphics";
1896
1897kw = "PIImage";
1898usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1899usage += "and controls a zoom widget, as well as a global image view widget \n";
1900usage += ">>>> Mouse controls : \n";
1901usage += "o Button-1: Display current coordinates and pixel value\n";
1902usage += " Position the cursor an refresh the zoom widget\n";
1903usage += "o Button-2: Defines an image zone and positions the cursor \n";
1904usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1905usage += ">>>> Keyboard controls : \n";
1906usage += "o <Alt>R : Refresh display \n";
1907usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1908usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1909usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1910usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1911usage += "o <Alt>X : Show/Hide the Cut Window \n";
1912usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1913usage += "o <Alt>E : Removes the last added graphic element \n";
1914usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
1915usage += "o <Alt>- or <Cntl>- : Zoom out \n";
1916usage += "o Cursor keys : Moves the image cursor \n";
1917piac->RegisterHelp(kw, usage, grp);
1918
1919kw = "PIScDrawWdg";
1920usage = "Manages display of 2-D drawers with interactive zoom \n";
1921usage += ">>>> Mouse controls : \n";
1922usage += "o Button-1: Display current coordinates \n";
1923usage += "o Button-2: Defines a rectangle for zoom \n";
1924usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1925usage += ">>>> Keyboard controls : \n";
1926usage += "o <Alt>R : Refresh display \n";
1927usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1928usage += " Specific controls for 2-D histograms \n";
1929usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1930usage += " Drawer 0 manages the axes, as well as the added text \n";
1931usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1932usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1933usage += "o <Alt>E : Removes the last added graphic element \n";
1934usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
1935usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
1936usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
1937usage += ">>>> Mouse + Keyboard controls : \n";
1938usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
1939piac->RegisterHelp(kw, usage, grp);
1940
1941kw = "PIDraw3DWdg";
1942usage = "Manages display of 3-D objects (drawers) \n";
1943usage += ">>>> Mouse controls : \n";
1944usage += "o Button-2: Rotates the observer (camera) around object \n";
1945usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1946usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1947usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1948usage += ">>>> Keyboard controls : \n";
1949usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1950usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1951usage += "o <Alt>O : = <Alt>G \n";
1952usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1953usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1954usage += "o <Alt>E : Removes the last added graphic element \n";
1955usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1956usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1957piac->RegisterHelp(kw, usage, grp);
1958
1959kw = "Windows";
1960usage = "Objects can be displayed in different windows, or overlayed on the \n";
1961usage += "previous display. The graphics attributes next,win,stack,same control \n";
1962usage += "the display window. \n";
1963usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1964usage += " Graphic windows can be divided int zones. Object is displayed \n";
1965usage += " in the next available position, removing a previously displayed \n";
1966usage += " widget if necessary \n";
1967usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1968usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1969usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1970usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1971usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1972usage += " be activated using the StackTools menu (Blink) \n";
1973usage += "o Most objects can be also be displayed overlayed \n";
1974usage += " on the last displayed widget (gr_att= same) \n";
1975usage += "o The overlay can be on a selected rectangle of the \n";
1976usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
1977usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
1978piac->RegisterHelp(kw, usage, grp);
1979
1980kw = "PIConsole";
1981usage = "Text output area and command editing window (console) \n";
1982usage += ">>>> Mouse controls : \n";
1983usage += "o Button-1: Rectangle selection for copy/paste \n";
1984usage += "o Button-2: Paste text in the command editing line \n";
1985usage += "o Button-3: activate display option menu \n";
1986usage += ">>>> Keyboard controls : \n";
1987usage += "o <Alt>O : activate display option menu \n";
1988usage += "o <Alt>V : Paste text in the command editing line \n";
1989usage += "o <Alt>A : Selection of the whole window for copy \n";
1990usage += "o <Alt>L : Command history (List of command history buffer) \n";
1991usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1992usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1993usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1994usage += "o <Ctl>C : Command editing -> Clear the line \n";
1995usage += "o Cursor left,right : Command editing -> Move cursor \n";
1996usage += "o Cursor Up,Down : recall command from history buffer \n";
1997usage += "o Backspace,Del : Command editing \n";
1998usage += "o <Return>,<Enter> : Execute command \n";
1999piac->RegisterHelp(kw, usage, grp);
2000}
Note: See TracBrowser for help on using the repository browser.