diff --git a/COPYRIGHT b/COPYRIGHT index 99a378c..4a3b713 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -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 diff --git a/src/item.cpp b/src/item.cpp index 34883f5..4c4ffc6 100755 --- a/src/item.cpp +++ b/src/item.cpp @@ -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(); diff --git a/src/item.h b/src/item.h index 18d7f4a..ebca37f 100755 --- a/src/item.h +++ b/src/item.h @@ -157,6 +157,10 @@ template void Item::CacheFunctions(Functions & 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 & 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 diff --git a/src/pattern.cpp b/src/pattern.cpp index cdd22ab..5d320d0 100755 --- a/src/pattern.cpp +++ b/src/pattern.cpp @@ -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(); +} diff --git a/src/pattern.h b/src/pattern.h index be4583d..4dd63b4 100755 --- a/src/pattern.h +++ b/src/pattern.h @@ -55,13 +55,6 @@ public: Pattern(); void Clear(); - void ClearCache(); - - template - void CacheFunctions(Functions & 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 + void CacheFunctions(Functions & 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 +void Pattern::CacheFunctions(Functions & fun) +{ + item_root.CacheFunctions(fun); +}