summaryrefslogtreecommitdiff
path: root/libguile/eval.c
diff options
context:
space:
mode:
authorKeisuke Nishida <kxn30@po.cwru.edu>2001-06-26 15:46:40 +0000
committerKeisuke Nishida <kxn30@po.cwru.edu>2001-06-26 15:46:40 +0000
commitfdc2839563bd8c821221a4869f27255ae77f757b (patch)
tree63bc043598fe6d9c2cac3d3c7251898cc306f5cd /libguile/eval.c
parent36284627919a6968174b5f17369349187a2b4b1b (diff)
downloadguile-fdc2839563bd8c821221a4869f27255ae77f757b.tar.gz
* eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3,
scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3): New functions.
Diffstat (limited to 'libguile/eval.c')
-rw-r--r--libguile/eval.c64
1 files changed, 60 insertions, 4 deletions
diff --git a/libguile/eval.c b/libguile/eval.c
index 53177f6ae..5d07e2434 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -1246,7 +1246,7 @@ scm_macroexp (SCM x, SCM env)
return x;
SCM_SETCAR (x, orig_sym); /* Undo memoizing effect of lookupcar */
- res = scm_apply (SCM_MACRO_CODE (proc), x, scm_cons (env, scm_listofnull));
+ res = scm_call_2 (SCM_MACRO_CODE (proc), x, env);
if (scm_ilength (res) <= 0)
res = scm_cons2 (SCM_IM_BEGIN, res, SCM_EOL);
@@ -3245,6 +3245,62 @@ ret:
#ifndef DEVAL
+
+/* Simple procedure calls
+ */
+
+SCM
+scm_call_0 (SCM proc)
+{
+ return scm_apply (proc, SCM_EOL, SCM_EOL);
+}
+
+SCM
+scm_call_1 (SCM proc, SCM arg1)
+{
+ return scm_apply (proc, arg1, scm_listofnull);
+}
+
+SCM
+scm_call_2 (SCM proc, SCM arg1, SCM arg2)
+{
+ return scm_apply (proc, arg1, scm_cons (arg2, scm_listofnull));
+}
+
+SCM
+scm_call_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3)
+{
+ return scm_apply (proc, arg1, scm_cons2 (arg2, arg3, scm_listofnull));
+}
+
+/* Simple procedure applies
+ */
+
+SCM
+scm_apply_0 (SCM proc, SCM args)
+{
+ return scm_apply (proc, args, SCM_EOL);
+}
+
+SCM
+scm_apply_1 (SCM proc, SCM arg1, SCM args)
+{
+ return scm_apply (proc, scm_cons (arg1, args), SCM_EOL);
+}
+
+SCM
+scm_apply_2 (SCM proc, SCM arg1, SCM arg2, SCM args)
+{
+ return scm_apply (proc, scm_cons2 (arg1, arg2, args), SCM_EOL);
+}
+
+SCM
+scm_apply_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM args)
+{
+ return scm_apply (proc, scm_cons (arg1, scm_cons2 (arg2, arg3, args)),
+ SCM_EOL);
+}
+
/* This code processes the arguments to apply:
(apply PROC ARG1 ... ARGS)
@@ -3812,7 +3868,7 @@ SCM_DEFINE (scm_force, "force", 1, 0, 0,
SCM_VALIDATE_SMOB (1, x, promise);
if (!((1L << 16) & SCM_CELL_WORD_0 (x)))
{
- SCM ans = scm_apply (SCM_CELL_OBJECT_1 (x), SCM_EOL, SCM_EOL);
+ SCM ans = scm_call_0 (SCM_CELL_OBJECT_1 (x));
if (!((1L << 16) & SCM_CELL_WORD_0 (x)))
{
SCM_DEFER_INTS;
@@ -3948,7 +4004,7 @@ scm_primitive_eval_x (SCM exp)
SCM env;
SCM transformer = scm_current_module_transformer ();
if (SCM_NIMP (transformer))
- exp = scm_apply (transformer, exp, scm_listofnull);
+ exp = scm_call_1 (transformer, exp);
env = scm_top_level_env (scm_current_module_lookup_closure ());
return scm_i_eval_x (exp, env);
}
@@ -3962,7 +4018,7 @@ SCM_DEFINE (scm_primitive_eval, "primitive-eval", 1, 0, 0,
SCM env;
SCM transformer = scm_current_module_transformer ();
if (SCM_NIMP (transformer))
- exp = scm_apply (transformer, exp, scm_listofnull);
+ exp = scm_call_1 (transformer, exp);
env = scm_top_level_env (scm_current_module_lookup_closure ());
return scm_i_eval (exp, env);
}