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
fixed: removed GetStringFromStream() method
it returns a reference to a local object (from stream.str())
now the code is used directly
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@972 e52654a7-88a9-db11-a3e9-0013d4bc506e
* This file is a part of EZC -- Easy templating in C++ library
* and is distributed under the BSD 3-Clause licence.
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@971 e52654a7-88a9-db11-a3e9-0013d4bc506e
changed: in Functions
Functions are only for user-defined functions now
(before they could remember a string variable too)
added: class Vars for variables
a variable can be a string or an alias to an other function or block
added: now we can have nested functions calls e.g.:
[function1 [function2]]
in the above example an output (stream) from function2 will be passed
as the first argument to funcion1 (will be passed as a string)
removed: UTF8() method from PatternParser
now it is treated that when we have only std::string (or char*)
that this is an UTF-8 string
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@970 e52654a7-88a9-db11-a3e9-0013d4bc506e
in Pattern we have only the tree
in PatternParser there is the whole logic used to parse a file
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@969 e52654a7-88a9-db11-a3e9-0013d4bc506e
Generate() methods can take std::vector with pointers to streams
added: 'ezc' keyword -- currently only for selecting streams
e.g.
[ezc stream "0" "3"] - after now the output is generated to streams 0 and 3
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@445 e52654a7-88a9-db11-a3e9-0013d4bc506e
[if-index] statement has to look for a last [for] statement on the stack
(because the stack is for all items now)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@394 e52654a7-88a9-db11-a3e9-0013d4bc506e
now we have a stack item for all statements [if...] [normal_fun] etc.
previously was only for [for ...] statements
changed: FunInfo<> has a pointer to the current stack item
changed: now we have a static number of stack items (default: 300)
so you can remember a pointer to a stack item and this pointer
is always valid
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@393 e52654a7-88a9-db11-a3e9-0013d4bc506e
bool remove_fun_data
fun_data is removed only when remove_fun_data is true (default)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@392 e52654a7-88a9-db11-a3e9-0013d4bc506e
now we have a pointer to FunData struct
by default the pointer is null
you can create an object of a class derived from FunData
an set the pointer to the object
those pointers will be kept on the [for] stack
and will be auto removed
(not finished yet -- need some testing)
added: to FunInfo<>::
bool is_if;
bool is_is;
bool is_normal;
bool is_filter;
removed: from FunInfo<>:
bool is_for_first_iter;
changed: in FunInfo<>:
int iter -> size_t iter
now it indicates the number of a current iteration for the [for] statement
for other statements than [for] this is always zero
(the same old behaviour as before revision 331)
added: in FunInfo<>:
size_t last_iter
it indicates the number of a previous [for] iteration
for a [for] it returns not the current iterator but a value from a previous [for]
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@391 e52654a7-88a9-db11-a3e9-0013d4bc506e
// indicates that this function is from [for ...] statement
bool is_for;
// indicates that this function is from [for ...] statement
// and this is a first iteration (iter=0 too)
// this is only for convenience -- you don't have to check is_for and iter==0
bool is_for_first_iter;
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@380 e52654a7-88a9-db11-a3e9-0013d4bc506e
previously they used FunInfo::res, now they use FunInfo::out
and the out string is not put to the main output stream
added: FunInfo<>::case_sensitive (default true)
when false then [is] statement is comparing in case insensitive manner
changed: the out stream in [if...] [for] statements
the output text is ingored now
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@344 e52654a7-88a9-db11-a3e9-0013d4bc506e
a new statement [filter]
syntax:
[filter funcion_name]....[end]
everything which is between [filter] and [end] is processed normally and
at the end it is passed to the function (function_name)
FunInfo struct has 'in' input stream now
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@333 e52654a7-88a9-db11-a3e9-0013d4bc506e
sample:
[for my_function]
[for my_function]
foo
[end]
[end]
changed: FunInfo::iter has a value from the last [for] statement now
sample:
[for my_function]
[other_function]
[end]
void other_function(Info &i)
{
// here i.iter is the number of iteration
// previously was always zero
}
changed: small optimization in [for]
the proper function is being looking for only once at the beginning
previously it was searched in each iteration
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@331 e52654a7-88a9-db11-a3e9-0013d4bc506e
you can cache all functions (their addresses) in the pattern
changed: now we have two methods for generating content:
Generator<>::Generate(StreamType & o, Pattern & p, Functions<StreamType> & f);
similar like previous -- Set(...) methods were removed as well as the second ctor
and a second one:
Generate(StreamType & o, Pattern & p);
without functions, the functions should be cached beforehand in the pattern
by calling CacheFunctions() method on the pattern
this gives O(1) complexity when looking for a specific function
previously was O(log n)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@329 e52654a7-88a9-db11-a3e9-0013d4bc506e
StreamType
we use method write where the content should not be escaped (html escaping)
we use operator<< where the content can be escaped (such as error messages)
PrintSpecialText() and PrintNormalText() are a little faster now
we use 'write' for a whole text instead of printing each character
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@328 e52654a7-88a9-db11-a3e9-0013d4bc506e
in some places there were reserve() method used (on std::wstring/std::string objects)
especially in AssignString() methods
if we add a new string we should check the new size
and only call reserve() if the new size will be greater than existing one
(plus some constant)
added: Functions<>::Size() method
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@327 e52654a7-88a9-db11-a3e9-0013d4bc506e
they can be even used without the rest library
as only a library for converting between wide characters and UTF-8
changed: everywhere we use std::wstring instead of std::string
changed: Generator and Functions are templates now
they take a stream type
renamed: Info to FunInfo and it is a template too
taking a stream type
now you can use other kind of streams with the library
previous was only std::ostringstream
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@326 e52654a7-88a9-db11-a3e9-0013d4bc506e
void RecognizeSpecialChars(bool spec);
recognizing some special characters in text patterns (item_text in Patterns)
\r will be a carriage return (13)
\n will be a new line (10)
\t will be a tabulator (9)
\s will be a space
\\ will be one '\'
default: false
void TrimWhite(bool trim);
trimming white characters (at the beginning and at the end of an item_text)
(special char \s if enabled is not treated as a white character here)
default: false
void SkipNewLine(bool skip);
skipping new line characters (from the whole string in an item_text)
but you can use a new line character written as "\n" (if special chars are turn on)
default: false
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@305 e52654a7-88a9-db11-a3e9-0013d4bc506e
now it is allowed to use a slash (we can use directories)
only ".." is not allowed (you cannot go up in a directory structure)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@299 e52654a7-88a9-db11-a3e9-0013d4bc506e
functions can have more than one parameter and the parameters can be used in [if...] statements too
sample:
[normal_function "par1" "par2" "par3"]
[if-one function "par1" "par2" "par3"]...[end]
each function can have its own parameters:
[if-one function1 "par1" "par2" "par3" function2 "par" "par2"]...[end]
changed:
[is] is now [if] (not exactly but very similar)
[is-no] is now [if-no] (the same)
[if] and [if-no] are taking one function (with or without arguments)
sample:
[if function]...[end]
[if function "par1"]...[end]
[if function "par1" "par2" "par3" "par4"]...[end]
[is] is taking two functions now and evaluates them to boolean value
(variables are also evaluated to boolean - if not empty that means true)
[is function1 function2]...[end]
[is variable1 variable2] either variable1 and variable2 are empty or both are not empty
(they don't have to be equal)[end]
added:
[if-any-no fun1 fun2 fun3] the three functions have to return false [end]
[if-one-no fun1 fun2 fun3] one the the three functions have to return false [end]
removed:
extracting the unix directory from the file name (in patterns)
you have to call Pattern::Directory() method first to set directories
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@298 e52654a7-88a9-db11-a3e9-0013d4bc506e
parameters to "for" statement [for function "parameter"]
changed: in Info struct there is a "par" std::string reference now
changed: Info::result to Info::res
removed: Info::is
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@295 e52654a7-88a9-db11-a3e9-0013d4bc506e
added: ezc can use the logger from winix
added: we check how many [include] directive was called
(if more than 100 then we break - supposing infinite loop)
added: in Pattern we read from two directories
if a file is not in the first directory then we try to read
from the other one
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@292 e52654a7-88a9-db11-a3e9-0013d4bc506e
if true all text-items which have only white characters (with new lines as well)
will be deleted
this not actually delete the whole item but only the string
the item will be present with an empty string
default: false
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@260 e52654a7-88a9-db11-a3e9-0013d4bc506e