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

Last change on this file since 2215 was 2188, checked in by ansari, 23 years ago

Ajout commande exitpiapp et possibilite de soumettre une commande a executer a PIStdImgApp (pour execution du script specifie au demarrage) - Reza 9/9/2002

File size: 61.7 KB
RevLine 
[293]1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11
12#include "pistdimgapp.h"
13#include "nobjmgr.h"
[326]14#include "servnobjm.h"
[293]15
16#include "histos.h"
17#include "histos2.h"
18#include "hisprof.h"
19#include "ntuple.h"
20#include "generaldata.h"
[769]21
22#ifdef SANS_EVOLPLANCK
[333]23#include "cvector.h"
[769]24#else
25#include "tvector.h"
26#endif
[293]27
28
29/* --Methode-- */
30PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
31{
32mpiac = piac;
33mObjMgr = omg;
34mImgApp = app;
[312]35dynlink = NULL;
[1276]36dynlink2 = NULL;
[293]37RegisterCommands();
38}
39
40PIABaseExecutor::~PIABaseExecutor()
41{
[1276]42 if (dynlink) delete dynlink;
43 if (dynlink2) delete dynlink2;
[293]44}
45
46
47
48/* --Methode-- */
[1268]49int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
[293]50{
[333]51Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
[2188]52// ----> Sortie d'application
53if (kw == "exitpiapp") {
54 mImgApp->Stop();
55 return(0);
56}
[293]57// >>>>> Chargement de modules
[2188]58else if (kw == "loadmodule") {
[293]59 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
60 mpiac->LoadModule(tokens[0], tokens[1]);
61 }
62// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
63else if (kw == "zone") {
[384]64 while (tokens.size() < 2) tokens.push_back("1");
[293]65 int nx, ny;
66 nx = ny = 1;
67 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
[1971]68 if (mImgApp) mImgApp->SetZone(nx, ny);
[293]69 }
70else if (kw == "newwin") {
[1451]71 int nx=1, ny=1;
72 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
73 if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
74 if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
[1971]75 if (mImgApp) mImgApp->CreateGraphWin(nx, ny);
[293]76 }
77else if (kw == "stacknext") mImgApp->StackWinNext();
[553]78else if (kw == "graphicatt") {
79 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
[1971]80 string opts = tokens[0];
81 if (tokens.size() > 1)
[2089]82 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
[1971]83 if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts);
[293]84 }
[1971]85else if (kw == "setaxesatt") {
86 if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl; return(0); }
87 string opts = tokens[0];
88 if (tokens.size() > 1)
[2089]89 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
[1971]90 if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts);
[331]91 }
[548]92else if (kw == "setinsetlimits") {
93 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
94 double xmin = atof(tokens[0].c_str());
95 double xmax = atof(tokens[1].c_str());
96 double ymin = atof(tokens[2].c_str());
97 double ymax = atof(tokens[3].c_str());
98 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
99 }
[349]100else if (kw == "addtext") {
[1642]101 if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl; return(0); }
[349]102 double xp = atof(tokens[0].c_str());
103 double yp = atof(tokens[1].c_str());
[1642]104 string txt = tokens[2];
[1971]105 string sop;
106 if (tokens.size() > 3) sop = tokens[3];
107 mImgApp->AddText(txt, xp, yp, sop);
[349]108 }
[1642]109else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) {
110 if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl; return(0); }
111 double xp1 = atof(tokens[0].c_str());
112 double yp1 = atof(tokens[1].c_str());
113 double xp2 = atof(tokens[2].c_str());
114 double yp2 = atof(tokens[3].c_str());
[1971]115 string sop;
116 if (tokens.size() > 4) sop = tokens[4];
117 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop);
[1642]118 else {
119 bool fgfill = (kw == "addrect") ? false : true;
[1971]120 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill);
[1642]121 }
122 }
123else if ((kw == "addcirc") || (kw == "addfcirc")) {
124 if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl; return(0); }
125 double xc = atof(tokens[0].c_str());
126 double yc = atof(tokens[1].c_str());
127 double rad = atof(tokens[2].c_str());
[1971]128 string sop;
129 if (tokens.size() > 3) sop = tokens[3];
[1642]130 bool fgfill = (kw == "addcirc") ? false : true;
[1971]131 mImgApp->AddCircle(xc, yc, rad, sop, fgfill);
[1642]132 }
133
134
[2165]135else if ((kw == "settitle") || (kw == "addtitle")) {
136 if (tokens.size() < 1) { cout << "Usage: settitle/addtitle TopTitle [BotTitle] [fontatt]" << endl; return(0); }
[2154]137 if(tokens.size()<2) tokens.push_back("");
[2165]138 string gropt;
139 if(tokens.size()>2) gropt = tokens[2];
140 mImgApp->SetTitle(tokens[0], tokens[1], gropt);
[2154]141}
[2165]142
143else if ((kw == "setaxelabels") || (kw == "addaxelabels")) {
144 if (tokens.size() < 2) { cout << "Usage: setaxelabels/addaxelabels xLabel yLabel [fontatt]" << endl; return(0); }
145 string gropt;
146 if(tokens.size()>2) gropt = tokens[2];
147 mImgApp->SetAxeLabels(tokens[0], tokens[1], gropt);
148}
[349]149
[293]150// >>>>>>>>>>> Link dynamique de fonctions C++
151else if (kw == "link" ) {
152 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
153 string sph = "";
154 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
155 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
156 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
157}
[1276]158else if (kw == "linkff2" ) {
159 if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
160 string sph = "";
161 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
162 int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
163 if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
164}
[293]165else if (kw == "call" ) {
166 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
[1276]167 UsFmap::iterator it;
168 UsFmap::iterator it1 = usfmap.find(tokens[0]);
169 UsFmap::iterator it2 = usfmap2.find(tokens[0]);
170 if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
[293]171 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
172 return(0);
173 }
[1276]174 if (it1 == usfmap.end()) it = it2;
175 else it = it1;
[293]176 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
177// on est oblige de faire un cast etant donne qu'on
178// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
179 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
180// On redirige la sortie sur le terminal
181 bool red = mImgApp->HasRedirectedStdOutErr();
182 mImgApp->RedirectStdOutErr(false);
[1276]183#ifdef SANS_EVOLPLANCK
[293]184 TRY {
185 tokens.erase(tokens.begin());
186 fuf(tokens);
187 } CATCH(merr) {
188 fflush(stdout);
[1276]189 string es = PeidaExc(merr);
190 cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
[293]191 cout << endl;
192 }
[1276]193#else
194 try {
195 tokens.erase(tokens.begin());
196 fuf(tokens);
197 }
198 catch ( PThrowable & exc ) {
199 cerr << "\n PIABaseExecutor: Call / Catched Exception :"
200 << (string)typeid(exc).name() << " Msg= "
201 << exc.Msg() << endl;
202 cout << endl;
203 }
204 catch ( ... ) {
205 cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
206 << endl;
207 cout << endl;
208 }
209#endif
[293]210 mImgApp->RedirectStdOutErr(red);
211}
212
213// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
214else if (kw == "openfits" ) {
215 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
[331]216 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
[293]217}
218else if (kw == "savefits" ) {
219 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
220 else mObjMgr->SaveFits(tokens[0], tokens[1]);
221}
222else if (kw == "openppf" ) {
223 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
224 mObjMgr->ReadAll(tokens[0]);
225}
[2132]226else if ((kw == "saveobjs") || (kw == "saveppf")) {
[333]227 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
228 mObjMgr->SaveObjects(tokens[0], tokens[1]);
229}
[293]230else if (kw == "saveall" ) {
231 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
232 mObjMgr->SaveAll(tokens[0]);
233}
234else if (kw == "print" ) {
235 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
236 mObjMgr->PrintObj(tokens[0]);
237}
[333]238else if ( (kw == "rename" ) || (kw == "mv") ) {
[2132]239 if (tokens.size() < 2) { cout << "Usage: rename/mv nameobj namenew" << endl; return(0); }
[293]240 mObjMgr->RenameObj(tokens[0], tokens[1]);
241}
[333]242else if ( (kw == "del" ) || (kw == "rm") ) {
[1655]243 if (tokens.size() < 1) { cout << "Usage: del nameobj [nameobj2 ...]" << endl; return(0); }
244 if (tokens.size()>0)
245 for(uint_4 i=0;i<tokens.size();i++) mObjMgr->DelObj(tokens[i]);
[293]246}
247else if (kw == "delobjs" ) {
248 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
249 mObjMgr->DelObjects(tokens[0]);
250}
[333]251else if ( (kw == "listobjs") || (kw == "ls") ) {
[331]252 if (tokens.size() < 1) tokens.push_back("*");
253 mObjMgr->ListObjs(tokens[0]);
254}
[333]255// Gestion des repertoires
256else if (kw == "mkdir" ) {
[344]257 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
258 bool crd = mObjMgr->CreateDir(tokens[0]);
259 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
260 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
[333]261 }
262else if (kw == "rmdir" ) {
263 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
264 mObjMgr->DeleteDir(tokens[0]);
265 }
[2132]266else if (kw == "setdiratt" ) {
267 if (tokens.size() < 2) { cout << "Usage: setdiratt dirname true/false" << endl; return(0); }
268 if (tokens[1] == "true") mObjMgr->SetKeepOldDirAtt(tokens[0], true);
269 else mObjMgr->SetKeepOldDirAtt(tokens[0], false);
270}
[333]271else if (kw == "cd") {
272 if (tokens.size() < 1) tokens.push_back("home");
273 mObjMgr->SetCurrentDir(tokens[0]);
274 }
[345]275else if (kw == "pwd") {
276 string dirn;
277 mObjMgr->GetCurrentDir(dirn);
278 cout << "CurrentDirectory: " << dirn << endl;
279 }
[333]280else if (kw == "listdirs") {
281 if (tokens.size() < 1) tokens.push_back("*");
282 mObjMgr->ListDirs(tokens[0]);
283 }
[293]284
285// >>>>>>>>>>> Creation d'histos 1D-2D
286else if (kw == "newh1d") {
287 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
[1091]288 int_4 nbx = 100;
289 r_8 xmin = 0., xmax = 1.;
[293]290 nbx = atoi(tokens[3].c_str());
291 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
292 Histo* h = new Histo(xmin, xmax, nbx);
293 mObjMgr->AddObj(h, tokens[0]);
294 }
295else if (kw == "newh2d") {
296 if (tokens.size() < 7) {
297 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
298 return(0);
299 }
[1091]300 int_4 nbx = 50, nby = 50;
301 r_8 xmin = 0., xmax = 1.;
302 r_8 ymin = 0., ymax = 1.;
[293]303 nbx = atoi(tokens[3].c_str());
304 nby = atoi(tokens[6].c_str());
305 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
306 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
307 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
308 mObjMgr->AddObj(h, tokens[0]);
309 }
[1035]310else if (kw == "newprof" || kw == "newprofe") {
[293]311 if (tokens.size() < 4)
[1035]312 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
[1091]313 int_4 nbx = 100;
314 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
[293]315 if(tokens.size() > 5)
316 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
317 nbx = atoi(tokens[3].c_str());
318 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
319 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
[1035]320 if(kw == "newprofe") h->SetErrOpt(false);
[293]321 mObjMgr->AddObj(h, tokens[0]);
322 }
[447]323
324// Creation de NTuple
325else if (kw == "newnt") {
326 if(tokens.size() < 2)
327 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
328 vector<string> varname;
329 int nvar = 0;
330 const char *c = tokens[1].c_str();
331 if(isdigit(c[0])) {
332 nvar = atoi(tokens[1].c_str());
333 if(nvar<=0 || nvar>=10000)
334 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
335 return(0);}
336 for(int i=0;i<nvar;i++) {
337 char str[16]; sprintf(str,"%d",i);
338 string dum = "v"; dum += str;
339 varname.push_back(dum.c_str());
340 }
341 } else if( islower(c[0]) || isupper(c[0]) ) {
[1548]342 for(int i=1;i<(int)tokens.size();i++) {
[447]343 varname.push_back(tokens[i].c_str());
344 nvar++;
345 }
346 } else {
347 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
348 <<"newnt name nvar : nvar must be an positive integer"<<endl;
349 return(0);
350 }
351 char **noms = new char*[nvar];
352 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
353 NTuple* nt = new NTuple(nvar,noms);
354 delete [] noms;
355 mObjMgr->AddObj(nt,tokens[0]);
356 }
357
358// Creation de GeneralFitData
[293]359else if (kw == "newgfd") {
360 if (tokens.size() < 3)
361 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
362 int nvar, nalloc, errx=0;
363 if (tokens.size() > 3)
364 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
365 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
366 if(nvar>0 && nalloc>0) {
367 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
368 mObjMgr->AddObj(gfd, tokens[0]);
369 }
370 }
371
[333]372// Creation/remplissage de vecteur et de matrice
373else if (kw == "newvec") {
374 if (tokens.size() < 2) {
375 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
376 }
377 int n = atoi(tokens[1].c_str());
378 double xmin, xmax;
379 xmin = 0.; xmax = n;
[357]380 if (tokens.size() < 3) {
381 Vector* v = new Vector(n);
382 mObjMgr->AddObj(v, tokens[0]);
383 }
384 else {
385 if (tokens.size() < 4) tokens.push_back("");
386 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
387 }
[333]388 }
389else if (kw == "newmtx") {
390 if (tokens.size() < 3) {
[1917]391 cout << "Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
[333]392 }
393 int nx = atoi(tokens[1].c_str());
394 int ny = atoi(tokens[2].c_str());
395 double xmin, xmax, ymin, ymax;
396 xmin = 0.; xmax = nx;
397 ymin = 0.; ymax = ny;
[357]398 if (tokens.size() < 4) {
399 Matrix* mtx = new Matrix(ny,nx);
400 mObjMgr->AddObj(mtx, tokens[0]);
401 }
402 else {
[1971]403 if (tokens.size() < 5) tokens.push_back("next");
[357]404 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
405 nx, ny, tokens[4]);
406 }
[333]407 }
408
[455]409// Copie d'objets
[2176]410else if ( (kw == "copy") || (kw == "cp") ) {
[455]411 if(tokens.size()<2) {
412 cout<<"Usage: copy name_from name_to"<<endl;return(0);
413 }
[463]414 mObjMgr->CopyObj(tokens[0],tokens[1]);
[455]415}
416
417
[293]418// >>>>>>>>>>> Affichage des objets
[295]419else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
420 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
[1971]421 string opt = "next";
[293]422 if (tokens.size() > 1) opt = tokens[1];
423 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
424 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
[295]425 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
[293]426 }
427
428else if (kw == "nt2d") {
[486]429 if (tokens.size() < 3) {
430 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
431 return(0);
[293]432 }
[486]433 while (tokens.size() < 8) tokens.push_back("");
[333]434 string ph = "";
[486]435 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
436 tokens[5], tokens[6], tokens[7], false);
[333]437 }
[293]438else if (kw == "nt3d") {
[486]439 if (tokens.size() < 7) {
440 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
441 return(0);
[293]442 }
[486]443 while (tokens.size() < 10) tokens.push_back("");
444 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
445 tokens[6], tokens[7], tokens[8], tokens[9], true);
446 }
[1525]447else if (kw == "vecplot") {
448 if (tokens.size() < 2) {
449 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
450 }
451 while (tokens.size() < 3) tokens.push_back("");
452 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
453}
[293]454
[339]455// Obsolete : ne pas virer SVP, cmv 26/7/99
[293]456else if (kw == "gfd2d") {
[339]457 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
[293]458 if(tokens.size()<2)
459 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
460 return(0);}
461 string numvary = "";
462 string err = "";
[1971]463 string opt = "next";
[293]464 if(tokens.size()>2) err = tokens[2];
465 if(tokens.size()>3) opt = tokens[3];
466 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
467 }
468else if (kw == "gfd3d") {
[339]469 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
[293]470 if(tokens.size()<3)
471 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
472 return(0);}
473 string err = "";
[1971]474 string opt = "next";
[293]475 if(tokens.size()>3) err = tokens[3];
476 if(tokens.size()>4) opt = tokens[4];
477 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
478 }
479
480// >>>>>>>>>>> Trace de fonctions
481else if ( (kw == "func") ) {
[1938]482 if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
483 int np = 100;
484 double xmin=0., xmax=1.;
485 string opt = "", nom = "";
486 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
487 if (tokens.size() > 3) np = atoi(tokens[3].c_str());
[293]488 if (tokens.size() > 4) opt = tokens[4];
[333]489 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
[293]490 }
[326]491else if ( (kw == "funcff") ) {
[1938]492 if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
493 int np = 100;
494 double xmin=0., xmax=1.;
495 string opt = "", nom = "";
496 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
497 if(tokens.size()>4) np = atoi(tokens[4].c_str());
498 if(tokens.size()>5) opt = tokens[5];
[333]499 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
[326]500 }
[293]501else if ( (kw == "func2d") ) {
502 if (tokens.size() < 7) {
[357]503 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
[293]504 return(0);
505 }
506 int npx, npy;
[333]507 double xmin, xmax;
508 double ymin, ymax;
[293]509 npx = npy = 50;
510 xmin = 0.; xmax = 1.;
511 ymin = 0.; ymax = 1.;
512 npx = atoi(tokens[3].c_str());
513 npy = atoi(tokens[6].c_str());
514 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
515 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
[357]516 string opt = "";
[293]517 if (tokens.size() > 7) opt = tokens[7];
[333]518 string nom = "";
519 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[293]520 }
[326]521else if ( (kw == "func2dff") ) {
522 if (tokens.size() < 8) {
[357]523 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
[326]524 return(0);
525 }
526 int npx, npy;
[333]527 double xmin, xmax;
528 double ymin, ymax;
[326]529 npx = npy = 50;
530 xmin = 0.; xmax = 1.;
531 ymin = 0.; ymax = 1.;
532 npx = atoi(tokens[4].c_str());
533 npy = atoi(tokens[7].c_str());
534 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
535 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
[357]536 string opt = "";
[326]537 if (tokens.size() > 8) opt = tokens[8];
[333]538 string nom = "";
539 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[326]540 }
[293]541
542// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
543else if (kw == "plot2d" ) {
[357]544 if (tokens.size() < 3) {
545 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
[293]546 return(0);
547 }
[357]548 string errx = ""; string erry = "";
549 if (tokens.size() < 4) tokens.push_back("1");
550 while (tokens.size() < 6) tokens.push_back("");
551 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
552 }
553
554else if (kw == "plot2de" ) { // Plot2D avec les erreurs
555 if (tokens.size() < 5) {
556 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
557 return(0);
[293]558 }
[357]559 if (tokens.size() < 6) tokens.push_back("1");
560 while (tokens.size() < 8) tokens.push_back("");
561 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
562 tokens[5],tokens[6],tokens[7]);
[293]563 }
564
[357]565else if (kw == "plot2dw" ) { // Plot2d avec poids
566 if (tokens.size() < 4) {
567 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
[333]568 return(0);
569 }
[357]570 if (tokens.size() < 5) tokens.push_back("1");
571 while (tokens.size() < 7) tokens.push_back("");
572 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
[333]573 }
[357]574else if (kw == "plot3d" ) {
575 if (tokens.size() < 4) {
576 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
[293]577 return(0);
578 }
[357]579 if (tokens.size() < 5) tokens.push_back("1");
580 while (tokens.size() < 7) tokens.push_back("");
581 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
[293]582 }
583
584else if (kw == "projh1d" ) {
[357]585 if (tokens.size() < 3) {
586 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
[293]587 return(0);
588 }
[357]589 if (tokens.size() < 4) tokens.push_back("1.");
590 if (tokens.size() < 5) tokens.push_back("1");
591 while (tokens.size() < 7) tokens.push_back("");
592 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]593 }
594
[357]595
596// Projection dans histogrammes
[293]597else if (kw == "projh2d" ) {
[357]598 if (tokens.size() < 4) {
599 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]600 return(0);
601 }
[357]602 if (tokens.size() < 5) tokens.push_back("1.");
603 if (tokens.size() < 6) tokens.push_back("1");
604 while (tokens.size() < 8) tokens.push_back("");
605 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
606 tokens[6], tokens[7] );
[293]607 }
608
609else if (kw == "projprof" ) {
[357]610 if (tokens.size() < 4) {
611 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]612 return(0);
613 }
[357]614 if (tokens.size() < 5) tokens.push_back("1.");
615 if (tokens.size() < 6) tokens.push_back("1");
616 while (tokens.size() < 8) tokens.push_back("");
617 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
[1091]618 tokens[6], tokens[7] );
[357]619 }
[293]620
[357]621// Projection dans vector/matrix
622else if (kw == "fillvec" ) {
623 if (tokens.size() < 4) {
624 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
625 return(0);
626 }
627 if (tokens.size() < 5) tokens.push_back("1");
628 while (tokens.size() < 7) tokens.push_back("");
629 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]630 }
631
[357]632else if (kw == "fillmtx" ) {
633 if (tokens.size() < 5) {
634 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
635 return(0);
636 }
637 if (tokens.size() < 6) tokens.push_back("1");
638 while (tokens.size() < 8) tokens.push_back("");
639 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
640 tokens[6], tokens[7] );
641 }
642
643// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
[447]644else if (kw == "ntfrascii" ) {
645 if(tokens.size() < 2) {
646 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
647 return(0);
648 }
649 double def_val = 0.;
650 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
651 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
652 }
653
[293]654else if (kw == "fillnt" ) {
[357]655 if (tokens.size() < 5) {
656 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
[293]657 return(0);
658 }
[357]659 while (tokens.size() < 8) tokens.push_back("");
660 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
[293]661 }
662
[333]663else if (kw == "ntloop" ) {
664 if (tokens.size() < 3) {
[357]665 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
[333]666 return(0);
667 }
[357]668 while (tokens.size() < 5) tokens.push_back("");
669 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
[333]670 }
671
672else if (kw == "ntexpcfile" ) {
673 if (tokens.size() < 3) {
674 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
675 return(0);
676 }
677 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
678 }
679
[357]680else if (kw == "exptovec" ) {
681 if (tokens.size() < 3) {
682 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
[293]683 return(0);
684 }
[357]685 while (tokens.size() < 6) tokens.push_back("");
686 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
[293]687 }
688
689else if (kw == "fillgd1" ) {
690 if (tokens.size() < 5) {
[357]691 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
[293]692 return(0);
693 }
[357]694 if (tokens.size() < 6) tokens.push_back("1");
695 if (tokens.size() < 7) tokens.push_back("");
[293]696 string expy = "";
[357]697 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
[293]698 }
699
700else if (kw == "fillgd2" ) {
701 if (tokens.size() < 6) {
[357]702 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
[293]703 return(0);
704 }
[357]705 if (tokens.size() < 7) tokens.push_back("1");
706 if (tokens.size() < 8) tokens.push_back("");
707 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
[293]708 }
709
[1067]710else if (kw == "gdfrvec" ) {
711 if(tokens.size()<3) {
712 cout<<"Usage: gdfrvec namegfd X Y\n"
713 <<" gdfrvec namegfd X Y"
714 <<" gdfrvec namegfd X Y ! EY\n"
715 <<" gdfrvec namegfd X Y Z\n"
716 <<" gdfrvec namegfd X Y Z EZ"<<endl;
717 return(0);
718 }
719 while(tokens.size()<5) tokens.push_back("!");
720 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
721 }
[293]722
[2180]723// >>>>>>>>>>> Calcul d'expression arithmetique
724else if ( (kw == "eval") ) {
725 if(tokens.size()<2)
726 {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
727 string expval = "";
728 for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
729 string resultvarname = "";
730 if(isalpha(tokens[0][0])) resultvarname=tokens[0];
731 mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
732 }
[293]733
734else {
735 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
736 return(-1);
737 }
738
739return(0);
740}
741
[388]742// Fonction pour enregistrer le Help des Widgets et Windows de piapp
743static void RegisterPIGraphicsHelp(PIACmd* piac);
744
[293]745/* --Methode-- */
746void PIABaseExecutor::RegisterCommands()
747{
748string kw, usage;
[2188]749kw = "exitpiapp";
750usage = "To end the piapp session";
751mpiac->RegisterCommand(kw, usage, this, "Commands");
[293]752kw = "loadmodule";
753usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
754usage += "\n Related commands: link";
[330]755mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]756kw = "link";
757usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
758usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
[1276]759usage += "\n Related commands: call loadmodule linkff2";
[330]760mpiac->RegisterCommand(kw, usage, this, "External Modules");
[1276]761kw = "linkff2";
762usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
763usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
764usage += "\n Related commands: call link loadmodule";
765mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]766kw = "call";
767usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
768usage += "\n User function : f(vector<string>& args)";
769usage += "\n Related commands: link";
[330]770mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]771
772kw = "zone";
[384]773usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
[388]774usage += "\n Related commands: newwin";
[330]775mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]776kw = "newwin";
777usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
[388]778usage += "\n Related commands: zone";
[330]779mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]780kw = "stacknext";
781usage = "Displays the next widget on stack window \n Usage: stacknext";
[330]782mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]783
[553]784kw = "graphicatt";
785usage = "To change default graphic options \n Usage: graphicatt att_list \n";
[1971]786usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
[293]787usage += "\n ------------------ Graphic attribute list ------------------ \n";
[1642]788usage += ">> Colors: defcol black white grey red blue green yellow \n";
789usage += " magenta cyan turquoise navyblue orange siennared purple \n";
790usage += " limegreen gold violet violetred blueviolet darkviolet \n";
[293]791usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
792usage += " thickdashedline dottedline thindottedline thickdottedline \n";
[1569]793usage += ">> Font Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
794usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont \n";
795usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont \n";
796usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont \n";
797usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont \n";
[293]798usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
799usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
800usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
801usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
[1126]802usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
803usage += " grey128 invgrey128 colrj128 colbr128 \n";
804usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
805usage += " midas_bluewhite midas_redwhite \n";
806usage += " rainbow16 \n";
[1504]807usage += " revcmap : This flag reverses ColorMap indexing \n";
[2118]808usage += ">> ZoomFactors zoomxN zoomx1 zoomx2 zoomx3 ... \n";
809usage += " (image display) zoom/N zoom/2 zoom/3 zoom/4 ...\n";
[1971]810usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
[2121]811usage += ">> lut=ltyp,min,max -> Sets LUT type and min/max for image display \n";
[2118]812usage += " (ltyp=lin/log/sqrt/square) \n";
813usage += ">> Axes: stdaxes=defaxes=boxaxes boxaxesgrid centeredaxes\n";
814usage += " fineaxes finecenteredaxes fineaxesgrid=grid \n";
815usage += " centeredaxesgrid finecenteredaxesgrid \n";
[2121]816usage += ">> Axe labels font size: fixedfontsize/autofontsize \n";
817usage += " autofontsize: Font size computed automatically \n";
818usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
[506]819usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
[2118]820usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
[546]821usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
[1131]822usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
[548]823usage += ">> DisplayWindow: next same win stack inset \n";
[1971]824usage += " Related commands: setaxesatt setinsetlimits ";
[330]825mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]826
[1971]827kw = "setaxesatt";
828usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
[2118]829usage += "Color/Line/Font attributes and axes attributes";
830usage += ">> Axes: stdaxes=defaxes=boxaxes boxaxesgrid centeredaxes\n";
831usage += " fineaxes finecenteredaxes fineaxesgrid=grid \n";
832usage += " centeredaxesgrid finecenteredaxesgrid \n";
[2121]833usage += ">> Axe labels font size: fixedfontsize/autofontsize \n";
834usage += " autofontsize: Font size computed automatically \n";
835usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
[1971]836usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
837usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
[331]838mpiac->RegisterCommand(kw, usage, this, "Graphics");
839
[548]840kw = "setinsetlimits";
841usage = "Define the display rectangle for drawers added as insets \n";
842usage += " over existing graphic objects - limits expressed as fraction \n";
843usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
844usage += " Usage: setinsetlimits xmin xmax ymin ymax";
[558]845usage += "\n Related commands: graphicatt /inset";
[548]846mpiac->RegisterCommand(kw, usage, this, "Graphics");
847
[349]848kw = "addtext";
849usage = "Adds a text string to the current graphic object";
[1642]850usage += "\n at the specified position (+ color and font attributes) ";
851usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
852usage += "\n Alt<Z> to remove added elements";
853usage += "\n Font attribute is common with axes";
854usage += "\n Usage: addtext x y TextString [ColFontAtt]";
855usage += "\n (use quotes '' for multi word text strings) ";
856usage += "\n Related commands: addline addrect addfrect addcirc addfcirc settitle graphicatt";
[349]857mpiac->RegisterCommand(kw, usage, this, "Graphics");
858
[1642]859kw = "addline";
860usage = "Adds a line to the current graphic object";
861usage += "\n at the specified position (+ color attribute)";
862usage += "\n The Base/AxesDrawer is used to handle added lines";
863usage += "\n Alt<Z> to remove added elements";
864usage += "\n Usage: addline x1 y1 x2 y2 [ColAtt]";
865usage += "\n Related commands: addtext addrect addfrect addcirc addfcirc graphicatt";
866mpiac->RegisterCommand(kw, usage, this, "Graphics");
867
868kw = "addrect";
869usage = "Adds a rectangle to the current graphic object";
870usage += "\n between the specified positions (+ color attribute)";
871usage += "\n The Base/AxesDrawer is used to handle added rectangle";
872usage += "\n Alt<Z> to remove added elements";
873usage += "\n Usage: addrect x1 y1 x2 y2 [ColAtt]";
874usage += "\n Related commands: addtext addline addfrect addcirc addfcirc graphicatt";
875mpiac->RegisterCommand(kw, usage, this, "Graphics");
876
877kw = "addfrect";
878usage = "Adds a filled rectangle to the current graphic object";
879usage += "\n between the specified positions (+ color attribute)";
880usage += "\n The Base/AxesDrawer is used to handle added rectangle";
881usage += "\n Alt<Z> to remove added elements";
882usage += "\n Usage: addfrect x1 y1 x2 y2 [ColAtt]";
883usage += "\n Related commands: addtext addline addrect addcirc addfcirc graphicatt";
884mpiac->RegisterCommand(kw, usage, this, "Graphics");
885
886kw = "addcirc";
887usage = "Adds a circle to the current graphic object";
888usage += "\n with the specified center and radius (+ color attribute)";
889usage += "\n The Base/AxesDrawer is used to handle added circles";
890usage += "\n Alt<Z> to remove added elements";
891usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]";
892usage += "\n Related commands: addtext addline addfrect addfrect addfcirc graphicatt";
893mpiac->RegisterCommand(kw, usage, this, "Graphics");
894
895kw = "addfcirc";
896usage = "Adds a filled circle to the current graphic object";
897usage += "\n with the specified center and radius (+ color attribute)";
898usage += "\n The Base/AxesDrawer is used to handle added circles";
899usage += "\n Alt<Z> to remove added elements";
900usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]";
901usage += "\n Related commands: addtext addline addfrect addfrect addcirc graphicatt";
902mpiac->RegisterCommand(kw, usage, this, "Graphics");
903
[1131]904kw = "settitle";
[1642]905usage = "Set the title string (top title / bottom title) for the current graphic object";
906usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
[1131]907usage += "\n Related commands: addtext graphicatt";
908mpiac->RegisterCommand(kw, usage, this, "Graphics");
909
[2165]910kw = "addtitle";
911usage = "Set the title string (top title / bottom title) \n";
912usage += " alias for settitle ";
913mpiac->RegisterCommand(kw, usage, this, "Graphics");
914
915kw = "setaxelabels";
916usage = "Set the X and Y axis labels for the current 2D graphic object \n";
917usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
918usage += "\n Related commands: settitle addtext graphicatt";
919mpiac->RegisterCommand(kw, usage, this, "Graphics");
920
921kw = "addaxelabels";
922usage = "Set the X and Y axis labels for the current 2D graphic object";
923usage += " alias for setaxelabels ";
924mpiac->RegisterCommand(kw, usage, this, "Graphics");
925
[388]926RegisterPIGraphicsHelp(mpiac);
927
[293]928kw = "openfits";
[2132]929usage = "Loads a FITS file into an apprpiate object \n Usage: openfits filename";
[293]930usage += "\n Related commands: savefits openppf";
[330]931mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]932kw = "savefits";
933usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
[2132]934usage += "\n Related commands: openfits saveobjs saveall";
[330]935mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]936kw = "openppf";
937usage = "Reads all objects from a PPF file \n Usage: openppf filename";
938usage += "\n Related commands: saveall openfits";
[330]939mpiac->RegisterCommand(kw, usage, this, "FileIO");
[2132]940kw = "saveppf";
941usage = "Saves objects with names matching a pattern into a\n";
942usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
943usage += "Usage: saveppf nameobjpattern filename";
944usage += "\n Related commands: saveobjs saveall openppf savefits";
945mpiac->RegisterCommand(kw, usage, this, "FileIO");
[333]946kw = "saveobjs";
[2132]947usage = "Saves objects with names matching a pattern into a\n";
948usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
[1068]949usage += "Usage: saveobjs nameobjpattern filename";
[2132]950usage += "\n Related commands: saveppf saveall openppf savefits";
[333]951mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]952kw = "saveall";
953usage = "Saves all objects into a PPF file \n Usage: saveall filename";
[333]954usage += "\n Related commands: saveobj openppf savefits";
[330]955mpiac->RegisterCommand(kw, usage, this, "FileIO");
[449]956kw = "ntfrascii";
957usage = "Fills an existing NTuple from ASCII table file";
958usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
959usage += "\n Related commands: ntloop fillnt ";
960mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]961
[449]962
[293]963kw = "print";
964usage = "Prints an object \n Usage: print nameobj";
[330]965mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]966
[333]967kw = "mkdir";
968usage = "Create a directory";
[344]969usage += "\n Usage: mkdir dirname [true]";
970usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
[463]971mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]972kw = "rmdir";
973usage = "Removes an empty directory";
974usage += "\n Usage: remove dirname";
[463]975mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]976kw = "setdiratt";
977usage = "Sets directory attributes";
978usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
979usage += "\n KeepOldFlag=true Object with the same name is moved to old";
980usage += "\n when adding objects";
981mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]982kw = "cd";
983usage = "Change current directory";
984usage += "\n Usage: cd [dirname]";
[463]985mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]986kw = "pwd";
987usage = "Prints current directory";
988usage += "\n Usage: pwd";
[463]989mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]990kw = "listdirs";
991usage = "Prints the list of directories";
992usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
[463]993mpiac->RegisterCommand(kw, usage, this, "Object Management");
[295]994kw = "listobjs";
[333]995usage = "Prints the list of objects (Alias: ls)";
996 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
[463]997mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]998kw = "rename";
[333]999usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
[2132]1000usage += "\n Related commands: mv del delobjs";
[463]1001mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1002kw = "mv";
1003usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1004usage += "\n Related commands: rename del delobjs";
1005mpiac->RegisterCommand(kw, usage, this, "Object Management");
[463]1006kw = "copy";
[2132]1007usage = "Copy objects (Alias cp) \n";
[463]1008usage +=" Usage: copy name_from name_to";
[2132]1009usage += "\n Related commands: cp new...";
[2176]1010mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1011kw = "cp";
1012usage = "Copy objects (Alias copy) \n";
1013usage +=" Usage: cp name_from name_to";
1014usage += "\n Related commands: copy new...";
[463]1015mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1016kw = "del";
[1655]1017usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
[2132]1018usage += "\n Related commands: rm delobjs rename";
[463]1019mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1020kw = "rm";
1021usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1022usage += "\n Related commands: del delobjs rename";
1023mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1024kw = "delobjs";
1025usage = "Delete a set of objects with names matching a pattern (x?y*)";
1026usage += "\n Usage: delobjs nameobjpattern \n";
1027usage += "\n Related commands: del rename";
[463]1028mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1029
1030kw = "newh1d";
1031usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
[1035]1032usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
[333]1033mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1034kw = "newh2d";
1035usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
[1035]1036usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
[333]1037mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1038kw = "newprof";
1039usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
[1035]1040usage += "\n Errors represent the data spread in the X bin ";
1041usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
[333]1042mpiac->RegisterCommand(kw, usage, this, "Objects");
[1035]1043kw = "newprofe";
1044usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1045usage += "\n Errors represent the error on the data mean in the X bin ";
1046usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
1047mpiac->RegisterCommand(kw, usage, this, "Objects");
[447]1048kw = "newnt";
1049usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1050usage += "\n newnt name nvar";
[1035]1051usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
[447]1052mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1053kw = "newgfd";
1054usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
[1035]1055usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
[333]1056mpiac->RegisterCommand(kw, usage, this, "Objects");
1057kw = "newvec";
[357]1058usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
[333]1059usage += "\n Related commands: newmtx";
[357]1060mpiac->RegisterCommand(kw, usage, this, "Objects");
[333]1061kw = "newmtx";
[357]1062usage = "Creates (and optionaly fills) a matrix \n";
[1917]1063usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
[333]1064usage += "\n Related commands: newvec";
[357]1065mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1066
1067kw = "disp";
1068usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
[1525]1069usage += "\n Related commands: surf nt2d nt3d vecplot";
[330]1070mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[295]1071kw = "imag";
1072usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
[1525]1073usage += "\n Related commands: disp surf nt2d nt3d vecplot";
[330]1074mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]1075kw = "surf";
1076usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
[1525]1077usage += "\n Related commands: disp nt2d nt3d vecplot";
[330]1078mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]1079kw = "nt2d";
[486]1080usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
1081usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
[1525]1082usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
[330]1083mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]1084kw = "nt3d";
[486]1085usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
1086usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
1087usage += "\n Related commands: disp surf nt2d gfd3d ";
[330]1088mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[1525]1089kw = "vecplot";
1090usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
1091usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
1092usage += "\n Related commands: disp nt2d ";
1093mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[339]1094
1095// Ceci est maintenant obsolete, on garde pour info.
[293]1096kw = "gfd2d";
1097usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
1098usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
[339]1099usage += "\n Related commands: gfd3d nt2d nt3d ";
1100usage += "\n ----- OBSOLETE: utilisez nt2d -----";
[330]1101mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]1102kw = "gfd3d";
1103usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
1104usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
1105usage += "\n Related commands: gfd2d nt2d nt3d ";
[339]1106usage += "\n ----- OBSOLETE: utilisez nt3d -----";
[330]1107mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]1108
1109kw = "func";
1110usage = "Displays a function y=f(x) (Fills a vector with function values)";
[1938]1111usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
[326]1112usage += "\n Related commands: funcff func2d func2dff ";
[330]1113mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]1114kw = "funcff";
1115usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
[1938]1116usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
[326]1117usage += "\n Related commands: func func2d func2dff ";
[330]1118mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]1119kw = "func2d";
1120usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1121usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1122usage += "\n Related commands: func";
[330]1123mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]1124kw = "func2dff";
1125usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1126usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1127usage += "\n Related commands: func funcff func2d ";
[330]1128mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]1129
[357]1130kw = "ObjectExpressions";
1131usage = "Any mathematical expression (math.h) with object variables can be used";
1132usage += "\n ------ Object Variable names (double) -------- ";
[1548]1133usage += "\n- NTuple: ntuple variable names";
1134usage += "\n- Histo1D/HProf: i,x,val,err";
1135usage += "\n- Histo2D: i,j,x,y,val,err";
1136usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas";
1137usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas";
1138usage += "\n- Image: i,j,x,y,val(=pix)";
1139usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok";
1140usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
1141usage += "\n- i,k,val,real,imag,mod,phas,teta,phi";
1142usage += "\n- FITS Binary/ASCII table: fits column names";
[2128]1143#ifdef SANS_EVOLPLANCK
1144usage += "\n ------ Eros Variable names (double) -------- ";
1145usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
1146usage += "\n- xref,yref,fluxref,fondref,pixmaxref";
1147#endif
[1548]1148usage += "\n ------ Other parameters -------- ";
[357]1149usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1150usage += "\nThe default Cut() expression in true (=1) for all";
[1548]1151usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d ";
[357]1152usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1153usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
1154mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
[293]1155kw = "plot2d";
1156usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
[357]1157usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
1158usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
[330]1159mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1160kw = "plot2de";
1161usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1162usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1163usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1164mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[333]1165kw = "plot2dw";
1166usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
[357]1167usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1168usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
[333]1169mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1170kw = "plot3d";
1171usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
[357]1172usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1173usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
[330]1174mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1175
1176kw = "projh1d";
1177usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
[357]1178usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1179usage += "\n Histo1D nameh1d is created if necessary ";
[357]1180usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
[330]1181mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1182kw = "projh2d";
1183usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
[357]1184usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1185usage += "\n Histo2D nameh2d is created if necessary ";
[357]1186usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
[330]1187mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1188kw = "projprof";
1189usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
[709]1190usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1191usage += "\n HProf nameprof is created if necessary ";
[357]1192usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
[330]1193mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1194kw = "fillvec";
1195usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1196usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1197usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1198mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1199kw = "fillmtx";
1200usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1201usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1202usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1203mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1204
1205kw = "fillnt";
1206usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1207usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
[333]1208usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
[357]1209usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
[330]1210mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1211
[333]1212kw = "ntloop";
1213usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1214usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1215usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1216usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
[333]1217usage += "\n Related commands: ntexpcfile fillnt";
1218mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1219
[333]1220kw = "ntexpcfile";
1221usage = "Creates a C-File with declarations suitable to be used for ntloop";
1222usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1223usage += "\n Related commands: ntloop";
1224mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1225
[357]1226kw = "exptovec";
[293]1227usage = "Creates and Fills a Vector with X=f(Object)";
[357]1228usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1229usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1230mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1231kw = "fillgd1";
1232usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
[357]1233usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1234usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1235mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1236kw = "fillgd2";
1237usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
[357]1238usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1239usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1240mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[1067]1241kw = "gdfrvec";
1242usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1243usage += "\n Usage: gdfrvec namegfd X Y";
1244usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1245usage += "\n Usage: gdfrvec namegfd X Y Z";
1246usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1247usage += "\n Related commands: fillgd1 fillgd2 ...";
1248mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1249
[2180]1250
1251kw = "eval";
1252usage = "Compute arithmetic expression\n";
1253usage += "\n Usage: eval resultvarname arithmetic expression....";
1254usage += "\n resultvarname: store result in variable resultvarname";
1255usage += "\n - If first character is not alphabetic, just print result";
1256usage += "\n arithmetic expression:";
1257usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1258usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1259usage += "\n ex: 360 * M_PI / 180.";
1260mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1261
[293]1262}
1263
1264/* --Methode-- */
1265int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1266// string& func4, string& func5)
1267{
1268string cmd;
1269
1270if (dynlink) delete dynlink; dynlink = NULL;
1271usfmap.clear();
1272
1273dynlink = new PDynLinkMgr(fnameso, true);
1274if (dynlink == NULL) {
1275 string sn = fnameso;
1276 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1277 return(2);
1278 }
1279
1280int nok=0;
1281// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1282// DlUserProcFunction f = NULL;
1283DlFunction f = NULL;
1284if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1285// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1286f = dynlink->GetFunction(func1);
1287if (f) { nok++; usfmap[func1] = f; }
1288else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1289
1290if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1291// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1292f = dynlink->GetFunction(func2);
1293if (f) { nok++; usfmap[func2] = f; }
1294else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1295
1296if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1297// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1298f = dynlink->GetFunction(func3);
1299if (f) { nok++; usfmap[func3] = f; }
1300else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1301
1302/* Pb compile g++ 2.7.2
1303if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1304// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1305f = dynlink->GetFunction(func4);
1306if (f) { nok++; usfmap[func4] = f; }
1307else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1308
1309if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1310// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1311f = dynlink->GetFunction(func5);
1312if (f) { nok++; usfmap[func5] = f; }
1313else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1314*/
1315fin:
1316if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1317else return(0);
1318}
1319
[1276]1320/* --Methode-- */
1321int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1322{
1323string cmd;
1324
1325if (dynlink2) delete dynlink2; dynlink2 = NULL;
1326usfmap2.clear();
1327
1328dynlink2 = new PDynLinkMgr(fnameso, true);
1329if (dynlink2 == NULL) {
1330 string sn = fnameso;
1331 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1332 return(2);
1333 }
1334
1335int nok=0;
1336// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1337// DlUserProcFunction f = NULL;
1338DlFunction f = NULL;
1339if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1340f = dynlink2->GetFunction(func1);
1341if (f) { nok++; usfmap2[func1] = f; }
1342else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1343
1344if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1345f = dynlink2->GetFunction(func2);
1346if (f) { nok++; usfmap2[func2] = f; }
1347else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1348
1349if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1350f = dynlink2->GetFunction(func3);
1351if (f) { nok++; usfmap2[func3] = f; }
1352else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1353
1354fin:
1355if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1356else return(0);
1357}
1358
[388]1359/* Nouvelle-Fonction */
1360void RegisterPIGraphicsHelp(PIACmd* piac)
1361{
1362string kw,grp,usage;
1363
1364grp = "Graphics";
1365
1366kw = "PIImage";
1367usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1368usage += "and controls a zoom widget, as well as a global image view widget \n";
1369usage += ">>>> Mouse controls : \n";
1370usage += "o Button-1: Display current coordinates and pixel value\n";
1371usage += " Position the cursor an refresh the zoom widget\n";
1372usage += "o Button-2: Defines an image zone and positions the cursor \n";
1373usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1374usage += ">>>> Keyboard controls : \n";
1375usage += "o <Alt>R : Refresh display \n";
1376usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1377usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1378usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1379usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1380usage += "o <Alt>X : Show/Hide the Cut Window \n";
1381usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
[2158]1382usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
1383usage += "o <Alt>- or <Cntl>- : Zoom out \n";
[388]1384usage += "o Cursor keys : Moves the image cursor \n";
1385piac->RegisterHelp(kw, usage, grp);
1386
1387kw = "PIScDrawWdg";
1388usage = "Manages display of 2-D drawers with interactive zoom \n";
1389usage += ">>>> Mouse controls : \n";
1390usage += "o Button-1: Display current coordinates \n";
1391usage += "o Button-2: Defines a rectangle for zoom \n";
1392usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1393usage += ">>>> Keyboard controls : \n";
1394usage += "o <Alt>R : Refresh display \n";
1395usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1396usage += " Specific controls for 2-D histograms \n";
1397usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1398usage += " Drawer 0 manages the axes, as well as the added text \n";
1399usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1400usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
[1134]1401usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
[1911]1402usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
1403usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
[1883]1404usage += ">>>> Mouse + Keyboard controls : \n";
1405usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
[388]1406piac->RegisterHelp(kw, usage, grp);
1407
1408kw = "PIDraw3DWdg";
1409usage = "Manages display of 3-D objects (drawers) \n";
1410usage += ">>>> Mouse controls : \n";
1411usage += "o Button-2: Rotates the observer (camera) around object \n";
1412usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1413usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1414usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1415usage += ">>>> Keyboard controls : \n";
1416usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1417usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1418usage += "o <Alt>O : = <Alt>G \n";
1419usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1420usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1421usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1422usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1423piac->RegisterHelp(kw, usage, grp);
1424
1425kw = "Windows";
1426usage = "Objects can be displayed in different windows, or overlayed on the \n";
1427usage += "previous display. The graphics attributes next,win,stack,same control \n";
1428usage += "the display window. \n";
1429usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1430usage += " Graphic windows can be divided int zones. Object is displayed \n";
1431usage += " in the next available position, removing a previously displayed \n";
1432usage += " widget if necessary \n";
1433usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1434usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1435usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1436usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1437usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1438usage += " be activated using the StackTools menu (Blink) \n";
[548]1439usage += "o Most objects can be also be displayed overlayed \n";
1440usage += " on the last displayed widget (gr_att= same) \n";
1441usage += "o The overlay can be on a selected rectangle of the \n";
1442usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
[553]1443usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
[388]1444piac->RegisterHelp(kw, usage, grp);
[484]1445
1446kw = "PIConsole";
1447usage = "Text output area and command editing window (console) \n";
1448usage += ">>>> Mouse controls : \n";
1449usage += "o Button-1: Rectangle selection for copy/paste \n";
1450usage += "o Button-2: Paste text in the command editing line \n";
1451usage += "o Button-3: activate display option menu \n";
1452usage += ">>>> Keyboard controls : \n";
1453usage += "o <Alt>O : activate display option menu \n";
1454usage += "o <Alt>V : Paste text in the command editing line \n";
1455usage += "o <Alt>A : Selection of the whole window for copy \n";
1456usage += "o <Alt>L : Command history (List of command history buffer) \n";
1457usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1458usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1459usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1460usage += "o <Ctl>C : Command editing -> Clear the line \n";
1461usage += "o Cursor left,right : Command editing -> Move cursor \n";
1462usage += "o Cursor Up,Down : recall command from history buffer \n";
1463usage += "o Backspace,Del : Command editing \n";
1464usage += "o <Return>,<Enter> : Execute command \n";
1465piac->RegisterHelp(kw, usage, grp);
[388]1466}
Note: See TracBrowser for help on using the repository browser.