diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-09-21 16:52:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-09-21 16:52:13 -0700 |
commit | b0c3b95360c9e5b4aa54f19ec88e1b96a10b6d0a (patch) | |
tree | e78e8f45cc70769218a5055dad53a2be291f3e00 /args.c | |
parent | 1bd49e57588269ac8f6e55aee80b82d5612694d2 (diff) | |
download | txr-b0c3b95360c9e5b4aa54f19ec88e1b96a10b6d0a.tar.gz txr-b0c3b95360c9e5b4aa54f19ec88e1b96a10b6d0a.tar.bz2 txr-b0c3b95360c9e5b4aa54f19ec88e1b96a10b6d0a.zip |
New functions: nested-vec-of and nested-vec.
* eval.c (eval_init): Register nestd-vec-of and nested-vec
intrinsics.
* lib.[ch] (vec_allocate, vec_own, vec_init): New static functions.
(vector, copy_vec): Expressed in terms of new functions.
(nested_vec_of_v, nested_vec_v): New functions.
* args.[ch] (args_cat_from): New function.
* tests/010/vec.tl: New tests.
* txr.1: Documented.
Diffstat (limited to 'args.c')
-rw-r--r-- | args.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -106,6 +106,15 @@ varg args_cat(varg to, varg from) return to; } +varg args_cat_from(varg to, varg from, cnum index) +{ + size_t size = sizeof *from->arg * (from->fill - index); + to->list = from->list; + memcpy(to->arg + to->fill, from->arg + index, size); + to->fill += from->fill - index; + return to; +} + varg args_cat_zap(varg to, varg from) { size_t size = sizeof *from->arg * from->fill; |