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

Last change on this file since 2616 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

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