Commit Graph

74 Commits

Author SHA1 Message Date
345e1870e3 WIP: add a Val struct as an input/output when calling a function 2024-12-13 15:47:54 +01:00
6f75664400 WIP: add a Val struct as an input/output when calling a function 2024-12-12 17:57:24 +01:00
0ac4df97e9 WIP: add a Val struct as an input/output when calling a function 2024-12-11 17:29:32 +01:00
6e2fe34a5c WIP: add a Val struct as an input/output when calling a function 2024-12-11 17:04:05 +01:00
079a62c230 WIP: add a Val struct as an input/output when calling a function 2024-12-09 16:36:53 +01:00
5d5d5bcdde rename the FunInfo struct to Env 2024-12-06 12:20:55 +01:00
e39311c290 WIP: use pt::Stream instead of a template argument 2024-12-05 17:48:06 +01:00
0de5623182 make some more optimizations when generating the output 2024-07-08 00:34:52 +02:00
6def06c647 make some optimization when generating the output
Add three methods to the Generator:
- void OnlyFrames(const std::vector<std::wstring> & frames);
- void OnlyFrames(const std::vector<std::wstring> * frames);
if provided frames then only such frames will be generated,
call OnlyFrames(nullptr) to disable it (default)

- void UseMainStream(bool use_main_stream);
whether or not the main stream should be produced (true by default)
2024-07-07 21:55:49 +02:00
5814bfca0d fix: correctly initialize FunInfo<> object when calling a model field 2023-02-22 00:38:36 +01:00
369cefacdf fix: do not evaluate content in [for] statement if the function was not found 2022-08-01 15:20:02 +02:00
d023abce74 fix: set the last boolean result when evaluating a space structure 2022-07-29 03:24:19 +02:00
08da4a56b8 change licence from 3-Clause BSD to 2-Clause BSD 2022-07-03 08:54:36 +02:00
d8692f6ed5 added options: "index" and "index-one" for space tables e.g. [table_name "index-one"] 2021-09-23 14:03:26 +02:00
b047a10e8d added: "this" virtual field for a table - only if the next field is not an object
e.g.:
       [for space_object]
       	    [space_object.this] instead of [space_object "current"]
       [end]
       "this" can be nested, e.g. if we have two nested tables:
       [for space_object]
          [for space_object.this]
             [space_object.this.this]
          [end]
       [end]

removed: "current" parameter for tables
2021-09-23 04:02:34 +02:00
a983698e3d Generator: some methods take std::vector<Var> parameters not through a reference 2021-08-17 17:33:51 +02:00
6a8cb019f5 added parameters "only_date" and "only_time" when printing a pt::Date 2021-08-14 19:40:05 +02:00
b0afdf7f0f check block arguments e.g. [1] at the beginning - before all other lookups 2021-08-14 17:44:11 +02:00
5e47313af8 fixed: when incrementing space tables iterators in [for] statements we should invalidate indices for nested tables 2021-08-13 21:44:07 +02:00
44407c2a4b changed: added two new parameters to Generator class: template<class StreamType, bool is_pikotools_stream = false, bool is_autoescape_stream = false> class Generator
changed: added one new parameter to Outstreams class: template<class StreamType, bool is_pikotools_stream = false> class OutStreams
removed macros: EZC_GENERATOR_HAS_PT_STREAM, EZC_GENERATOR_HAS_WINIX_STREAM
2021-07-12 23:00:11 +02:00
ae6a5c52a1 fixed in Generator: ezc_frames_stack_index was not initialized 2021-07-06 23:56:29 +02:00
b9b9a881e0 added "roman" and "no_sec" parameters when serializing a date 2021-07-06 21:47:42 +02:00
995cccdace add two new ezc statements: [if-def ...] and [if-not-def ...]
[if-def my_function] returns true if my_function is defined somewhere (either a model, model container, space, date, block, function or variable)
add support for "noescape" or "raw" parameters to Space fields
fixed: CallWrapper() didn't return a status if a model/space/date/container was found
2021-07-02 20:23:20 +02:00
849b3e9ecc changed the way how we iterate through Models, instead of ModelWrapper now we have Wrapper which has pointers to: model, model container, space or date 2021-07-01 23:21:20 +02:00
acb42f453c added support for two new ezc statements for clearing/trimming text nodes
[ezc clear_all_white_nodes "yes"]...[end] - will clear a text node if the text consists of only white characters
[ezc trim_text_nodes "yes"]...[end] - will trim text nodes (removes white characters at the beginning and at the end)

"yes" is assumed by default if not present, also "no" can be specified to change the behavior
2021-06-29 23:38:38 +02:00
c2283f70d4 Generator when printing Model/Space is recognizing now such parameters:
- "dump" or "dump_to_space" parameters to make a dump in Space format
- "dump_to_json" parameter to make json dump
- "pretty" parameter to make the dump pretty (with new lines and indents)
2021-06-27 22:42:00 +02:00
3926793a17 fixed in Generator::CallSpace() when a middle field was a table: last_res should be set only for last field
refactoring in Generator::CallSpace()
2021-06-25 16:16:30 +02:00
16bce07c75 fixed: in Space::CallSpace() we should not increment field index when a new table item is prepared 2021-06-23 21:56:04 +02:00
526d57b72e added possibility to take a Space struct in Models: Models::Add(const std::wstring & name, pt::Space & space); 2021-06-23 06:53:43 +02:00
eda276356f added possibility to iterate through Space object in Models objects 2021-06-22 18:01:47 +02:00
615bad7372 renamed macro: EZC_HAS_SPECIAL_STREAM -> EZC_GENERATOR_HAS_PT_STREAM
added macro EZC_GENERATOR_HAS_WINIX_STREAM which is used by Generator::CopyStream(pt::WTextStream & src_stream, StreamType & dst_stream, bool should_escape)
if this macro is defined then Generator is able to escape output stream
2021-06-20 16:54:55 +02:00
9c4fe51790 Generator uses now pt::Log as a logger
- added method SetLogger(pt::Log & logger)
- removed SetCommentary(...) methods
- added logs when a model is not found

