mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 23:00:22 +02:00
* eval.c (SCM_CEVAL): Improved readability of call-with-values
execution. Generalize apply_closure to apply_proc and use that for call-with-values.
This commit is contained in:
parent
e910e9d2eb
commit
9a069bdd77
2 changed files with 45 additions and 42 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-05-30 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* eval.c (SCM_CEVAL): Improved readability of call-with-values
|
||||||
|
execution. Generalize apply_closure to apply_proc and use that
|
||||||
|
for call-with-values.
|
||||||
|
|
||||||
2003-05-30 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
2003-05-30 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
* eval.c (SCM_CEVAL): Avoid one level of indirection when applying
|
* eval.c (SCM_CEVAL): Avoid one level of indirection when applying
|
||||||
|
|
|
@ -2388,12 +2388,12 @@ dispatch:
|
||||||
PREP_APPLY (proc, SCM_EOL);
|
PREP_APPLY (proc, SCM_EOL);
|
||||||
x = SCM_CDR (x);
|
x = SCM_CDR (x);
|
||||||
arg1 = EVALCAR (x, env);
|
arg1 = EVALCAR (x, env);
|
||||||
|
|
||||||
|
apply_proc:
|
||||||
|
/* Go here to tail-apply a procedure. PROC is the procedure and
|
||||||
|
* ARG1 is the list of arguments. PREP_APPLY must have been called
|
||||||
|
* before jumping to apply_proc. */
|
||||||
if (SCM_CLOSUREP (proc))
|
if (SCM_CLOSUREP (proc))
|
||||||
{
|
|
||||||
apply_closure:
|
|
||||||
/* Go here to tail-call a closure. PROC is the closure
|
|
||||||
and ARG1 is the list of arguments. Do not forget to
|
|
||||||
call PREP_APPLY. */
|
|
||||||
{
|
{
|
||||||
SCM formals = SCM_CLOSURE_FORMALS (proc);
|
SCM formals = SCM_CLOSURE_FORMALS (proc);
|
||||||
#ifdef DEVAL
|
#ifdef DEVAL
|
||||||
|
@ -2423,7 +2423,6 @@ dispatch:
|
||||||
x = SCM_CLOSURE_BODY (proc);
|
x = SCM_CLOSURE_BODY (proc);
|
||||||
goto nontoplevel_begin;
|
goto nontoplevel_begin;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ENTER_APPLY;
|
ENTER_APPLY;
|
||||||
|
@ -2680,21 +2679,19 @@ dispatch:
|
||||||
|
|
||||||
case (SCM_ISYMNUM (SCM_IM_CALL_WITH_VALUES)):
|
case (SCM_ISYMNUM (SCM_IM_CALL_WITH_VALUES)):
|
||||||
{
|
{
|
||||||
proc = SCM_CDR (x);
|
SCM producer;
|
||||||
x = EVALCAR (proc, env);
|
|
||||||
proc = SCM_CDR (proc);
|
x = SCM_CDR (x);
|
||||||
proc = EVALCAR (proc, env);
|
producer = EVALCAR (x, env);
|
||||||
arg1 = SCM_APPLY (x, SCM_EOL, SCM_EOL);
|
x = SCM_CDR (x);
|
||||||
|
proc = EVALCAR (x, env); /* proc is the consumer. */
|
||||||
|
arg1 = SCM_APPLY (producer, SCM_EOL, SCM_EOL);
|
||||||
if (SCM_VALUESP (arg1))
|
if (SCM_VALUESP (arg1))
|
||||||
arg1 = scm_struct_ref (arg1, SCM_INUM0);
|
arg1 = scm_struct_ref (arg1, SCM_INUM0);
|
||||||
else
|
else
|
||||||
arg1 = scm_list_1 (arg1);
|
arg1 = scm_list_1 (arg1);
|
||||||
if (SCM_CLOSUREP (proc))
|
|
||||||
{
|
|
||||||
PREP_APPLY (proc, arg1);
|
PREP_APPLY (proc, arg1);
|
||||||
goto apply_closure;
|
goto apply_proc;
|
||||||
}
|
|
||||||
return SCM_APPLY (proc, arg1, SCM_EOL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue