Commit 03a65cdb authored by Mathieu Faverge's avatar Mathieu Faverge

Support new naming convention in Paje, the old one is still supported

parent 205d4f05
......@@ -111,7 +111,7 @@ SET(VITE_HDRS
parser/ParsingThread.hpp
parser/Parser.hpp
parser/ParserFactory.hpp
# Paje
# Paje
parser/PajeParser/PajeDefinition.hpp
parser/PajeParser/PajeFileManager.hpp
parser/PajeParser/ParserDefinitionPaje.hpp
......@@ -150,7 +150,7 @@ SET(VITE_UIS
)
SET(VITE_SRCS
# Messages & Errors
# Messages & Errors
common/Message.cpp
common/Errors.cpp
common/Tools.cpp
......@@ -268,7 +268,7 @@ IF(VITE_ENABLE_VBO)
${VITE_SRCS}
render/vbo.cpp
render/Render_alternate.cpp
)
)
ENDIF(VITE_ENABLE_VBO)
#############################################
......@@ -325,7 +325,7 @@ ENDIF(VITE_ENABLE_TAU)
#ADD_DEFINITIONS(-DMEMORY_USAGE)
#ADD_DEFINITIONS(-DMEMORY_TRACE)
#############################################
# BOOST
#############################################
......@@ -333,23 +333,23 @@ IF(VITE_ENABLE_SERIALIZATION)
link_directories ( ${Boost_LIBRARY_DIRS} )
include_directories ( ${Boost_INCLUDE_DIRS} )
add_definitions("-DUSE_ITC -DBOOST_SERIALIZE")
SET(VITE_HDRS
${VITE_HDRS}
parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp
parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp
trace/SerializerDispatcher.hpp
)
SET(VITE_SRCS
${VITE_SRCS}
parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp
parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp
trace/SerializerDispatcher.cpp
)
)
ENDIF(VITE_ENABLE_SERIALIZATION)
......@@ -386,7 +386,7 @@ if( APPLE )
SET( OSX_ICON_FILES "interface/icon/mac_logo.icns")
set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
ADD_EXECUTABLE(vite MACOSX_BUNDLE ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS} ${OSX_ICON_FILES})
SET_TARGET_PROPERTIES(vite PROPERTIES
SET_TARGET_PROPERTIES(vite PROPERTIES
MACOSX_BUNDLE_INFO_STRING "ViTE"
MACOSX_BUNDLE_ICON_FILE "mac_logo.icns"
MACOSX_BUNDLE_LONG_VERSION_STRING "Visual Trace Explorer - version ${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
......@@ -394,7 +394,7 @@ if( APPLE )
MACOSX_BUNDLE_SHORT_VERSION_STRING "ViTE-${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
MACOSX_BUNDLE_BUNDLE_VERSION "1.0"
MACOSX_BUNDLE_COPYRIGHT "INRIA 2006-2012"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/vite-info.plist.in)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/vite-info.plist.in)
else( APPLE )
ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
endif( APPLE )
......@@ -410,7 +410,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
rt
)
ADD_DEFINITIONS("-DBOOST_GZIP")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(VITE_ENABLE_VBO)
TARGET_LINK_LIBRARIES(vite
......
......@@ -60,41 +60,41 @@ void print(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
size_t size = def->_fields.size();
cout << def->_trid << " : " << def->_name << endl;
for(i=0 ; i < size ; i ++){
PajeFieldName p;
PajeFieldName p;
try{
p = (*fields).at( def->_fields[i]._idname);
cout << " " << p._name;
}catch(out_of_range& e){
cout << " " << "name not found";
}
string s;
string s;
//as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
default:
s="error : wrong type";
break;
}
cout << " " << s << endl;
cout << " " << s << endl;
}
}
......@@ -106,7 +106,7 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
outstream << def->_name;
outstream << "\n";
for(i=0 ; i < size ; i ++){
//try to find the name of the field we want to print
PajeFieldName p;
......@@ -116,33 +116,33 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
}catch(out_of_range& e){
outstream << " " << "name not found";
}
string s;
string s;
//as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
default:
s="error : wrong type";
break;
}
outstream << " " << s;
outstream << "\n";
outstream << " " << s;
outstream << "\n";
}
return outstream.str();
......@@ -150,19 +150,19 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
bool check_definition(PajeDefinition *def) {
int fdpresent = def->_fdpresent;
// If the definition requires Alias or Name,
// and the trace provide only one the both, it's ok
if ( ((def->_fdrequired & CODE(_PajeFN_Alias)) ||
(def->_fdrequired & CODE(_PajeFN_Name ))) &&
((def->_fdpresent & CODE(_PajeFN_Alias)) ||
(def->_fdpresent & CODE(_PajeFN_Name ))) ) {
fdpresent = fdpresent | CODE(_PajeFN_Alias);
fdpresent = fdpresent | CODE(_PajeFN_Name );
(def->_fdrequired & CODE(_PajeFN_Name ))) &&
((def->_fdpresent & CODE(_PajeFN_Alias)) ||
(def->_fdpresent & CODE(_PajeFN_Name ))) ) {
fdpresent = fdpresent | CODE(_PajeFN_Alias);
fdpresent = fdpresent | CODE(_PajeFN_Name );
}
if ( (fdpresent & def->_fdrequired) == def->_fdrequired )
return true;
return true;
else
return false;
}
......
......@@ -82,23 +82,32 @@
* the need of the user.
*/
#define FIELDNAME_SIZEMAX 32
#define FIELDNAME_SIZE 16
#define FIELDNAME_SIZE 14
#define _PajeFN_Time 0
#define _PajeFN_Name 1
#define _PajeFN_Alias 2
#define _PajeFN_Type 3
#define _PajeFN_Container 4
#define _PajeFN_StartContainerType 5
#define _PajeFN_EndContainerType 6
#define _PajeFN_StartContainer 7
#define _PajeFN_EndContainer 8
#define _PajeFN_Color 9
#define _PajeFN_Value 10
#define _PajeFN_Key 11
#define _PajeFN_File 12
#define _PajeFN_Line 13
/*
* Former type that are no longer used in Paje Format.
* Kept here for compatibility
*/
#define _PajeFN_ContainerType 3
#define _PajeFN_EntityType 4
#define _PajeFN_Type 5
#define _PajeFN_Container 6
#define _PajeFN_SourceContainerType 7
#define _PajeFN_DestContainerType 8
#define _PajeFN_SourceContainer 9
#define _PajeFN_DestContainer 10
#define _PajeFN_Color 11
#define _PajeFN_Value 12
#define _PajeFN_Key 13
#define _PajeFN_File 14
#define _PajeFN_Line 15
#define _PajeFN_EntityType 3
#define _PajeFN_SourceContainerType 5
#define _PajeFN_DestContainerType 6
#define _PajeFN_SourceContainer 7
#define _PajeFN_DestContainer 8
/*!
* \brief Types for the fields
......
......@@ -6,13 +6,13 @@
** 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,
......@@ -23,7 +23,7 @@
** 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.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
......@@ -83,7 +83,7 @@ using namespace std;
_EventDefs[_##name]._fdrequired = required; \
i++; \
}
std::map<std::string, int> ParserDefinitionPaje::_EvDefStr2Id;
std::map<std::string, int> ParserDefinitionPaje::_FTypeStr2Code;
......@@ -98,34 +98,34 @@ ParserDefinitionPaje::ParserDefinitionPaje() {
_nbparsers++;
if ( !_initialized ) {
_initialized = true;
// Initialize the list of EventDef's names
_EvDefStr2Id.insert(pair<string, int>("PajeDefineContainerType", _PajeDefineContainerType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineEventType" , _PajeDefineEventType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineStateType" , _PajeDefineStateType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineVariableType" , _PajeDefineVariableType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineLinkType" , _PajeDefineLinkType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineEntityValue" , _PajeDefineEntityValue ));
_EvDefStr2Id.insert(pair<string, int>("PajeCreateContainer" , _PajeCreateContainer ));
_EvDefStr2Id.insert(pair<string, int>("PajeDestroyContainer" , _PajeDestroyContainer ));
_EvDefStr2Id.insert(pair<string, int>("PajeNewEvent" , _PajeNewEvent ));
_EvDefStr2Id.insert(pair<string, int>("PajeSetState" , _PajeSetState ));
_EvDefStr2Id.insert(pair<string, int>("PajePushState" , _PajePushState ));
_EvDefStr2Id.insert(pair<string, int>("PajePopState" , _PajePopState ));
_EvDefStr2Id.insert(pair<string, int>("PajeSetVariable" , _PajeSetVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeAddVariable" , _PajeAddVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeSubVariable" , _PajeSubVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeStartLink" , _PajeStartLink ));
_EvDefStr2Id.insert(pair<string, int>("PajeEndLink" , _PajeEndLink ));
// Initialize the list of types available for field in EventDef declaration
_FTypeStr2Code.insert(pair<string, int>("int" ,_FieldType_Int ));
_FTypeStr2Code.insert(pair<string, int>("hex" ,_FieldType_Hex ));
_FTypeStr2Code.insert(pair<string, int>("date" ,_FieldType_Date ));
_FTypeStr2Code.insert(pair<string, int>("double",_FieldType_Double ));
_FTypeStr2Code.insert(pair<string, int>("string",_FieldType_String ));
_FTypeStr2Code.insert(pair<string, int>("color" ,_FieldType_Color ));
_initialized = true;
// Initialize the list of EventDef's names
_EvDefStr2Id.insert(pair<string, int>("PajeDefineContainerType", _PajeDefineContainerType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineEventType" , _PajeDefineEventType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineStateType" , _PajeDefineStateType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineVariableType" , _PajeDefineVariableType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineLinkType" , _PajeDefineLinkType ));
_EvDefStr2Id.insert(pair<string, int>("PajeDefineEntityValue" , _PajeDefineEntityValue ));
_EvDefStr2Id.insert(pair<string, int>("PajeCreateContainer" , _PajeCreateContainer ));
_EvDefStr2Id.insert(pair<string, int>("PajeDestroyContainer" , _PajeDestroyContainer ));
_EvDefStr2Id.insert(pair<string, int>("PajeNewEvent" , _PajeNewEvent ));
_EvDefStr2Id.insert(pair<string, int>("PajeSetState" , _PajeSetState ));
_EvDefStr2Id.insert(pair<string, int>("PajePushState" , _PajePushState ));
_EvDefStr2Id.insert(pair<string, int>("PajePopState" , _PajePopState ));
_EvDefStr2Id.insert(pair<string, int>("PajeSetVariable" , _PajeSetVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeAddVariable" , _PajeAddVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeSubVariable" , _PajeSubVariable ));
_EvDefStr2Id.insert(pair<string, int>("PajeStartLink" , _PajeStartLink ));
_EvDefStr2Id.insert(pair<string, int>("PajeEndLink" , _PajeEndLink ));
// Initialize the list of types available for field in EventDef declaration
_FTypeStr2Code.insert(pair<string, int>("int" ,_FieldType_Int ));
_FTypeStr2Code.insert(pair<string, int>("hex" ,_FieldType_Hex ));
_FTypeStr2Code.insert(pair<string, int>("date" ,_FieldType_Date ));
_FTypeStr2Code.insert(pair<string, int>("double",_FieldType_Double ));
_FTypeStr2Code.insert(pair<string, int>("string",_FieldType_String ));
_FTypeStr2Code.insert(pair<string, int>("color" ,_FieldType_Color ));
}
......@@ -135,14 +135,12 @@ ParserDefinitionPaje::ParserDefinitionPaje() {
INSERT_FNAME(Time, _FieldType_Date );
INSERT_FNAME(Name, _FieldType_Int | _FieldType_String );
INSERT_FNAME(Alias, _FieldType_Int | _FieldType_String );
INSERT_FNAME(ContainerType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(EntityType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(Type, _FieldType_Int | _FieldType_String );
INSERT_FNAME(Container, _FieldType_Int | _FieldType_String );
INSERT_FNAME(SourceContainerType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(DestContainerType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(SourceContainer, _FieldType_Int | _FieldType_String );
INSERT_FNAME(DestContainer, _FieldType_Int | _FieldType_String );
INSERT_FNAME(StartContainerType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(EndContainerType, _FieldType_Int | _FieldType_String );
INSERT_FNAME(StartContainer, _FieldType_Int | _FieldType_String );
INSERT_FNAME(EndContainer, _FieldType_Int | _FieldType_String );
INSERT_FNAME(Color, _FieldType_Color );
INSERT_FNAME(Value, _FieldType_Int | _FieldType_String | _FieldType_Double);
INSERT_FNAME(Key, _FieldType_Int | _FieldType_String );
......@@ -152,20 +150,28 @@ ParserDefinitionPaje::ParserDefinitionPaje() {
// Initialize the map between the field names and the associated id
_nbFieldNames = FIELDNAME_SIZE;
for(i=0; i<FIELDNAME_SIZE; i++) {
_FNameStr2Id.insert(pair<string, int>(_FieldNames[i]._name, i));
_FNameStr2Id.insert(pair<string, int>(_FieldNames[i]._name, i));
}
// Former types no longer used in Paje format
_FNameStr2Id.insert(pair<string, int>("ContainerType" , _PajeFN_ContainerType ));
_FNameStr2Id.insert(pair<string, int>("EntityType" , _PajeFN_EntityType ));
_FNameStr2Id.insert(pair<string, int>("SourceContainerType", _PajeFN_SourceContainerType ));
_FNameStr2Id.insert(pair<string, int>("DestContainerType" , _PajeFN_DestContainerType ));
_FNameStr2Id.insert(pair<string, int>("SourceContainer" , _PajeFN_SourceContainer ));
_FNameStr2Id.insert(pair<string, int>("DestContainer" , _PajeFN_DestContainer ));
// Initialize the list of Events available
i = 0;
_EventDefs.resize(PAJE_EVENTDEF_SIZE);
INSERT_EVENT(PajeDefineContainerType, CODE2(Name) | CODE2(Alias) | CODE2(ContainerType) );
INSERT_EVENT(PajeDefineEventType , CODE2(Name) | CODE2(Alias) | CODE2(ContainerType) );
INSERT_EVENT(PajeDefineStateType , CODE2(Name) | CODE2(Alias) | CODE2(ContainerType) );
INSERT_EVENT(PajeDefineVariableType , CODE2(Name) | CODE2(Alias) | CODE2(ContainerType) );
INSERT_EVENT(PajeDefineEntityValue , CODE2(Name) | CODE2(Alias) | CODE2(EntityType) );
INSERT_EVENT(PajeDefineContainerType, CODE2(Name) | CODE2(Alias) | CODE2(Type) );
INSERT_EVENT(PajeDefineEventType , CODE2(Name) | CODE2(Alias) | CODE2(Type) );
INSERT_EVENT(PajeDefineStateType , CODE2(Name) | CODE2(Alias) | CODE2(Type) );
INSERT_EVENT(PajeDefineVariableType , CODE2(Name) | CODE2(Alias) | CODE2(Type) );
INSERT_EVENT(PajeDefineEntityValue , CODE2(Name) | CODE2(Alias) | CODE2(Type) );
INSERT_EVENT(PajeDestroyContainer , CODE2(Name) | CODE2(Alias) | CODE2(Time) | CODE2(Type) );
INSERT_EVENT(PajeCreateContainer , CODE2(Name) | CODE2(Alias) | CODE2(Time) | CODE2(Type) | CODE2(Container) );
INSERT_EVENT(PajeDefineLinkType , CODE2(Name) | CODE2(Alias) | CODE2(ContainerType) | CODE2(SourceContainerType) | CODE2(DestContainerType) );
INSERT_EVENT(PajeDefineLinkType , CODE2(Name) | CODE2(Alias) | CODE2(Type) | CODE2(StartContainerType) | CODE2(EndContainerType) );
INSERT_EVENT(PajePopState , CODE2(Time) | CODE2(Type) | CODE2(Container) );
INSERT_EVENT(PajeSetState , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) );
INSERT_EVENT(PajePushState , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) );
......@@ -173,9 +179,8 @@ ParserDefinitionPaje::ParserDefinitionPaje() {
INSERT_EVENT(PajeSetVariable , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) );
INSERT_EVENT(PajeAddVariable , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) );
INSERT_EVENT(PajeSubVariable , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) );
INSERT_EVENT(PajeStartLink , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) | CODE2(Key) | CODE2(SourceContainer) );
INSERT_EVENT(PajeEndLink , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) | CODE2(Key) | CODE2(DestContainer) );
INSERT_EVENT(PajeStartLink , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) | CODE2(Key) | CODE2(StartContainer) );
INSERT_EVENT(PajeEndLink , CODE2(Time) | CODE2(Type) | CODE2(Container) | CODE2(Value) | CODE2(Key) | CODE2(EndContainer) );
}
ParserDefinitionPaje::~ParserDefinitionPaje() {
......@@ -183,7 +188,7 @@ ParserDefinitionPaje::~ParserDefinitionPaje() {
// Free the string to store extra names
for( i=FIELDNAME_SIZE ; i<_nbFieldNames; i++) {
delete[] _FieldNames[i]._name;
delete[] _FieldNames[i]._name;
}
_FieldNames.clear();
_EventDefs.clear();
......@@ -192,9 +197,9 @@ ParserDefinitionPaje::~ParserDefinitionPaje() {
_nbparsers--;
if ( (_nbparsers == 0) && _initialized ) {
_FTypeStr2Code.clear();
_EvDefStr2Id.clear();
_initialized = false;
_FTypeStr2Code.clear();
_EvDefStr2Id.clear();
_initialized = false;
}
}
......@@ -202,20 +207,20 @@ void ParserDefinitionPaje::enter_definition(const PajeLine_t *line){
int defid, trid;
char *defname = line->_tokens[2];
char *tridstr = line->_tokens[3];
// The name is missing
if(defname == NULL) {
Error::set(Error::VITE_ERR_EXPECT_NAME_DEF, line->_id, Error::VITE_ERRCODE_ERROR);
return;
}
// The id is missing
if(tridstr == NULL) {
Error::set(Error::VITE_ERR_EXPECT_ID_DEF, line->_id, Error::VITE_ERRCODE_ERROR);
return;
}
// If we are already trying to define an event,
// If we are already trying to define an event,
// we close it before starting a new one
if(_state == _IN_A_DEFINITION){
Error::set(Error::VITE_ERR_EXPECT_END_DEF, line->_id, Error::VITE_ERRCODE_WARNING);
......@@ -234,7 +239,7 @@ void ParserDefinitionPaje::enter_definition(const PajeLine_t *line){
return;
}
defid = _EvDefStr2Id[defname];
defid = _EvDefStr2Id[defname];
// Check if it is the first time we see this Event
if ( _EventDefs[defid]._trid != -1 ) {
......@@ -252,12 +257,12 @@ void ParserDefinitionPaje::enter_definition(const PajeLine_t *line){
_defid = defid;
_state = _IN_A_DEFINITION;
_EvDefTrId2Id.insert(pair<int, int>(trid, defid));
return;
}
void ParserDefinitionPaje::leave_definition(const PajeLine_t *line){
// We can't end a definition if we are not in one !!!
if(_state != _IN_A_DEFINITION){
Error::set(Error::VITE_ERR_EXPECT_EVENT_DEF, line->_id, Error::VITE_ERRCODE_WARNING);
......@@ -268,14 +273,14 @@ void ParserDefinitionPaje::leave_definition(const PajeLine_t *line){
// Check that the event has been correctly defined
if( !(PajeDef::check_definition(&_EventDefs[_defid])) ) {
Error::set(Error::VITE_ERR_EVENT_NOT_CORRECT
+ PajeDef::print_string(&_FieldNames, &_EventDefs[_defid]),
line->_id, Error::VITE_ERRCODE_ERROR);
// We remove the definition
_EvDefTrId2Id.erase(_EventDefs[_defid]._trid);
_EventDefs[_defid]._fields.clear();
_EventDefs[_defid]._trid = -1;
Error::set(Error::VITE_ERR_EVENT_NOT_CORRECT
+ PajeDef::print_string(&_FieldNames, &_EventDefs[_defid]),
line->_id, Error::VITE_ERRCODE_ERROR);
// We remove the definition
_EvDefTrId2Id.erase(_EventDefs[_defid]._trid);
_EventDefs[_defid]._fields.clear();
_EventDefs[_defid]._trid = -1;
return;
}
......@@ -314,36 +319,36 @@ void ParserDefinitionPaje::add_field_to_definition(const PajeLine_t *line){
// Type unknown
if ( idtype == 0 ) {
Error::set(Error::VITE_ERR_FIELD_TYPE_UNKNOWN + fieldtype, line->_id, Error::VITE_ERRCODE_ERROR);
return;
Error::set(Error::VITE_ERR_FIELD_TYPE_UNKNOWN + fieldtype, line->_id, Error::VITE_ERRCODE_ERROR);
return;
}
// Name unknown, we have to store it
if ( _FNameStr2Id.find(fieldname) == _FNameStr2Id.end() ) {
int size = strlen(fieldname)+1;
char *newfn = new char[size];
int size = strlen(fieldname)+1;
char *newfn = new char[size];
#ifndef WIN32
strcpy(newfn, fieldname);
strcpy(newfn, fieldname);
#else
strcpy_s(newfn, size, fieldname);
strcpy_s(newfn, size, fieldname);
#endif
_FieldNames[_nbFieldNames]._name = newfn;
_FieldNames[_nbFieldNames]._id = _nbFieldNames;
_FieldNames[_nbFieldNames]._code = (1 << _nbFieldNames);
_FieldNames[_nbFieldNames]._allowed = idtype;
idname = _nbFieldNames;
_nbFieldNames++;
_FieldNames[_nbFieldNames]._name = newfn;
_FieldNames[_nbFieldNames]._id = _nbFieldNames;
_FieldNames[_nbFieldNames]._code = (1 << _nbFieldNames);
_FieldNames[_nbFieldNames]._allowed = idtype;
idname = _nbFieldNames;
_nbFieldNames++;
} else {
idname =_FNameStr2Id[fieldname];
idname =_FNameStr2Id[fieldname];
}
// check if type is allowed
if ( !( idtype & _FieldNames[idname]._allowed ) ) {
Error::set(Error::VITE_ERR_FIELD_NOT_ALLOWED + "(" + fieldname + "," + fieldtype + ")", line->_id, Error::VITE_ERRCODE_ERROR);
return;
Error::set(Error::VITE_ERR_FIELD_NOT_ALLOWED + "(" + fieldname + "," + fieldtype + ")", line->_id, Error::VITE_ERRCODE_ERROR);
return;
}
// Extra tokens are not supported
if(line->_nbtks > 3){
Error::set(Error::VITE_ERR_EXTRA_TOKEN, line->_id, Error::VITE_ERRCODE_WARNING);
......@@ -359,10 +364,10 @@ void ParserDefinitionPaje::add_field_to_definition(const PajeLine_t *line){
void ParserDefinitionPaje::store_definition(const PajeLine_t *line){
string token = line->_tokens[1];
// We need almost two tokens '%' and "[End]EventDef"
if(line->_nbtks < 2){
Error::set(Error::VITE_ERR_EMPTY_DEF, line->_id, Error::VITE_ERRCODE_WARNING);
Error::set(Error::VITE_ERR_EMPTY_DEF, line->_id, Error::VITE_ERRCODE_WARNING);
return;
}
......@@ -375,20 +380,20 @@ void ParserDefinitionPaje::store_definition(const PajeLine_t *line){
leave_definition(line);
if(line->_nbtks > 2){
Error::set(Error::VITE_ERR_EXTRA_TOKEN, line->_id, Error::VITE_ERRCODE_WARNING);
}
}
}
// Add a field to the definition
else{
add_field_to_definition(line);
}
}
PajeDefinition *ParserDefinitionPaje::getDefFromTrid(int trid) {
if ( _EvDefTrId2Id.find(trid) == _EvDefTrId2Id.end() ) {
return NULL;
return NULL;
} else {
return &(_EventDefs[_EvDefTrId2Id[trid]]);
return &(_EventDefs[_EvDefTrId2Id[trid]]);
}
}
......@@ -399,8 +404,8 @@ void ParserDefinitionPaje::print_definitions() {
for (; it != it_end ; ++ it){
cout << "###### " << (*it).first << endl;
// (*it).second represents the current definition
PajeDef::print(&_FieldNames, &_EventDefs[(*it).second]);
// (*it).second represents the current definition
PajeDef::print(&_FieldNames, &_EventDefs[(*it).second]);
}
}
......@@ -411,5 +416,3 @@ int ParserDefinitionPaje::definitions_number() const {
const vector<PajeFieldName> *ParserDefinitionPaje::get_FieldNames() const {
return &_FieldNames;
}
......@@ -6,13 +6,13 @@
** 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,
......@@ -23,7 +23,7 @@
** 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.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/*!
......@@ -50,21 +50,21 @@
struct PajeDefinition;
struct PajeFieldName;