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

Last change on this file since 2350 was 2350, checked in by ansari, 23 years ago

Ajout nouvelles options pour trace d'axes ds le Help de baseexecut.cc
et ajout d'une nouvelle option (connectpoints) ds PINTupleDrawer (et 3D)

Reza 18 Mars 2003

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