changed: SetCommentary() methods from Pattern were moved to PatternParser and Generator

added:   caching functions and blocks
         caching is added into Pattern and Blocks
         methods: CacheFunctions() and CacheBlocks()
		 




git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@975 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-10-19 05:42:25 +00:00
parent ad2fb11a5c
commit 2fca5f3492
12 changed files with 366 additions and 132 deletions

View File

@@ -121,6 +121,55 @@ void PatternParser::SetBlocks(Blocks & blocks)
}
void PatternParser::SetCommentary(const char * com_start, const char * com_stop)
{
PT::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(com_stop, commentary_stop);
}
void PatternParser::SetCommentary(const std::string & com_start, const std::string & com_stop)
{
PT::UTF8ToWide(com_start, commentary_start);
PT::UTF8ToWide(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::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);
@@ -284,7 +333,7 @@ void PatternParser::ReadFile(const wchar_t * name, std::wstring & result)
{
if( !IsFileCorrect(name) )
{
pat->CreateMsg(result, L"incorrect file name: ", name);
CreateMsg(result, L"incorrect file name: ", name);
}
else
{
@@ -292,7 +341,7 @@ void PatternParser::ReadFile(const wchar_t * name, std::wstring & result)
if( !ReadFileFromDir(directory, name, result) )
if( !ReadFileFromDir(directory2, name, result) )
pat->CreateMsg(result, L"can't open: ", name);
CreateMsg(result, L"can't open: ", name);
}
}