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

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

Ajout aide options decodage d'axes PIImage ds graphic_att - Reza 01/04/2003

File size: 80.8 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 += "--- For image displays: \n";
1135usage += ">> ZoomFactors zoomxN zoomx1 zoomx2 zoomx3 ... \n";
1136usage += " zoom/N zoom/2 zoom/3 zoom/4 ...\n";
1137usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
1138usage += ">> lut=ltyp,min,max -> Sets LUT type and min/max for image display \n";
1139usage += " (ltyp=lin/log/sqrt/square) \n";
1140usage += ">> image axes configuration: invx invy exchxy \n";
1141usage += ">> Axes / Axe labels / LogScale / xylimits / defdrrect \n";
1142usage += " See setaxesatt command \n";
1143usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
1144usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
1145usage += ">> DisplayWindow: next same win stack inset \n";
1146usage += " Related commands: setaxesatt setinsetlimits ";
1147mpiac->RegisterCommand(kw, usage, this, "Graphics");
1148
1149kw = "setaxesatt";
1150usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
1151usage += "Color/Line/Font attributes and axes attributes \n";
1152usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n";
1153usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n";
1154usage += " centeredaxesgrid finecenteredaxesgrid \n";
1155usage += " grid nogrid labels nolabels \n";
1156usage += " ticks noticks minorticks nominorticks \n";
1157usage += " extticks intticks extintticks \n";
1158usage += " nbticks=X_NTicks,Y_NTicks \n";
1159usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n";
1160usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n";
1161usage += " autofontsize=fsizef: Font size computed automatically \n";
1162usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
1163usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
1164usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
1165usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
1166usage += " The rectangle is defined as a fraction of the widget size\n";
1167mpiac->RegisterCommand(kw, usage, this, "Graphics");
1168
1169kw = "setinsetlimits";
1170usage = "Define the display rectangle for drawers added as insets \n";
1171usage += " over existing graphic objects - limits expressed as fraction \n";
1172usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
1173usage += " Usage: setinsetlimits xmin xmax ymin ymax";
1174usage += "\n Related commands: graphicatt /inset";
1175mpiac->RegisterCommand(kw, usage, this, "Graphics");
1176
1177kw = "drpanel";
1178usage = "Creates a new 2D drawing zone for addtext, addline \n";
1179usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
1180usage += "\n Related commands: addtext addline addrect addcirc ...";
1181mpiac->RegisterCommand(kw, usage, this, "Graphics");
1182
1183kw = "addtext";
1184usage = "Adds a text string to the current graphic object";
1185usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1186usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
1187usage += "\n Alt<E> to remove the added element";
1188usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
1189usage += "\n (use quotes '' for multi word text strings) ";
1190usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1191usage += "\n Text position/direction attribute: ";
1192usage += "\n horizleft horizcenter horizright";
1193usage += "\n vertbottom vertcenter verttop ";
1194usage += "\n textdirhoriz textdirvertup textdirvertdown ";
1195usage += "\n Related commands: addctext addline addarrow addrect addfrect";
1196usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
1197mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1198
1199kw = "addctext";
1200usage = "Adds a composite text string with superscript and subscripts ";
1201usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1202usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
1203usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1204usage += "\n Related commands: addtext addline addrect ...";
1205usage += "\n (See command addtext and graphicatt for more details)";
1206mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1207
1208kw = "addline";
1209usage = "Adds a line to the current graphic object";
1210usage += "\n at the specified position (+ graphic attribute)";
1211usage += "\n The Base/AxesDrawer is used to handle added lines";
1212usage += "\n Alt<E> to remove the added element";
1213usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1214usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1215usage += "\n Related commands: addarrow addtext addrect addfrect ";
1216usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1217mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1218
1219kw = "addarrow";
1220usage = "Adds an arrow to the current graphic object";
1221usage += "\n at the specified position (+ graphic attribute)";
1222usage += "\n The Base/AxesDrawer is used to handle added lines";
1223usage += "\n Alt<E> to remove the added element";
1224usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1225usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1226usage += "\n Related commands: addline addtext addrect addfrect ";
1227usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1228mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1229kw = "addarrow_nc";
1230
1231kw = "addrect";
1232usage = "Adds a rectangle to the current graphic object";
1233usage += "\n between the specified positions (+ graphic attribute)";
1234usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1235usage += "\n Alt<E> to remove added element";
1236usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1237usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1238usage += "\n Related commands: addtext addline addarrow addfrect";
1239usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1240mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1241
1242kw = "addfrect";
1243usage = "Adds a filled rectangle to the current graphic object";
1244usage += "\n between the specified positions (+ graphic attribute)";
1245usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1246usage += "\n Alt<E> to remove added element";
1247usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1248usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1249usage += "\n Related commands: addtext addline addarrow addrect";
1250usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
1251mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1252
1253kw = "addmarker";
1254usage = "Adds a marker to the current graphic object";
1255usage += "\n at the specified position (+ graphic attribute)";
1256usage += "\n The Base/AxesDrawer is used to handle added circles";
1257usage += "\n Alt<E> to remove added element";
1258usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
1259usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1260usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1261usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1262mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1263
1264kw = "addcirc";
1265usage = "Adds a circle to the current graphic object";
1266usage += "\n with the specified center and radius (+ graphic attribute)";
1267usage += "\n The Base/AxesDrawer is used to handle added circles";
1268usage += "\n Alt<E> to remove added element";
1269usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1270usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1271usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1272usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
1273mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1274
1275kw = "addfcirc";
1276usage = "Adds a filled circle to the current graphic object";
1277usage += "\n with the specified center and radius (+ graphic attribute)";
1278usage += "\n The Base/AxesDrawer is used to handle added circles";
1279usage += "\n Alt<E> to remove added element";
1280usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1281usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1282usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1283usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
1284mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1285
1286kw = "addarca";
1287usage = "Adds an arc to the current graphic object";
1288usage += "\n defined by the circle (center+radius), start angle and angular extension";
1289usage += "\n Angles are specified in degrees";
1290usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1291usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1292usage += "\n Related commands: addtext addline addfarca addarc ...";
1293mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1294
1295kw = "addfarca";
1296usage = "Adds a filled arc to the current graphic object";
1297usage += "\n defined by the circle (center+radius), start angle and angular extension";
1298usage += "\n Angles are specified in degrees";
1299usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1300usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1301usage += "\n Related commands: addtext addline addarca addarc ...";
1302mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1303
1304kw = "addarc";
1305usage = "Adds an arc to the current graphic object";
1306usage += "\n defined by 3 points (+ graphic attribute)";
1307usage += "\n The Base/AxesDrawer is used to handle added arcs";
1308usage += "\n Alt<E> to remove the added element";
1309usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1310usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1311usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1312usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
1313mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1314
1315kw = "addfarc";
1316usage = "Adds a filled arc to the current graphic object";
1317usage += "\n defined by 3 points (+ graphic attribute)";
1318usage += "\n The Base/AxesDrawer is used to handle added arcs";
1319usage += "\n Alt<E> to remove added element";
1320usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1321usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1322usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1323usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
1324mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1325
1326kw = "addpoly";
1327usage = "Adds a polyline/polygon to the current graphic object";
1328usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1329usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1330usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1331usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1332usage += "\n addcirc addfcirc addfarc graphicatt";
1333mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1334
1335kw = "addfpoly";
1336usage = "Adds a filled polygon to the current graphic object";
1337usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1338usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1339usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1340usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1341usage += "\n addcirc addfcirc addfarc graphicatt";
1342mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1343
1344kw = "settitle";
1345usage = "Set the title string (top title / bottom title) for the current graphic object";
1346usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
1347usage += "\n Related commands: addtext graphicatt";
1348mpiac->RegisterCommand(kw, usage, this, "Graphics");
1349
1350kw = "addtitle";
1351usage = "Set the title string (top title / bottom title) \n";
1352usage += " alias for settitle ";
1353mpiac->RegisterCommand(kw, usage, this, "Graphics");
1354
1355kw = "setaxelabels";
1356usage = "Set the X and Y axis labels for the current 2D graphic object \n";
1357usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
1358usage += "\n Related commands: settitle addtext graphicatt";
1359mpiac->RegisterCommand(kw, usage, this, "Graphics");
1360
1361kw = "addaxelabels";
1362usage = "Set the X and Y axis labels for the current 2D graphic object";
1363usage += " alias for setaxelabels ";
1364mpiac->RegisterCommand(kw, usage, this, "Graphics");
1365
1366RegisterPIGraphicsHelp(mpiac);
1367
1368kw = "openfits";
1369usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
1370usage += "\n Related commands: savefits openppf";
1371mpiac->RegisterCommand(kw, usage, this, "FileIO");
1372kw = "savefits";
1373usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
1374usage += "\n Related commands: openfits saveobjs saveall";
1375mpiac->RegisterCommand(kw, usage, this, "FileIO");
1376kw = "openppf";
1377usage = "Reads all objects from a PPF file \n Usage: openppf filename";
1378usage += "\n Related commands: saveall openfits";
1379mpiac->RegisterCommand(kw, usage, this, "FileIO");
1380kw = "saveppf";
1381usage = "Saves objects with names matching a pattern into a\n";
1382usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1383usage += "Usage: saveppf nameobjpattern filename";
1384usage += "\n Related commands: saveobjs saveall openppf savefits";
1385mpiac->RegisterCommand(kw, usage, this, "FileIO");
1386kw = "saveobjs";
1387usage = "Saves objects with names matching a pattern into a\n";
1388usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1389usage += "Usage: saveobjs nameobjpattern filename";
1390usage += "\n Related commands: saveppf saveall openppf savefits";
1391mpiac->RegisterCommand(kw, usage, this, "FileIO");
1392kw = "saveall";
1393usage = "Saves all objects into a PPF file \n Usage: saveall filename";
1394usage += "\n Related commands: saveobj openppf savefits";
1395mpiac->RegisterCommand(kw, usage, this, "FileIO");
1396kw = "ntfrascii";
1397usage = "Fills an existing NTuple from ASCII table file";
1398usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
1399usage += "\n Related commands: ntloop fillnt ";
1400mpiac->RegisterCommand(kw, usage, this, "FileIO");
1401#ifndef SANS_EVOLPLANCK
1402kw = "mtxfrascii";
1403usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
1404usage += "\n Usage: mtxfrascii mtx_name file_name [CommChar Separator]";
1405usage += "\n Related commands: arrtoascii vecfrascii ntfrascii ";
1406mpiac->RegisterCommand(kw, usage, this, "FileIO");
1407kw = "vecfrascii";
1408usage = "Reads a vector from an ASCII file (TVector<r_8>)";
1409usage += "\n Usage: vecfrascii vec_name file_name";
1410usage += "\n Related commands: arrtoascii mtxfrascii ntfrascii [CommChar Separator]";
1411mpiac->RegisterCommand(kw, usage, this, "FileIO");
1412kw = "arrtoascii";
1413usage = "Writes an array (TArray<T>) to an ASCII file ";
1414usage += "\n Usage: arrtoascii array_name file_name";
1415usage += "\n Related commands: mtxfrascii vecfrascii ntfrascii ";
1416mpiac->RegisterCommand(kw, usage, this, "FileIO");
1417#endif
1418
1419kw = "print";
1420usage = "Prints an object \n Usage: print nameobj";
1421mpiac->RegisterCommand(kw, usage, this, "FileIO");
1422
1423kw = "mkdir";
1424usage = "Create a directory";
1425usage += "\n Usage: mkdir dirname [true]";
1426usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
1427mpiac->RegisterCommand(kw, usage, this, "Object Management");
1428kw = "rmdir";
1429usage = "Removes an empty directory";
1430usage += "\n Usage: remove dirname";
1431mpiac->RegisterCommand(kw, usage, this, "Object Management");
1432kw = "setdiratt";
1433usage = "Sets directory attributes";
1434usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
1435usage += "\n KeepOldFlag=true Object with the same name is moved to old";
1436usage += "\n when adding objects";
1437mpiac->RegisterCommand(kw, usage, this, "Object Management");
1438kw = "cd";
1439usage = "Change current directory";
1440usage += "\n Usage: cd [dirname]";
1441mpiac->RegisterCommand(kw, usage, this, "Object Management");
1442kw = "pwd";
1443usage = "Prints current directory";
1444usage += "\n Usage: pwd";
1445mpiac->RegisterCommand(kw, usage, this, "Object Management");
1446kw = "listdirs";
1447usage = "Prints the list of directories";
1448usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
1449mpiac->RegisterCommand(kw, usage, this, "Object Management");
1450kw = "listobjs";
1451usage = "Prints the list of objects (Alias: ls)";
1452 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
1453mpiac->RegisterCommand(kw, usage, this, "Object Management");
1454kw = "rename";
1455usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
1456usage += "\n Related commands: mv del delobjs";
1457mpiac->RegisterCommand(kw, usage, this, "Object Management");
1458kw = "mv";
1459usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1460usage += "\n Related commands: rename del delobjs";
1461mpiac->RegisterCommand(kw, usage, this, "Object Management");
1462kw = "copy";
1463usage = "Copy objects (Alias cp) \n";
1464usage +=" Usage: copy name_from name_to";
1465usage += "\n Related commands: cp new...";
1466mpiac->RegisterCommand(kw, usage, this, "Object Management");
1467kw = "cp";
1468usage = "Copy objects (Alias copy) \n";
1469usage +=" Usage: cp name_from name_to";
1470usage += "\n Related commands: copy new...";
1471mpiac->RegisterCommand(kw, usage, this, "Object Management");
1472kw = "del";
1473usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
1474usage += "\n Related commands: rm delobjs rename";
1475mpiac->RegisterCommand(kw, usage, this, "Object Management");
1476kw = "rm";
1477usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1478usage += "\n Related commands: del delobjs rename";
1479mpiac->RegisterCommand(kw, usage, this, "Object Management");
1480kw = "delobjs";
1481usage = "Delete a set of objects with names matching a pattern (x?y*)";
1482usage += "\n Usage: delobjs nameobjpattern \n";
1483usage += "\n Related commands: del rename";
1484mpiac->RegisterCommand(kw, usage, this, "Object Management");
1485
1486kw = "newh1d";
1487usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
1488usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
1489mpiac->RegisterCommand(kw, usage, this, "Objects");
1490kw = "newh2d";
1491usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
1492usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
1493mpiac->RegisterCommand(kw, usage, this, "Objects");
1494kw = "newprof";
1495usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
1496usage += "\n Errors represent the data spread in the X bin ";
1497usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
1498mpiac->RegisterCommand(kw, usage, this, "Objects");
1499kw = "newprofe";
1500usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1501usage += "\n Errors represent the error on the data mean in the X bin ";
1502usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
1503mpiac->RegisterCommand(kw, usage, this, "Objects");
1504kw = "newnt";
1505usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1506usage += "\n newnt name nvar";
1507usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
1508mpiac->RegisterCommand(kw, usage, this, "Objects");
1509kw = "newgfd";
1510usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
1511usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
1512mpiac->RegisterCommand(kw, usage, this, "Objects");
1513kw = "newvec";
1514usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
1515usage += "\n Related commands: newmtx line2vec";
1516mpiac->RegisterCommand(kw, usage, this, "Objects");
1517kw = "newmtx";
1518usage = "Creates (and optionaly fills) a matrix \n";
1519usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
1520usage += "\n Related commands: newvec";
1521mpiac->RegisterCommand(kw, usage, this, "Objects");
1522kw = "line2vec";
1523usage = "Creates a vector from the line \n";
1524usage += " Usage: line2vec vecname v0 v1 v2 ... \n";
1525usage += " Related commands: newvec line2nt";
1526mpiac->RegisterCommand(kw, usage, this, "Objects");
1527kw = "line2nt";
1528usage = "Fills (append) an NTuple from the line content \n";
1529usage += " Usage: line2nt ntname col0 col1 ... \n";
1530usage += " Related commands: newnt line2vec ntline2var ntcol2var";
1531mpiac->RegisterCommand(kw, usage, this, "Objects");
1532kw = "vec2var";
1533usage = "Vector content to an interpreter variable varname = 'v0 v1 v2 ...' \n";
1534usage += " Usage: line2vec vecname varname [LoopParam start:end[:step] ]\n";
1535usage += " Related commands: line2vec ntline2var";
1536mpiac->RegisterCommand(kw, usage, this, "Objects");
1537kw = "ntline2var";
1538usage = "Object NTupleInterface line to an interpreter variable \n";
1539usage += " Usage: ntline2var objname line_number varname \n";
1540usage += " Related commands: vec2var ntcol2var";
1541mpiac->RegisterCommand(kw, usage, this, "Objects");
1542kw = "ntcol2var";
1543usage = "Object NTupleInterface column to an interpreter variable \n";
1544usage += " Usage: ntline2var objname column_number varname [LoopParam start:end[:step] ] \n";
1545usage += " Related commands: vec2var ntline2var";
1546mpiac->RegisterCommand(kw, usage, this, "Objects");
1547
1548kw = "disp";
1549usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
1550usage += "\n Related commands: surf nt2d nt3d vecplot";
1551mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1552kw = "imag";
1553usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
1554usage += "\n Related commands: disp surf nt2d nt3d vecplot";
1555mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1556kw = "surf";
1557usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
1558usage += "\n Related commands: disp nt2d nt3d vecplot";
1559mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1560kw = "nt2d";
1561usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
1562usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
1563usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
1564mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1565kw = "nt3d";
1566usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
1567usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
1568usage += "\n Related commands: disp surf nt2d gfd3d ";
1569mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1570kw = "vecplot";
1571usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
1572usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
1573usage += "\n Related commands: disp nt2d ";
1574mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1575
1576// Ceci est maintenant obsolete, on garde pour info.
1577kw = "gfd2d";
1578usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
1579usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
1580usage += "\n Related commands: gfd3d nt2d nt3d ";
1581usage += "\n ----- OBSOLETE: utilisez nt2d -----";
1582mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1583kw = "gfd3d";
1584usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
1585usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
1586usage += "\n Related commands: gfd2d nt2d nt3d ";
1587usage += "\n ----- OBSOLETE: utilisez nt3d -----";
1588mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1589
1590kw = "func";
1591usage = "Displays a function y=f(x) (Fills a vector with function values)";
1592usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
1593usage += "\n Related commands: funcff func2d func2dff ";
1594mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1595kw = "funcff";
1596usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
1597usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
1598usage += "\n Related commands: func func2d func2dff ";
1599mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1600kw = "func2d";
1601usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1602usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1603usage += "\n Related commands: func";
1604mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1605kw = "func2dff";
1606usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1607usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1608usage += "\n Related commands: func funcff func2d ";
1609mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1610
1611kw = "ObjectExpressions";
1612usage = "Any mathematical expression (math.h) with object variables can be used";
1613usage += "\n ------ Object Variable names (double) -------- ";
1614usage += "\n- NTuple: ntuple variable names";
1615usage += "\n- Histo1D/HProf: i,x,val,err";
1616usage += "\n- Histo2D: i,j,x,y,val,err";
1617usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas";
1618usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas";
1619usage += "\n- Image: i,j,x,y,val(=pix)";
1620usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok";
1621usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
1622usage += "\n- i,k,val,real,imag,mod,phas,teta,phi";
1623usage += "\n- FITS Binary/ASCII table: fits column names";
1624#ifdef SANS_EVOLPLANCK
1625usage += "\n ------ Eros Variable names (double) -------- ";
1626usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
1627usage += "\n- xref,yref,fluxref,fondref,pixmaxref";
1628#endif
1629usage += "\n ------ Other parameters -------- ";
1630usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1631usage += "\nThe default Cut() expression in true (=1) for all";
1632usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d ";
1633usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1634usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
1635mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
1636kw = "plot2d";
1637usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
1638usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
1639usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
1640mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1641kw = "plot2de";
1642usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1643usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1644usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1645mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1646kw = "plot2dw";
1647usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
1648usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1649usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1650mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1651kw = "plot3d";
1652usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
1653usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1654usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
1655mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1656
1657kw = "projh1d";
1658usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
1659usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
1660usage += "\n Histo1D nameh1d is created if necessary ";
1661usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
1662mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1663kw = "projh2d";
1664usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
1665usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1666usage += "\n Histo2D nameh2d is created if necessary ";
1667usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
1668mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1669kw = "projprof";
1670usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
1671usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1672usage += "\n HProf nameprof is created if necessary ";
1673usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
1674mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1675kw = "fillvec";
1676usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1677usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1678usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1679mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1680kw = "fillmtx";
1681usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1682usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1683usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1684mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1685
1686kw = "fillnt";
1687usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1688usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
1689usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
1690usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
1691mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1692
1693kw = "ntloop";
1694usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1695usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1696usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1697usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
1698usage += "\n Related commands: ntexpcfile fillnt";
1699mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1700
1701kw = "ntexpcfile";
1702usage = "Creates a C-File with declarations suitable to be used for ntloop";
1703usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1704usage += "\n Related commands: ntloop";
1705mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1706
1707kw = "exptovec";
1708usage = "Creates and Fills a Vector with X=f(Object)";
1709usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1710usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1711mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1712kw = "fillgd1";
1713usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1714usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1715usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1716mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1717kw = "fillgd2";
1718usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1719usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1720usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1721mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1722kw = "gdfrvec";
1723usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1724usage += "\n Usage: gdfrvec namegfd X Y";
1725usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1726usage += "\n Usage: gdfrvec namegfd X Y Z";
1727usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1728usage += "\n Related commands: fillgd1 fillgd2 ...";
1729mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1730
1731
1732kw = "eval";
1733usage = "Compute arithmetic expression\n";
1734usage += "\n Usage: eval resultvarname arithmetic expression....";
1735usage += "\n resultvarname: store result in variable resultvarname";
1736usage += "\n - If first character is not alphabetic, just print result";
1737usage += "\n arithmetic expression:";
1738usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1739usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1740usage += "\n ex: 360 * M_PI / 180.";
1741mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1742
1743}
1744
1745/* --Methode-- */
1746int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1747// string& func4, string& func5)
1748{
1749string cmd;
1750
1751if (dynlink) delete dynlink; dynlink = NULL;
1752usfmap.clear();
1753
1754dynlink = new PDynLinkMgr(fnameso, true);
1755if (dynlink == NULL) {
1756 string sn = fnameso;
1757 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1758 return(2);
1759 }
1760
1761int nok=0;
1762// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1763// DlUserProcFunction f = NULL;
1764DlFunction f = NULL;
1765if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1766// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1767f = dynlink->GetFunction(func1);
1768if (f) { nok++; usfmap[func1] = f; }
1769else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1770
1771if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1772// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1773f = dynlink->GetFunction(func2);
1774if (f) { nok++; usfmap[func2] = f; }
1775else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1776
1777if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1778// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1779f = dynlink->GetFunction(func3);
1780if (f) { nok++; usfmap[func3] = f; }
1781else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1782
1783/* Pb compile g++ 2.7.2
1784if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1785// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1786f = dynlink->GetFunction(func4);
1787if (f) { nok++; usfmap[func4] = f; }
1788else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1789
1790if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1791// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1792f = dynlink->GetFunction(func5);
1793if (f) { nok++; usfmap[func5] = f; }
1794else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1795*/
1796fin:
1797if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1798else return(0);
1799}
1800
1801/* --Methode-- */
1802int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1803{
1804string cmd;
1805
1806if (dynlink2) delete dynlink2; dynlink2 = NULL;
1807usfmap2.clear();
1808
1809dynlink2 = new PDynLinkMgr(fnameso, true);
1810if (dynlink2 == NULL) {
1811 string sn = fnameso;
1812 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1813 return(2);
1814 }
1815
1816int nok=0;
1817// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1818// DlUserProcFunction f = NULL;
1819DlFunction f = NULL;
1820if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1821f = dynlink2->GetFunction(func1);
1822if (f) { nok++; usfmap2[func1] = f; }
1823else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1824
1825if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1826f = dynlink2->GetFunction(func2);
1827if (f) { nok++; usfmap2[func2] = f; }
1828else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1829
1830if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1831f = dynlink2->GetFunction(func3);
1832if (f) { nok++; usfmap2[func3] = f; }
1833else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1834
1835fin:
1836if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1837else return(0);
1838}
1839
1840/* Nouvelle-Fonction */
1841void RegisterPIGraphicsHelp(PIACmd* piac)
1842{
1843string kw,grp,usage;
1844
1845grp = "Graphics";
1846
1847kw = "PIImage";
1848usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1849usage += "and controls a zoom widget, as well as a global image view widget \n";
1850usage += ">>>> Mouse controls : \n";
1851usage += "o Button-1: Display current coordinates and pixel value\n";
1852usage += " Position the cursor an refresh the zoom widget\n";
1853usage += "o Button-2: Defines an image zone and positions the cursor \n";
1854usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1855usage += ">>>> Keyboard controls : \n";
1856usage += "o <Alt>R : Refresh display \n";
1857usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1858usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1859usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1860usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1861usage += "o <Alt>X : Show/Hide the Cut Window \n";
1862usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1863usage += "o <Alt>E : Removes the last added graphic element \n";
1864usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
1865usage += "o <Alt>- or <Cntl>- : Zoom out \n";
1866usage += "o Cursor keys : Moves the image cursor \n";
1867piac->RegisterHelp(kw, usage, grp);
1868
1869kw = "PIScDrawWdg";
1870usage = "Manages display of 2-D drawers with interactive zoom \n";
1871usage += ">>>> Mouse controls : \n";
1872usage += "o Button-1: Display current coordinates \n";
1873usage += "o Button-2: Defines a rectangle for zoom \n";
1874usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1875usage += ">>>> Keyboard controls : \n";
1876usage += "o <Alt>R : Refresh display \n";
1877usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1878usage += " Specific controls for 2-D histograms \n";
1879usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1880usage += " Drawer 0 manages the axes, as well as the added text \n";
1881usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1882usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1883usage += "o <Alt>E : Removes the last added graphic element \n";
1884usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
1885usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
1886usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
1887usage += ">>>> Mouse + Keyboard controls : \n";
1888usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
1889piac->RegisterHelp(kw, usage, grp);
1890
1891kw = "PIDraw3DWdg";
1892usage = "Manages display of 3-D objects (drawers) \n";
1893usage += ">>>> Mouse controls : \n";
1894usage += "o Button-2: Rotates the observer (camera) around object \n";
1895usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1896usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1897usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1898usage += ">>>> Keyboard controls : \n";
1899usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1900usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1901usage += "o <Alt>O : = <Alt>G \n";
1902usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1903usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1904usage += "o <Alt>E : Removes the last added graphic element \n";
1905usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1906usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1907piac->RegisterHelp(kw, usage, grp);
1908
1909kw = "Windows";
1910usage = "Objects can be displayed in different windows, or overlayed on the \n";
1911usage += "previous display. The graphics attributes next,win,stack,same control \n";
1912usage += "the display window. \n";
1913usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1914usage += " Graphic windows can be divided int zones. Object is displayed \n";
1915usage += " in the next available position, removing a previously displayed \n";
1916usage += " widget if necessary \n";
1917usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1918usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1919usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1920usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1921usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1922usage += " be activated using the StackTools menu (Blink) \n";
1923usage += "o Most objects can be also be displayed overlayed \n";
1924usage += " on the last displayed widget (gr_att= same) \n";
1925usage += "o The overlay can be on a selected rectangle of the \n";
1926usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
1927usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
1928piac->RegisterHelp(kw, usage, grp);
1929
1930kw = "PIConsole";
1931usage = "Text output area and command editing window (console) \n";
1932usage += ">>>> Mouse controls : \n";
1933usage += "o Button-1: Rectangle selection for copy/paste \n";
1934usage += "o Button-2: Paste text in the command editing line \n";
1935usage += "o Button-3: activate display option menu \n";
1936usage += ">>>> Keyboard controls : \n";
1937usage += "o <Alt>O : activate display option menu \n";
1938usage += "o <Alt>V : Paste text in the command editing line \n";
1939usage += "o <Alt>A : Selection of the whole window for copy \n";
1940usage += "o <Alt>L : Command history (List of command history buffer) \n";
1941usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1942usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1943usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1944usage += "o <Ctl>C : Command editing -> Clear the line \n";
1945usage += "o Cursor left,right : Command editing -> Move cursor \n";
1946usage += "o Cursor Up,Down : recall command from history buffer \n";
1947usage += "o Backspace,Del : Command editing \n";
1948usage += "o <Return>,<Enter> : Execute command \n";
1949piac->RegisterHelp(kw, usage, grp);
1950}
Note: See TracBrowser for help on using the repository browser.