summaryrefslogtreecommitdiffhomepage
path: root/lib.c
AgeCommit message (Collapse)Author
2020-10-02main: track current template filename during executionJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-10-02lib: fix procedure entry in ut_require_utpl()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-26lib: add json() functionJo-Philipp Wich
The json function allows parsing JSON strings into structured data. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-26lib: implement '%J' printf formatJo-Philipp Wich
The `%J` format allows outputting values as valid JSON string. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-24syntax: add regular expression supportJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-20Revert "treewide: rework exception handling"Jo-Philipp Wich
This reverts commit 54bb15b2be3656e91386b80074f45591b20fed3f. Relying on setjmp() / longjmp() causes too many headaches trying to track and properly release intermediate values. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-16treewide: rework exception handlingJo-Philipp Wich
Use setjmp() and longjmp() to deal with runtime exceptions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-11lib: add iptoarr() and arrtoip() functionsJo-Philipp Wich
These functions allow converting IP addresses to and from arrays of byte values respectively. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-11lib: move math functions to new moduleJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-11lib: expose ut_new_double() and ut_cast_number() in the module interfaceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-11lib: expose ut_invoke() in the module interfaceJo-Philipp Wich
This allows invoking other functions from module code. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-10treewide: eliminate unused function argumentsJo-Philipp Wich
Also introduce convenience macro for registering function arrays in modules. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-10build: test whether json_object_array_shrink() is availableJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-08lib: make type() report extended types as "ressource"Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-06treewide: refactor internal AST structuresJo-Philipp Wich
- unify operand and value tag structures - use a contiguous array for storing opcodes - use relative offsets for next and children ops - defer function creation to runtime - rework "this" context handling by storing context pointer in scope tags Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-02treewide: rename double and null value constructor functionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-02eval, lib: add loadable module infrastructureJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-02eval, lib: use tagged JSON objects to register C functionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25lib.c: move ut_add_function() to headerJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25treewide: add dedicated T_CFUNC typeJo-Philipp Wich
Tag C function values with a dedicated T_CFUNC type to clearly differentiate them from runtime declared functions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25lib.c: use snprint_append() helper for sprintf and printf functionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25main.c, lib.c: move error formatting logic to lib.cJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-24eval.c, lib.c: allow invoking functions with existing scopeJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-22lib.c: add printf and sprintf functionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-22lib.c: add missing string case to type()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-21Add missing lib sourceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>