Generator uses now pt::Log as a logger
- added method SetLogger(pt::Log & logger) - removed SetCommentary(...) methods - added logs when a model is not found PatternParser uses only pt::Log - removed SetCommentary(...) methods
This commit is contained in:
@@ -124,37 +124,6 @@ void PatternParser::SetBlocks(Blocks & blocks)
|
||||
}
|
||||
|
||||
|
||||
void PatternParser::SetCommentary(const char * com_start, const char * com_stop)
|
||||
{
|
||||
pt::utf8_to_wide(com_start, commentary_start);
|
||||
pt::utf8_to_wide(com_stop, commentary_stop);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PatternParser::SetCommentary(const std::string & com_start, const std::string & com_stop)
|
||||
{
|
||||
pt::utf8_to_wide(com_start, commentary_start);
|
||||
pt::utf8_to_wide(com_stop, commentary_stop);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PatternParser::SetCommentary(const wchar_t * com_start, const wchar_t * com_stop)
|
||||
{
|
||||
commentary_start = com_start;
|
||||
commentary_stop = com_stop;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PatternParser::SetCommentary(const std::wstring & com_start, const std::wstring & com_stop)
|
||||
{
|
||||
commentary_start = com_start;
|
||||
commentary_stop = com_stop;
|
||||
}
|
||||
|
||||
|
||||
void PatternParser::SetProgramMode(bool program_mode)
|
||||
{
|
||||
this->program_mode = program_mode;
|
||||
@@ -167,23 +136,6 @@ void PatternParser::SetLogger(pt::Log * log)
|
||||
}
|
||||
|
||||
|
||||
void PatternParser::CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg)
|
||||
{
|
||||
out = commentary_start;
|
||||
out += L"Ezc: ";
|
||||
out += type;
|
||||
|
||||
if( arg )
|
||||
{
|
||||
out += ' ';
|
||||
out += arg;
|
||||
}
|
||||
|
||||
out += commentary_stop;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PatternParser::ParseFile(const std::string & file_name, Pattern & pattern)
|
||||
{
|
||||
ParseFile(file_name.c_str(), pattern);
|
||||
@@ -350,15 +302,25 @@ void PatternParser::ReadFile(const wchar_t * name, std::wstring & result)
|
||||
{
|
||||
if( !IsFileCorrect(name) )
|
||||
{
|
||||
CreateMsg(result, L"incorrect file name: ", name);
|
||||
if( log )
|
||||
{
|
||||
(*log) << pt::Log::log2 << "Ezc: incorrect file name: " << name << pt::Log::logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.clear();
|
||||
|
||||
if( !ReadFileFromDir(directory, name, result) )
|
||||
{
|
||||
if( !ReadFileFromDir(directory2, name, result) )
|
||||
CreateMsg(result, L"can't open: ", name);
|
||||
{
|
||||
if( log )
|
||||
{
|
||||
(*log) << pt::Log::log2 << "Ezc: can't open file: " << name << pt::Log::logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,7 +1123,7 @@ void PatternParser::CreateTreeReadIncludeSkipAllowFlag(Item & item)
|
||||
{
|
||||
if( log )
|
||||
{
|
||||
(*log) << pt::Log::log1 << "Ezc: \"include\" directive has reached the maximum level" << pt::Log::logend;
|
||||
(*log) << pt::Log::log2 << "Ezc: \"include\" directive has reached the maximum level" << pt::Log::logend;
|
||||
}
|
||||
|
||||
return;
|
||||
|
Reference in New Issue
Block a user