Commit 3f975943 authored by Arthur Redondy's avatar Arthur Redondy

rectification de src.pro pour que ca compile merci clement et debut d'ajout de...

rectification de src.pro pour que ca compile merci clement et debut d'ajout de messages d'erreurs pour TokenSource
parent 2edd78f7
......@@ -11,7 +11,6 @@
#include <iostream>
#include <fstream>
#include "../message/message_ns.hpp"
#include "../interface/interface_graphic.hpp"
/*! \class Error
* \brief Define errors and warnings used in the parser.
......
#include "TokenSource.hpp"
using namespace std;
using namespace message_ns;
TokenSource::TokenSource(){
//no file are opened
......@@ -18,7 +19,7 @@ TokenSource::~TokenSource(){
_file.close();
#else
if (munmap(_buffer, _filesize) == -1){
perror("error : munmap");
message << "munmap error" << endw;
}
close(_fd);
#endif
......@@ -34,24 +35,24 @@ void TokenSource::open(const char *filename){
fill_buffer();
#else
if ((_fd = ::open(filename, O_RDONLY)) == -1){
perror("error : open file");
message << "open file error" << ende;
exit(-1);
}
struct stat buf;
if(fstat(_fd, &buf) == -1){
perror("error status file");
message << "status file error" << ende;
exit(-1);
}
_filesize = buf.st_size;
if(_filesize == 0){
perror("empty file");
message << "empty file" << endw;
}
if ((_buffer = (char *)mmap(0, _filesize, PROT_READ, MAP_PRIVATE, _fd, 0)) == MAP_FAILED){
perror("error mmap");
message << "mmap error" << ende;
exit(-1);
}
#endif
......@@ -95,14 +96,14 @@ void TokenSource::build_composite_token(){
#ifdef WIN32
if (_cursor == _buffer_size){
if (!fill_buffer()){
cout << "found \" at end of file" << endl;
message << "found \" at end of file" << endw;
return;
}
_cursor = 0;
}
#else
if (ensure_capacity()){
cout << "error :found \" at end of file" << endl;
message << "found \" at end of file" << endw;
return;
}
#endif
......
......@@ -4,6 +4,8 @@
#include <string>
#include <iostream>
#include "../message/message_ns.hpp"
#ifdef WIN32 // They do not have mmap
#define BUFFER_SIZE 2048
#define WORD_SIZE 64
......
......@@ -37,7 +37,6 @@ message/endwarning.hpp \
trace/ContainerType.hpp \
trace/DrawTrace.hpp \
trace/Entity.hpp \
trace/EntityList.hpp \
trace/EntityType.hpp \
trace/EntityValue.hpp \
trace/Event.hpp \
......@@ -80,7 +79,6 @@ SOURCES += message/enderror.cpp \
trace/Container.cpp \
trace/ContainerType.cpp \
trace/Entity.cpp \
trace/EntityList.cpp \
trace/EntityType.cpp \
trace/EntityValue.cpp \
trace/Event.cpp \
......
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