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

Last change on this file since 3423 was 3423, checked in by ansari, 18 years ago

ajout possibilite lecture ppf sequentielle (sans nametag) avec openppf et amelioration texte de help piapp, Reza 08/12/2007

File size: 53.7 KB
RevLine 
[2615]1#include "sopnamsp.h"
[293]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"
[2263]12#include "strutilxx.h"
[293]13
14#include "pistdimgapp.h"
15#include "nobjmgr.h"
[326]16#include "servnobjm.h"
[2305]17#include "nomgadapter.h"
[293]18
19#include "histos.h"
20#include "histos2.h"
21#include "hisprof.h"
22#include "ntuple.h"
23#include "generaldata.h"
[2792]24#include "datatable.h"
[769]25
26#ifdef SANS_EVOLPLANCK
[333]27#include "cvector.h"
[769]28#else
29#include "tvector.h"
30#endif
[293]31
32
33/* --Methode-- */
34PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
35{
36mpiac = piac;
37mObjMgr = omg;
38mImgApp = app;
[312]39dynlink = NULL;
[1276]40dynlink2 = NULL;
[293]41RegisterCommands();
42}
43
44PIABaseExecutor::~PIABaseExecutor()
45{
[1276]46 if (dynlink) delete dynlink;
47 if (dynlink2) delete dynlink2;
[293]48}
49
50
[2755]51
[293]52/* --Methode-- */
[1268]53int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
[293]54{
[333]55Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
[293]56// >>>>> Chargement de modules
[2307]57if (kw == "loadmodule") {
[293]58 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
59 mpiac->LoadModule(tokens[0], tokens[1]);
60 }
[349]61
[293]62// >>>>>>>>>>> Link dynamique de fonctions C++
63else if (kw == "link" ) {
64 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
65 string sph = "";
66 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
67 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
68 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
69}
[1276]70else if (kw == "linkff2" ) {
71 if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
72 string sph = "";
73 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
74 int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
75 if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
76}
[293]77else if (kw == "call" ) {
78 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
[1276]79 UsFmap::iterator it;
80 UsFmap::iterator it1 = usfmap.find(tokens[0]);
81 UsFmap::iterator it2 = usfmap2.find(tokens[0]);
82 if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
[293]83 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
84 return(0);
85 }
[1276]86 if (it1 == usfmap.end()) it = it2;
87 else it = it1;
[293]88 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
89// on est oblige de faire un cast etant donne qu'on
90// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
91 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
[2494]92/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
[293]93// On redirige la sortie sur le terminal
94 bool red = mImgApp->HasRedirectedStdOutErr();
95 mImgApp->RedirectStdOutErr(false);
[2494]96 --------DEL */
[1276]97#ifdef SANS_EVOLPLANCK
[293]98 TRY {
99 tokens.erase(tokens.begin());
100 fuf(tokens);
101 } CATCH(merr) {
102 fflush(stdout);
[1276]103 string es = PeidaExc(merr);
104 cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
[293]105 cout << endl;
106 }
[1276]107#else
108 try {
109 tokens.erase(tokens.begin());
110 fuf(tokens);
[2944]111 return(0);
[1276]112 }
113 catch ( PThrowable & exc ) {
114 cerr << "\n PIABaseExecutor: Call / Catched Exception :"
115 << (string)typeid(exc).name() << " Msg= "
116 << exc.Msg() << endl;
[2944]117 return(-77);
[1276]118 }
119 catch ( ... ) {
120 cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
121 << endl;
[2944]122 return(-79);
[1276]123 }
124#endif
[2494]125/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
[293]126 mImgApp->RedirectStdOutErr(red);
[2494]127 --------DEL */
[293]128}
129
130else if (kw == "openppf" ) {
[3423]131 if (tokens.size()<1) {
132 cout<<"Usage: openppf [-s] file [objname1 objname2 ...]"<<endl;
133 return(0);
134 }
135 else if (tokens.size()==1) // read all objects at nametags
136 mObjMgr->ReadAll(tokens[0],true);
137 else {
138 if (tokens[0] == "-s") // Read all objects sequentially
139 mObjMgr->ReadAll(tokens[1],false);
140 else mObjMgr->ReadObj(tokens); // read specified objects
141 }
[293]142}
[2132]143else if ((kw == "saveobjs") || (kw == "saveppf")) {
[333]144 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
145 mObjMgr->SaveObjects(tokens[0], tokens[1]);
146}
[2669]147else if (kw == "savelist") {
148 if (tokens.size() < 2) {
149 cout << "Usage: savelist objname1 [objname2 ...] filename "<<endl;
150 return(0);
151 }
152 mObjMgr->SaveListObjects(tokens);
153}
[293]154else if (kw == "saveall" ) {
155 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
156 mObjMgr->SaveAll(tokens[0]);
157}
158else if (kw == "print" ) {
[2975]159 if (tokens.size() < 1) { cout << "Usage: print nameobj [prtlev]" << endl; return(0); }
160 int lev = 0;
161 if (tokens.size()>1) lev = atoi(tokens[1].c_str());
162 mObjMgr->PrintObj(tokens[0], lev);
[293]163}
[333]164else if ( (kw == "rename" ) || (kw == "mv") ) {
[2132]165 if (tokens.size() < 2) { cout << "Usage: rename/mv nameobj namenew" << endl; return(0); }
[293]166 mObjMgr->RenameObj(tokens[0], tokens[1]);
167}
[333]168else if ( (kw == "del" ) || (kw == "rm") ) {
[1655]169 if (tokens.size() < 1) { cout << "Usage: del nameobj [nameobj2 ...]" << endl; return(0); }
170 if (tokens.size()>0)
171 for(uint_4 i=0;i<tokens.size();i++) mObjMgr->DelObj(tokens[i]);
[293]172}
173else if (kw == "delobjs" ) {
174 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
175 mObjMgr->DelObjects(tokens[0]);
176}
[333]177else if ( (kw == "listobjs") || (kw == "ls") ) {
[331]178 if (tokens.size() < 1) tokens.push_back("*");
[2519]179 if (tokens.size() < 2) mObjMgr->ListObjs(tokens[0]);
180 else {
181 vector<string> olv;
182 mObjMgr->GetObjList(tokens[0], olv);
183 mpiac->SetVar(tokens[1], olv);
184 }
[331]185}
[2519]186
[333]187// Gestion des repertoires
188else if (kw == "mkdir" ) {
[344]189 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
190 bool crd = mObjMgr->CreateDir(tokens[0]);
191 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
192 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
[333]193 }
194else if (kw == "rmdir" ) {
195 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
196 mObjMgr->DeleteDir(tokens[0]);
197 }
[2132]198else if (kw == "setdiratt" ) {
199 if (tokens.size() < 2) { cout << "Usage: setdiratt dirname true/false" << endl; return(0); }
200 if (tokens[1] == "true") mObjMgr->SetKeepOldDirAtt(tokens[0], true);
201 else mObjMgr->SetKeepOldDirAtt(tokens[0], false);
202}
[333]203else if (kw == "cd") {
204 if (tokens.size() < 1) tokens.push_back("home");
205 mObjMgr->SetCurrentDir(tokens[0]);
206 }
[345]207else if (kw == "pwd") {
208 string dirn;
209 mObjMgr->GetCurrentDir(dirn);
210 cout << "CurrentDirectory: " << dirn << endl;
211 }
[333]212else if (kw == "listdirs") {
213 if (tokens.size() < 1) tokens.push_back("*");
214 mObjMgr->ListDirs(tokens[0]);
215 }
[293]216
217// >>>>>>>>>>> Creation d'histos 1D-2D
218else if (kw == "newh1d") {
219 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
[1091]220 int_4 nbx = 100;
221 r_8 xmin = 0., xmax = 1.;
[293]222 nbx = atoi(tokens[3].c_str());
223 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
224 Histo* h = new Histo(xmin, xmax, nbx);
225 mObjMgr->AddObj(h, tokens[0]);
226 }
227else if (kw == "newh2d") {
228 if (tokens.size() < 7) {
229 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
230 return(0);
231 }
[1091]232 int_4 nbx = 50, nby = 50;
233 r_8 xmin = 0., xmax = 1.;
234 r_8 ymin = 0., ymax = 1.;
[293]235 nbx = atoi(tokens[3].c_str());
236 nby = atoi(tokens[6].c_str());
237 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
238 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
239 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
240 mObjMgr->AddObj(h, tokens[0]);
241 }
[1035]242else if (kw == "newprof" || kw == "newprofe") {
[293]243 if (tokens.size() < 4)
[1035]244 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
[1091]245 int_4 nbx = 100;
246 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
[293]247 if(tokens.size() > 5)
248 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
249 nbx = atoi(tokens[3].c_str());
250 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
251 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
[1035]252 if(kw == "newprofe") h->SetErrOpt(false);
[293]253 mObjMgr->AddObj(h, tokens[0]);
254 }
[447]255
256// Creation de NTuple
257else if (kw == "newnt") {
258 if(tokens.size() < 2)
259 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
260 vector<string> varname;
261 int nvar = 0;
262 const char *c = tokens[1].c_str();
263 if(isdigit(c[0])) {
264 nvar = atoi(tokens[1].c_str());
265 if(nvar<=0 || nvar>=10000)
266 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
267 return(0);}
268 for(int i=0;i<nvar;i++) {
269 char str[16]; sprintf(str,"%d",i);
270 string dum = "v"; dum += str;
271 varname.push_back(dum.c_str());
272 }
273 } else if( islower(c[0]) || isupper(c[0]) ) {
[1548]274 for(int i=1;i<(int)tokens.size();i++) {
[447]275 varname.push_back(tokens[i].c_str());
276 nvar++;
277 }
278 } else {
279 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
280 <<"newnt name nvar : nvar must be an positive integer"<<endl;
281 return(0);
282 }
283 char **noms = new char*[nvar];
284 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
285 NTuple* nt = new NTuple(nvar,noms);
286 delete [] noms;
287 mObjMgr->AddObj(nt,tokens[0]);
288 }
289
[2792]290// Creation de DataTable
291else if (kw == "newdt") {
292 if(tokens.size() < 2)
293 {cout<<"Usage: newdt name v1:t1 v2:t2 ... vn:tn / newdt name nvar"<<endl; return(0);}
294 DataTable* dt = new DataTable();
295 const char *c = tokens[1].c_str();
296 if(isdigit(c[0])) {
297 int n = atoi(tokens[1].c_str());
298 if(n<=0 || n>=10000) {
299 cout<<"newdt name nvar : nvar="<<n<<" must be an positive integer<10000"<<endl;
300 delete dt; return(0);
301 }
302 for(int i=0;i<n;i++) {
303 char str[16]; sprintf(str,"v%d",i);
304 dt->AddDoubleColumn(str);
305 }
306 } else {
307 for(int i=1;i<tokens.size();i++) {
308 string vname = tokens[i];
309 uint_4 p = tokens[i].find(':');
310 if(p<tokens[i].size()) vname = vname.substr(0,p);
311 if(vname.size()<1) {
312 cout<<"Zero size name for variable: tokens["<<i<<"]="<<tokens[i]<<endl;
313 delete dt; return(0);
314 }
315 if (tokens[i].find(":r4")<tokens[i].size()) dt->AddFloatColumn(vname);
316 else if(tokens[i].find(":r8")<tokens[i].size()) dt->AddDoubleColumn(vname);
317 else if(tokens[i].find(":i4")<tokens[i].size()) dt->AddIntegerColumn(vname);
318 else if(tokens[i].find(":i8")<tokens[i].size()) dt->AddLongColumn(vname);
319 else if(tokens[i].find(":s") <tokens[i].size()) dt->AddStringColumn(vname);
320 else dt->AddDoubleColumn(vname);
321 }
322 }
323 mObjMgr->AddObj(dt,tokens[0]);
324}
325
[447]326// Creation de GeneralFitData
[293]327else if (kw == "newgfd") {
328 if (tokens.size() < 3)
329 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
330 int nvar, nalloc, errx=0;
331 if (tokens.size() > 3)
332 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
333 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
334 if(nvar>0 && nalloc>0) {
335 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
336 mObjMgr->AddObj(gfd, tokens[0]);
337 }
338 }
339
[333]340// Creation/remplissage de vecteur et de matrice
341else if (kw == "newvec") {
342 if (tokens.size() < 2) {
343 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
344 }
345 int n = atoi(tokens[1].c_str());
346 double xmin, xmax;
347 xmin = 0.; xmax = n;
[357]348 if (tokens.size() < 3) {
349 Vector* v = new Vector(n);
350 mObjMgr->AddObj(v, tokens[0]);
351 }
352 else {
353 if (tokens.size() < 4) tokens.push_back("");
354 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
355 }
[333]356 }
357else if (kw == "newmtx") {
358 if (tokens.size() < 3) {
[1917]359 cout << "Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
[333]360 }
361 int nx = atoi(tokens[1].c_str());
362 int ny = atoi(tokens[2].c_str());
363 double xmin, xmax, ymin, ymax;
364 xmin = 0.; xmax = nx;
365 ymin = 0.; ymax = ny;
[357]366 if (tokens.size() < 4) {
367 Matrix* mtx = new Matrix(ny,nx);
368 mObjMgr->AddObj(mtx, tokens[0]);
369 }
370 else {
[1971]371 if (tokens.size() < 5) tokens.push_back("next");
[357]372 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
373 nx, ny, tokens[4]);
374 }
[333]375 }
[2305]376// ----- Vecteur/NTuple <> Lignes/variables interpreteur
377// Creation de vecteur depuis le contenu de la ligne
378else if (kw == "line2vec") {
379 if (tokens.size() < 2) {
380 cout << "Usage: line2vec vecname v0 v1 v2 ... " << endl; return(0);
381 }
382 int vsz = tokens.size()-1;
383 Vector* v = new Vector(vsz);
384 for(int kkv=0; kkv<vsz; kkv++) (*v)(kkv) = atof(tokens[kkv+1].c_str());
385 mObjMgr->AddObj(v, tokens[0]);
386 }
387// Remplissage de NTuple depuis la ligne
388else if (kw == "line2nt") {
389 if (tokens.size() < 2) {
390 cout << "Usage: line2nt ntname col0 col1 ..." << endl; return(0);
391 }
392 AnyDataObj* obj;
393 obj = mObjMgr->GetObj(tokens[0]);
394 if(obj == NULL) {
395 cerr << "line2nt Error , No such object " << tokens[0] << endl;
396 return(0);
397 }
398 NTuple* nt = dynamic_cast<NTuple *>(obj);
399 if(nt == NULL) {
400 cerr << "line2nt Error " << tokens[0] << " not an NTuple ! " << endl;
401 return(0);
402 }
403 if (nt->NbColumns() < 1) {
404 cerr << "line2nt Error: NbColumns < 1" << endl;
405 return(0);
406 }
407 r_4* xnt = new r_4[ nt->NbColumns() ];
408 int kkx;
409 for(kkx=0; kkx<nt->NbColumns(); kkx++) {
410 if (kkx < tokens.size()-1) xnt[kkx] = atof(tokens[kkx+1].c_str());
411 else xnt[kkx] = 0.;
412 }
413 nt->Fill(xnt);
414 delete[] xnt;
415}
416// Contenu du vecteur vers variable interpreteur
417#define MAXNWORDSO2V 32768
418else if (kw == "vec2var") {
419 if (tokens.size() < 2) {
420 cout << "Usage: vec2var vecname varname [loop_param start:end:step] " << endl; return(0);
421 }
422 AnyDataObj* obj;
423 obj = mObjMgr->GetObj(tokens[0]);
424 if(obj == NULL) {
425 cerr << "vec2var Error , No such object " << tokens[0] << endl;
426 return(0);
427 }
428 Vector* v = dynamic_cast<Vector *>(obj);
429 if(v == NULL) {
430 cerr << "vec2var Error " << tokens[0] << " not a Vector ! " << endl;
431 return(0);
432 }
[2419]433 int_8 kks = 0;
434 int_8 kke = v->NElts();
435 int_8 kkp = 1;
[2305]436 if (tokens.size() > 2) Services2NObjMgr::DecodeLoopParameters(tokens[2], kks, kke, kkp);
437 if (kks < 0) kks = 0;
[2419]438 if (kke > (int_8)v->NElts()) kke = v->NElts();
[2305]439 if (kkp < 1) kkp = 1;
440 int nelt = (kke-kks-1)/kkp;
441 if (nelt > MAXNWORDSO2V) {
442 nelt = MAXNWORDSO2V;
443 cout << "vec2var Warning: Only " << nelt
444 << " elements will be converted to string" << endl;
445 kke = kks+nelt*kkp;
446 }
447 string v2str;
448 char buff[64];
449 for(int kkv=kks; kkv<kke; kkv+=kkp) {
450 sprintf(buff, "%lg ", (*v)(kkv));
451 v2str += buff;
452 }
453
[2999]454 mpiac->SetVar(tokens[1], v2str);
[2305]455}
456// Une ligne du NTuple/NTupleInterface -> variable interpreteur
457else if ((kw == "ntline2var") || (kw == "ntcol2var")) {
458 if (tokens.size() < 3) {
459 cout << "Usage: ntline/col2var objname line_number varname" << endl;
460 return(0);
461 }
462 NObjMgrAdapter* oa = mObjMgr->GetObjAdapter(tokens[0]);
463 if(oa == NULL) {
464 cerr << "ntline/col2var Error , No such object " << tokens[0] << endl;
465 return(0);
466 }
467 bool adel = false;
468 NTupleInterface* nti = oa->GetNTupleInterface(adel);
469 if(nti == NULL) {
470 cerr << "ntline/col2var Error: objet" << tokens[0] << " has no NTupleInterface" << endl;
471 return(0);
472 }
[333]473
[2305]474 if (nti->NbColumns() < 1 || nti->NbLines() < 1) {
475 cerr << "ntline/col2var Error: NbColumns or NbLines < 1" << endl;
476 return(0);
477 }
478 string v2str;
479 char buff[64];
480 if (kw == "ntline2var") {
481 int numline = atoi(tokens[1].c_str());
482 if ( (numline >= nti->NbLines()) || (numline < 0) ) {
483 cerr << "ntline2var Error: numline" << tokens[1] << " out of bounds" << endl;
484 return(0);
485 }
486 r_8* dline = nti->GetLineD(numline);
487 for(int kkv=0; kkv<nti->NbColumns(); kkv++) {
488 sprintf(buff, "%lg ", dline[kkv]);
489 v2str += buff;
490 }
491 }
492 else {
493 int numcol = atoi(tokens[1].c_str());
494 if ( (numcol >= nti->NbColumns()) || (numcol < 0) ) {
495 cerr << "ntcol2var Error: numcol" << tokens[1] << " out of bounds" << endl;
496 return(0);
497 }
[2419]498 int_8 kks = 0;
499 int_8 kke = nti->NbLines();
500 int_8 kkp = 1;
[2305]501 if (tokens.size() > 3) Services2NObjMgr::DecodeLoopParameters(tokens[3], kks, kke, kkp);
502 if (kks < 0) kks = 0;
[2419]503 if (kke > (int_8)nti->NbLines()) kke = nti->NbLines();
[2305]504 if (kkp < 1) kkp = 1;
505 int nelt = (kke-kks-1)/kkp;
506 if (nelt > MAXNWORDSO2V) {
507 nelt = MAXNWORDSO2V;
508 cout << "ntcol2var Warning: Only " << nelt
509 << " lines " << " will be converted to string" << endl;
510 kke = kks+nelt*kkp;
511 }
512 r_8* dline;
513 for(int kkl=kks; kkl<kke; kkl+=kkp) {
514 dline = nti->GetLineD(kkl);
515 sprintf(buff, "%lg ", dline[numcol]);
516 v2str += buff;
517 }
518 }
[2999]519 mpiac->SetVar(tokens[2], v2str);
[2305]520 if (adel) delete nti;
521}
[2999]522// Operation sur objets a travers l'adaptateur NObjMgrAdapter::PerformOperation()
523else if (kw == "objaoper") {
524 if (tokens.size() < 2) {
525 cout << "Usage: objaoper objname operation [args ...]" << endl;
526 return(0);
527 }
528 NObjMgrAdapter* oa = mObjMgr->GetObjAdapter(tokens[0]);
529 if(oa == NULL) {
530 cerr << "objaoper Error , No such object " << tokens[0] << endl;
531 return(0);
532 }
533 tokens.erase(tokens.begin());
534 return oa->PerformOperation(tokens);
535}
[2305]536
537// -------------------------------------------------------
[455]538// Copie d'objets
[2176]539else if ( (kw == "copy") || (kw == "cp") ) {
[455]540 if(tokens.size()<2) {
541 cout<<"Usage: copy name_from name_to"<<endl;return(0);
542 }
[463]543 mObjMgr->CopyObj(tokens[0],tokens[1]);
[455]544}
545
546
[293]547// >>>>>>>>>>> Trace de fonctions
548else if ( (kw == "func") ) {
[1938]549 if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
550 int np = 100;
551 double xmin=0., xmax=1.;
552 string opt = "", nom = "";
553 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
554 if (tokens.size() > 3) np = atoi(tokens[3].c_str());
[293]555 if (tokens.size() > 4) opt = tokens[4];
[333]556 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
[293]557 }
[326]558else if ( (kw == "funcff") ) {
[1938]559 if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
560 int np = 100;
561 double xmin=0., xmax=1.;
562 string opt = "", nom = "";
563 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
564 if(tokens.size()>4) np = atoi(tokens[4].c_str());
565 if(tokens.size()>5) opt = tokens[5];
[333]566 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
[326]567 }
[293]568else if ( (kw == "func2d") ) {
569 if (tokens.size() < 7) {
[357]570 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
[293]571 return(0);
572 }
573 int npx, npy;
[333]574 double xmin, xmax;
575 double ymin, ymax;
[293]576 npx = npy = 50;
577 xmin = 0.; xmax = 1.;
578 ymin = 0.; ymax = 1.;
579 npx = atoi(tokens[3].c_str());
580 npy = atoi(tokens[6].c_str());
581 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
582 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
[357]583 string opt = "";
[293]584 if (tokens.size() > 7) opt = tokens[7];
[333]585 string nom = "";
586 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[293]587 }
[326]588else if ( (kw == "func2dff") ) {
589 if (tokens.size() < 8) {
[357]590 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
[326]591 return(0);
592 }
593 int npx, npy;
[333]594 double xmin, xmax;
595 double ymin, ymax;
[326]596 npx = npy = 50;
597 xmin = 0.; xmax = 1.;
598 ymin = 0.; ymax = 1.;
599 npx = atoi(tokens[4].c_str());
600 npy = atoi(tokens[7].c_str());
601 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
602 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
[357]603 string opt = "";
[326]604 if (tokens.size() > 8) opt = tokens[8];
[333]605 string nom = "";
606 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[326]607 }
[293]608
609// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
610else if (kw == "plot2d" ) {
[357]611 if (tokens.size() < 3) {
612 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
[293]613 return(0);
614 }
[357]615 string errx = ""; string erry = "";
616 if (tokens.size() < 4) tokens.push_back("1");
617 while (tokens.size() < 6) tokens.push_back("");
618 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
619 }
620
621else if (kw == "plot2de" ) { // Plot2D avec les erreurs
622 if (tokens.size() < 5) {
623 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
624 return(0);
[293]625 }
[357]626 if (tokens.size() < 6) tokens.push_back("1");
627 while (tokens.size() < 8) tokens.push_back("");
628 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
629 tokens[5],tokens[6],tokens[7]);
[293]630 }
631
[3279]632else if ((kw == "plot2dw")||(kw == "plot2dc")) { // Plot2d avec poids
[357]633 if (tokens.size() < 4) {
[3279]634 cout << "Usage: plot2dw/c nomobj expx expy expwt/expcolidx [expcut opt loop_par]" << endl;
[333]635 return(0);
636 }
[357]637 if (tokens.size() < 5) tokens.push_back("1");
638 while (tokens.size() < 7) tokens.push_back("");
[3279]639 bool fgcolidx = false;
640 if (kw == "plot2dc") fgcolidx = true;
641 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4],
642 fgcolidx, tokens[5], tokens[6]);
[333]643 }
[357]644else if (kw == "plot3d" ) {
645 if (tokens.size() < 4) {
646 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
[293]647 return(0);
648 }
[357]649 if (tokens.size() < 5) tokens.push_back("1");
650 while (tokens.size() < 7) tokens.push_back("");
651 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
[293]652 }
[2999]653else if (kw == "plot3dw" ) {
654 if (tokens.size() < 5) {
655 cout << "Usage: plot3dw nomobj expx expy expz expwt [expcut opt loop_par]" << endl;
656 return(0);
657 }
658 if (tokens.size() < 6) tokens.push_back("1");
659 while (tokens.size() < 8) tokens.push_back("");
660 srvo->DisplayPoints3DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5],
661 tokens[6], tokens[7]);
662}
[293]663
664else if (kw == "projh1d" ) {
[357]665 if (tokens.size() < 3) {
666 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
[293]667 return(0);
668 }
[357]669 if (tokens.size() < 4) tokens.push_back("1.");
670 if (tokens.size() < 5) tokens.push_back("1");
671 while (tokens.size() < 7) tokens.push_back("");
672 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]673 }
674
[357]675
676// Projection dans histogrammes
[293]677else if (kw == "projh2d" ) {
[357]678 if (tokens.size() < 4) {
679 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]680 return(0);
681 }
[357]682 if (tokens.size() < 5) tokens.push_back("1.");
683 if (tokens.size() < 6) tokens.push_back("1");
684 while (tokens.size() < 8) tokens.push_back("");
685 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
686 tokens[6], tokens[7] );
[293]687 }
688
689else if (kw == "projprof" ) {
[357]690 if (tokens.size() < 4) {
691 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]692 return(0);
693 }
[357]694 if (tokens.size() < 5) tokens.push_back("1.");
695 if (tokens.size() < 6) tokens.push_back("1");
696 while (tokens.size() < 8) tokens.push_back("");
697 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
[1091]698 tokens[6], tokens[7] );
[357]699 }
[293]700
[357]701// Projection dans vector/matrix
702else if (kw == "fillvec" ) {
703 if (tokens.size() < 4) {
704 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
705 return(0);
706 }
707 if (tokens.size() < 5) tokens.push_back("1");
708 while (tokens.size() < 7) tokens.push_back("");
709 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]710 }
711
[357]712else if (kw == "fillmtx" ) {
713 if (tokens.size() < 5) {
714 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
715 return(0);
716 }
717 if (tokens.size() < 6) tokens.push_back("1");
718 while (tokens.size() < 8) tokens.push_back("");
719 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
720 tokens[6], tokens[7] );
721 }
722
723// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
[447]724else if (kw == "ntfrascii" ) {
725 if(tokens.size() < 2) {
726 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
727 return(0);
728 }
729 double def_val = 0.;
730 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
731 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
732 }
733
[2263]734#ifndef SANS_EVOLPLANCK
735/* Lecture matrice/vecteur depuis fichier ASCII */
736else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
737 if(tokens.size() < 2) {
[2289]738 cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name [CommLine Separator]"<<endl;
[2263]739 return(0);
740 }
741 TMatrix<r_8> mtx;
742 TVector<r_8> vec;
743 FILE* fip = fopen(tokens[1].c_str(), "r");
744 if (fip == NULL) {
745 cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
746 return(0);
747 }
748 fclose(fip);
749 ifstream is(tokens[1].c_str());
750 sa_size_t nr, nc;
[2289]751 char clm = '#';
752 string sep = " \t";
753 if (tokens.size()>2) clm = tokens[2][0];
754 if (tokens.size()>3) sep = tokens[3];
[2263]755 if (kw == "mtxfrascii") {
[2289]756 mtx.ReadASCII(is, nr, nc, clm, sep.c_str());
[2263]757 mObjMgr->AddObj(mtx, tokens[0]);
758 cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
759 << tokens[1] << endl;
760 }
761 else {
[2289]762 vec.ReadASCII(is, nr, nc, clm, sep.c_str());
[2263]763 mObjMgr->AddObj(vec, tokens[0]);
764 cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
765 << tokens[1] << endl;
766 }
767}
[2268]768else if (kw == "arrtoascii") {
769 if(tokens.size() < 2) {
770 cout<<"Usage: arrtoascii array_name file_name "<<endl;
771 return(0);
772 }
773
774 AnyDataObj* obj;
775 obj = mObjMgr->GetObj(tokens[0]);
776 if(obj == NULL) {
777 cerr << "arrtoascii Error , No such object " << tokens[0] << endl;
778 return(0);
779 }
780 BaseArray* ba = dynamic_cast<BaseArray *>(obj);
781 if(ba == NULL) {
782 cerr << "arrtoascii Error " << tokens[0] << " not a BaseArray ! " << endl;
783 return(0);
784 }
785 ofstream os(tokens[1].c_str());
786 ba->WriteASCII(os);
787 cout << "arrtoascii: Array " << tokens[0] << " written to file " << tokens[1] << endl;
788}
789
[2263]790#endif
791
[293]792else if (kw == "fillnt" ) {
[357]793 if (tokens.size() < 5) {
794 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
[293]795 return(0);
796 }
[357]797 while (tokens.size() < 8) tokens.push_back("");
798 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
[293]799 }
800
[333]801else if (kw == "ntloop" ) {
802 if (tokens.size() < 3) {
[357]803 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
[333]804 return(0);
805 }
[357]806 while (tokens.size() < 5) tokens.push_back("");
807 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
[333]808 }
809
810else if (kw == "ntexpcfile" ) {
811 if (tokens.size() < 3) {
812 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
813 return(0);
814 }
815 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
816 }
817
[2922]818else if (kw == "expmeansig" ) {
819 if (tokens.size() < 2) {
820 cout << "Usage: expmeansig nameobj expx [expcut loop_par]" << endl;
821 return(0);
822 }
823 while (tokens.size() < 4) tokens.push_back("");
824 string dummy = "";
825 cout << " expmeansig: computing mean/sigma + min/max for " << tokens[0]
826 << "." << tokens[1] << endl;
827 srvo->ExpressionToVector(tokens[0],tokens[1],tokens[2],dummy,dummy,tokens[3]);
828 }
829
[357]830else if (kw == "exptovec" ) {
831 if (tokens.size() < 3) {
832 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
[293]833 return(0);
834 }
[357]835 while (tokens.size() < 6) tokens.push_back("");
836 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
[293]837 }
838
839else if (kw == "fillgd1" ) {
840 if (tokens.size() < 5) {
[357]841 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
[293]842 return(0);
843 }
[357]844 if (tokens.size() < 6) tokens.push_back("1");
845 if (tokens.size() < 7) tokens.push_back("");
[293]846 string expy = "";
[357]847 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
[293]848 }
849
850else if (kw == "fillgd2" ) {
851 if (tokens.size() < 6) {
[357]852 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
[293]853 return(0);
854 }
[357]855 if (tokens.size() < 7) tokens.push_back("1");
856 if (tokens.size() < 8) tokens.push_back("");
857 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
[293]858 }
859
[1067]860else if (kw == "gdfrvec" ) {
861 if(tokens.size()<3) {
862 cout<<"Usage: gdfrvec namegfd X Y\n"
863 <<" gdfrvec namegfd X Y"
864 <<" gdfrvec namegfd X Y ! EY\n"
865 <<" gdfrvec namegfd X Y Z\n"
866 <<" gdfrvec namegfd X Y Z EZ"<<endl;
867 return(0);
868 }
869 while(tokens.size()<5) tokens.push_back("!");
870 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
871 }
[293]872
[2180]873// >>>>>>>>>>> Calcul d'expression arithmetique
874else if ( (kw == "eval") ) {
875 if(tokens.size()<2)
876 {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
877 string expval = "";
878 for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
879 string resultvarname = "";
880 if(isalpha(tokens[0][0])) resultvarname=tokens[0];
881 mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
882 }
[293]883
884else {
885 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
886 return(-1);
887 }
888
889return(0);
890}
891
[2755]892/* --Methode-- */
893bool PIABaseExecutor::IsThreadable(string const & keyw)
894{
895 if ( (keyw == "fillvec") || (keyw == "fillmtx") ||
896 (keyw == "fillnt") || (keyw == "ntloop") ) return true;
897 else if (keyw.substr(0,4) == "func") return true;
898 else {
899 string skw = keyw.substr(0,5);
900 if ( (skw == "plot2") || (skw == "plot3") || (skw == "projh") ) return true;
901 }
902 return false;
903}
904
[388]905
[293]906/* --Methode-- */
907void PIABaseExecutor::RegisterCommands()
908{
[2419]909string kw, usage, grp;
[2781]910//--------- Commandes du groupe modules externes
[2465]911grp = "External Modules";
912string gdesc = "Dynamic load (shared object modules) management command group";
913mpiac->AddHelpGroup(grp, gdesc);
[293]914kw = "loadmodule";
915usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
916usage += "\n Related commands: link";
[2465]917mpiac->RegisterCommand(kw, usage, this, grp);
[293]918kw = "link";
919usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
920usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
[1276]921usage += "\n Related commands: call loadmodule linkff2";
[2465]922mpiac->RegisterCommand(kw, usage, this, grp);
[1276]923kw = "linkff2";
924usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
925usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
926usage += "\n Related commands: call link loadmodule";
[2465]927mpiac->RegisterCommand(kw, usage, this, grp);
[293]928kw = "call";
929usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
930usage += "\n User function : f(vector<string>& args)";
931usage += "\n Related commands: link";
[2465]932mpiac->RegisterCommand(kw, usage, this, grp);
[293]933
934kw = "openppf";
[3423]935usage = "Reads all or some objects from a PPF file";
936usage += "\n Usage: (1) openppf filename ";
937usage += "\n Or (2) openppf -s filename (2)";
938usage += "\n Or (3) openppf filename objname1 [ objname2 ...]";
939usage += "\n The first form reads all objects at NameTags,";
940usage += "\n or all objects if the file has no NameTags.";
941usage += "\n The third reads only the objects with the specified nametags";
942usage += "\n Related commands: saveppf saveall savelist";
[330]943mpiac->RegisterCommand(kw, usage, this, "FileIO");
[2132]944kw = "saveppf";
945usage = "Saves objects with names matching a pattern into a\n";
946usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
947usage += "Usage: saveppf nameobjpattern filename";
[2933]948usage += "\n Related commands: saveobjs savelist saveall openppf";
[2132]949mpiac->RegisterCommand(kw, usage, this, "FileIO");
[333]950kw = "saveobjs";
[2132]951usage = "Saves objects with names matching a pattern into a\n";
952usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
[1068]953usage += "Usage: saveobjs nameobjpattern filename";
[2933]954usage += "\n Related commands: saveppf savelist saveall openppf ";
[333]955mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]956kw = "saveall";
957usage = "Saves all objects into a PPF file \n Usage: saveall filename";
[2933]958usage += "\n Related commands: saveobj savelist openppf";
[2669]959mpiac->RegisterCommand(kw, usage, this, "FileIO");
960kw = "savelist";
961usage = "Saves a list of objects into a PPF file";
962usage = "\n Usage: savelist objname1 [objname2 ...] filename";
[2933]963usage += "\n Related commands: saveobj openppf";
[330]964mpiac->RegisterCommand(kw, usage, this, "FileIO");
[449]965kw = "ntfrascii";
[2792]966usage = "Fills an existing NTuple or DataTable from ASCII table file";
[449]967usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
968usage += "\n Related commands: ntloop fillnt ";
969mpiac->RegisterCommand(kw, usage, this, "FileIO");
[2263]970#ifndef SANS_EVOLPLANCK
971kw = "mtxfrascii";
972usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
[2289]973usage += "\n Usage: mtxfrascii mtx_name file_name [CommChar Separator]";
[2268]974usage += "\n Related commands: arrtoascii vecfrascii ntfrascii ";
[2263]975mpiac->RegisterCommand(kw, usage, this, "FileIO");
976kw = "vecfrascii";
[2268]977usage = "Reads a vector from an ASCII file (TVector<r_8>)";
[2263]978usage += "\n Usage: vecfrascii vec_name file_name";
[2289]979usage += "\n Related commands: arrtoascii mtxfrascii ntfrascii [CommChar Separator]";
[2263]980mpiac->RegisterCommand(kw, usage, this, "FileIO");
[2268]981kw = "arrtoascii";
982usage = "Writes an array (TArray<T>) to an ASCII file ";
983usage += "\n Usage: arrtoascii array_name file_name";
984usage += "\n Related commands: mtxfrascii vecfrascii ntfrascii ";
985mpiac->RegisterCommand(kw, usage, this, "FileIO");
[2263]986#endif
[293]987
988kw = "print";
[2975]989usage = "Prints an object \n Usage: print nameobj [prtlev]";
990usage += "\n prtlev = 0,1,2... default: prtlev=0";
[330]991mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]992
[2781]993//------- Commandes gestion de repertoires et d'objets
[333]994kw = "mkdir";
995usage = "Create a directory";
[344]996usage += "\n Usage: mkdir dirname [true]";
997usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
[463]998mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]999kw = "rmdir";
1000usage = "Removes an empty directory";
1001usage += "\n Usage: remove dirname";
[463]1002mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1003kw = "setdiratt";
1004usage = "Sets directory attributes";
1005usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
1006usage += "\n KeepOldFlag=true Object with the same name is moved to old";
1007usage += "\n when adding objects";
1008mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]1009kw = "cd";
1010usage = "Change current directory";
1011usage += "\n Usage: cd [dirname]";
[463]1012mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]1013kw = "pwd";
1014usage = "Prints current directory";
1015usage += "\n Usage: pwd";
[463]1016mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]1017kw = "listdirs";
1018usage = "Prints the list of directories";
1019usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
[463]1020mpiac->RegisterCommand(kw, usage, this, "Object Management");
[295]1021kw = "listobjs";
[333]1022usage = "Prints the list of objects (Alias: ls)";
[3423]1023usage += "\n Usage: listobjs [patt=*] ";
1024usage += "\n Or listobjs patt VarName ";
1025 usage += "\n Obj. name pattern patt in the form abc?x* or /*/x?y ... ";
[463]1026mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1027kw = "rename";
[333]1028usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
[2132]1029usage += "\n Related commands: mv del delobjs";
[463]1030mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1031kw = "mv";
1032usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1033usage += "\n Related commands: rename del delobjs";
1034mpiac->RegisterCommand(kw, usage, this, "Object Management");
[463]1035kw = "copy";
[2132]1036usage = "Copy objects (Alias cp) \n";
[463]1037usage +=" Usage: copy name_from name_to";
[2132]1038usage += "\n Related commands: cp new...";
[2176]1039mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1040kw = "cp";
1041usage = "Copy objects (Alias copy) \n";
1042usage +=" Usage: cp name_from name_to";
1043usage += "\n Related commands: copy new...";
[463]1044mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1045kw = "del";
[1655]1046usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
[2132]1047usage += "\n Related commands: rm delobjs rename";
[463]1048mpiac->RegisterCommand(kw, usage, this, "Object Management");
[2132]1049kw = "rm";
1050usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1051usage += "\n Related commands: del delobjs rename";
1052mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1053kw = "delobjs";
1054usage = "Delete a set of objects with names matching a pattern (x?y*)";
1055usage += "\n Usage: delobjs nameobjpattern \n";
1056usage += "\n Related commands: del rename";
[463]1057mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]1058
[2781]1059//------- Commandes creation/manipulation d'objets
[293]1060kw = "newh1d";
1061usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
[2792]1062usage += "\n Related commands: newh2d newprof[e] newdt newnt newgfd ";
[333]1063mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1064kw = "newh2d";
1065usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
[2792]1066usage += "\n Related commands: newh1d newprof[e] newdt newnt newgfd ";
[333]1067mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1068kw = "newprof";
1069usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
[1035]1070usage += "\n Errors represent the data spread in the X bin ";
[2792]1071usage += "\n Related commands: newh1d newh2d newprofe newdt newnt newgfd ";
[333]1072mpiac->RegisterCommand(kw, usage, this, "Objects");
[1035]1073kw = "newprofe";
1074usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1075usage += "\n Errors represent the error on the data mean in the X bin ";
[2792]1076usage += "\n Related commands: newh1d newh2d newprof newdt newnt newgfd ";
[1035]1077mpiac->RegisterCommand(kw, usage, this, "Objects");
[447]1078kw = "newnt";
1079usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1080usage += "\n newnt name nvar";
[2792]1081usage += "\n Related commands: newdt newh1d newh2d newprof[e] newgfd ";
[447]1082mpiac->RegisterCommand(kw, usage, this, "Objects");
[2792]1083kw = "newdt";
1084usage = "Creates a datatable \n Usage: newdt name v1:t1 v2:t2 v3:t3 .. vn:tn";
1085usage += "\n newdt name nvar";
1086usage += "\n vi : variable name";
1087usage += "\n ti : variable type";
1088usage += "\n r8,r4 for 8 and 4 bytes float";
1089usage += "\n i8,i4 for 8 and 4 bytes signed integer";
1090usage += "\n s for string";
1091usage += "\n Related commands: newnt newh1d newh2d newprof[e] newgfd";
1092mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1093kw = "newgfd";
1094usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
[2792]1095usage += "\n Related commands: newh1d newh2d newprof[e] newdt newnt ";
[333]1096mpiac->RegisterCommand(kw, usage, this, "Objects");
1097kw = "newvec";
[357]1098usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
[2305]1099usage += "\n Related commands: newmtx line2vec";
[357]1100mpiac->RegisterCommand(kw, usage, this, "Objects");
[333]1101kw = "newmtx";
[357]1102usage = "Creates (and optionaly fills) a matrix \n";
[1917]1103usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
[333]1104usage += "\n Related commands: newvec";
[357]1105mpiac->RegisterCommand(kw, usage, this, "Objects");
[2305]1106kw = "line2vec";
1107usage = "Creates a vector from the line \n";
1108usage += " Usage: line2vec vecname v0 v1 v2 ... \n";
1109usage += " Related commands: newvec line2nt";
1110mpiac->RegisterCommand(kw, usage, this, "Objects");
1111kw = "line2nt";
1112usage = "Fills (append) an NTuple from the line content \n";
1113usage += " Usage: line2nt ntname col0 col1 ... \n";
1114usage += " Related commands: newnt line2vec ntline2var ntcol2var";
1115mpiac->RegisterCommand(kw, usage, this, "Objects");
1116kw = "vec2var";
1117usage = "Vector content to an interpreter variable varname = 'v0 v1 v2 ...' \n";
1118usage += " Usage: line2vec vecname varname [LoopParam start:end[:step] ]\n";
1119usage += " Related commands: line2vec ntline2var";
1120mpiac->RegisterCommand(kw, usage, this, "Objects");
1121kw = "ntline2var";
1122usage = "Object NTupleInterface line to an interpreter variable \n";
1123usage += " Usage: ntline2var objname line_number varname \n";
1124usage += " Related commands: vec2var ntcol2var";
1125mpiac->RegisterCommand(kw, usage, this, "Objects");
1126kw = "ntcol2var";
1127usage = "Object NTupleInterface column to an interpreter variable \n";
1128usage += " Usage: ntline2var objname column_number varname [LoopParam start:end[:step] ] \n";
1129usage += " Related commands: vec2var ntline2var";
1130mpiac->RegisterCommand(kw, usage, this, "Objects");
[2999]1131kw = "objaoper";
1132usage = "Perform an operation through the object adapter NObjMgrAdapter::PerformOperation()\n";
1133usage += " Usage: objaoper objname operation [arg1 ...] \n";
1134usage += " Examples of defined operations : \n";
1135usage += " Matrices: row indx_row , col indx_col \n";
1136usage += " Arrays: slicexy indx_Z , slicexz indx_Y, sliceyz indxX \n";
1137mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]1138
[2781]1139//------- Commandes trace de fonctions
[293]1140kw = "func";
1141usage = "Displays a function y=f(x) (Fills a vector with function values)";
[1938]1142usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
[326]1143usage += "\n Related commands: funcff func2d func2dff ";
[330]1144mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]1145kw = "funcff";
1146usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
[1938]1147usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
[326]1148usage += "\n Related commands: func func2d func2dff ";
[330]1149mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]1150kw = "func2d";
1151usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1152usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1153usage += "\n Related commands: func";
[330]1154mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]1155kw = "func2dff";
1156usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1157usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1158usage += "\n Related commands: func funcff func2d ";
[330]1159mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]1160
[2781]1161//------ Commandes trace d'expression
[357]1162kw = "ObjectExpressions";
1163usage = "Any mathematical expression (math.h) with object variables can be used";
1164usage += "\n ------ Object Variable names (double) -------- ";
[2419]1165usage += "\n (_nl is the table line number or the sequential index)";
1166usage += "\n- NTuple: ntuple variable names,_nl";
[3123]1167usage += "\n- Histo1D/HProf: i,x,val,err,nb,_nl";
[2419]1168usage += "\n- Histo2D: i,j,x,y,val,err,_nl";
[3123]1169usage += "\n- HistoErr: i,x,val,err2,nb,_nl";
1170usage += "\n- Histo2DErr: i,j,x,y,val,err2,nb,_nl";
[2419]1171usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl";
1172usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl";
1173usage += "\n- Image: i,j,x,y,val(=pix),_nl";
1174usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok ,_nl";
[1548]1175usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
[2419]1176usage += "\n- i,k,val,real,imag,mod,phas,teta,phi,_nl";
1177usage += "\n- FITS Binary/ASCII table: fits column names,_nl";
[2128]1178#ifdef SANS_EVOLPLANCK
1179usage += "\n ------ Eros Variable names (double) -------- ";
1180usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
[2419]1181usage += "\n- xref,yref,fluxref,fondref,pixmaxref,_nl";
[2128]1182#endif
[1548]1183usage += "\n ------ Other parameters -------- ";
[357]1184usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1185usage += "\nThe default Cut() expression in true (=1) for all";
[2999]1186usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d plot3dw";
1187usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1188usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
[2419]1189grp = "Expr. Plotting";
1190mpiac->RegisterHelp(kw, usage, grp);
[293]1191kw = "plot2d";
1192usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
[357]1193usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
[2999]1194usage += "\n Related commands: plot2de plot2dw plot3d plot3dw ObjectExpressions ...";
[330]1195mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1196kw = "plot2de";
1197usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1198usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1199usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1200mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[333]1201kw = "plot2dw";
1202usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
[357]1203usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
[3279]1204usage += "\n Related commands: plot2d plot2dc plot3d ObjectExpressions ...";
1205mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1206kw = "plot2dc";
1207usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Color ColIndex=h(Object) ";
1208usage += "\n Usage: plot2dc nameobj f_X() g_Y() h_Col() [Cut() graphic_attributes loop_param]";
[357]1209usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
[333]1210mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1211kw = "plot3d";
[2999]1212usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object)";
[357]1213usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
[2999]1214usage += "\n Related commands: plot2d plot2de plot3dw ObjectExpressions ...";
[330]1215mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[2999]1216kw = "plot3dw";
1217usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) with Weight W=k(Object) ";
1218usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() k_Wt() [Cut() graphic_attributes loop_param]";
1219usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1220mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1221
1222kw = "projh1d";
1223usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
[357]1224usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1225usage += "\n Histo1D nameh1d is created if necessary ";
[357]1226usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
[330]1227mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1228kw = "projh2d";
1229usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
[357]1230usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1231usage += "\n Histo2D nameh2d is created if necessary ";
[357]1232usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
[330]1233mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1234kw = "projprof";
1235usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
[709]1236usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1237usage += "\n HProf nameprof is created if necessary ";
[357]1238usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
[330]1239mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1240kw = "fillvec";
1241usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1242usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1243usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1244mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1245kw = "fillmtx";
1246usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1247usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1248usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1249mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1250
1251kw = "fillnt";
1252usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1253usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
[333]1254usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
[357]1255usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
[330]1256mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1257
[333]1258kw = "ntloop";
1259usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1260usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1261usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1262usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
[333]1263usage += "\n Related commands: ntexpcfile fillnt";
1264mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1265
[333]1266kw = "ntexpcfile";
1267usage = "Creates a C-File with declarations suitable to be used for ntloop";
1268usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1269usage += "\n Related commands: ntloop";
1270mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1271
[2922]1272kw = "expmeansig";
1273usage = "Computes Mean/Sigma (+Min/Max) for an expression X=f(Object)";
1274usage += "\n Usage: expmeansig nameobj f_X() [Cut() loop_param]";
1275usage += "\n Related commands: exptovec ntloop fillnt ObjectExpressions ...";
1276mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1277
[357]1278kw = "exptovec";
[293]1279usage = "Creates and Fills a Vector with X=f(Object)";
[357]1280usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1281usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1282mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[2922]1283
[293]1284kw = "fillgd1";
1285usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
[357]1286usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1287usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1288mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1289kw = "fillgd2";
1290usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
[357]1291usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1292usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1293mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[1067]1294kw = "gdfrvec";
1295usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1296usage += "\n Usage: gdfrvec namegfd X Y";
1297usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1298usage += "\n Usage: gdfrvec namegfd X Y Z";
1299usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1300usage += "\n Related commands: fillgd1 fillgd2 ...";
1301mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1302
[2180]1303
1304kw = "eval";
1305usage = "Compute arithmetic expression\n";
1306usage += "\n Usage: eval resultvarname arithmetic expression....";
1307usage += "\n resultvarname: store result in variable resultvarname";
1308usage += "\n - If first character is not alphabetic, just print result";
1309usage += "\n arithmetic expression:";
1310usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1311usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1312usage += "\n ex: 360 * M_PI / 180.";
1313mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1314
[293]1315}
1316
1317/* --Methode-- */
1318int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1319// string& func4, string& func5)
1320{
1321string cmd;
1322
1323if (dynlink) delete dynlink; dynlink = NULL;
1324usfmap.clear();
1325
1326dynlink = new PDynLinkMgr(fnameso, true);
1327if (dynlink == NULL) {
1328 string sn = fnameso;
1329 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1330 return(2);
1331 }
1332
1333int nok=0;
1334// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1335// DlUserProcFunction f = NULL;
1336DlFunction f = NULL;
1337if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1338// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1339f = dynlink->GetFunction(func1);
1340if (f) { nok++; usfmap[func1] = f; }
1341else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1342
1343if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1344// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1345f = dynlink->GetFunction(func2);
1346if (f) { nok++; usfmap[func2] = f; }
1347else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1348
1349if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1350// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1351f = dynlink->GetFunction(func3);
1352if (f) { nok++; usfmap[func3] = f; }
1353else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1354
1355/* Pb compile g++ 2.7.2
1356if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1357// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1358f = dynlink->GetFunction(func4);
1359if (f) { nok++; usfmap[func4] = f; }
1360else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1361
1362if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1363// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1364f = dynlink->GetFunction(func5);
1365if (f) { nok++; usfmap[func5] = f; }
1366else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1367*/
1368fin:
1369if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1370else return(0);
1371}
1372
[1276]1373/* --Methode-- */
1374int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1375{
1376string cmd;
1377
1378if (dynlink2) delete dynlink2; dynlink2 = NULL;
1379usfmap2.clear();
1380
1381dynlink2 = new PDynLinkMgr(fnameso, true);
1382if (dynlink2 == NULL) {
1383 string sn = fnameso;
1384 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1385 return(2);
1386 }
1387
1388int nok=0;
1389// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1390// DlUserProcFunction f = NULL;
1391DlFunction f = NULL;
1392if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1393f = dynlink2->GetFunction(func1);
1394if (f) { nok++; usfmap2[func1] = f; }
1395else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1396
1397if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1398f = dynlink2->GetFunction(func2);
1399if (f) { nok++; usfmap2[func2] = f; }
1400else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1401
1402if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1403f = dynlink2->GetFunction(func3);
1404if (f) { nok++; usfmap2[func3] = f; }
1405else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1406
1407fin:
1408if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1409else return(0);
1410}
1411
Note: See TracBrowser for help on using the repository browser.