Commit f4d43ade authored by Mathieu Faverge's avatar Mathieu Faverge

Spaces and indent

parent b08487fe
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
#include <iostream>
#include <fstream>
#include <string>
......@@ -65,22 +65,22 @@
/* -- */
using namespace std;
ParserPaje::ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new ParserEventPaje(_ParserDefinition)), _file(NULL){}
ParserPaje::ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new ParserEventPaje(_ParserDefinition)), _file(NULL){}
ParserPaje::ParserPaje(const string &filename) : Parser(filename),
_ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new ParserEventPaje(_ParserDefinition)), _file(NULL) {}
ParserPaje::ParserPaje(const string &filename) : Parser(filename),
_ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new ParserEventPaje(_ParserDefinition)), _file(NULL) {}
ParserPaje::~ParserPaje() {
delete _ParserDefinition;
delete _ParserEvent;
if (_file != NULL)
delete _file;
delete _file;
}
void ParserPaje::parse(Trace &trace,
bool finish_trace_after_parse) {
void ParserPaje::parse(Trace &trace,
bool finish_trace_after_parse) {
static const string PERCENT = "%";
PajeLine_t line;
......@@ -90,52 +90,52 @@ void ParserPaje::parse(Trace &trace,
// Open the trace
try {
_file = new PajeFileManager(_file_to_parse.c_str());
_file = new PajeFileManager(_file_to_parse.c_str());
} catch (const char *) {
delete _file;
_file = NULL;
delete _file;
_file = NULL;
_is_canceled = true;
finish();
trace.finish();
std::cerr << "Cannot open file " << _file_to_parse.c_str() << std::endl;
std::cerr << "Cannot open file " << _file_to_parse.c_str() << std::endl;
Error::set(Error::VITE_ERR_OPEN, 0, Error::VITE_ERRCODE_WARNING);
return;
}
return;
}
while( (!(_file->eof())) && !(_is_canceled) ) {
try {
#ifdef DBG_PARSER_PAJE
if ( (lineid+1) == _file->get_line(&line) )
{
_file->print_line();
lineid++;
}
if ( (lineid+1) == _file->get_line(&line) )
{
_file->print_line();
lineid++;
}
#else
_file->get_line(&line);
#endif
_file->get_line(&line);
#endif
}
catch(char *){
Error::set(Error::VITE_ERR_EXPECT_ID_DEF, 0, Error::VITE_ERRCODE_ERROR);
continue;
}
catch(char *){
Error::set(Error::VITE_ERR_EXPECT_ID_DEF, 0, Error::VITE_ERRCODE_ERROR);
continue;
}
// If it's an empty line
if (line._nbtks == 0) {
continue;
}
// The line starts by a '%' : it's a definition
else if(line._tokens[0][0] == '%') {
// If it's an empty line
if (line._nbtks == 0) {
continue;
}
// The line starts by a '%' : it's a definition
else if(line._tokens[0][0] == '%') {
_ParserDefinition->store_definition(&line);
}
// It's an event
else {
// It's an event
else {
_ParserEvent->store_event(&line, trace);
}
}
if(finish_trace_after_parse) {
finish();
finish();
trace.finish();
}
......@@ -146,9 +146,9 @@ void ParserPaje::parse(Trace &trace,
float ParserPaje::get_percent_loaded() const {
if (_file != NULL)
return _file->get_percent_loaded();
return _file->get_percent_loaded();
else
return 0.;
return 0.;
}
ParserDefinitionPaje *ParserPaje::get_parser_def() const {
......
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
#include <iostream>
#include <fstream>
......@@ -73,8 +73,8 @@ ParserVite::ParserVite() {}
ParserVite::ParserVite(const std::string &filename) : Parser(filename) {}
ParserVite::~ParserVite() {}
void ParserVite::parse(Trace &trace,
bool finish_trace_after_parse){
void ParserVite::parse(Trace &trace,
bool finish_trace_after_parse){
ParserPaje parserpaje(_file_to_parse);
......@@ -83,18 +83,18 @@ void ParserVite::parse(Trace &trace,
const Container::Vector *root_containers;
const map<std::string, Value *> *extra_fields;
map<string, Value *>::const_iterator fnamefield;
// Store the absolute directory of the first file for relative path in the others
QString absdir = QFileInfo(_file_to_parse.c_str()).absolutePath();
// Parse the first file with definitions
try {
parserpaje.parse(trace, false);
parserpaje.parse(trace, false);
}
catch(...) {
finish();
trace.finish();
return ;
finish();
trace.finish();
return ;
}
#ifdef DBG_PARSER_VITE
......@@ -106,11 +106,11 @@ void ParserVite::parse(Trace &trace,
root_containers = trace.get_root_containers();
for (Container::VectorIt it = root_containers->begin();
it != root_containers->end(); it++) {
it != root_containers->end(); it++) {
#ifdef DBG_PARSER_VITE
std::cerr << "+";
std::cerr << "+";
#endif
CTstack.push(*it);
CTstack.push(*it);
}
#ifdef DBG_PARSER_VITE
......@@ -119,42 +119,42 @@ void ParserVite::parse(Trace &trace,
/* Deep-First search over container to parse extra files */
while ( ! CTstack.empty()) {
Container *c = CTstack.top();
CTstack.pop();
Container *c = CTstack.top();
CTstack.pop();
extra_fields = c->get_extra_fields();
fnamefield = extra_fields->find(string("FileName"));
extra_fields = c->get_extra_fields();
fnamefield = extra_fields->find(string("FileName"));
// Search the filename
if (fnamefield != extra_fields->end()) {
name = QString::fromStdString( ((String *)(*fnamefield).second)->to_string() );
}
else {
name = "";
}
// Search the filename
if (fnamefield != extra_fields->end()) {
name = QString::fromStdString( ((String *)(*fnamefield).second)->to_string() );
}
else {
name = "";
}
if(name != "") {
if(name != "") {
#ifdef DBG_PARSER_VITE
std::cerr << ( (absdir + QDir::separator() + name).toStdString() ) << std::endl;
std::cerr << ( (absdir + QDir::separator() + name).toStdString() ) << std::endl;
#endif
parserpaje.set_file_to_parse( (absdir + QDir::separator() + name).toStdString() );
try {
parserpaje.parse(trace, false);
}
catch(...) {
finish();
trace.finish();
return ;
}
}
// We add the children
Container::VectorIt children_end = c->get_children()->end();
for (Container::VectorIt i = c->get_children()->begin();
i != children_end; ++ i) {
CTstack.push(*i);
}
parserpaje.set_file_to_parse( (absdir + QDir::separator() + name).toStdString() );
try {
parserpaje.parse(trace, false);
}
catch(...) {
finish();
trace.finish();
return ;
}
}
// We add the children
Container::VectorIt children_end = c->get_children()->end();
for (Container::VectorIt i = c->get_children()->begin();
i != children_end; ++ i) {
CTstack.push(*i);
}
}
finish();
......
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