summaryrefslogtreecommitdiffstats
path: root/args.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-03-22 18:44:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-03-22 18:44:12 -0700
commit24bfded1413e45bb949f6c1ee2b3e8ef34f12329 (patch)
tree2c0ee03aa67f25cde703f6b98b6c33bedcaa0e39 /args.h
parent6ff237b689590320f942a195193fed3f95934de1 (diff)
downloadtxr-24bfded1413e45bb949f6c1ee2b3e8ef34f12329.tar.gz
txr-24bfded1413e45bb949f6c1ee2b3e8ef34f12329.tar.bz2
txr-24bfded1413e45bb949f6c1ee2b3e8ef34f12329.zip
New type args with DARG type code.
An object of args type captures into the heap the "struct args" argument list that normally appears only on the stack. Such an object also has space for a car and cdr field, which can come in handy. * args.c (dyn_args): New function: hoist a struct args * into an args heap object. * args.h (dyn_args): Declared. * gc.c (finalize, mark_obj): Handle DARGS type code. * hash.c (equal_hash): Handle DARG via eq equivalence. * lib.c (args_s): New symbol variable. (code2type): Map DARG to args symbol. (equal): Handle DARG type, using eq equivalence for now. (obj_init): Initialize args_s with interned symbol. * lib.h (enum type, type_t): New type code, DARG. (struct dyn_args): New struct. (union obj): New member, a of type struct dyn_args. * txr.1: Documented args type under typeof.
Diffstat (limited to 'args.h')
-rw-r--r--args.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/args.h b/args.h
index e721629c..13296ac8 100644
--- a/args.h
+++ b/args.h
@@ -189,3 +189,4 @@ void args_for_each(struct args *args,
int (*fn)(val arg, int ix, mem_t *ctx),
mem_t *ctx);
void args_keys_extract(struct args *args, struct args_bool_key *, int n);
+val dyn_args(struct args *args, val car, val cdr);