fixed: compile error in item.h (in CacheFunctions)

fixed: Pattern::ClearCache() was missing



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@973 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2014-10-17 23:56:30 +00:00
parent 00f8af232b
commit ad2fb11a5c
5 changed files with 31 additions and 19 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2007-2010, Tomasz Sowa
Copyright (c) 2007-2014, Tomasz Sowa
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -164,7 +164,10 @@ Item::~Item()
void Item::ClearCache()
{
for(size_t f = 0; f < functions.size() ; ++f)
functions[f].fun_cache = 0;
{
functions[f].fun_cache = 0;
functions[f].item_block = 0;
}
for(size_t i = 0; i < item_tab.size() ; ++i)
item_tab[i]->ClearCache();

View File

@ -157,6 +157,10 @@ template<class StreamType>
void Item::CacheFunctions(Functions<StreamType> & fun)
{
// one exception (if_index is putting its argument on the functions stack)
/*
* IMPROVE ME
* and now we have [0] [1] too...
*/
if( type != Item::item_ifindex )
{
for(size_t f=0; f < functions.size() ; ++f)
@ -165,13 +169,14 @@ void Item::CacheFunctions(Functions<StreamType> & fun)
if( i != fun.End() )
{
functions[f].fun_cache = i->second;
functions[f].fun_cache = &i->second;
}
else
{
functions[f].fun_cache = 0;
// teraz chyba nie trzeba tego logowac
// bo mamy zmienne i identyfikator moze byc znaleziony w runtime
// !! CHECK ME
// now probably we don't have to log these
// because we've got variables and an identifier can be found at runtime
// #ifdef EZC_USE_WINIX_LOGGER
// Winix::log << Winix::log1 << "Ezc: unknown function: " << item.functions[f].name << Winix::logend;
// #endif

View File

@ -95,8 +95,6 @@ void Pattern::SetCommentary(const std::wstring & com_start, const std::wstring &
void Pattern::CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg)
{
out = commentary_start;
@ -114,7 +112,10 @@ void Pattern::CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t
void Pattern::ClearCache()
{
item_root.ClearCache();
}

View File

@ -55,13 +55,6 @@ public:
Pattern();
void Clear();
void ClearCache();
template<class StreamType>
void CacheFunctions(Functions<StreamType> & fun)
{
CacheFunctions(item_root, fun);
}
void SetCommentary(const char * com_start, const char * com_stop);
void SetCommentary(const std::string & com_start, const std::string & com_stop);
@ -70,22 +63,32 @@ public:
void CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg = 0);
template<class StreamType>
void CacheFunctions(Functions<StreamType> & fun);
void ClearCache();
Item item_root;
private:
/*
* IMRPOVE ME
* they should be moved into PatternParser and Generator
*/
std::wstring commentary_start, commentary_stop;
}; // class Pattern
template<class StreamType>
void Pattern::CacheFunctions(Functions<StreamType> & fun)
{
item_root.CacheFunctions(fun);
}