PatternParser uses only pt::Log
- removed SetCommentary(...) methods
2021-06-19 20:18:30 +02:00
d76bb9349b added typename keyword to Generator::CallModelHelper Generator::FindLastModelWrapper(...) 2021-06-18 18:55:39 +02:00
9022d4a5fc changed how models from morm library are used
now we are using morm::ModelWrapper... classes as wrappers on models and list/vector of models
and Models class is using these wrappers
this allows us to iterate through list/vectors in [for...] statements
2021-06-16 14:16:49 +02:00
e6fd9aad37 added basic support for calling variables and functions from morm::Model objects 2021-05-31 18:37:09 +02:00
052f803eac renamed [ezc out ...] statement to [ezc frame ...], similar [out ...] to [frame ...] 2021-05-28 16:10:16 +02:00
0ac8e05c04 changed semantic of [def] statements:
- [def] is used to define a variable (like before)
  but if we assign a string such as [def var "string"] the string is evaluated to bool
  in a different way: empty string is false, not empty string is true
- added [def?] statement - similar like [def] but define a variable only if such
  a variable is not already defined
- added [let] statement - similar like [def] but with lazy evaluation (it is an alias to a function)
  if it is called to assign a string e.g. [let var "string"] then this has the
  same meaning like [def] - an alias is only created when we assign a function e.g. [let var my_function]
  both [def] and [let] are using the same Vars object
- added [let?] - make an alias but only if such a variable is not already defined
- a std::map of variables moved outside of Generator
  added method void SetVariables(Vars & variables);
- fixed: a result status was not correctly propagated when evaluating [def] statements,
  this was in Call(...) function: last_res from variables was set in Find()
  but later was overwritten by Call(...) called for parameters (recursively)
2021-05-23 10:02:51 +02:00
6f6df9524c updated to the new pikotools api: changed utf8 functions PascalCase to snake_case 2021-05-21 00:32:05 +02:00
cd1c24d0a5 updated to new pikotools api: namespace PT renamed to pt 2021-05-20 16:12:41 +02:00
bf62d44346 fixed: program_mode was not set in cctor
fixed: container was not correctly parsed (in template mode)




git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1139 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-01 21:52:33 +00:00
a6b767a223 some work on a 'program mode'
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1136 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-30 20:59:17 +00:00
c825c85878 start working on a 'program mode'
a new syntax for simple scripting



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1134 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-29 23:50:10 +00:00
363605bde5 changed: a function can have a postfix now e.g. [my_function:my_postfix]
this will be mainly used in conjuction with [for ...] statements

[for my_function:xxx]
  [for my_function]
    [my_function_value]
    [my_function_valu:xxx] (references the first loop)
  [end]
[end]

added: to FunInfo<>: a reference to current item from a pattern (const Item & item)
       similary on the stack is added a pointer to an item
       by having this reference you can compare a function's name and its postfix
       added methods:
       Stack * FindLastFor(const std::wstring & name);
       Stack * FindLastFor(const std::wstring & name, const std::wstring & postfix);
       template<class FunUserObject> FunUserObject * FindUserObject(const std::wstring & function_name, Stack ** ezc_stack = 0);




git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1038 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-04-04 15:53:11 +00:00
a1ea2e3ccd changed: OutStreams<>::streams_map should not have null pointers to StreamType objects
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1018 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-11-16 12:09:34 +00:00
c3deb960c5 fixed: 'typename' keyword is missing in some places
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1015 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-11-12 11:08:53 +00:00
7b6f7ad328 changed: [ezc streams "..."] to [ezc out "..."] or just [out "..."]
the syntax has been changed, now [ezc ...] is used with [end] statement
added: OutStreams<StreamType> class with a pool with output streams,
the Generator::Generate() method can take it as its argument
(Generator API has been changed)



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1014 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-11-12 09:53:20 +00:00
76490d4c19 added: now ezc functions can be methods of a special object
added: objects.h with a base class for the object
       and Objects container (similar as Functions container)



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1011 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-06-14 18:20:00 +00:00
6b42cdf76e changed: the way how functions' arguments are parsed
now this [fun1 fun2 "something" fun3]
         will call fun1 with three arguments: fun2, "something" and fun3
         and this [fun1 [fun2 "something"] fun3]
         will call fun1 with two arguments: [fun2 "something] and fun3
         "something" is an argument for fun2 function
removed: statements: [if-one] [if-any] [if-no] [if-any-no] [if-one-no]



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1004 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-08 02:31:21 +00:00
b519c79a3e removed: statements: [if-index ...] [is ...] and [is-no ...]
we can provide a user definied function which does the same
added:   to FunInfo<>:
         Stack * stack_tab
         size_t stack_index
         a stack table and an index to the current stack item



git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@988 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-02 17:26:56 +00:00
6f1e2eb518 removed: svn:executable atribute from files
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@987 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-01 17:14:39 +00:00