summaryrefslogtreecommitdiffstats
path: root/args.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-23 19:23:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-23 19:23:07 -0700
commita6fa35d2877745ba0b285093c40c1a3aad82a0e8 (patch)
treec198bb2deaa979417dbabc184dadf2061da86731 /args.h
parent6d0af6ae2af0003716581ed23b486f26ac809e0c (diff)
downloadtxr-a6fa35d2877745ba0b285093c40c1a3aad82a0e8.tar.gz
txr-a6fa35d2877745ba0b285093c40c1a3aad82a0e8.tar.bz2
txr-a6fa35d2877745ba0b285093c40c1a3aad82a0e8.zip
Use of new args for function calls in interpreter.
* args.c (args_copy_to_list): New function. * args.h (ARGS_MIN): New preprocessor symbol. (args_add_list): New inline function. (args_copy_to_list): Declared. * debug.c (debug): Args in debug frame are now struct args *. Pull them out nondestructively for printing using args_copy_to_list. * eval.c (do_eval_args): Fill struct args argument list rather than returning evaluated list. Dot position evaluation is handled by installing the dot position value as args->list. (do_eval): Allocate args of at least ARGS_MAX for the call to do_eval_args. Then use generic_funcall to invoke the function rather than apply. (eval_args_lisp1): Modified similarly to do_eval_args. (eval_lisp1): New static function. (expand_macro): Construct struct args argument list for the sake of debug_frame. (op_dwim): Allocate args which are filled by eval_args_lisp1, and applied to the function/object with generic_funcall. The object expression is separately evaluated with eval_lisp1. * match.c (h_fun, v_fun): Construct struct args arglist for the sake of debug_frame call. * unwind.c (uw_push_debug): args argument becomes struct args *. * unwind.h (struct uw_debug): args member becomes struct args *. (uw_push_debug): Declaration updated. * txr.1: Update documentation about dot position argument in function calls. (list . a) now works, which previously didn't.
Diffstat (limited to 'args.h')
-rw-r--r--args.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/args.h b/args.h
index e75193d6..0349d160 100644
--- a/args.h
+++ b/args.h
@@ -88,6 +88,11 @@ INLINE void args_add4(struct args *args, val arg1, val arg2, val arg3, val arg4)
val args_add_checked(val name, struct args *args, val arg);
+INLINE void args_add_list(struct args *args, val list)
+{
+ args->list = list;
+}
+
INLINE int args_more(struct args *args, cnum index)
{
return index < args->fill || args->list;
@@ -120,7 +125,6 @@ INLINE val args_get_rest(struct args *args, cnum index)
return z(args->list);
}
-
INLINE val args_at(struct args *args, cnum arg_index)
{
if (arg_index < args->fill)
@@ -150,3 +154,4 @@ INLINE void args_clear(struct args *args)
val args_get_checked(val name, struct args *args, cnum *arg_index);
struct args *args_copy(struct args *to, struct args *from);
struct args *args_copy_zap(struct args *to, struct args *from);
+val args_copy_to_list(struct args *args);