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

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

openppf modified to allow for object selection at the line command level. cmv 070205

File size: 85.4 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") ) {
717 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag 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);
723 }
724
725else if (kw == "nt2d") {
726 if (tokens.size() < 3) {
727 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
728 return(0);
729 }
730 while (tokens.size() < 8) tokens.push_back("");
731 string ph = "";
732 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
733 tokens[5], tokens[6], tokens[7], false);
734 }
735else if (kw == "nt3d") {
736 if (tokens.size() < 7) {
737 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
738 return(0);
739 }
740 while (tokens.size() < 10) tokens.push_back("");
741 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
742 tokens[6], tokens[7], tokens[8], tokens[9], true);
743 }
744else if (kw == "vecplot") {
745 if (tokens.size() < 2) {
746 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
747 return(0);
748 }
749 while (tokens.size() < 3) tokens.push_back("");
750 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
751}
752else if (kw == "bargraph") {
753 if (tokens.size() < 2) {
754 cout << "Usage: bargraph gr_opt v1 [v2 ...]" << endl;
755 return(0);
756 }
757 PIBarGraph* bgd = new PIBarGraph;
758 for(int k=1; k<tokens.size(); k++)
759 bgd->AddBar(atof(tokens[k].c_str()));
760 string grname = "BarGraph";
761 mImgApp->DispScDrawer(bgd, grname, tokens[0]);
762}
763else if (kw == "textdrawer") {
764 if (tokens.size() < 2) {
765 cout << "Usage: textdrawer gr_opt line1 [line2 ...]" << endl;
766 return(0);
767 }
768 PITextDrawer* txd = new PITextDrawer;
769 for(int k=1; k<tokens.size(); k++)
770 txd->AddLine(tokens[k]);
771 string grname = "TextDrawer";
772 tokens[0] += " inset";
773 mImgApp->DispScDrawer(txd, grname, tokens[0]);
774}
775
776// Obsolete : ne pas virer SVP, cmv 26/7/99
777else if (kw == "gfd2d") {
778 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
779 if(tokens.size()<2)
780 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
781 return(0);}
782 string numvary = "";
783 string err = "";
784 string opt = "next";
785 if(tokens.size()>2) err = tokens[2];
786 if(tokens.size()>3) opt = tokens[3];
787 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
788 }
789else if (kw == "gfd3d") {
790 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
791 if(tokens.size()<3)
792 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
793 return(0);}
794 string err = "";
795 string opt = "next";
796 if(tokens.size()>3) err = tokens[3];
797 if(tokens.size()>4) opt = tokens[4];
798 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
799 }
800
801// >>>>>>>>>>> Trace de fonctions
802else if ( (kw == "func") ) {
803 if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
804 int np = 100;
805 double xmin=0., xmax=1.;
806 string opt = "", nom = "";
807 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
808 if (tokens.size() > 3) np = atoi(tokens[3].c_str());
809 if (tokens.size() > 4) opt = tokens[4];
810 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
811 }
812else if ( (kw == "funcff") ) {
813 if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
814 int np = 100;
815 double xmin=0., xmax=1.;
816 string opt = "", nom = "";
817 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
818 if(tokens.size()>4) np = atoi(tokens[4].c_str());
819 if(tokens.size()>5) opt = tokens[5];
820 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
821 }
822else if ( (kw == "func2d") ) {
823 if (tokens.size() < 7) {
824 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
825 return(0);
826 }
827 int npx, npy;
828 double xmin, xmax;
829 double ymin, ymax;
830 npx = npy = 50;
831 xmin = 0.; xmax = 1.;
832 ymin = 0.; ymax = 1.;
833 npx = atoi(tokens[3].c_str());
834 npy = atoi(tokens[6].c_str());
835 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
836 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
837 string opt = "";
838 if (tokens.size() > 7) opt = tokens[7];
839 string nom = "";
840 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
841 }
842else if ( (kw == "func2dff") ) {
843 if (tokens.size() < 8) {
844 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
845 return(0);
846 }
847 int npx, npy;
848 double xmin, xmax;
849 double ymin, ymax;
850 npx = npy = 50;
851 xmin = 0.; xmax = 1.;
852 ymin = 0.; ymax = 1.;
853 npx = atoi(tokens[4].c_str());
854 npy = atoi(tokens[7].c_str());
855 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
856 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
857 string opt = "";
858 if (tokens.size() > 8) opt = tokens[8];
859 string nom = "";
860 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
861 }
862
863// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
864else if (kw == "plot2d" ) {
865 if (tokens.size() < 3) {
866 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
867 return(0);
868 }
869 string errx = ""; string erry = "";
870 if (tokens.size() < 4) tokens.push_back("1");
871 while (tokens.size() < 6) tokens.push_back("");
872 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
873 }
874
875else if (kw == "plot2de" ) { // Plot2D avec les erreurs
876 if (tokens.size() < 5) {
877 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
878 return(0);
879 }
880 if (tokens.size() < 6) tokens.push_back("1");
881 while (tokens.size() < 8) tokens.push_back("");
882 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
883 tokens[5],tokens[6],tokens[7]);
884 }
885
886else if (kw == "plot2dw" ) { // Plot2d avec poids
887 if (tokens.size() < 4) {
888 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
889 return(0);
890 }
891 if (tokens.size() < 5) tokens.push_back("1");
892 while (tokens.size() < 7) tokens.push_back("");
893 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
894 }
895else if (kw == "plot3d" ) {
896 if (tokens.size() < 4) {
897 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
898 return(0);
899 }
900 if (tokens.size() < 5) tokens.push_back("1");
901 while (tokens.size() < 7) tokens.push_back("");
902 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
903 }
904
905else if (kw == "projh1d" ) {
906 if (tokens.size() < 3) {
907 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
908 return(0);
909 }
910 if (tokens.size() < 4) tokens.push_back("1.");
911 if (tokens.size() < 5) tokens.push_back("1");
912 while (tokens.size() < 7) tokens.push_back("");
913 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
914 }
915
916
917// Projection dans histogrammes
918else if (kw == "projh2d" ) {
919 if (tokens.size() < 4) {
920 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
921 return(0);
922 }
923 if (tokens.size() < 5) tokens.push_back("1.");
924 if (tokens.size() < 6) tokens.push_back("1");
925 while (tokens.size() < 8) tokens.push_back("");
926 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
927 tokens[6], tokens[7] );
928 }
929
930else if (kw == "projprof" ) {
931 if (tokens.size() < 4) {
932 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
933 return(0);
934 }
935 if (tokens.size() < 5) tokens.push_back("1.");
936 if (tokens.size() < 6) tokens.push_back("1");
937 while (tokens.size() < 8) tokens.push_back("");
938 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
939 tokens[6], tokens[7] );
940 }
941
942// Projection dans vector/matrix
943else if (kw == "fillvec" ) {
944 if (tokens.size() < 4) {
945 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
946 return(0);
947 }
948 if (tokens.size() < 5) tokens.push_back("1");
949 while (tokens.size() < 7) tokens.push_back("");
950 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
951 }
952
953else if (kw == "fillmtx" ) {
954 if (tokens.size() < 5) {
955 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
956 return(0);
957 }
958 if (tokens.size() < 6) tokens.push_back("1");
959 while (tokens.size() < 8) tokens.push_back("");
960 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
961 tokens[6], tokens[7] );
962 }
963
964// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
965else if (kw == "ntfrascii" ) {
966 if(tokens.size() < 2) {
967 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
968 return(0);
969 }
970 double def_val = 0.;
971 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
972 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
973 }
974
975#ifndef SANS_EVOLPLANCK
976/* Lecture matrice/vecteur depuis fichier ASCII */
977else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
978 if(tokens.size() < 2) {
979 cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name [CommLine Separator]"<<endl;
980 return(0);
981 }
982 TMatrix<r_8> mtx;
983 TVector<r_8> vec;
984 FILE* fip = fopen(tokens[1].c_str(), "r");
985 if (fip == NULL) {
986 cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
987 return(0);
988 }
989 fclose(fip);
990 ifstream is(tokens[1].c_str());
991 sa_size_t nr, nc;
992 char clm = '#';
993 string sep = " \t";
994 if (tokens.size()>2) clm = tokens[2][0];
995 if (tokens.size()>3) sep = tokens[3];
996 if (kw == "mtxfrascii") {
997 mtx.ReadASCII(is, nr, nc, clm, sep.c_str());
998 mObjMgr->AddObj(mtx, tokens[0]);
999 cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
1000 << tokens[1] << endl;
1001 }
1002 else {
1003 vec.ReadASCII(is, nr, nc, clm, sep.c_str());
1004 mObjMgr->AddObj(vec, tokens[0]);
1005 cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
1006 << tokens[1] << endl;
1007 }
1008}
1009else if (kw == "arrtoascii") {
1010 if(tokens.size() < 2) {
1011 cout<<"Usage: arrtoascii array_name file_name "<<endl;
1012 return(0);
1013 }
1014
1015 AnyDataObj* obj;
1016 obj = mObjMgr->GetObj(tokens[0]);
1017 if(obj == NULL) {
1018 cerr << "arrtoascii Error , No such object " << tokens[0] << endl;
1019 return(0);
1020 }
1021 BaseArray* ba = dynamic_cast<BaseArray *>(obj);
1022 if(ba == NULL) {
1023 cerr << "arrtoascii Error " << tokens[0] << " not a BaseArray ! " << endl;
1024 return(0);
1025 }
1026 ofstream os(tokens[1].c_str());
1027 ba->WriteASCII(os);
1028 cout << "arrtoascii: Array " << tokens[0] << " written to file " << tokens[1] << endl;
1029}
1030
1031#endif
1032
1033else if (kw == "fillnt" ) {
1034 if (tokens.size() < 5) {
1035 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
1036 return(0);
1037 }
1038 while (tokens.size() < 8) tokens.push_back("");
1039 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
1040 }
1041
1042else if (kw == "ntloop" ) {
1043 if (tokens.size() < 3) {
1044 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
1045 return(0);
1046 }
1047 while (tokens.size() < 5) tokens.push_back("");
1048 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
1049 }
1050
1051else if (kw == "ntexpcfile" ) {
1052 if (tokens.size() < 3) {
1053 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
1054 return(0);
1055 }
1056 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
1057 }
1058
1059else if (kw == "exptovec" ) {
1060 if (tokens.size() < 3) {
1061 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
1062 return(0);
1063 }
1064 while (tokens.size() < 6) tokens.push_back("");
1065 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
1066 }
1067
1068else if (kw == "fillgd1" ) {
1069 if (tokens.size() < 5) {
1070 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
1071 return(0);
1072 }
1073 if (tokens.size() < 6) tokens.push_back("1");
1074 if (tokens.size() < 7) tokens.push_back("");
1075 string expy = "";
1076 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
1077 }
1078
1079else if (kw == "fillgd2" ) {
1080 if (tokens.size() < 6) {
1081 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
1082 return(0);
1083 }
1084 if (tokens.size() < 7) tokens.push_back("1");
1085 if (tokens.size() < 8) tokens.push_back("");
1086 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
1087 }
1088
1089else if (kw == "gdfrvec" ) {
1090 if(tokens.size()<3) {
1091 cout<<"Usage: gdfrvec namegfd X Y\n"
1092 <<" gdfrvec namegfd X Y"
1093 <<" gdfrvec namegfd X Y ! EY\n"
1094 <<" gdfrvec namegfd X Y Z\n"
1095 <<" gdfrvec namegfd X Y Z EZ"<<endl;
1096 return(0);
1097 }
1098 while(tokens.size()<5) tokens.push_back("!");
1099 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
1100 }
1101
1102// >>>>>>>>>>> Calcul d'expression arithmetique
1103else if ( (kw == "eval") ) {
1104 if(tokens.size()<2)
1105 {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
1106 string expval = "";
1107 for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
1108 string resultvarname = "";
1109 if(isalpha(tokens[0][0])) resultvarname=tokens[0];
1110 mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
1111 }
1112
1113else {
1114 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
1115 return(-1);
1116 }
1117
1118return(0);
1119}
1120
1121// Fonction pour enregistrer le Help des Widgets et Windows de piapp
1122static void RegisterPIGraphicsHelp(PIACmd* piac);
1123
1124/* --Methode-- */
1125void PIABaseExecutor::RegisterCommands()
1126{
1127string kw, usage, grp;
1128grp = "External Modules";
1129string gdesc = "Dynamic load (shared object modules) management command group";
1130mpiac->AddHelpGroup(grp, gdesc);
1131kw = "loadmodule";
1132usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
1133usage += "\n Related commands: link";
1134mpiac->RegisterCommand(kw, usage, this, grp);
1135kw = "link";
1136usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
1137usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
1138usage += "\n Related commands: call loadmodule linkff2";
1139mpiac->RegisterCommand(kw, usage, this, grp);
1140kw = "linkff2";
1141usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
1142usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
1143usage += "\n Related commands: call link loadmodule";
1144mpiac->RegisterCommand(kw, usage, this, grp);
1145kw = "call";
1146usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
1147usage += "\n User function : f(vector<string>& args)";
1148usage += "\n Related commands: link";
1149mpiac->RegisterCommand(kw, usage, this, grp);
1150
1151grp = "Graphics";
1152gdesc = "Basic graphics and object display commands";
1153mpiac->AddHelpGroup(grp, gdesc);
1154kw = "zone";
1155usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
1156usage += "\n Related commands: newwin";
1157mpiac->RegisterCommand(kw, usage, this, grp);
1158kw = "newwin";
1159usage = "To Create a New Graphic window, with zones \n";
1160usage += " Window size can be specified \n";
1161usage += " Usage: newwin [nx ny [sizeX sizeY]] ";
1162usage += "\n Related commands: zone";
1163mpiac->RegisterCommand(kw, usage, this, grp);
1164kw = "stacknext";
1165usage = "Displays the next widget on stack window \n Usage: stacknext";
1166mpiac->RegisterCommand(kw, usage, this, grp);
1167
1168kw = "graphicatt";
1169usage = "To change default graphic options \n Usage: graphicatt att_list \n";
1170usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
1171usage += "\n ------------------ Graphic attribute list ------------------ \n";
1172usage += ">> Colors: defcol black white grey red blue green yellow \n";
1173usage += " magenta cyan turquoise navyblue orange siennared purple \n";
1174usage += " limegreen gold violet violetred blueviolet darkviolet \n";
1175usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
1176usage += " thickdashedline dottedline thindottedline thickdottedline \n";
1177usage += ">> Font Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
1178usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont \n";
1179usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont \n";
1180usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont \n";
1181usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont \n";
1182usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T> \n";
1183usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
1184usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
1185usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n";
1186usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T> \n";
1187usage += " arrowshapedarrow<T> farrowshapedarrow<T> \n";
1188usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n";
1189usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
1190usage += " grey128 invgrey128 colrj128 colbr128 \n";
1191usage += " red32cm green32cm blue32cm yellow32cm \n";
1192usage += " orange32cm cyan32cm violet32cm \n";
1193usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
1194usage += " midas_bluewhite midas_redwhite \n";
1195usage += " multicol16 multicol64 \n";
1196usage += " revcmap : This flag reverses ColorMap indexing \n";
1197usage += "--- For image displays: \n";
1198usage += ">> ZoomFactors zoomxN zoomx1 zoomx2 zoomx3 ... \n";
1199usage += " zoom/N zoom/2 zoom/3 zoom/4 ...\n";
1200usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
1201usage += ">> lut=ltyp,min,max -> Sets LUT type and min/max for image display \n";
1202usage += " (ltyp=lin/log/sqrt/square) \n";
1203usage += ">> image axes configuration: invx invy exchxy \n";
1204usage += ">> Axes / Axe labels / LogScale / xylimits / defdrrect \n";
1205usage += " See setaxesatt command \n";
1206usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
1207usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
1208usage += ">> DisplayWindow: next same win stack inset \n";
1209usage += " Related commands: setaxesatt setinsetlimits ";
1210mpiac->RegisterCommand(kw, usage, this, grp);
1211
1212kw = "setaxesatt";
1213usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
1214usage += "Color/Line/Font attributes and axes attributes \n";
1215usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n";
1216usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n";
1217usage += " centeredaxesgrid finecenteredaxesgrid\n";
1218usage += " axescenter=x0,y0 (only with centered axes, default \"axescenter=\")\n";
1219usage += " grid nogrid labels nolabels \n";
1220usage += " ticks noticks minorticks nominorticks \n";
1221usage += " extticks intticks extintticks \n";
1222usage += " nbticks=X_NTicks,Y_NTicks \n";
1223usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n";
1224usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n";
1225usage += " autofontsize=fsizef: Font size computed automatically \n";
1226usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
1227usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
1228usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
1229usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
1230usage += " The rectangle is defined as a fraction of the widget size\n";
1231mpiac->RegisterCommand(kw, usage, this, grp);
1232
1233kw = "setinsetlimits";
1234usage = "Define the display rectangle for drawers added as insets \n";
1235usage += " over existing graphic objects - limits expressed as fraction \n";
1236usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
1237usage += " Usage: setinsetlimits xmin xmax ymin ymax";
1238usage += "\n Related commands: graphicatt /inset";
1239mpiac->RegisterCommand(kw, usage, this, grp);
1240
1241kw = "drpanel";
1242usage = "Creates a new 2D drawing zone for addtext, addline \n";
1243usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
1244usage += "\n Related commands: addtext addline addrect addcirc ...";
1245mpiac->RegisterCommand(kw, usage, this, grp);
1246
1247kw = "addtext";
1248usage = "Adds a text string to the current graphic object";
1249usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1250usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
1251usage += "\n Alt<E> to remove the added element";
1252usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
1253usage += "\n (use quotes '' for multi word text strings) ";
1254usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1255usage += "\n Text position/direction attribute: ";
1256usage += "\n horizleft horizcenter horizright";
1257usage += "\n vertbottom vertcenter verttop ";
1258usage += "\n textdirhoriz textdirvertup textdirvertdown ";
1259usage += "\n Related commands: addctext addline addarrow addrect addfrect";
1260usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
1261mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1262
1263kw = "addctext";
1264usage = "Adds a composite text string with superscript and subscripts ";
1265usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1266usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
1267usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1268usage += "\n Related commands: addtext addline addrect ...";
1269usage += "\n (See command addtext and graphicatt for more details)";
1270mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1271
1272kw = "addline";
1273usage = "Adds a line to the current graphic object";
1274usage += "\n at the specified position (+ graphic attribute)";
1275usage += "\n The Base/AxesDrawer is used to handle added lines";
1276usage += "\n Alt<E> to remove the added element";
1277usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1278usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1279usage += "\n Related commands: addarrow addtext addrect addfrect ";
1280usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1281mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1282
1283kw = "addarrow";
1284usage = "Adds an arrow to the current graphic object";
1285usage += "\n at the specified position (+ graphic attribute)";
1286usage += "\n The Base/AxesDrawer is used to handle added lines";
1287usage += "\n Alt<E> to remove the added element";
1288usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1289usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1290usage += "\n Related commands: addline addtext addrect addfrect ";
1291usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1292mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1293kw = "addarrow_nc";
1294
1295kw = "addrect";
1296usage = "Adds a rectangle to the current graphic object";
1297usage += "\n between the specified positions (+ graphic attribute)";
1298usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1299usage += "\n Alt<E> to remove added element";
1300usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1301usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1302usage += "\n Related commands: addtext addline addarrow addfrect";
1303usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1304mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1305
1306kw = "addfrect";
1307usage = "Adds a filled rectangle to the current graphic object";
1308usage += "\n between the specified positions (+ graphic attribute)";
1309usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1310usage += "\n Alt<E> to remove added element";
1311usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1312usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1313usage += "\n Related commands: addtext addline addarrow addrect";
1314usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
1315mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1316
1317kw = "addmarker";
1318usage = "Adds a marker to the current graphic object";
1319usage += "\n at the specified position (+ graphic attribute)";
1320usage += "\n The Base/AxesDrawer is used to handle added circles";
1321usage += "\n Alt<E> to remove added element";
1322usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
1323usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1324usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1325usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1326mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1327
1328kw = "addcirc";
1329usage = "Adds a circle to the current graphic object";
1330usage += "\n with the specified center and radius (+ graphic attribute)";
1331usage += "\n The Base/AxesDrawer is used to handle added circles";
1332usage += "\n Alt<E> to remove added element";
1333usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1334usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1335usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1336usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
1337mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1338
1339kw = "addfcirc";
1340usage = "Adds a filled circle to the current graphic object";
1341usage += "\n with the specified center and radius (+ graphic attribute)";
1342usage += "\n The Base/AxesDrawer is used to handle added circles";
1343usage += "\n Alt<E> to remove added element";
1344usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1345usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1346usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1347usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
1348mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1349
1350kw = "addoval";
1351usage = "Adds an oval (ellipse) to the current graphic object";
1352usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
1353usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1354usage += "\n Alt<E> to remove added element";
1355usage += "\n Usage: addoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
1356usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1357usage += "\n Related commands: addfoval addline addarrow addfrect addcirc addfcirc";
1358usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1359mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1360
1361kw = "addfoval";
1362usage = "Adds a filled oval (ellipse) to the current graphic object";
1363usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
1364usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1365usage += "\n Alt<E> to remove added element";
1366usage += "\n Usage: addfoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
1367usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1368usage += "\n Related commands: addoval addline addarrow addfrect addcirc addfcirc";
1369usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1370mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1371
1372kw = "addarca";
1373usage = "Adds an arc to the current graphic object";
1374usage += "\n defined by the circle (center+radius), start angle and angular extension";
1375usage += "\n Angles are specified in degrees";
1376usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1377usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1378usage += "\n Related commands: addtext addline addfarca addarc ...";
1379mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1380
1381kw = "addfarca";
1382usage = "Adds a filled arc to the current graphic object";
1383usage += "\n defined by the circle (center+radius), start angle and angular extension";
1384usage += "\n Angles are specified in degrees";
1385usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1386usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1387usage += "\n Related commands: addtext addline addarca addarc ...";
1388mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1389
1390kw = "addarc";
1391usage = "Adds an arc to the current graphic object";
1392usage += "\n defined by 3 points (+ graphic attribute)";
1393usage += "\n The Base/AxesDrawer is used to handle added arcs";
1394usage += "\n Alt<E> to remove the added element";
1395usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1396usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1397usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1398usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
1399mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1400
1401kw = "addfarc";
1402usage = "Adds a filled arc to the current graphic object";
1403usage += "\n defined by 3 points (+ graphic attribute)";
1404usage += "\n The Base/AxesDrawer is used to handle added arcs";
1405usage += "\n Alt<E> to remove added element";
1406usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1407usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1408usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1409usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
1410mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1411
1412kw = "addpoly";
1413usage = "Adds a polyline/polygon to the current graphic object";
1414usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1415usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1416usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1417usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1418usage += "\n addcirc addfcirc addfarc graphicatt";
1419mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1420
1421kw = "addfpoly";
1422usage = "Adds a filled polygon to the current graphic object";
1423usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1424usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1425usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1426usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1427usage += "\n addcirc addfcirc addfarc graphicatt";
1428mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1429
1430kw = "settitle";
1431usage = "Set the title string (top title / bottom title) for the current graphic object";
1432usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
1433usage += "\n Related commands: addtext graphicatt";
1434mpiac->RegisterCommand(kw, usage, this, grp);
1435
1436kw = "addtitle";
1437usage = "Set the title string (top title / bottom title) \n";
1438usage += " alias for settitle ";
1439mpiac->RegisterCommand(kw, usage, this, grp);
1440
1441kw = "setaxelabels";
1442usage = "Set the X and Y axis labels for the current 2D graphic object \n";
1443usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
1444usage += "\n Related commands: settitle addtext graphicatt";
1445mpiac->RegisterCommand(kw, usage, this, grp);
1446
1447kw = "addaxelabels";
1448usage = "Set the X and Y axis labels for the current 2D graphic object";
1449usage += " alias for setaxelabels ";
1450mpiac->RegisterCommand(kw, usage, this, grp);
1451
1452RegisterPIGraphicsHelp(mpiac);
1453
1454kw = "openfits";
1455usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
1456usage += "\n Related commands: savefits openppf";
1457mpiac->RegisterCommand(kw, usage, this, "FileIO");
1458kw = "savefits";
1459usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
1460usage += "\n Related commands: openfits saveobjs saveall";
1461mpiac->RegisterCommand(kw, usage, this, "FileIO");
1462kw = "openppf";
1463usage = "Reads all or some objects from a PPF file \n Usage: openppf filename [objname1 objname2 ...]";
1464usage += "\n Related commands: saveall openfits";
1465mpiac->RegisterCommand(kw, usage, this, "FileIO");
1466kw = "saveppf";
1467usage = "Saves objects with names matching a pattern into a\n";
1468usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1469usage += "Usage: saveppf nameobjpattern filename";
1470usage += "\n Related commands: saveobjs saveall openppf savefits";
1471mpiac->RegisterCommand(kw, usage, this, "FileIO");
1472kw = "saveobjs";
1473usage = "Saves objects with names matching a pattern into a\n";
1474usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1475usage += "Usage: saveobjs nameobjpattern filename";
1476usage += "\n Related commands: saveppf saveall openppf savefits";
1477mpiac->RegisterCommand(kw, usage, this, "FileIO");
1478kw = "saveall";
1479usage = "Saves all objects into a PPF file \n Usage: saveall filename";
1480usage += "\n Related commands: saveobj openppf savefits";
1481mpiac->RegisterCommand(kw, usage, this, "FileIO");
1482kw = "ntfrascii";
1483usage = "Fills an existing NTuple from ASCII table file";
1484usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
1485usage += "\n Related commands: ntloop fillnt ";
1486mpiac->RegisterCommand(kw, usage, this, "FileIO");
1487#ifndef SANS_EVOLPLANCK
1488kw = "mtxfrascii";
1489usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
1490usage += "\n Usage: mtxfrascii mtx_name file_name [CommChar Separator]";
1491usage += "\n Related commands: arrtoascii vecfrascii ntfrascii ";
1492mpiac->RegisterCommand(kw, usage, this, "FileIO");
1493kw = "vecfrascii";
1494usage = "Reads a vector from an ASCII file (TVector<r_8>)";
1495usage += "\n Usage: vecfrascii vec_name file_name";
1496usage += "\n Related commands: arrtoascii mtxfrascii ntfrascii [CommChar Separator]";
1497mpiac->RegisterCommand(kw, usage, this, "FileIO");
1498kw = "arrtoascii";
1499usage = "Writes an array (TArray<T>) to an ASCII file ";
1500usage += "\n Usage: arrtoascii array_name file_name";
1501usage += "\n Related commands: mtxfrascii vecfrascii ntfrascii ";
1502mpiac->RegisterCommand(kw, usage, this, "FileIO");
1503#endif
1504
1505kw = "print";
1506usage = "Prints an object \n Usage: print nameobj";
1507mpiac->RegisterCommand(kw, usage, this, "FileIO");
1508
1509kw = "mkdir";
1510usage = "Create a directory";
1511usage += "\n Usage: mkdir dirname [true]";
1512usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
1513mpiac->RegisterCommand(kw, usage, this, "Object Management");
1514kw = "rmdir";
1515usage = "Removes an empty directory";
1516usage += "\n Usage: remove dirname";
1517mpiac->RegisterCommand(kw, usage, this, "Object Management");
1518kw = "setdiratt";
1519usage = "Sets directory attributes";
1520usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
1521usage += "\n KeepOldFlag=true Object with the same name is moved to old";
1522usage += "\n when adding objects";
1523mpiac->RegisterCommand(kw, usage, this, "Object Management");
1524kw = "cd";
1525usage = "Change current directory";
1526usage += "\n Usage: cd [dirname]";
1527mpiac->RegisterCommand(kw, usage, this, "Object Management");
1528kw = "pwd";
1529usage = "Prints current directory";
1530usage += "\n Usage: pwd";
1531mpiac->RegisterCommand(kw, usage, this, "Object Management");
1532kw = "listdirs";
1533usage = "Prints the list of directories";
1534usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
1535mpiac->RegisterCommand(kw, usage, this, "Object Management");
1536kw = "listobjs";
1537usage = "Prints the list of objects (Alias: ls)";
1538 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
1539mpiac->RegisterCommand(kw, usage, this, "Object Management");
1540kw = "rename";
1541usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
1542usage += "\n Related commands: mv del delobjs";
1543mpiac->RegisterCommand(kw, usage, this, "Object Management");
1544kw = "mv";
1545usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1546usage += "\n Related commands: rename del delobjs";
1547mpiac->RegisterCommand(kw, usage, this, "Object Management");
1548kw = "copy";
1549usage = "Copy objects (Alias cp) \n";
1550usage +=" Usage: copy name_from name_to";
1551usage += "\n Related commands: cp new...";
1552mpiac->RegisterCommand(kw, usage, this, "Object Management");
1553kw = "cp";
1554usage = "Copy objects (Alias copy) \n";
1555usage +=" Usage: cp name_from name_to";
1556usage += "\n Related commands: copy new...";
1557mpiac->RegisterCommand(kw, usage, this, "Object Management");
1558kw = "del";
1559usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
1560usage += "\n Related commands: rm delobjs rename";
1561mpiac->RegisterCommand(kw, usage, this, "Object Management");
1562kw = "rm";
1563usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1564usage += "\n Related commands: del delobjs rename";
1565mpiac->RegisterCommand(kw, usage, this, "Object Management");
1566kw = "delobjs";
1567usage = "Delete a set of objects with names matching a pattern (x?y*)";
1568usage += "\n Usage: delobjs nameobjpattern \n";
1569usage += "\n Related commands: del rename";
1570mpiac->RegisterCommand(kw, usage, this, "Object Management");
1571
1572kw = "newh1d";
1573usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
1574usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
1575mpiac->RegisterCommand(kw, usage, this, "Objects");
1576kw = "newh2d";
1577usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
1578usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
1579mpiac->RegisterCommand(kw, usage, this, "Objects");
1580kw = "newprof";
1581usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
1582usage += "\n Errors represent the data spread in the X bin ";
1583usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
1584mpiac->RegisterCommand(kw, usage, this, "Objects");
1585kw = "newprofe";
1586usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1587usage += "\n Errors represent the error on the data mean in the X bin ";
1588usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
1589mpiac->RegisterCommand(kw, usage, this, "Objects");
1590kw = "newnt";
1591usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1592usage += "\n newnt name nvar";
1593usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
1594mpiac->RegisterCommand(kw, usage, this, "Objects");
1595kw = "newgfd";
1596usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
1597usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
1598mpiac->RegisterCommand(kw, usage, this, "Objects");
1599kw = "newvec";
1600usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
1601usage += "\n Related commands: newmtx line2vec";
1602mpiac->RegisterCommand(kw, usage, this, "Objects");
1603kw = "newmtx";
1604usage = "Creates (and optionaly fills) a matrix \n";
1605usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
1606usage += "\n Related commands: newvec";
1607mpiac->RegisterCommand(kw, usage, this, "Objects");
1608kw = "line2vec";
1609usage = "Creates a vector from the line \n";
1610usage += " Usage: line2vec vecname v0 v1 v2 ... \n";
1611usage += " Related commands: newvec line2nt";
1612mpiac->RegisterCommand(kw, usage, this, "Objects");
1613kw = "line2nt";
1614usage = "Fills (append) an NTuple from the line content \n";
1615usage += " Usage: line2nt ntname col0 col1 ... \n";
1616usage += " Related commands: newnt line2vec ntline2var ntcol2var";
1617mpiac->RegisterCommand(kw, usage, this, "Objects");
1618kw = "vec2var";
1619usage = "Vector content to an interpreter variable varname = 'v0 v1 v2 ...' \n";
1620usage += " Usage: line2vec vecname varname [LoopParam start:end[:step] ]\n";
1621usage += " Related commands: line2vec ntline2var";
1622mpiac->RegisterCommand(kw, usage, this, "Objects");
1623kw = "ntline2var";
1624usage = "Object NTupleInterface line to an interpreter variable \n";
1625usage += " Usage: ntline2var objname line_number varname \n";
1626usage += " Related commands: vec2var ntcol2var";
1627mpiac->RegisterCommand(kw, usage, this, "Objects");
1628kw = "ntcol2var";
1629usage = "Object NTupleInterface column to an interpreter variable \n";
1630usage += " Usage: ntline2var objname column_number varname [LoopParam start:end[:step] ] \n";
1631usage += " Related commands: vec2var ntline2var";
1632mpiac->RegisterCommand(kw, usage, this, "Objects");
1633
1634kw = "disp";
1635usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
1636usage += "\n Related commands: surf nt2d nt3d vecplot";
1637mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1638kw = "imag";
1639usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
1640usage += "\n Related commands: disp surf nt2d nt3d vecplot";
1641mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1642kw = "surf";
1643usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
1644usage += "\n Related commands: disp nt2d nt3d vecplot";
1645mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1646kw = "nt2d";
1647usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
1648usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
1649usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
1650mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1651kw = "nt3d";
1652usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
1653usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
1654usage += "\n Related commands: disp surf nt2d gfd3d ";
1655mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1656kw = "vecplot";
1657usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
1658usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
1659usage += "\n Related commands: disp nt2d ";
1660mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1661kw = "bargraph";
1662usage = "Bar-Graph view of a sequence of values (test)";
1663usage += "\n Usage : bargraph graphic_attributes v1 [v2 v3 ...] ";
1664usage += "\n Related commands: disp nt2d vecplot";
1665mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1666kw = "textdrawer";
1667usage = "Multi line text darwer (test)";
1668usage += "\n Usage : textdrawer graphic_attributes line1 [line2 line3 ...] ";
1669usage += "\n Related commands: disp ";
1670mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1671
1672// Ceci est maintenant obsolete, on garde pour info.
1673kw = "gfd2d";
1674usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
1675usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
1676usage += "\n Related commands: gfd3d nt2d nt3d ";
1677usage += "\n ----- OBSOLETE: utilisez nt2d -----";
1678mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1679kw = "gfd3d";
1680usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
1681usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
1682usage += "\n Related commands: gfd2d nt2d nt3d ";
1683usage += "\n ----- OBSOLETE: utilisez nt3d -----";
1684mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1685
1686kw = "func";
1687usage = "Displays a function y=f(x) (Fills a vector with function values)";
1688usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
1689usage += "\n Related commands: funcff func2d func2dff ";
1690mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1691kw = "funcff";
1692usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
1693usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
1694usage += "\n Related commands: func func2d func2dff ";
1695mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1696kw = "func2d";
1697usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1698usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1699usage += "\n Related commands: func";
1700mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1701kw = "func2dff";
1702usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1703usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1704usage += "\n Related commands: func funcff func2d ";
1705mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1706
1707kw = "ObjectExpressions";
1708usage = "Any mathematical expression (math.h) with object variables can be used";
1709usage += "\n ------ Object Variable names (double) -------- ";
1710usage += "\n (_nl is the table line number or the sequential index)";
1711usage += "\n- NTuple: ntuple variable names,_nl";
1712usage += "\n- Histo1D/HProf: i,x,val,err,_nl";
1713usage += "\n- Histo2D: i,j,x,y,val,err,_nl";
1714usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl";
1715usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl";
1716usage += "\n- Image: i,j,x,y,val(=pix),_nl";
1717usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok ,_nl";
1718usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
1719usage += "\n- i,k,val,real,imag,mod,phas,teta,phi,_nl";
1720usage += "\n- FITS Binary/ASCII table: fits column names,_nl";
1721#ifdef SANS_EVOLPLANCK
1722usage += "\n ------ Eros Variable names (double) -------- ";
1723usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
1724usage += "\n- xref,yref,fluxref,fondref,pixmaxref,_nl";
1725#endif
1726usage += "\n ------ Other parameters -------- ";
1727usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1728usage += "\nThe default Cut() expression in true (=1) for all";
1729usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d ";
1730usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1731usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
1732grp = "Expr. Plotting";
1733mpiac->RegisterHelp(kw, usage, grp);
1734kw = "plot2d";
1735usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
1736usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
1737usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
1738mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1739kw = "plot2de";
1740usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1741usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1742usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1743mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1744kw = "plot2dw";
1745usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
1746usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1747usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1748mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1749kw = "plot3d";
1750usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
1751usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1752usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
1753mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1754
1755kw = "projh1d";
1756usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
1757usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
1758usage += "\n Histo1D nameh1d is created if necessary ";
1759usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
1760mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1761kw = "projh2d";
1762usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
1763usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1764usage += "\n Histo2D nameh2d is created if necessary ";
1765usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
1766mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1767kw = "projprof";
1768usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
1769usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1770usage += "\n HProf nameprof is created if necessary ";
1771usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
1772mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1773kw = "fillvec";
1774usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1775usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1776usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1777mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1778kw = "fillmtx";
1779usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1780usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1781usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1782mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1783
1784kw = "fillnt";
1785usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1786usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
1787usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
1788usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
1789mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1790
1791kw = "ntloop";
1792usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1793usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1794usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1795usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
1796usage += "\n Related commands: ntexpcfile fillnt";
1797mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1798
1799kw = "ntexpcfile";
1800usage = "Creates a C-File with declarations suitable to be used for ntloop";
1801usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1802usage += "\n Related commands: ntloop";
1803mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1804
1805kw = "exptovec";
1806usage = "Creates and Fills a Vector with X=f(Object)";
1807usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1808usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1809mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1810kw = "fillgd1";
1811usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1812usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1813usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1814mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1815kw = "fillgd2";
1816usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1817usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1818usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1819mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1820kw = "gdfrvec";
1821usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1822usage += "\n Usage: gdfrvec namegfd X Y";
1823usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1824usage += "\n Usage: gdfrvec namegfd X Y Z";
1825usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1826usage += "\n Related commands: fillgd1 fillgd2 ...";
1827mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1828
1829
1830kw = "eval";
1831usage = "Compute arithmetic expression\n";
1832usage += "\n Usage: eval resultvarname arithmetic expression....";
1833usage += "\n resultvarname: store result in variable resultvarname";
1834usage += "\n - If first character is not alphabetic, just print result";
1835usage += "\n arithmetic expression:";
1836usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1837usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1838usage += "\n ex: 360 * M_PI / 180.";
1839mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1840
1841}
1842
1843/* --Methode-- */
1844int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1845// string& func4, string& func5)
1846{
1847string cmd;
1848
1849if (dynlink) delete dynlink; dynlink = NULL;
1850usfmap.clear();
1851
1852dynlink = new PDynLinkMgr(fnameso, true);
1853if (dynlink == NULL) {
1854 string sn = fnameso;
1855 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1856 return(2);
1857 }
1858
1859int nok=0;
1860// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1861// DlUserProcFunction f = NULL;
1862DlFunction f = NULL;
1863if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1864// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1865f = dynlink->GetFunction(func1);
1866if (f) { nok++; usfmap[func1] = f; }
1867else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1868
1869if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1870// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1871f = dynlink->GetFunction(func2);
1872if (f) { nok++; usfmap[func2] = f; }
1873else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1874
1875if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1876// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1877f = dynlink->GetFunction(func3);
1878if (f) { nok++; usfmap[func3] = f; }
1879else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1880
1881/* Pb compile g++ 2.7.2
1882if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1883// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1884f = dynlink->GetFunction(func4);
1885if (f) { nok++; usfmap[func4] = f; }
1886else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1887
1888if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1889// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1890f = dynlink->GetFunction(func5);
1891if (f) { nok++; usfmap[func5] = f; }
1892else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1893*/
1894fin:
1895if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1896else return(0);
1897}
1898
1899/* --Methode-- */
1900int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1901{
1902string cmd;
1903
1904if (dynlink2) delete dynlink2; dynlink2 = NULL;
1905usfmap2.clear();
1906
1907dynlink2 = new PDynLinkMgr(fnameso, true);
1908if (dynlink2 == NULL) {
1909 string sn = fnameso;
1910 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1911 return(2);
1912 }
1913
1914int nok=0;
1915// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1916// DlUserProcFunction f = NULL;
1917DlFunction f = NULL;
1918if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1919f = dynlink2->GetFunction(func1);
1920if (f) { nok++; usfmap2[func1] = f; }
1921else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1922
1923if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1924f = dynlink2->GetFunction(func2);
1925if (f) { nok++; usfmap2[func2] = f; }
1926else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1927
1928if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1929f = dynlink2->GetFunction(func3);
1930if (f) { nok++; usfmap2[func3] = f; }
1931else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1932
1933fin:
1934if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1935else return(0);
1936}
1937
1938/* Nouvelle-Fonction */
1939void RegisterPIGraphicsHelp(PIACmd* piac)
1940{
1941string kw,grp,usage;
1942
1943grp = "Graphics";
1944
1945kw = "PIImage";
1946usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1947usage += "and controls a zoom widget, as well as a global image view widget \n";
1948usage += ">>>> Mouse controls : \n";
1949usage += "o Button-1: Display current coordinates and pixel value\n";
1950usage += " Position the cursor an refresh the zoom widget\n";
1951usage += "o Button-2: Defines an image zone and positions the cursor \n";
1952usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1953usage += ">>>> Keyboard controls : \n";
1954usage += "o <Alt>R : Refresh display \n";
1955usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1956usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1957usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
1958usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1959usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1960usage += "o <Alt>X : Show/Hide the Cut Window \n";
1961usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1962usage += "o <Alt>E : Removes the last added graphic element \n";
1963usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
1964usage += "o <Alt>- or <Cntl>- : Zoom out \n";
1965usage += "o Cursor keys : Moves the image cursor \n";
1966piac->RegisterHelp(kw, usage, grp);
1967
1968kw = "PIScDrawWdg";
1969usage = "Manages display of 2-D drawers with interactive zoom \n";
1970usage += ">>>> Mouse controls : \n";
1971usage += "o Button-1: Display current coordinates \n";
1972usage += "o Button-2: Defines a rectangle for zoom \n";
1973usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1974usage += ">>>> Keyboard controls : \n";
1975usage += "o <Alt>R : Refresh display \n";
1976usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1977usage += " (2-D histograms, contour plot ...) \n";
1978usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1979usage += " Drawer 0 manages the axes, as well as the added text \n";
1980usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
1981usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1982usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1983usage += "o <Alt>E : Removes the last added graphic element \n";
1984usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
1985usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
1986usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
1987usage += ">>>> Mouse + Keyboard controls : \n";
1988usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
1989piac->RegisterHelp(kw, usage, grp);
1990
1991kw = "PIDraw3DWdg";
1992usage = "Manages display of 3-D objects (drawers) \n";
1993usage += ">>>> Mouse controls : \n";
1994usage += "o Button-2: Rotates the observer (camera) around object \n";
1995usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1996usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1997usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1998usage += ">>>> Keyboard controls : \n";
1999usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
2000usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
2001usage += " (2-D histograms, contour plot ...) \n";
2002usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
2003usage += " Drawer 0 manages the axes, as well as the added text \n";
2004usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
2005usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
2006usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
2007usage += "o <Alt>E : Removes the last added graphic element \n";
2008usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
2009usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
2010piac->RegisterHelp(kw, usage, grp);
2011
2012kw = "Windows";
2013usage = "Objects can be displayed in different windows, or overlayed on the \n";
2014usage += "previous display. The graphics attributes next,win,stack,same control \n";
2015usage += "the display window. \n";
2016usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
2017usage += " Graphic windows can be divided int zones. Object is displayed \n";
2018usage += " in the next available position, removing a previously displayed \n";
2019usage += " widget if necessary \n";
2020usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
2021usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
2022usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
2023usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
2024usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
2025usage += " be activated using the StackTools menu (Blink) \n";
2026usage += "o Most objects can be also be displayed overlayed \n";
2027usage += " on the last displayed widget (gr_att= same) \n";
2028usage += "o The overlay can be on a selected rectangle of the \n";
2029usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
2030usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
2031piac->RegisterHelp(kw, usage, grp);
2032
2033kw = "PIConsole";
2034usage = "Text output area and command editing window (console) \n";
2035usage += ">>>> Mouse controls : \n";
2036usage += "o Button-1: Rectangle selection for copy/paste \n";
2037usage += "o Button-2: Paste text in the command editing line \n";
2038usage += "o Button-3: activate display option menu \n";
2039usage += ">>>> Keyboard controls : \n";
2040usage += "o <Alt>O : activate display option menu \n";
2041usage += "o <Alt>V : Paste text in the command editing line \n";
2042usage += "o <Alt>A : Selection of the whole window for copy \n";
2043usage += "o <Alt>L : Command history (List of command history buffer) \n";
2044usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
2045usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
2046usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
2047usage += "o <Ctl>C : Command editing -> Clear the line \n";
2048usage += "o Cursor left,right : Command editing -> Move cursor \n";
2049usage += "o Cursor Up,Down : recall command from history buffer \n";
2050usage += "o Backspace,Del : Command editing \n";
2051usage += "o <Return>,<Enter> : Execute command \n";
2052piac->RegisterHelp(kw, usage, grp);
2053}
Note: See TracBrowser for help on using the repository browser.