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

Last change on this file since 2494 was 2494, checked in by ansari, 22 years ago

Suite debugging gestion lock entre threads ds piapp - A l'air de

marcher sur OSF1 et Linux ... Reza 06/01/2004

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