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

Last change on this file since 2521 was 2521, checked in by cmv, 22 years ago

b;abla pour axescenter=x0,y0 cmv 19/03/04

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