* Define a function for the XML-reading workaround in order to clean up a bit.
For the moment we keep to copies of it -- one for the use within the various musrfit programs, one that can be used in user functions. * musrt0 is now again activated in musrgui/musredit by default.
This commit is contained in:
parent
dc48ea9712
commit
caa3fdfc12
@ -418,9 +418,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
fstream xmlFile;
|
|
||||||
unsigned int xmlSize = 0;
|
|
||||||
char *xmlBuffer = 0;
|
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
PStartupHandler *startupHandler = new PStartupHandler();
|
||||||
@ -440,22 +437,9 @@ int main(int argc, char *argv[])
|
|||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
status = parseXmlFile(saxParser, startup_path_name);
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
|
@ -415,35 +415,19 @@ int PMsr2Data::SetRunNumbers(const string &runListFile)
|
|||||||
*
|
*
|
||||||
* <p><b>return:</b>
|
* <p><b>return:</b>
|
||||||
* - 0 if everything went fine
|
* - 0 if everything went fine
|
||||||
* - return value of the ParseFile-method otherwise
|
* - return value of the parseXmlFile function otherwise
|
||||||
*/
|
*/
|
||||||
int PMsr2Data::ParseXmlStartupFile()
|
int PMsr2Data::ParseXmlStartupFile()
|
||||||
{
|
{
|
||||||
fstream xmlFile;
|
|
||||||
unsigned int xmlSize = 0;
|
|
||||||
char *xmlBuffer = 0;
|
|
||||||
int status;
|
int status;
|
||||||
fSaxParser = new TSAXParser();
|
fSaxParser = new TSAXParser();
|
||||||
fStartupHandler = new PStartupHandler();
|
fStartupHandler = new PStartupHandler();
|
||||||
string startup_path_name(fStartupHandler->GetStartupFilePath().Data());
|
string startup_path_name(fStartupHandler->GetStartupFilePath().Data());
|
||||||
fSaxParser->ConnectToHandler("PStartupHandler", fStartupHandler);
|
fSaxParser->ConnectToHandler("PStartupHandler", fStartupHandler);
|
||||||
//status = fSaxParser->ParseFile(startup_path_name.c_str());
|
//status = fSaxParser->ParseFile(startup_path_name.c_str());
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
status = parseXmlFile(fSaxParser, startup_path_name.c_str());
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = fSaxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl;
|
cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl;
|
||||||
|
@ -42,6 +42,47 @@ using namespace std;
|
|||||||
|
|
||||||
ClassImpQ(PStartupHandler)
|
ClassImpQ(PStartupHandler)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This function is a replacement for the ParseFile method of TSAXParser.
|
||||||
|
// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p> Replacement for the ParseFile method of TSAXParser.
|
||||||
|
*
|
||||||
|
* <p><b>return:</b>
|
||||||
|
* - 1 if file cannot be read
|
||||||
|
* - 0 if the file has been parsed successfully
|
||||||
|
* - parse error code otherwise
|
||||||
|
*
|
||||||
|
* \param saxParser pointer to a TSAXParser object
|
||||||
|
* \param startup_path_name full path to the XML file to be read
|
||||||
|
*/
|
||||||
|
int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
fstream xmlFile;
|
||||||
|
unsigned int xmlSize = 0;
|
||||||
|
char *xmlBuffer = 0;
|
||||||
|
|
||||||
|
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
||||||
|
if (xmlFile.is_open()) { // check if file has been opened successfully
|
||||||
|
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
||||||
|
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
||||||
|
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
||||||
|
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
||||||
|
xmlFile.close(); // close the XML file
|
||||||
|
}
|
||||||
|
if (!xmlBuffer) { // file has not been read into the buffer
|
||||||
|
status = 1;
|
||||||
|
} else {
|
||||||
|
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
||||||
|
delete[] xmlBuffer; // free the buffer memory
|
||||||
|
xmlBuffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "PUserFcnBase.h"
|
#include "PUserFcnBase.h"
|
||||||
@ -56,5 +57,47 @@ PUserFcnBase::~PUserFcnBase()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This function is a replacement for the ParseFile method of TSAXParser.
|
||||||
|
// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p> Replacement for the ParseFile method of TSAXParser
|
||||||
|
* that can be used in user functions.
|
||||||
|
*
|
||||||
|
* <p><b>return:</b>
|
||||||
|
* - 1 if file cannot be read
|
||||||
|
* - 0 if the file has been parsed successfully
|
||||||
|
* - parse error code otherwise
|
||||||
|
*
|
||||||
|
* \param saxParser pointer to a TSAXParser object
|
||||||
|
* \param startup_path_name full path to the XML file to be read
|
||||||
|
*/
|
||||||
|
Int_t parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
|
||||||
|
{
|
||||||
|
Int_t status;
|
||||||
|
fstream xmlFile;
|
||||||
|
UInt_t xmlSize = 0;
|
||||||
|
Char_t *xmlBuffer = 0;
|
||||||
|
|
||||||
|
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
||||||
|
if (xmlFile.is_open()) { // check if file has been opened successfully
|
||||||
|
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
||||||
|
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
||||||
|
xmlBuffer = new Char_t[xmlSize]; // allocate buffer memory for the whole XML file
|
||||||
|
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
||||||
|
xmlFile.close(); // close the XML file
|
||||||
|
}
|
||||||
|
if (!xmlBuffer) { // file has not been read into the buffer
|
||||||
|
status = 1;
|
||||||
|
} else {
|
||||||
|
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
||||||
|
delete[] xmlBuffer; // free the buffer memory
|
||||||
|
xmlBuffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
// place a void pointer vector for global user function objects which might be needed
|
// place a void pointer vector for global user function objects which might be needed
|
||||||
vector<void *> gGlobalUserFcn;
|
vector<void *> gGlobalUserFcn;
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TSAXParser.h>
|
#include <TSAXParser.h>
|
||||||
@ -66,26 +65,9 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
|
|||||||
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler);
|
saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler);
|
||||||
//Int_t status = saxParser->ParseFile(startup_path_name);
|
//Int_t status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
Int_t status = parseXmlFile(saxParser, startup_path_name);
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
Int_t status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed.";
|
cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed.";
|
||||||
|
24
src/external/Nonlocal/PNL_PippardFitter.cpp
vendored
24
src/external/Nonlocal/PNL_PippardFitter.cpp
vendored
@ -33,7 +33,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TSAXParser.h>
|
#include <TSAXParser.h>
|
||||||
@ -65,26 +64,9 @@ PNL_PippardFitterGlobal::PNL_PippardFitterGlobal()
|
|||||||
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PNL_StartupHandler", fStartupHandler);
|
saxParser->ConnectToHandler("PNL_StartupHandler", fStartupHandler);
|
||||||
//Int_t status = saxParser->ParseFile(startup_path_name);
|
//Int_t status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
Int_t status = parseXmlFile(saxParser, startup_path_name);
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
Int_t status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal: **WARNING** Reading/parsing nonlocal_startup.xml failed.";
|
cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal: **WARNING** Reading/parsing nonlocal_startup.xml failed.";
|
||||||
|
162
src/external/libFitPofB/classes/TLondon1D.cpp
vendored
162
src/external/libFitPofB/classes/TLondon1D.cpp
vendored
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "TLondon1D.h"
|
#include "TLondon1D.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -155,26 +154,9 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -323,26 +305,9 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -526,26 +491,9 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -716,26 +664,9 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -883,26 +814,9 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1072,26 +986,9 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1261,26 +1158,9 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
|
|||||||
// BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
// BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
// saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
// saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
// //int status (saxParser->ParseFile(startup_path_name.c_str()));
|
// //int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// // parsing the file as above seems to lead to problems in certain environments;
|
||||||
// fstream xmlFile;
|
// // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
// unsigned int xmlSize = 0;
|
// int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
// char *xmlBuffer = 0;
|
|
||||||
// xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
// if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
// xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
// xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
// xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
// xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
// xmlFile.close(); // close the XML file
|
|
||||||
// }
|
|
||||||
// int status;
|
|
||||||
// if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
// status = 1;
|
|
||||||
// } else {
|
|
||||||
// status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
// delete[] xmlBuffer; // free the buffer memory
|
|
||||||
// xmlBuffer = 0;
|
|
||||||
// }
|
|
||||||
// // check for parse errors
|
// // check for parse errors
|
||||||
// if (status) { // error
|
// if (status) { // error
|
||||||
// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl;
|
// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl;
|
||||||
|
208
src/external/libFitPofB/classes/TVortex.cpp
vendored
208
src/external/libFitPofB/classes/TVortex.cpp
vendored
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "TVortex.h"
|
#include "TVortex.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -167,26 +166,9 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -244,26 +226,9 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true)
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -491,26 +456,9 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -647,26 +595,9 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -802,26 +733,9 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true)
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -970,26 +884,9 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1142,26 +1039,9 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1401,26 +1281,9 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1660,26 +1523,9 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
|
47
src/external/libLFRelaxation/TLFRelaxation.cpp
vendored
47
src/external/libLFRelaxation/TLFRelaxation.cpp
vendored
@ -35,7 +35,6 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#ifdef HAVE_GOMP
|
#ifdef HAVE_GOMP
|
||||||
@ -203,26 +202,9 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) {
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -545,26 +527,9 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f
|
|||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
fstream xmlFile;
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
unsigned int xmlSize = 0;
|
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
||||||
char *xmlBuffer = 0;
|
|
||||||
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
|
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
int status;
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
|
@ -36,9 +36,15 @@
|
|||||||
#include <TQObject.h>
|
#include <TQObject.h>
|
||||||
#include <TList.h>
|
#include <TList.h>
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
|
#include <TSAXParser.h>
|
||||||
|
|
||||||
#include "PMusr.h"
|
#include "PMusr.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This function is a replacement for the ParseFile method of TSAXParser.
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
int parseXmlFile(TSAXParser*, const char*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Handles the XML musrfit startup file (musrfit_startup.xml) in which default settings
|
* <p>Handles the XML musrfit startup file (musrfit_startup.xml) in which default settings
|
||||||
* are stored:
|
* are stored:
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "TObject.h"
|
#include "TObject.h"
|
||||||
|
#include "TSAXParser.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
@ -56,4 +57,9 @@ class PUserFcnBase : public TObject
|
|||||||
ClassDef(PUserFcnBase, 1)
|
ClassDef(PUserFcnBase, 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This function is a replacement for the ParseFile method of TSAXParser.
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
Int_t parseXmlFile(TSAXParser*, const Char_t*);
|
||||||
|
|
||||||
#endif // _PUSERFCNBASE_H_
|
#endif // _PUSERFCNBASE_H_
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<default_save_path>./</default_save_path>
|
<default_save_path>./</default_save_path>
|
||||||
<msr_default_file_path>$HOME/analysis/musrfit/src/musredit</msr_default_file_path>
|
<msr_default_file_path>$HOME/analysis/musrfit/src/musredit</msr_default_file_path>
|
||||||
<title_from_data_file>y</title_from_data_file>
|
<title_from_data_file>y</title_from_data_file>
|
||||||
<enable_musrt0>n</enable_musrt0>
|
<enable_musrt0>y</enable_musrt0>
|
||||||
</general>
|
</general>
|
||||||
<help_section>
|
<help_section>
|
||||||
<musr_web_main>http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrFit.html</musr_web_main>
|
<musr_web_main>http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrFit.html</musr_web_main>
|
||||||
|
@ -424,9 +424,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
fstream xmlFile;
|
|
||||||
unsigned int xmlSize = 0;
|
|
||||||
char *xmlBuffer = 0;
|
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
PStartupHandler *startupHandler = new PStartupHandler();
|
||||||
@ -446,22 +443,9 @@ int main(int argc, char *argv[])
|
|||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
status = parseXmlFile(saxParser, startup_path_name);
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<default_save_path>./</default_save_path>
|
<default_save_path>./</default_save_path>
|
||||||
<msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path>
|
<msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path>
|
||||||
<title_from_data_file>n</title_from_data_file>
|
<title_from_data_file>n</title_from_data_file>
|
||||||
<enable_musrt0>n</enable_musrt0>
|
<enable_musrt0>y</enable_musrt0>
|
||||||
</general>
|
</general>
|
||||||
<font_settings>
|
<font_settings>
|
||||||
<font_name>Courier</font_name>
|
<font_name>Courier</font_name>
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TApplication.h>
|
#include <TApplication.h>
|
||||||
@ -276,9 +275,6 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
fstream xmlFile;
|
|
||||||
unsigned int xmlSize = 0;
|
|
||||||
char *xmlBuffer = 0;
|
|
||||||
Char_t startup_path_name[128];
|
Char_t startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
PStartupHandler *startupHandler = new PStartupHandler();
|
||||||
@ -298,22 +294,9 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
status = parseXmlFile(saxParser, startup_path_name);
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
cerr << endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TApplication.h>
|
#include <TApplication.h>
|
||||||
@ -159,9 +158,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
fstream xmlFile;
|
|
||||||
unsigned int xmlSize = 0;
|
|
||||||
char *xmlBuffer = 0;
|
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
PStartupHandler *startupHandler = new PStartupHandler();
|
||||||
@ -181,22 +177,9 @@ int main(int argc, char *argv[])
|
|||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
if (xmlFile.is_open()) { // check if file has been opened successfully
|
status = parseXmlFile(saxParser, startup_path_name);
|
||||||
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
|
|
||||||
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
|
|
||||||
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
|
|
||||||
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
|
|
||||||
xmlFile.close(); // close the XML file
|
|
||||||
}
|
|
||||||
if (!xmlBuffer) { // file has not been read into the buffer
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
|
|
||||||
delete[] xmlBuffer; // free the buffer memory
|
|
||||||
xmlBuffer = 0;
|
|
||||||
}
|
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
cerr << endl << ">> musrview **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
cerr << endl << ">> musrview **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user