aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/ucode
Commit message (Collapse)AuthorAgeFilesLines
* ucode: update to latest Git HEADJo-Philipp Wich2022-06-011-3/+3
| | | | | | | | | | | | d996047 syntax: adjust number literal parsing and string to number conversion 9efbe18 lib: refactor `uc_int()` da3f089 lib: rework uc_index() implementation 559029e ci: make jobs faster during pull request testing Fixes: #9923 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (backported from commits 251e70c88725fb33960ca60202dd55a84ae6b4d7 and 7f998088f01baf0da24a9fd20de5d5389023361a)
* ucode: update to latest Git HEADJo-Philipp Wich2022-05-201-3/+3
| | | | | | | | | | 081871e compiler: fix segmentation fault on compiling unexpected unary expressions 090b426 fs: avoid input buffering with small limits in fs.readfile() 8da140f lib: introduce hexenc() and hexdec() 9a72423 Update README.md Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit e2ce2a8d3cd3c885eb61a8b577abf9508ffad7d2)
* ucode: reorder BuildPackage callsJo-Philipp Wich2022-04-281-1/+1
| | | | | | | | | | Ensure that the libucode recipe is processed before the ucode one in order to reliably encode the ABI version into ucode's libucode dependency. Fixes: #9788 Ref: https://forum.openwrt.org/t/fw4-wont-start-after-upgrade/126308 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 573ce80ca612b0f642b7cbd5d9d33d89b7e96670)
* ucode: update to latest Git HEADJo-Philipp Wich2022-04-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e14b099 syntax: implement support for ES6 template literals 111cf06 vm: stop executing bytecode on return of nested calls 33f1e0b treewide: move json-c compat shims into internal header file e0e9431 vm: move unhandled exception reporting out of `uc_vm_execute_chunk()` 2b59140 vm: fix callframe double free on unhanded exceptions 7d7e950 main: abort when failing to load a preload library 1032a67 lib: let `json()` accept input objects implementing `read()` method 5ee68d5 fs: implement `fs.readfile()` and `fs.writefile()` df6b861 ci: debian: change path before attempting to invoke Git operations dfaf05a ci: debian: automatically update changelog from Git tag 34f3c45 ci: fix YAML syntax of Debian workflow e956bcf fs: fix off-by-one in fs.dirname() function 6fc4b6c .gitignore: fix overmatching patterns, blacklist cram .venv 7c2e082 build: remove legacy json-c check 77942af build: add polyfills for older libjson-c versions 0b4aaa3 CI: build Debian package f404285 debian: Add package definition a37f654 types: fix escape sequence encoding of high byte values in JSON strings aae5312 Update README.md 8134e25 build: fix symlink install target 87c7296 treewide: replace some leftover "utpl" occurrences, update .gitignore 7d27ad5 build: only stage ucc symlink if compile support is enabled 171402f lib: add date and time related functions 8b5dc60 lib: provide API function to obtain stdlib function implementations eb0d2f1 main: turn ucode into multicall executable 28ee7e1 uloop: add support for tasks 753dea9 CI: build on macOS 668c5c0 lib: add argument position support (`%m$`) to `sprintf()` and `printf()` ab46fdf treewide: remove legacy json-c include directives b8f49b1 tests: 21_regex_literals: generalize syntax error test case fd2e5e7 tests: 16_sort: fix logic flaw exposed on OS X 2c71bf2 tests: run_tests.sh: pass dummy value to `-T` flag 55c4a90 lib: disallow zero padding for %s formats 0d05cb5 tests: run_tests.sh: use greadlink if available 271e520 resolv: make OS X compatible d13c320 fs: avoid Linux specific sys/sysmacros.h include on OS X 33397a3 uloop: use execvp() on OS X bafdc8f lib: add naive sigtimedwait() stub for OS X ada1585 build: consolidate CMakeLists.txt and cover OS X deviations befbb69 include: add OS X compatible endian.h header 49838a8 include: rename include guards to avoid clashes with system headers 91f65de nl80211: add missing attributes and correct some attribute flags b4a1fd5 lib: adjust require(), render() and include() raw mode semantics 4618807 main: rework CLI frontend 73dcd78 lib: fix potential integer underflow on empty render output c402551 vm: fix crash on object literals with non-string computed properties efe8a02 syntax: support add new operators 078d686 ubus: add event support 6c66c83 ubus: refactor error and argument handling 1cb04f9 ubus: add object publishing, notify and subscribe support 0e85974 uloop: clear errno before integer conversion attempts 05bd7ed types: treat resource type prototypes as GC roots a2a26ca lib: introduce uloop binding 6b6d01f vm: release this context on exception in managed method call 1af23a9 tests: fix proto() testcase 4ce69a8 fs: implement access(), mkstemp(), file.flush() and proc.flush() Signed-off-by: Jo-Philipp Wich <jo@mein.io> (backported from commits cef3e6a69c4751189e946cf2ff0e00304f9fff6e, 0400774a1001835b912ecf2097bba1306deba9f8 and c59704334c4a01bc18ab489f86d4ca7d2ea3cb8f)
* ucode: update to latest Git HEADJo-Philipp Wich2022-02-121-3/+3
| | | | | | | | a29bad9 compiler: fix patchlist corruption on switch statement syntax errors 86f0662 lib: change `ord()` to always return single byte value 116a8ce vallist: fix storing/retrieving short strings with 8bit byte value Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2022-02-081-4/+4
| | | | | | a317c17 compiler: fix incorrect loop break targets Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2022-02-071-3/+3
| | | | | | | | | | | | | | | | | | | | | 11adf0c source: convert source objects into proper uc_value_t type 3a49192 treewide: rework function memory model 7edad5c tests: add functional tests for builtin functions d5003fd lib: fix leaking tokener in uc_json() on parse exception 5d0ecd9 lib: fix infinite loop on empty regexp matches in uc_replace() 3ad57f1 lib: fix infinite loop on empty regexp matches in uc_match() 32d596d lib: fix infinite loop on empty regexp matches in uc_split() 3e3f38d vm: ensure consistent trace output between gcc and clang compiled ucode 3600ded vm: fix leaking function value on call exception 3059295 vm: NULL-initialize pointer to make cppcheck happy 98e59bf source: zero-initialize conversion union to make cppcheck happy 7a65c14 run_tests.sh: change workdir to testcase directory during execution afec8d7 run_tests.sh: support placing supplemental testcase files 3ada6e0 run_tests.sh: always treat outputs as text data 2cb627f program: rename bytecode load/write functions, track path of executed file 1094ffa lib: fix memory leak in uc_require_ucode() Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2022-01-282-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c6dae42 LICENSE: add ISC license file 402f603 lib: introduce struct library dcb6ffd struct: fix PowerPC specific compiler pragma name a0512ea treewide: fix typo in exported function names and types eaaaf88 nl80211: fix wiphy dump reply merge logic e6efadb fs: add utility functions 54ef6c0 nl80211: fix premature netlink reply receive abort 07802f3 syntax: disallow keywords in object property shorthand notation 3489b75 vm: support object property access on resource value types dc8027c types: consider resource prototypes when marking reachable objects 5680fab treewide: fix upvalue reference type name 0d29b25 treewide: fix "resource" misspellings 99fdafd vm: introduce value registry 66f7c00 ubus: add support for async requests 5c77dd5 fs: implement fdopen(), file.fileno() and proc.fileno() b605dbf treewide: rework numeric value handling 599d233 vallist: store double values in a platform neutral manner 5bb9ab7 struct: reuse double packing routines from core 2fd7ab5 vm: optimize string concatenation eafa321 lib: implement uniq() function 6b2e79a types: add initial infrastructure for function serialization 725bb75 compiler, vm: use a program wide constant list 6c2caf9 source: refactor source file handling 371ba45 program: implement support for precompiling source files 3578afe build: support building without compile capabilities 61d0a34 lib: replace usages of vasprintf() with xvasprintf() 03b6a8e syntax: drop legacy syntax support 01132db lib: fix %J string formats with precision specifier 3f44c42 lib: rework format string handling a1b3c5d struct: implement `*` format, fix invalid memory accesses 34a04a2 run_tests.sh: fix exitcode evaluation abe38e7 run_tests.sh: add ability to define environment variables for testcases 04fa2ba tests: reorganize testcase files 6a55d10 lib: fix exists() error return value aa860a3 vm: fix `null` loose equality/inequality checks 3f6d199 vallist: uc_number_parse(): parse empty strings as `0`, not `NaN` ddc5aa7 vm: fix NaN strict equality tests Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: add temporary fix for integer formatting on 32bit systemsJo-Philipp Wich2022-01-232-1/+12
| | | | | | | | | | | | The ucode VM always passes 64bit integer values to sprintf implementation while the `%d` format expects 32bit integers on 32bit platforms, leading to incorrect formatting results. Temporarily solve the issue by casting the numeric argument to int until a more thorough fix arrives with the next update. Fixes: FS#4234 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2021-10-251-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 0f022aa lib: increase refcount when returning cached module instance c9e68bb lib: introduce resolver library 9041e24 lib: fix uninitialized memory access on handling %J string formats 4ee06d8 syntax: introduce optional chaining operators ce4a7d9 vm: reset callframes before invoking unhandled exception handler 218e822 vm: clear exception information before calling managed code functions 5b908bd ubus: properly handle signed 64bit values too e43b751 ubus: fix handling signed 16bit and 32bit integers 137428f nl80211: fix issues spotted by static code analyzer b9d4f61 nl80211: treat signal attr values as signed integers 9a7c355 nl80211: expose sta_info attributes bb358d9 lib: introduce Linux 802.11 netlink binding 914f54c types: fix invalid memory access on setting non-contiguous array indexes 631f00d main: fix leaking module name when processing -m flag e55188b compiler: properly handle jumps to offset 0 98c4147 tests: support specifying cmdline args in testcase files 64e4f68 types: fix formatting escape sequences for 8 bit chars dd86e1d rtnl: automatically derive message family from certain address attrs 74fdb97 rtnl: expose IPv4 and IPv6 devconfig information 7fa1008 rtnl: allow reply nla payloads to be smaller than headsize cbae3cb lib: introduce Linux route netlink binding e6dd389 ci: adjust build prereqs for GitHub as well 07ae165 ci: add libnl-tiny to prereqs Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2021-09-011-9/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 929c862 vm: fix toplevel function call protocol 8f34d70 fs: fix chown() and rename() error return values 03ca445 tests: disable fuzz tests for now 3b1be3d types: mark further GC roots d49af4e types: fix comparison of differently signed integers c79ff39 types: handle conversion errors when dealing with negative error indexes 3315b1f types: allow negative array indexes d5b25f9 treewide: harmonize function naming cc4ce8d module: remove unused defines f5d7526 examples: add libucode usage examples 559eff2 types, vm: adjust GC api e5e7e62 treewide: move header files into dedicated directory ff6168a build: install header files 7e6ce0f main: introduce new flag `-x` to allow disabling specific functions b1817b3 vm: fix invalid memory access on GC'ing uninitialized VM context 498fe87 main: refactor option parsing and VM setup ff52440 treewide: consolidate typedef naming 1d60418 vm: add API to control trace mode 48f33ad vm: make root exception handler configurable 0f69f09 vm: fix invalid memory access on toplevel function calls 6bcc318 vm: fix handling exceptions in top-level function calls 4ae0568 lib, vm: reimplement exit() as exception type 2f77657 vm: extend API to allow returning result value from VM execution 111645a vm: remove module preloading logic 38ff6de main: preload modules ourselves d5bc223 vm: add uc_vm_invoke() helper ef0baf1 vm: cosmetic fix for outputting exceptions without source context b11a2fa vm: move global scope allocation into uc_vm_init() 900b2a3 vm: add getter and setter for vm globals scope 0179576 lib: rename uc_add_proto_functions() to uc_add_functions() 98b9c84 lib: expose stdlib function array 1adfba0 treewide: eliminate dead code and unused functions 3974e71 treewide: replace a number of unnecessary type casts bf85226 treewide: move ressource type registry into vm instance e2b3d2e build: split into libucode and ucode cli dad8f3a types: properly deal with circular data in GC mark phase 62dbd64 lexer: rename UT_ prefixed constants to UC_ bc8e465 types: fix wrong assert() on tearing down object trees 853b9f1 vm: fix potential invalid memory access in uc_vm_get_error_context() 6f05cdd lib: fix refcount imbalance in uc_require_path() 96f140b lib, vm: ensure that require() compiles modules only once df5db5f compiler: don't segfault on invalid declaration expressions a97c7a1 lexer: transition into EOF state on unrecognized character 2a838d1 compiler: improve mapping of binary operator tokens to instructions 9872f65 vm: add support for I_LE and I_GE instructions 4e410c3 treewide: let uc_cmp() use instruction instead of token numbers ce6081d lexer, vm: reorder token and instruction numbers 234a4f6 lib: implement b64enc() and b64dec() functions 856a0c0 lib: only consider context of calling function for callbacks 86fb130 lib: implement min() and max() functions 3e893e6 lib: pass-through "this" context to library function callbacks 42de7ab lib: implement `sourcepath()` function 05c80a7 lib: fix negative uc_index() return value on 32bit systems 9874562 lexer: implement raw code mode 3b665c8 lexer: drop value union from keyword table 44354cf lexer, compiler: separate TK_BOOL token into TK_TRUE and TK_FALSE tokens 5879bdf syntax: drop Infinity and NaN keywords d4edadc lib: rename uc_lib_init() to uc_load_stdlib() d81bad7 main, lib: move allocation of globals object into lib function c4f4b38 main: simplify REQUIRE_SEARCH_PATH initialization 54ca3aa types: fix uninitialized memory on setting non-contiguous array indexes cbc0d78 build: let require search patch default to CMAKE_INSTALL_PREFIX 5714705 syntax: introduce `const` support ed32c42 compiler, lexer: add NO_LEGACY define to disable legacy syntax features ff6811f syntax: implement `delete` as proper operator 5803d86 lib: implement wildcard() function dfb7379 fs: implement chmod(), chown(), rename() and glob() functions 1ddf5b6 lexer: skip interpreter line in any source buffer 9951a00 build: lower minimum required CMake version to v3.13 7b81ab2 main: expose argv as global ARGV array to ucode scripts 7283a70 tests: rename misnamed testcases for consistency 3f80116 compiler: fix local for-loop initializer variable declarations f20b56f compiler: properly parse slashes in parenthesized division expressions 5c4e1ea lib: implement regexp(), a function to construct regexp instances at runtime e546bba lib: implement render(), an include variant capturing output in a string 0cb10c6 vm: implement mechanism to change output file descriptor eb8a64d lib: fix uc_sort() f1ffc9f vm: truncate long values after 60 chars in trace output 850612f compiler: properly handle break/continue in nested scopes f0a9875 compiler: properly handle keyword in parenthesized property access expression 1660433 compiler: fix stack mismatch on compiling `use strict` statements a36e0df syntax: implement support for 'use strict' pragma 827a34a vm, compiler: get rid of unused struct members 594cdf3 lib: implement assert() c4d1648 lib: add support for pretty printing JSON to printf() and sprintf() f2eaea3 lib: gracefully handle truncated format strings in uc_printf_common() 02629b8 lexer: fix infinite loop on parsing unterminated comments 2bc9bac lexer: fix infinite loop on parsing unterminated expression blocks f73e201 lexer: fix infinite loop when parsing regexp literal at EOF 86b4863 compiler: fix segfault on parsing invalid pre/post increment expressions 0e24509 lib: fix reporting source context lines at EOF e66b2ad compiler, lexer: improve lexical state handling e29b574 lib: fix uc_split() quirks 64eec7f treewide: ISO C / pedantic compliance 4af803d build: output error messages on test failures 9ef693e vm: improve context for early errors 6def9fc tests: pass ucode library path through environment d5dd183 treewide: address various sign-compare warnings 28825ac types: support creating ressource values without associated type 9c5106a types: fix potential memory leaks and null pointer accesses c51934a types: fix potential leak of key in ucv_object_add() 7b28727 main: fix ineffective EOF check in parse() 4cf897c lib: uc_system(): fix invalid free() of non-heap memory 35af4ba treewide: rework internal data type system f2c4b79 treewide: fix issues reported by clang code analyzer 93ededb tests: allow executing run_tests.sh from any directory 0e4a387 Add initial GitLab and GitHub CI support df73b25 tests: add more tests 41d33d0 tests: custom: return exit code if tests fails 1c548a6 cmake: do not output binaries into lib directory 2b59097 tests: create custom tests from current tests cases 8039361 main: provide just binary name in help output 778e4f7 lexer: fix incomplete struct initializers 502ecdc cmake: enable extra compiler checks 3c2aeff cmake: fix includes and libraries 617a114 cmake: make 3.0 minimum version f360350 lib: implement sleep(ms) function 7f0ff91 lib: allow parsing non-array, non-object value in json() Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2021-04-011-3/+3
| | | | | | | | 973cc6c compiler: actually expand block scope fix to for/while alt syntax 97bf297 compiler: ensure that alternative if/for/while syntax has own block scope f0e2a64 tests: add missing test case for fixed switch codegen Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: update to latest Git HEADJo-Philipp Wich2021-03-291-3/+3
| | | | | | | | | | | | | | | | | | | aa9621d compiler: rework switch statement code generation b5f0de1 vm: add trace mode instruction dump output fixes 0341d64 vm: fix another for-loop memory leak 00d9419 vm: fix further memory leaks in trace mode 20a3763 vm: fix loop variable memory leak in NEXTK/NEXTKV instruction 9a6ef2b lib: prevent use-after-free after uc_shift() 03f1324 object: free prototype object when registering existing ressource type b3d758b compiler: fix for/break miscompilation 86e3970 lib: fix value refcount of uc_unshift() return value fe464ea run_tests.sh: allow passing tests to run as arguments 091ae1b compiler: fix another try/catch miscompilation fcedb19 lib: fix passing uninitialized memory to sigprocmask() 0d0357d vm: fix leaking source context strings in trace mode 7a41fb3 lib: use execvp() in system() Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ucode: fix PKG_MIRROR_HASHDaniel Golle2021-03-241-1/+1
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* ucode: introduce packageJo-Philipp Wich2021-03-191-0/+116
This commit introduces ucode, a tiny template processor utilizing a syntax closely resembling ECMA Script for embedded script blocks. Signed-off-by: Jo-Philipp Wich <jo@mein.io>