updated to new pikotools api: namespace PT renamed to pt

This commit is contained in:
Tomasz Sowa 2021-05-20 16:12:41 +02:00
parent d1a15ad153
commit cd1c24d0a5
4 changed files with 29 additions and 29 deletions

View File

@ -88,7 +88,7 @@ private:
template<class StreamType> template<class StreamType>
void Functions<StreamType>::Insert(const char * key, UserFunction ufunction) void Functions<StreamType>::Insert(const char * key, UserFunction ufunction)
{ {
PT::UTF8ToWide(key, temp_key); pt::UTF8ToWide(key, temp_key);
functions_tab[temp_key] = ufunction; functions_tab[temp_key] = ufunction;
temp_key.clear(); temp_key.clear();
} }

View File

@ -429,8 +429,8 @@ Generator<StreamType>::~Generator()
template<class StreamType> template<class StreamType>
void Generator<StreamType>::SetCommentary(const char * com_start, const char * com_stop) void Generator<StreamType>::SetCommentary(const char * com_start, const char * com_stop)
{ {
PT::UTF8ToWide(com_start, commentary_start); pt::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(com_stop, commentary_stop); pt::UTF8ToWide(com_stop, commentary_stop);
} }
@ -438,8 +438,8 @@ void Generator<StreamType>::SetCommentary(const char * com_start, const char * c
template<class StreamType> template<class StreamType>
void Generator<StreamType>::SetCommentary(const std::string & com_start, const std::string & com_stop) void Generator<StreamType>::SetCommentary(const std::string & com_start, const std::string & com_stop)
{ {
PT::UTF8ToWide(com_start, commentary_start); pt::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(com_stop, commentary_stop); pt::UTF8ToWide(com_stop, commentary_stop);
} }
@ -1703,7 +1703,7 @@ void Generator<StreamType>::MakeTextFilter(Item & item)
/* /*
although we are using a stack for [etc out] there is no need for the stack now although we are using a stack for [etc out] there is no need for the stack now
because the output is only a one-level map (not nested structure) because the output is only a one-level map (not nested structure)
but in the future we can use more complicated class like PT::Space but in the future we can use more complicated class like pt::Space
and then nested [ezc out] statements can product a better output and then nested [ezc out] statements can product a better output
*/ */
template<class StreamType> template<class StreamType>

View File

@ -64,17 +64,17 @@ void PatternParser::Directory(const char * dir, const char * dir2)
directory2.clear(); directory2.clear();
if( dir ) if( dir )
PT::UTF8ToWide(dir, directory); pt::UTF8ToWide(dir, directory);
if( dir2 ) if( dir2 )
PT::UTF8ToWide(dir2, directory2); pt::UTF8ToWide(dir2, directory2);
} }
void PatternParser::Directory(const std::string & dir) void PatternParser::Directory(const std::string & dir)
{ {
PT::UTF8ToWide(dir, directory); pt::UTF8ToWide(dir, directory);
directory2.clear(); directory2.clear();
} }
@ -82,8 +82,8 @@ void PatternParser::Directory(const std::string & dir)
void PatternParser::Directory(const std::string & dir, const std::string & dir2) void PatternParser::Directory(const std::string & dir, const std::string & dir2)
{ {
PT::UTF8ToWide(dir, directory); pt::UTF8ToWide(dir, directory);
PT::UTF8ToWide(dir2, directory2); pt::UTF8ToWide(dir2, directory2);
} }
@ -126,16 +126,16 @@ void PatternParser::SetBlocks(Blocks & blocks)
void PatternParser::SetCommentary(const char * com_start, const char * com_stop) void PatternParser::SetCommentary(const char * com_start, const char * com_stop)
{ {
PT::UTF8ToWide(com_start, commentary_start); pt::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(com_stop, commentary_stop); pt::UTF8ToWide(com_stop, commentary_stop);
} }
void PatternParser::SetCommentary(const std::string & com_start, const std::string & com_stop) void PatternParser::SetCommentary(const std::string & com_start, const std::string & com_stop)
{ {
PT::UTF8ToWide(com_start, commentary_start); pt::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(com_stop, commentary_stop); pt::UTF8ToWide(com_stop, commentary_stop);
} }
@ -161,7 +161,7 @@ void PatternParser::SetProgramMode(bool program_mode)
} }
void PatternParser::SetLogger(PT::Log * log) void PatternParser::SetLogger(pt::Log * log)
{ {
this->log = log; this->log = log;
} }
@ -195,7 +195,7 @@ void PatternParser::ParseFile(const std::string & file_name, Pattern & pattern)
void PatternParser::ParseFile(const char * file_name, Pattern & pattern) void PatternParser::ParseFile(const char * file_name, Pattern & pattern)
{ {
pat = &pattern; pat = &pattern;
PT::UTF8ToWide(file_name, pat->item_root.file_name); pt::UTF8ToWide(file_name, pat->item_root.file_name);
include_level = 0; include_level = 0;
CreateTreeReadIncludeSkipAllowFlag(pat->item_root); CreateTreeReadIncludeSkipAllowFlag(pat->item_root);
@ -225,7 +225,7 @@ void PatternParser::ParseFile(const wchar_t * file_name, Pattern & pattern)
void PatternParser::ParseString(const char * str, Pattern & pattern) void PatternParser::ParseString(const char * str, Pattern & pattern)
{ {
PT::UTF8ToWide(str, string_content); pt::UTF8ToWide(str, string_content);
ParseString(string_content.c_str(), pattern); ParseString(string_content.c_str(), pattern);
string_content.clear(); string_content.clear();
} }
@ -372,7 +372,7 @@ bool PatternParser::ReadFileFromDir(const std::wstring & dir, const wchar_t * na
file_name = dir; file_name = dir;
file_name += '/'; file_name += '/';
file_name += name; file_name += name;
PT::WideToUTF8(file_name, afile_name); pt::WideToUTF8(file_name, afile_name);
std::ifstream file(afile_name.c_str()); std::ifstream file(afile_name.c_str());
@ -386,9 +386,9 @@ bool PatternParser::ReadFileFromDir(const std::wstring & dir, const wchar_t * na
if( log ) if( log )
{ {
if( include_level <= 1 ) if( include_level <= 1 )
(*log) << PT::Log::log4 << "Ezc: reading pattern: " << afile_name << PT::Log::logend; (*log) << pt::Log::log4 << "Ezc: reading pattern: " << afile_name << pt::Log::logend;
else else
(*log) << PT::Log::log4 << " including pattern: " << afile_name << PT::Log::logend; (*log) << pt::Log::log4 << " including pattern: " << afile_name << pt::Log::logend;
} }
ReadFile(file, result); ReadFile(file, result);
@ -403,7 +403,7 @@ return true;
void PatternParser::ReadFile(std::ifstream & file, std::wstring & result) void PatternParser::ReadFile(std::ifstream & file, std::wstring & result)
{ {
PT::UTF8ToWide(file, result); pt::UTF8ToWide(file, result);
} }
@ -935,7 +935,7 @@ bool PatternParser::CreateTreeCheckProgramDirective(Item & item)
{ {
const wchar_t * old_itext = itext; const wchar_t * old_itext = itext;
if( PT::is_substr_nc(L"if", itext) ) if( pt::is_substr_nc(L"if", itext) )
{ {
itext += 2; itext += 2;
SkipWhite(); SkipWhite();
@ -948,7 +948,7 @@ bool PatternParser::CreateTreeCheckProgramDirective(Item & item)
} }
} }
if( PT::is_substr_nc(L"while", itext) ) if( pt::is_substr_nc(L"while", itext) )
{ {
itext += 5; itext += 5;
SkipWhite(); SkipWhite();
@ -1042,7 +1042,7 @@ void PatternParser::CreateTreeReadInclude(Item & item)
{ {
if( log ) if( log )
{ {
(*log) << PT::Log::log2 << "Ezc: \"include\" directive is not allowed" << PT::Log::logend; (*log) << pt::Log::log2 << "Ezc: \"include\" directive is not allowed" << pt::Log::logend;
} }
} }
} }
@ -1059,7 +1059,7 @@ void PatternParser::CreateTreeReadIncludeSkipAllowFlag(Item & item)
{ {
if( log ) if( log )
{ {
(*log) << PT::Log::log1 << "Ezc: \"include\" directive has reached the maximum level" << PT::Log::logend; (*log) << pt::Log::log1 << "Ezc: \"include\" directive has reached the maximum level" << pt::Log::logend;
} }
return; return;
@ -1095,7 +1095,7 @@ void PatternParser::CreateTreeReadIf(Item & item)
{ {
SkipWhite(); SkipWhite();
if( PT::is_substr_nc(L"else", itext) ) if( pt::is_substr_nc(L"else", itext) )
{ {
itext += 4; itext += 4;
pitem = item.AddItem(); pitem = item.AddItem();

View File

@ -89,7 +89,7 @@ public:
void SetProgramMode(bool program_mode); void SetProgramMode(bool program_mode);
void SetLogger(PT::Log * log); void SetLogger(pt::Log * log);
private: private:
@ -138,7 +138,7 @@ private:
bool program_mode; bool program_mode;
PT::Log * log; pt::Log * log;
void CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg = 0); void CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg = 0);