Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 13fed4e4 authored by Réza Ansari's avatar Réza Ansari
Browse files

Debug decodage des arguments de la ligne de commande, Reza 28/2/2017

parent e476b847
......@@ -11,7 +11,7 @@ P4AnaParams::P4AnaParams()
: inpath5_("bao5/"), inpath6_("bao6/"), Imin_(0), Imax_(10), Istep_(1),
fgreorderfreq_(false), gain_gnu_file_("gain.ppf"),
outfile_("p4a.ppf"), Nmean_(10), prtlev_(0),
fgTFM_(false), TFMfreqbin_(), TFMtimebin_(30), fgdtable_(false)
fgTFM_(false), TFMtimebin_(30), TFMfreqbin_(4), fgdtable_(false)
{
}
......@@ -20,7 +20,7 @@ P4AnaParams::P4AnaParams(P4AnaParams const & a)
: inpath5_(a.inpath5_), inpath6_(a.inpath6_), Imin_(a.Imin_), Imax_(a.Imax_), Istep_(a.Istep_),
fgreorderfreq_(a.fgreorderfreq_), gain_gnu_file_(a.gain_gnu_file_),
outfile_(a.outfile_), Nmean_(a.Nmean_), prtlev_(a.prtlev_),
fgTFM_(a.fgTFM_), TFMfreqbin_(a.TFMfreqbin_), TFMtimebin_(a.TFMtimebin_),
fgTFM_(a.fgTFM_), TFMtimebin_(a.TFMtimebin_), TFMfreqbin_(a.TFMfreqbin_),
fgdtable_(a.fgdtable_), fbands_(a.fbands_), lastargs_(a.lastargs_)
{
}
......@@ -39,50 +39,54 @@ P4AnaParams& P4AnaParams::operator = (P4AnaParams const & a)
int P4AnaParams::DecodeArgs(int narg, const char* arg[])
{
// decodage arguments optionnel
bool fgoptarg=true;
while (fgoptarg&&(narg>1)) {
while (narg>1) {
string fbo = arg[1];
if (fbo=="-inrange") { // specification numeros de fichiers de visi a traiter
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
sscanf(arg[2],"%d,%d,%d",&Imin_,&Imax_,&Istep_); arg+=2; narg-=2;
sscanf(arg[2],"%d,%d,%d",&Imin_,&Imax_,&Istep_); arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-in5") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
inpath5_=arg[2]; arg+=2; narg-=2;
inpath5_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-in6") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
inpath6_=arg[2]; arg+=2; narg-=2;
inpath6_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-gnu") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
gain_gnu_file_=arg[2]; arg+=2; narg-=2;
gain_gnu_file_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-nmean") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
Nmean_=atoi(arg[2]); arg+=2; narg-=2;
Nmean_=atoi(arg[2]); arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-reorderfreq") {
fgreorderfreq_=true; arg++; narg--;
fgreorderfreq_=true; arg++; narg--; lastargs_.clear();
}
else if (fbo=="-o") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
outfile_=arg[2]; arg+=2; narg-=2;
outfile_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-tfm") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
int ja,jb;
sscanf(arg[2],"%d,%d",&ja,&jb); TFMtimebin_=ja; TFMfreqbin_=jb; fgTFM_=true; arg+=2; narg-=2;
sscanf(arg[2],"%d,%d",&ja,&jb); TFMtimebin_=ja; TFMfreqbin_=jb; fgTFM_=true;
arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-freq") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
double f0,df;
sscanf(arg[2],"%lg,%lg",&f0,&df); fbands_.push_back(P4FreqBand(f0,df)); fgdtable_=true; arg+=2; narg-=2;
}
else fgoptarg=false;
sscanf(arg[2],"%lg,%lg",&f0,&df); fbands_.push_back(P4FreqBand(f0,df)); fgdtable_=true;
arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-prt") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
prtlev_=atoi(arg[2]); arg+=2; narg-=2; lastargs_.clear();
}
else { arg++; narg--; lastargs_.push_back(fbo); }
}
// les arguments qui restent a la fin de la ligne de commande:
for(int k=1; k<narg; k++) lastargs_.push_back(arg[k]);
// les arguments qui restent a la fin de la ligne de commande sont dans lastargs_
return 0;
}
......@@ -91,7 +95,7 @@ int P4AnaParams::UsageOptions()
cout<< " P4AnaParams::UsageOptions(): -inrange -in5 -in6 -gnu -o -nmean -tfm -freq -prt \n"
<< " [-inrange Imin,Imax[,Istep] ] [-in5 InputPath_BAO5] [-in6 InputPath_BAO6] \n"
<< " [-o outfilename] [-gnu gain_filename] [-nmean N] [-reorderfreq] \n"
<< " [-tfm timebin,freqbin] [-freq f0,df] [-prt level] \n"
<< " [-tfm timebin,freqbin] [-freq f0,df] [-prt level] \n"
<< " -inrange Imin,Imax[,Istep] define range of visibilite matrices to be processed (Imin<=I<=Imax with step Istep) \n"
<< " -in5/6 InputPath_BAO5/6 : input file path for BAO5 and BAO6 \n"
<< " -o outfilename : specify output file name \n"
......@@ -112,6 +116,7 @@ ostream& P4AnaParams::Print(ostream& os) const
if (fgreorderfreq_) os<<" (frequency reordering for FFT firmware) ";
os<<" Gain, g(nu) file:"<<gain_gnu_file_<<" OutFile="<<outfile_<<endl;
os<<" Nmean="<<Nmean_<<" TFM: TimeBin="<<TFMtimebin_<<" FreqBin="<<TFMfreqbin_<<endl;
for(size_t i=0; i<fbands_.size(); i++) os<<"FreqBand["<<i<<"]: "<<fbands_[i]<<endl;
if (fbands_.size()==0) os<<" No frequency band defined ..."<<endl;
else for(size_t i=0; i<fbands_.size(); i++) os<<"FreqBand["<<i<<"]: "<<fbands_[i]<<endl;
return os;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment