Commit Graph

32 Commits

Author SHA1 Message Date
Tomasz Sowa 542e50d757 added filters:
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
2011-01-26 12:42:49 +00:00
Tomasz Sowa 3c85fa1a75 fixed: the exception for if-index in pattern (when caching is used)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@332 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-23 14:16:49 +00:00
Tomasz Sowa fd2194623a changed: now [for] statements with the same function can be nested
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
2011-01-14 23:59:30 +00:00
Tomasz Sowa c4f5f79218 fixed: Item::Item(const Item & i) should clear the item table
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@330 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-12-06 00:22:38 +00:00
Tomasz Sowa 0b09b5454f added: Pattern::CacheFunctions(Functions<StreamType> & fun)
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
2010-11-25 22:39:58 +00:00
Tomasz Sowa 5108495540 changed in Generator<>:
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
2010-11-25 01:55:32 +00:00
Tomasz Sowa 33c86d494b fixed: performance (memcpy used too often)
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
2010-11-23 21:59:52 +00:00
Tomasz Sowa 8f94937ed1 added: support for UTF-8 (files utf8.h utf8.cpp)
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
2010-11-22 01:23:32 +00:00
Tomasz Sowa b5ea2514e2 added to Generator:
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
2010-09-07 23:52:41 +00:00
Tomasz Sowa 376fe414f8 small refactoring: changed item_table to item_tab
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@300 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-08-17 23:22:55 +00:00
Tomasz Sowa 7554630395 changed: testing file names
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
2010-08-02 18:47:19 +00:00
Tomasz Sowa 573d241dc1 changed:
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
2010-07-19 23:07:00 +00:00
Tomasz Sowa c807d1c9b3 as a white character can be ascii 160 code (nonbreakable space)
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@297 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-06-30 18:43:33 +00:00
Tomasz Sowa b89c6daa7d added: an optional string parameter to normal statement e.g. [function "parameter"]
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
2010-05-30 21:07:15 +00:00
Tomasz Sowa f65178dd0e fixed: when Pattern::allow_include was false then nothing was read
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
2010-02-15 00:19:31 +00:00
Tomasz Sowa bb00f23f29 changed: limits in generator
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@291 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-02-13 19:55:51 +00:00
Tomasz Sowa 31156d33f3 added: directive [is-no ...] negative to [is ...]
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@290 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-02-11 20:03:51 +00:00
Tomasz Sowa e71c213ad1 added: Pattern::Clear()
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@282 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-01-28 16:14:47 +00:00
Tomasz Sowa b2aacc2da3 changed: [is ...] command
struct Info doesn't have out_string now



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@281 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-01-25 05:19:54 +00:00
Tomasz Sowa dbe91a6d91 added: Patter::delete_all_white flag
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
2009-12-09 00:34:17 +00:00
Tomasz Sowa 9b4586d7be small changes in Makefile
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@241 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-11-13 21:10:06 +00:00
Tomasz Sowa 141e1f67b3 added: Pattern::allow_include flag (default true)
if false there is no allowed [include ...] directive
       (this directive will be skipped)
added: Pattern::ParseString(const std::string & str);
       Pattern::ParseString(const char * str);
       can create the pattern from a string


git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@94 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-01-23 23:18:54 +00:00
Tomasz Sowa f8f55eae77 added: src/Makefile and src/Makefile.dep
the ezc.a library is built now


git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@93 e52654a7-88a9-db11-a3e9-0013d4bc506e
2008-12-30 01:21:30 +00:00
Tomasz Sowa 0b88257e08 added: directive [if-no fun1 fun2 ...]
if fun1 fun2 ... return false
       then the content is evaluated
changed: [if-one fun1 fun2 ...]
       when a function (from left to right) returns true 
       then the content is evaluated
       (previous all functions were called)


git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@91 e52654a7-88a9-db11-a3e9-0013d4bc506e
2008-12-23 20:08:11 +00:00
Tomasz Sowa 0760313ec3 changing version info to: 0.9.1
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@89 e52654a7-88a9-db11-a3e9-0013d4bc506e
2008-12-10 01:59:39 +00:00
Tomasz Sowa 54be9c0489 changed: the interface in this version is not the same as previous
added: class Functions, you can define your own set of functions and then
       put them into the Generator
added: variables
       parser is able to parse the "def" directive:
       [def variable "value"]
       [def variable another_variable]
       [def variable another_function]
       variables are put into a Functions object
added: class Info has a reference to std::ostringstream (out)
added: limit for a "for" directive
       limit for the whole tree (when genereting)
       this is to protect for a case when someone makes an infinite loop
changed: many small changes


git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@88 e52654a7-88a9-db11-a3e9-0013d4bc506e
2008-12-10 01:46:10 +00:00
Tomasz Sowa bf585d3716 moving cgi/ezc into /
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@86 e52654a7-88a9-db11-a3e9-0013d4bc506e
2008-12-10 00:56:56 +00:00
Tomasz Sowa 69bd57f428 added Ezc::SplitUnixDirectory(...)
it's possible to give the path into the working directory in the Pattern::ParseFile(...) without using the Pattern::Directory(...)
added [#] (commentary)
[include] now can open a file only in a specific directory


git-svn-id: svn://ttmath.org/publicrep/cgi/ezc/trunk@9 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-01-27 13:52:18 +00:00
Tomasz Sowa e42117714a completely rewritten
* Ezc is now a namespace
 * added Ezc::Pattern
 * added Ezc::Generator
added [if-one]
fixed a problem with memory lack


git-svn-id: svn://ttmath.org/publicrep/cgi/ezc/trunk@7 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-01-26 19:29:36 +00:00
Tomasz Sowa 043a5f2131 Ezc::ReadFile has gone
Ezc::CreateTree takes a name of an input file
added [for ...]
added [if-index ...]
added [is ....]
added [include...] (not all finished)


git-svn-id: svn://ttmath.org/publicrep/cgi/ezc/trunk@6 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-01-25 21:42:54 +00:00
Tomasz Sowa ac632987f3 added [for]
EzcInfo pushed into Ezc::
added info about a wrong directive


git-svn-id: svn://ttmath.org/publicrep/cgi/ezc/trunk@5 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-01-25 08:25:40 +00:00
Tomasz Sowa 700dcd0571 initial import
git-svn-id: svn://ttmath.org/publicrep/cgi/ezc/trunk@4 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-01-24 20:01:55 +00:00