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

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

1/ Ajout commande textdrawer ds basexecut.cc
2/ Adaptation aux modifs pour autosacleX/Y,Z pour Drawer3D

Reza, 1 Juin 2004

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