Commit 441f570d authored by Johnny Jazeix's avatar Johnny Jazeix

Ajout de corrections d'erreurs. Modif du doxyfile pour qu'il prenne en

compte le bon main. Ajout de la precision lors du to_string() des 
valeurs (avant ca tronquait mais la valeur stockee etait la bonne).
Ajout de la partie raccourcis dans le manuel user.
parent 83334493
...@@ -31,7 +31,7 @@ PROJECT_NAME = ViTE ...@@ -31,7 +31,7 @@ PROJECT_NAME = ViTE
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 1.0 PROJECT_NUMBER = 2.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
...@@ -513,7 +513,7 @@ WARN_LOGFILE = ...@@ -513,7 +513,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = src/interface/ src/message/ src/parser/ src/trace/ src/trace/values/ main.cpp main_resource.hpp tests/interface tests/message tests/parser tests/trace INPUT = src/interface/ src/message/ src/parser/ src/trace/ src/trace/values/ src/main.cpp src/main_resource.hpp tests/interface tests/message tests/parser tests/trace
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
...@@ -84,9 +84,14 @@ bool Interface_console::draw_trace(const string & filename, Render_area* render_ ...@@ -84,9 +84,14 @@ bool Interface_console::draw_trace(const string & filename, Render_area* render_
ParserPaje parser; ParserPaje parser;
DrawTrace<Render_area> drawing; DrawTrace<Render_area> drawing;
try{
parser.parse(filename, trace); parser.parse(filename, trace);
}
catch (const string &error){
//message << "unable to parse " << filename << ende;
message << "Reason : " << error << ende;
return false;
}
drawing.build(render_area, &trace); drawing.build(render_area, &trace);
return true; return true;
......
...@@ -18,80 +18,71 @@ const string Error::_EMPTY_DEF = "a definition line is empty"; ...@@ -18,80 +18,71 @@ const string Error::_EMPTY_DEF = "a definition line is empty";
const string Error::_INCOMPATIBLE_VALUE_IN_EVENT = "incompatible value : "; const string Error::_INCOMPATIBLE_VALUE_IN_EVENT = "incompatible value : ";
const string Error::_UNKNOWN_TYPE_IN_EVENT = "unknown type : "; const string Error::_UNKNOWN_TYPE_IN_EVENT = "unknown type : ";
const string Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND = "unknown field for the event. Should have been found on the definition parser : "; const string Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND = "unknown field for the event. Should have been found on the definition parser : ";
const string Error::_UNKNOWN_LINE = "the content of the line is unknown, must quit";
const string Error::_BAD_FILE_EXTENSION = "the extension of the file is not .trace";
const string Error::_LINE_TOO_LONG_EVENT = "extra token(s)";
string Error::_content = ""; string Error::_content = "";
void Error::set_error(string kind_of_error, unsigned int line_number){ void Error::set(const string kind_of_error, const int priority){
//_number_of_errors ++; Error::_content = kind_of_error;
char line[10]; switch(priority){
sprintf(line, "%d", line_number); case _WARNING:
Error::_content = kind_of_error + " on line " + line; Error::_warnings.push(Error::_content);
Error::_errors.push(Error::_content); break;
default: // Include the _ERROR
Error::_errors.push(Error::_content);
break;
}
} }
void Error::set_warning(string kind_of_error, unsigned int line_number){ void Error::set_and_print(const string kind_of_error, const int priority){
//_number_of_warnings ++; set(kind_of_error, priority);
char line[10]; print(priority);
sprintf(line, "%d", line_number);
Error::_content = kind_of_error + " on line " + line;
Error::_warnings.push(Error::_content);
} }
void Error::set_and_print_error(string kind_of_error, unsigned int line_number){ void Error::set_and_print(const string kind_of_error, const unsigned int line_number, const int priority){
set_error(kind_of_error, line_number); char line[10];
print_error(); sprintf(line, "%d", line_number);
set(kind_of_error + " on line " + line, priority);
print(priority);
} }
void Error::set_and_print_warning(string kind_of_error, unsigned int line_number){
set_warning(kind_of_error, line_number);
print_warning();
}
bool Error::set_error_if(bool condition, string kind_of_error, unsigned int line_number){ bool Error::set_if(bool condition, const string kind_of_error, const unsigned int line_number, const int priority){
if(condition){ if(condition){
set_error(kind_of_error, line_number); char line[10];
sprintf(line, "%d", line_number);
set(kind_of_error + " on line " + line, priority);
return true; return true;
} }
return false; return false;
} }
bool Error::set_warning_if(bool condition, string kind_of_error, unsigned int line_number){
if(condition){
set_warning(kind_of_error, line_number);
return true;
}
return false;
}
void Error::print_error(){
message << _content << ende;
}
void Error::print_warning(){ void Error::print(const int priority){
message << _content << endw; message << _content ;
} switch(priority){
case _WARNING:
bool Error::set_and_print_error_if(bool condition, string kind_of_error, unsigned int line_number){ message << endw;
if(condition){ break;
set_error(kind_of_error, line_number); default: // Include the _ERROR
print_error(); message << ende;
return true; break;
} }
return false;
} }
bool Error::set_and_print_warning_if(bool condition, string kind_of_error, unsigned int line_number){ bool Error::set_and_print_if(bool condition, const string kind_of_error, const unsigned int line_number, const int priority){
if(condition){ if(set_if(condition, kind_of_error, line_number, priority)){
set_warning(kind_of_error, line_number); print(priority);
print_warning();
return true; return true;
} }
return false; return false;
} }
void Error::print_numbers_of_warning_and_errors(){ void Error::print_numbers(){
message << "Your trace has " << Error::_errors.size() << " errors and " << Error::_warnings.size() << " warnings."; message << "The trace has " << Error::_errors.size() << " errors and " << Error::_warnings.size() << " warnings.";
if(Error::_warnings.size() == 0 && Error::_errors.size() == 0){ if(Error::_warnings.size() == 0 && Error::_errors.size() == 0){
message << endi; message << endi;
} }
......
...@@ -20,11 +20,19 @@ private: ...@@ -20,11 +20,19 @@ private:
static std::queue<std::string> _errors; static std::queue<std::string> _errors;
static std::queue<std::string> _warnings; static std::queue<std::string> _warnings;
static unsigned int _number_of_warnings;
static unsigned int _number_of_errors;
static std::string _content; static std::string _content;
public: public:
/*
* Priorities of errors
*/
const static int _ERROR = 1;
const static int _WARNING = 2;
/*
* Kind of errors known
*/
const static std::string _EXPECT_END_DEF; const static std::string _EXPECT_END_DEF;
const static std::string _EXPECT_EVENT_DEF; const static std::string _EXPECT_EVENT_DEF;
const static std::string _EXPECT_NAME_DEF; const static std::string _EXPECT_NAME_DEF;
...@@ -37,25 +45,25 @@ public: ...@@ -37,25 +45,25 @@ public:
const static std::string _INCOMPATIBLE_VALUE_IN_EVENT; const static std::string _INCOMPATIBLE_VALUE_IN_EVENT;
const static std::string _UNKNOWN_TYPE_IN_EVENT; const static std::string _UNKNOWN_TYPE_IN_EVENT;
const static std::string _UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND; const static std::string _UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND;
static void set_error(std::string kind_of_error, unsigned int line_number); const static std::string _UNKNOWN_LINE;
static void set_warning(std::string kind_of_error, unsigned int line_number); const static std::string _BAD_FILE_EXTENSION;
const static std::string _LINE_TOO_LONG_EVENT;
static void set_and_print_error(std::string kind_of_error, unsigned int line_number); static void set(const std::string kind_of_error, const int priority);
static void set_and_print_warning(std::string kind_of_error, unsigned int line_number);
static void set_and_print(const std::string kind_of_error, const int priority);
static void set_and_print(const std::string kind_of_error, const unsigned int line_number, const int priority);
static void print_error();
static void print_warning();
static void print(const int priority);
static bool set_error_if(bool condition, std::string kind_of_error, unsigned int line_number); static bool set_if(bool condition, const std::string kind_of_error, const unsigned int line_number, const int priority);
static bool set_warning_if(bool condition, std::string kind_of_error, unsigned int line_number);
static bool set_and_print_error_if(bool condition, std::string kind_of_error, unsigned int line_number); static bool set_and_print_if(bool condition, const std::string kind_of_error, const unsigned int line_number, const int priority);
static bool set_and_print_warning_if(bool condition, std::string kind_of_error, unsigned int line_number);
static void print_numbers_of_warning_and_errors(); static void print_numbers();
static void flush_in_file(const std::string &filename); static void flush_in_file(const std::string &filename);
}; };
......
...@@ -12,23 +12,24 @@ int ParserDefinitionDecoder::definitions_number(){ ...@@ -12,23 +12,24 @@ int ParserDefinitionDecoder::definitions_number(){
void ParserDefinitionDecoder::enter_definition(Line &line){ void ParserDefinitionDecoder::enter_definition(Line &line){
Error::set_and_print_error_if(_state == _IN_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count()); Error::set_and_print_if(_state == _IN_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count(), Error::_ERROR);
string definition_name; string definition_name;
Error::set_and_print_error_if(!line.item(2, definition_name), Error::_EXPECT_NAME_DEF, line.get_line_count()); Error::set_and_print_if(!line.item(2, definition_name), Error::_EXPECT_NAME_DEF, line.get_line_count(), Error::_ERROR);
//DIE_IF(!line.item(2, definition_name), "Error : a definition need a name"); //DIE_IF(!line.item(2, definition_name), "Error : a definition need a name");
unsigned int definition_identity; unsigned int definition_identity;
string definition_identity_string; string definition_identity_string;
if(Error::set_and_print_error_if(!line.item(3, definition_identity_string), Error::_EXPECT_ID_DEF, line.get_line_count())){ if(Error::set_and_print_if(!line.item(3, definition_identity_string),
Error::_EXPECT_ID_DEF, line.get_line_count(), Error::_ERROR)){
return; return;
} }
//DIE_IF(!line.item(3, definition_identity_string), "Error : definition has no identifier"); //DIE_IF(!line.item(3, definition_identity_string), "Error : definition has no identifier");
if(Error::set_and_print_error_if(sscanf(definition_identity_string.c_str(), "%d", &definition_identity) != 1, if(Error::set_and_print_if(sscanf(definition_identity_string.c_str(), "%d", &definition_identity) != 1,
Error::_EXPECT_ID_DEF, line.get_line_count())){ Error::_EXPECT_ID_DEF, line.get_line_count(), Error::_ERROR)){
return; return;
} }
//DIE_IF(sscanf(definition_identity_string.c_str(), "%d", &definition_identity) != 1, "Error : expected identifier for a definition"); //DIE_IF(sscanf(definition_identity_string.c_str(), "%d", &definition_identity) != 1, "Error : expected identifier for a definition");
...@@ -37,7 +38,7 @@ void ParserDefinitionDecoder::enter_definition(Line &line){ ...@@ -37,7 +38,7 @@ void ParserDefinitionDecoder::enter_definition(Line &line){
_definitions.insert(pair<unsigned int,Definition>(definition_identity, current_definition)); _definitions.insert(pair<unsigned int,Definition>(definition_identity, current_definition));
_current_definition = definition_identity; _current_definition = definition_identity;
Error::set_and_print_warning_if(line.length() > 4, Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count()); Error::set_and_print_if(line.length() > 4, Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count(), Error::_WARNING);
//WARN_IF((line.length() > 4), Error::_EXPECT_EVENT_DEF + line_number); //WARN_IF((line.length() > 4), Error::_EXPECT_EVENT_DEF + line_number);
//"Warning : extra token in %EventDef on line << line_number << endl"); //"Warning : extra token in %EventDef on line << line_number << endl");
...@@ -48,38 +49,41 @@ void ParserDefinitionDecoder::enter_definition(Line &line){ ...@@ -48,38 +49,41 @@ void ParserDefinitionDecoder::enter_definition(Line &line){
void ParserDefinitionDecoder::leave_definition(Line &line){ void ParserDefinitionDecoder::leave_definition(Line &line){
if(Error::set_and_print_error_if(_state != _IN_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count())){ if(Error::set_and_print_if(_state != _IN_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count(), Error::_ERROR)){
return; return;
} }
// DIE_IF(_state != _IN_A_DEFINITION, "Error : expected %EventDef"); // DIE_IF(_state != _IN_A_DEFINITION, "Error : expected %EventDef");
_state = _OUT_A_DEFINITION; _state = _OUT_A_DEFINITION;
if(Error::set_and_print_error_if(!_definitions[_current_definition].check_definition(), Error::_UNKNOWN_EVENT + _definitions[_current_definition].get_event_name(), line.get_line_count())){ if(Error::set_and_print_if(!_definitions[_current_definition].check_definition(),
Error::_UNKNOWN_EVENT + _definitions[_current_definition].get_event_name(),
line.get_line_count(), Error::_ERROR)){
return; return;
} }
//DIE_IF(!_definitions[_current_definition].check_definition(), "Error : unknown event : " + _definitions[_current_definition].get_event_name()); //DIE_IF(!_definitions[_current_definition].check_definition(), "Error : unknown event : " + _definitions[_current_definition].get_event_name());
Error::set_and_print_warning_if(line.length() > 2, Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count()); Error::set_and_print_if(line.length() > 2, Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count(), Error::_WARNING);
//WARN_IF(line.length() > 2, "Warning : extra token in %EventDef"); //WARN_IF(line.length() > 2, "Warning : extra token in %EventDef");
} }
void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,Line& line){ void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,Line& line){
if(Error::set_and_print_error_if(_state == _OUT_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count())){ if(Error::set_and_print_if(_state == _OUT_A_DEFINITION, Error::_EXPECT_EVENT_DEF, line.get_line_count(), Error::_ERROR)){
return; return;
} }
//DIE_IF(_state == _OUT_A_DEFINITION, "Error : expected %EventDef"); //DIE_IF(_state == _OUT_A_DEFINITION, "Error : expected %EventDef");
string field_type; string field_type;
if(Error::set_and_print_error_if(!line.item(2, field_type), Error::_FIELD_TYPE_MISSING, line.get_line_count())){ if(Error::set_and_print_if(!line.item(2, field_type), Error::_FIELD_TYPE_MISSING, line.get_line_count(), Error::_ERROR)){
return; return;
} }
// DIE_IF(!line.item(2, field_type), "Error : a field type is missing"); // DIE_IF(!line.item(2, field_type), "Error : a field type is missing");
if(Error::set_and_print_error_if(field_type != "string" && field_type != "int" && if(Error::set_and_print_if(field_type != "string" && field_type != "int" &&
field_type != "hex" && field_type != "date" && field_type != "hex" && field_type != "date" &&
field_type != "double" && field_type != "color", field_type != "double" && field_type != "color",
Error::_FIELD_TYPE_UNKNOWN, line.get_line_count())){ Error::_FIELD_TYPE_UNKNOWN, line.get_line_count(),
Error::_ERROR)){
return; return;
} }
// DIE_IF(field_type != "string" && field_type != "int" && // DIE_IF(field_type != "string" && field_type != "int" &&
...@@ -93,7 +97,7 @@ void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,L ...@@ -93,7 +97,7 @@ void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,L
void ParserDefinitionDecoder::store_definition(Line &line){ void ParserDefinitionDecoder::store_definition(Line &line){
string first_token; string first_token;
if(Error::set_and_print_warning_if(!line.item(1, first_token), Error::_EMPTY_DEF, line.get_line_count())){ if(Error::set_and_print_if(!line.item(1, first_token), Error::_EMPTY_DEF, line.get_line_count(), Error::_WARNING)){
return; return;
} }
//DIE_IF(!line.item(1, first_token), "Warning : a definition line is empty"); //DIE_IF(!line.item(1, first_token), "Warning : a definition line is empty");
......
...@@ -35,8 +35,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -35,8 +35,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
string current_value; string current_value;
if (!line.item(i, current_value)) { if (!line.item(i, current_value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//message << "warning : missing values" << endl;
return; return;
} }
...@@ -68,8 +67,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -68,8 +67,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if (fields[i-1]._name == "Time") { else if (fields[i-1]._name == "Time") {
if(!Date::instantiate(current_value, time)) { if(!Date::instantiate(current_value, time)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
} }
...@@ -85,8 +83,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -85,8 +83,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if (fields[i-1]._name == "Value") { else if (fields[i-1]._name == "Value") {
if(fields[i-1]._type == "double") { if(fields[i-1]._type == "double") {
if(!Double::instantiate(current_value, value_double)) { if(!Double::instantiate(current_value, value_double)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
// cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
} }
...@@ -114,8 +111,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -114,8 +111,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if(fields[i-1]._type == "double") { else if(fields[i-1]._type == "double") {
Double value; Double value;
if(!Double::instantiate(current_value, value)) { if(!Double::instantiate(current_value, value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
extra_fields[fields[i-1]._name] = new Double(value); extra_fields[fields[i-1]._name] = new Double(value);
...@@ -123,8 +119,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -123,8 +119,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if(fields[i-1]._type == "hex") { else if(fields[i-1]._type == "hex") {
Hex value; Hex value;
if(!Hex::instantiate(current_value, value)) { if(!Hex::instantiate(current_value, value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
extra_fields[fields[i-1]._name] = new Hex(value); extra_fields[fields[i-1]._name] = new Hex(value);
...@@ -132,8 +127,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -132,8 +127,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if(fields[i-1]._type == "date") { else if(fields[i-1]._type == "date") {
Date value; Date value;
if(!Date::instantiate(current_value, value)) { if(!Date::instantiate(current_value, value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
extra_fields[fields[i-1]._name] = new Date(value); extra_fields[fields[i-1]._name] = new Date(value);
...@@ -141,8 +135,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -141,8 +135,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if(fields[i-1]._type == "int") { else if(fields[i-1]._type == "int") {
Integer value; Integer value;
if(!Integer::instantiate(current_value, value)) { if(!Integer::instantiate(current_value, value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
extra_fields[fields[i-1]._name] = new Integer(value); extra_fields[fields[i-1]._name] = new Integer(value);
...@@ -150,15 +143,13 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -150,15 +143,13 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
else if(fields[i-1]._type == "color") { else if(fields[i-1]._type == "color") {
Color value; Color value;
if(!Color::instantiate(current_value, value)) { if(!Color::instantiate(current_value, value)) {
Error::set_and_print_warning(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : incompatible value : " << current_value << endl;
return; return;
} }
extra_fields[fields[i-1]._name] = new Color(value); extra_fields[fields[i-1]._name] = new Color(value);
} }
else { else {
Error::set_and_print_warning(Error::_UNKNOWN_TYPE_IN_EVENT + current_value, line.get_line_count()); Error::set_and_print(Error::_UNKNOWN_TYPE_IN_EVENT + current_value, line.get_line_count(), Error::_WARNING);
//cerr << "warning : unknown type" << endl;
return; return;
} }
} }
...@@ -167,7 +158,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -167,7 +158,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
} }
if(line.length() > i+1) { if(line.length() > i+1) {
cerr << "warning : extra value(s)" << endl; Error::set_and_print(Error::_LINE_TOO_LONG_EVENT, line.get_line_count(), Error::_WARNING);
} }
Name alias_name; Name alias_name;
...@@ -251,8 +242,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T ...@@ -251,8 +242,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
} }
else { else {
Error::set_and_print_warning(Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND + event_name, line.get_line_count()); Error::set_and_print(Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND + event_name, line.get_line_count(), Error::_WARNING);
//cerr << "BUG PARSER BIS" << endl;
return; return;
} }
} }
......
...@@ -4,6 +4,14 @@ using namespace std; ...@@ -4,6 +4,14 @@ using namespace std;
void ParserPaje::parse(string filename, Trace &trace){ void ParserPaje::parse(string filename, Trace &trace){
// If the file must have the extension .trace
//
const unsigned int position_of_dot = filename.find_last_of('.');
if(position_of_dot == string::npos || filename.substr(position_of_dot) != ".trace"){
Error::set_and_print(Error::_BAD_FILE_EXTENSION, Error::_WARNING);
//throw Error::_BAD_FILE_EXTENSION;
}
ParserDefinitionDecoder *parserdefinition = new ParserDefinitionDecoder(); ParserDefinitionDecoder *parserdefinition = new ParserDefinitionDecoder();
ParserEventDecoder *parserevent = new ParserEventDecoder(); ParserEventDecoder *parserevent = new ParserEventDecoder();
...@@ -14,31 +22,32 @@ void ParserPaje::parse(string filename, Trace &trace){ ...@@ -14,31 +22,32 @@ void ParserPaje::parse(string filename, Trace &trace){
unsigned int event_identity; unsigned int event_identity;
while(!line.is_eof()){ while(!line.is_eof()){
line.newline();