some minor changes to improve the robustness for various msr-file dialects

This commit is contained in:
nemu 2008-02-04 13:46:45 +00:00
parent bdbfe3b4df
commit 07f702167e
3 changed files with 13 additions and 11 deletions

View File

@ -92,7 +92,7 @@ cout << endl << "fLines[" << i << "] = '" << fLines[i].fLine.Data() << "'";
tree_parse_info<> info = ast_parse(line.Data(), function, space_p); tree_parse_info<> info = ast_parse(line.Data(), function, space_p);
if (info.full) { if (info.full) {
cout << endl << "parse successfull ..." << endl; cout << endl << "parse successful ..." << endl;
PFunction func(info); PFunction func(info);
fFuncs.push_back(func); fFuncs.push_back(func);
} else { } else {

View File

@ -736,7 +736,7 @@ bool PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
iter = lines.begin(); iter = lines.begin();
while ((iter != lines.end()) && !error) { while ((iter != lines.end()) && !error) {
tokens = iter->fLine.Tokenize(" "); tokens = iter->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo;
cout << endl << endl; cout << endl << endl;
@ -965,7 +965,7 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
iter->fLine.ToLower(); iter->fLine.ToLower();
// tokenize line // tokenize line
tokens = iter->fLine.Tokenize(" "); tokens = iter->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo;
cout << endl << endl; cout << endl << endl;
@ -1537,7 +1537,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines)
while ((iter1 != iter2) && !error) { while ((iter1 != iter2) && !error) {
if (iter1->fLine.Contains("PLOT")) { // handle plot header if (iter1->fLine.Contains("PLOT")) { // handle plot header
tokens = iter1->fLine.Tokenize(" "); tokens = iter1->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo;
cout << endl << endl; cout << endl << endl;
@ -1569,7 +1569,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines)
case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13 case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13
case MSR_PLOT_ASYM: case MSR_PLOT_ASYM:
case MSR_PLOT_NO_MUSR: case MSR_PLOT_NO_MUSR:
tokens = iter1->fLine.Tokenize(" "); tokens = iter1->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo;
cout << endl << endl; cout << endl << endl;
@ -1596,7 +1596,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines)
} }
break; break;
case MSR_PLOT_ASYM_RRF: // like: runs 1,1 1,2 case MSR_PLOT_ASYM_RRF: // like: runs 1,1 1,2
tokens = iter1->fLine.Tokenize(" "); tokens = iter1->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo;
cout << endl << endl; cout << endl << endl;
@ -1642,7 +1642,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines)
} }
if (iter1->fLine.Contains("range")) { // handle plot range if (iter1->fLine.Contains("range")) { // handle plot range
tokens = iter1->fLine.Tokenize(" "); tokens = iter1->fLine.Tokenize(" \t");
if (!tokens) { if (!tokens) {
cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo;
cout << endl << endl; cout << endl << endl;

View File

@ -443,7 +443,7 @@ bool PRunDataHandler::ReadNemuFile()
// read header // read header
bool headerInfo = true; bool headerInfo = true;
char instr[128]; char instr[512];
TString line; TString line;
double dval; double dval;
int ival; int ival;
@ -551,9 +551,11 @@ cout << endl << ">> time resolution : " << runData.fTimeResolution;
histoData.push_back(val[i]); histoData.push_back(val[i]);
} }
// save the last histo // save the last histo if not empty
runData.fDataBin.push_back(histoData); if (histoData.size() > 0) {
histoData.clear(); runData.fDataBin.push_back(histoData);
histoData.clear();
}
// close file // close file
f.close(); f.close();