#ifndef __NASAL_ERR_H__ #define __NASAL_ERR_H__ #include #include #include class file_line { protected: std::string file; std::vector res; public: void load(const std::string& f) { if(file==f) // don't need to load a loaded file return; file=f; res.clear(); std::ifstream fin(f,std::ios::binary); if(fin.fail()) { std::cerr<<"[src] cannot open file <"<\n"; std::exit(1); } std::string line; while(!fin.eof()) { std::getline(fin,line); res.push_back(line); } } void clear() { std::vector tmp; res.swap(tmp); } const std::string& operator[](const uint32_t line){return res[line];} const std::string& name(){return file;} size_t size(){return res.size();} }; class nasal_err:public file_line { private: uint32_t error; public: nasal_err():error(0){} void err(const char* stage,const std::string& info) { ++error; std::cerr<<"["<