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

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

Modifications pour l'utilisation viewer PIImageNavigator (ajout commande imagnav) - Reza 18 Fev 2005

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