From 052f803eac01ccc89707aefacedfc4a1bc5878d8 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Fri, 28 May 2021 16:10:16 +0200 Subject: [PATCH] renamed [ezc out ...] statement to [ezc frame ...], similar [out ...] to [frame ...] --- src/generator.h | 78 +++++++++++++++++++++---------------------- src/patternparser.cpp | 8 ++--- src/patternparser.h | 2 +- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/generator.h b/src/generator.h index a3ae991..9b49ed8 100644 --- a/src/generator.h +++ b/src/generator.h @@ -154,8 +154,8 @@ private: Vars * pvars; // pointer to the output streams map (can be null) - // output stream will be created when [ezc out "stream_name"] statement is found - OutStreams * output_stream_map; + // output stream will be created when [ezc frame "stream_name"] statement is found + OutStreams * output_frames_streams; // temporary error messages std::wstring temp_msg; @@ -168,8 +168,8 @@ private: bool trim_white; bool skip_new_line; - size_t ezc_out_stack_index; - size_t ezc_out_stack_size; + size_t ezc_frames_stack_index; + size_t ezc_frames_stack_size; size_t stack_index; size_t stack_size; @@ -179,7 +179,7 @@ private: // we have to use a pointers table because standard streams such // as std::wostringstream are not copyable std::vector filter_tab; - std::vector ezc_out_stack_tab; + std::vector ezc_frame_stack_tab; const StreamType empty_stream; // temporary streams used in [if..] [for...] or [def ...] @@ -219,13 +219,13 @@ private: void ResizeFilterTab(); void ResizeStack(); void ResizeBlockStack(); - void ResizeEzcOutStack(); + void ResizeEzcFrameStack(); void ClearStreamStack(std::vector & stream_tab); void ClearFilterTab(); void ClearForStack(); void ClearBlockStack(); - void ClearEzcOutTab(); + void ClearEzcFrameTab(); void ClearStream(StreamType & str); void RemoveStackFunData(Stack & sitem); @@ -335,7 +335,7 @@ private: void MakeTextEzc(Item & item); void MakeTextReturn(Item & item); void MakeText(Item & item); - void MakeEzcOut(Item & item); + void MakeEzcFrame(Item & item); void Generate(); @@ -366,7 +366,7 @@ Generator::Generator() : empty_stream() is_generator_working = false; stack_size = 300; block_stack_size = 64; - ezc_out_stack_size = 16; + ezc_frames_stack_size = 16; can_find_in_cache = true; can_use_vars = true; expression_parser = nullptr; @@ -403,7 +403,7 @@ Generator & Generator::operator=(const Generator & Generator::operator=(const Generator::~Generator() ClearFilterTab(); ClearForStack(); ClearBlockStack(); - ClearEzcOutTab(); + ClearEzcFrameTab(); } @@ -584,9 +584,9 @@ void Generator::ResizeFilterTab() template -void Generator::ResizeEzcOutStack() +void Generator::ResizeEzcFrameStack() { - ResizeStreamStack(ezc_out_stack_tab, ezc_out_stack_size); + ResizeStreamStack(ezc_frame_stack_tab, ezc_frames_stack_size); } @@ -635,9 +635,9 @@ void Generator::ClearFilterTab() template -void Generator::ClearEzcOutTab() +void Generator::ClearEzcFrameTab() { - ClearStreamStack(ezc_out_stack_tab); + ClearStreamStack(ezc_frame_stack_tab); } @@ -765,7 +765,7 @@ void Generator::Generate() ResizeFilterTab(); ResizeStack(); ResizeBlockStack(); - ResizeEzcOutStack(); + ResizeEzcFrameStack(); filter_index = 0; stack_index = 0; block_stack_index = 0; @@ -793,7 +793,7 @@ template void Generator::Generate(StreamType & out) { output_stream = &out; - output_stream_map = 0; + output_frames_streams = 0; Generate(); } @@ -803,7 +803,7 @@ template void Generator::Generate(StreamType & out, OutStreams & out_streams) { output_stream = &out; - output_stream_map = &out_streams; + output_frames_streams = &out_streams; Generate(); } @@ -812,7 +812,7 @@ template void Generator::Generate(OutStreams & out_streams) { output_stream = 0; - output_stream_map = &out_streams; + output_frames_streams = &out_streams; Generate(); } @@ -1380,7 +1380,7 @@ return res; template void Generator::CopyTmpStreamToOutputStreams(Item::Function & fun, StreamType & ezc_out_tmp_stream, StreamType & previous_stream) { - if( output_stream_map ) + if( output_frames_streams ) { #ifdef EZC_HAS_SPECIAL_STREAM const std::wstring & str = ezc_out_tmp_stream.Str(); @@ -1395,15 +1395,15 @@ void Generator::CopyTmpStreamToOutputStreams(Item::Function & fun, S for(size_t s=0 ; s < fun.parameters.size() ; ++s) { std::wstring & name = fun.parameters[s]->name; - auto imap = output_stream_map->streams_map.find(name); + auto imap = output_frames_streams->streams_map.find(name); - if( imap == output_stream_map->streams_map.end() ) + if( imap == output_frames_streams->streams_map.end() ) { - if( output_stream_map->streams_map.size() < output_stream_map->streams_tab.size() ) + if( output_frames_streams->streams_map.size() < output_frames_streams->streams_tab.size() ) { /* a new stream from the pool (output_stream_tab) is taken */ - StreamType * stream = output_stream_map->streams_tab[ output_stream_map->streams_map.size() ]; - output_stream_map->streams_map.insert(std::make_pair(name, stream)); + StreamType * stream = output_frames_streams->streams_tab[ output_frames_streams->streams_map.size() ]; + output_frames_streams->streams_map.insert(std::make_pair(name, stream)); ClearStream(*stream); stream->write(str.c_str(), str.size()); } @@ -1839,37 +1839,37 @@ void Generator::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 frame] there is no need for the stack now 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 - and then nested [ezc out] statements can product a better output + and then nested [ezc frame] statements can product a better output */ template -void Generator::MakeEzcOut(Item & item) +void Generator::MakeEzcFrame(Item & item) { std::vector output_stream_names; StreamType * old_stream; bool stream_added = true; - if( ezc_out_stack_index >= ezc_out_stack_tab.size() ) + if( ezc_frames_stack_index >= ezc_frame_stack_tab.size() ) { - CreateMsg(L"Generator exceeded allowed number of [ezc out] statements"); + CreateMsg(L"Generator exceeded allowed number of [ezc frame] statements"); return; } /* - if we encounter the first ezc_out statement without arguments e.g. [ezc out] or just [out] + if we encounter the first ezc frame statement without arguments e.g. [ezc frame] or just [frame] then we can simply ignore it */ - if( item.function.parameters.empty() && ezc_out_stack_index == 0 ) + if( item.function.parameters.empty() && ezc_frames_stack_index == 0 ) stream_added = false; if( stream_added ) { old_stream = output_stream; - output_stream = ezc_out_stack_tab[ezc_out_stack_index]; + output_stream = ezc_frame_stack_tab[ezc_frames_stack_index]; ClearStream(*output_stream); - ezc_out_stack_index += 1; + ezc_frames_stack_index += 1; } if( !item.item_tab.empty() ) @@ -1880,7 +1880,7 @@ bool stream_added = true; CopyTmpStreamToOutputStreams(item.function, *output_stream, *old_stream); ClearStream(*output_stream); output_stream = old_stream; - ezc_out_stack_index -= 1; + ezc_frames_stack_index -= 1; } } @@ -1889,8 +1889,8 @@ bool stream_added = true; template void Generator::MakeTextEzc(Item & item) { - if( item.function.name == L"out" ) - MakeEzcOut(item); + if( item.function.name == L"frame" ) + MakeEzcFrame(item); // in the future we can use more builtin functions } diff --git a/src/patternparser.cpp b/src/patternparser.cpp index 9d541d8..cab0b0d 100644 --- a/src/patternparser.cpp +++ b/src/patternparser.cpp @@ -878,15 +878,15 @@ void PatternParser::ReadDirectiveEzc(Item & item) /* - [out] is a shorthand for [ezc out] + [frame] is a shorthand for [ezc frame] */ -void PatternParser::ReadDirectiveOut(Item & item) +void PatternParser::ReadDirectiveFrame(Item & item) { item.type = Item::item_ezc; item.has_function = true; item.function.Clear(); - item.function.name = L"out"; + item.function.name = L"frame"; item.function.is_function = true; if( !ReadParams(item.function) ) @@ -944,7 +944,7 @@ std::wstring name; else if( name == L"let?" ) ReadDirectiveLetIfNotSet(item); else if( name == L"filter" ) ReadDirectiveFilter(item); else if( name == L"ezc" ) ReadDirectiveEzc(item); - else if( name == L"out" ) ReadDirectiveOut(item); + else if( name == L"frame" ) ReadDirectiveFrame(item); else if( name == L"block" ) ReadDirectiveBlock(item); else if( name == L"return" ) ReadDirectiveReturn(item); else if( name == L"#" ) ReadDirectiveComment(item); diff --git a/src/patternparser.h b/src/patternparser.h index 6a9cd9d..037d357 100644 --- a/src/patternparser.h +++ b/src/patternparser.h @@ -180,7 +180,7 @@ private: void ReadDirectiveLetIfNotSet(Item & item); void ReadDirectiveFilter(Item & item); void ReadDirectiveEzc(Item & item); - void ReadDirectiveOut(Item & item); + void ReadDirectiveFrame(Item & item); void ReadDirectiveBlock(Item & item); void ReadDirectiveReturn(Item & item); void ReadNormalStatement(Item & item);