1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

* eval.c: Removed outdated references to "everr". Improved some

comments.

(scm_deval_args, deval_args):  Renamed scm_deval_args to
deval_args, since it is not part of the interface.

(SCM_CEVAL):  Added (maybe somewhat verbose) comment.  Avoid to
use references to debug.vect[0] before it exists.  Add parentheses
to switch statement.

* goops.h:  Added local emacs variables.
This commit is contained in:
Dirk Herrmann 2002-01-10 21:57:03 +00:00
parent 2493378052
commit a392ee1556
3 changed files with 63 additions and 26 deletions

View file

@ -1,3 +1,17 @@
2002-01-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c: Removed outdated references to "everr". Improved some
comments.
(scm_deval_args, deval_args): Renamed scm_deval_args to
deval_args, since it is not part of the interface.
(SCM_CEVAL): Added (maybe somewhat verbose) comment. Avoid to
use references to debug.vect[0] before it exists. Add parentheses
to switch statement.
* goops.h: Added local emacs variables.
2002-01-10 Dirk Herrmann <D.Herrmann@tu-bs.de> 2002-01-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.[ch] (scm_deval_args): Made static. * eval.[ch] (scm_deval_args): Made static.

View file

@ -338,7 +338,6 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
if (!SCM_NULLP (env) || SCM_UNBNDP (SCM_VARIABLE_REF (real_var))) if (!SCM_NULLP (env) || SCM_UNBNDP (SCM_VARIABLE_REF (real_var)))
{ {
errout: errout:
/* scm_everr (vloc, genv,...) */
if (check) if (check)
{ {
if (SCM_NULLP (env)) if (SCM_NULLP (env))
@ -1598,6 +1597,7 @@ scm_badargsp (SCM formals, SCM args)
} }
return !SCM_NULLP (args) ? 1 : 0; return !SCM_NULLP (args) ? 1 : 0;
} }
#endif #endif
static int static int
@ -1826,7 +1826,7 @@ SCM_DEFINE (scm_evaluator_traps, "evaluator-traps-interface", 0, 1, 0,
#undef FUNC_NAME #undef FUNC_NAME
static SCM static SCM
scm_deval_args (SCM l, SCM env, SCM proc, SCM *lloc) deval_args (SCM l, SCM env, SCM proc, SCM *lloc)
{ {
SCM *results = lloc, res; SCM *results = lloc, res;
while (SCM_CONSP (l)) while (SCM_CONSP (l))
@ -1847,12 +1847,12 @@ scm_deval_args (SCM l, SCM env, SCM proc, SCM *lloc)
#endif /* !DEVAL */ #endif /* !DEVAL */
/* SECTION: Some local definitions for the evaluator. /* SECTION: This code is compiled twice.
*/ */
/* Update the toplevel environment frame ENV so that it refers to the /* Update the toplevel environment frame ENV so that it refers to the
current module. * current module. */
*/
#define UPDATE_TOPLEVEL_ENV(env) \ #define UPDATE_TOPLEVEL_ENV(env) \
do { \ do { \
SCM p = scm_current_module_lookup_closure (); \ SCM p = scm_current_module_lookup_closure (); \
@ -1864,20 +1864,41 @@ scm_deval_args (SCM l, SCM env, SCM proc, SCM *lloc)
#define CHECK_EQVISH(A,B) (SCM_EQ_P ((A), (B)) || (!SCM_FALSEP (scm_eqv_p ((A), (B))))) #define CHECK_EQVISH(A,B) (SCM_EQ_P ((A), (B)) || (!SCM_FALSEP (scm_eqv_p ((A), (B)))))
#endif /* DEVAL */ #endif /* DEVAL */
#define BUILTIN_RPASUBR /* Handle rpsubrs and asubrs without calling apply */ /* This is the evaluator. Like any real monster, it has three heads:
*
/* SECTION: This is the evaluator. Like any real monster, it has * scm_ceval is the non-debugging evaluator, scm_deval is the debugging
* three heads. This code is compiled twice. * version. Both are implemented using a common code base, using the
*/ * following mechanism: SCM_CEVAL is a macro, which is either defined to
* scm_ceval or scm_deval. Thus, there is no function SCM_CEVAL, but the code
* for SCM_CEVAL actually compiles to either scm_ceval or scm_deval. When
* SCM_CEVAL is defined to scm_ceval, it is known that the macro DEVAL is not
* defined. When SCM_CEVAL is defined to scm_deval, then the macro DEVAL is
* known to be defined. Thus, in SCM_CEVAL parts for the debugging evaluator
* are enclosed within #ifdef DEVAL ... #endif.
*
* All three (scm_ceval, scm_deval and their common implementation SCM_CEVAL)
* take two input parameters, x and env: x is a single expression to be
* evalutated. env is the environment in which bindings are searched.
*
* x is known to be a cell (i. e. a pair or any other non-immediate). Since x
* is a single expression, it is necessarily in a tail position. If x is just
* a call to another function like in the expression (foo exp1 exp2 ...), the
* realization of that call therefore _must_not_ increase stack usage (the
* evaluation of exp1, exp2 etc., however, may do so). This is realized by
* making extensive use of 'goto' statements within the evaluator: The gotos
* replace recursive calls to SCM_CEVAL, thus re-using the same stack frame
* that SCM_CEVAL was already using. If, however, x represents some form that
* requires to evaluate a sequence of expressions like (begin exp1 exp2 ...),
* then recursive calls to SCM_CEVAL are performed for all but the last
* expression of that sequence. */
#if 0 #if 0
SCM SCM
scm_ceval (SCM x, SCM env) scm_ceval (SCM x, SCM env)
{} {}
#endif #endif
#if 0
#if 0
SCM SCM
scm_deval (SCM x, SCM env) scm_deval (SCM x, SCM env)
{} {}
@ -1904,7 +1925,7 @@ SCM_CEVAL (SCM x, SCM env)
* Even frames are eval frames, odd frames are apply frames. * Even frames are eval frames, odd frames are apply frames.
*/ */
debug.vect = (scm_t_debug_info *) alloca (scm_debug_eframe_size debug.vect = (scm_t_debug_info *) alloca (scm_debug_eframe_size
* sizeof (debug.vect[0])); * sizeof (scm_t_debug_info));
debug.info = debug.vect; debug.info = debug.vect;
debug_info_end = debug.vect + scm_debug_eframe_size; debug_info_end = debug.vect + scm_debug_eframe_size;
scm_last_debug_frame = &debug; scm_last_debug_frame = &debug;
@ -1989,8 +2010,7 @@ dispatch:
switch (SCM_TYP7 (x)) switch (SCM_TYP7 (x))
{ {
case scm_tc7_symbol: case scm_tc7_symbol:
/* Only happens when called at top level. /* Only happens when called at top level. */
*/
x = scm_cons (x, SCM_UNDEFINED); x = scm_cons (x, SCM_UNDEFINED);
RETURN (*scm_lookupcar (x, env, 1)); RETURN (*scm_lookupcar (x, env, 1));
@ -2279,7 +2299,7 @@ dispatch:
case SCM_BIT8(SCM_MAKISYM (0)): case SCM_BIT8(SCM_MAKISYM (0)):
proc = SCM_CAR (x); proc = SCM_CAR (x);
SCM_ASRTGO (SCM_ISYMP (proc), badfun); SCM_ASRTGO (SCM_ISYMP (proc), badfun);
switch SCM_ISYMNUM (proc) switch (SCM_ISYMNUM (proc))
{ {
case (SCM_ISYMNUM (SCM_IM_APPLY)): case (SCM_ISYMNUM (SCM_IM_APPLY)):
proc = SCM_CDR (x); proc = SCM_CDR (x);
@ -2575,7 +2595,6 @@ dispatch:
default: default:
proc = x; proc = x;
badfun: badfun:
/* scm_everr (x, env,...) */
scm_misc_error (NULL, "Wrong type to apply: ~S", scm_list_1 (proc)); scm_misc_error (NULL, "Wrong type to apply: ~S", scm_list_1 (proc));
case scm_tc7_vector: case scm_tc7_vector:
case scm_tc7_wvect: case scm_tc7_wvect:
@ -2790,7 +2809,6 @@ evapply:
umwrongnumargs: umwrongnumargs:
unmemocar (x, env); unmemocar (x, env);
wrongnumargs: wrongnumargs:
/* scm_everr (x, env,...) */
scm_wrong_num_args (proc); scm_wrong_num_args (proc);
default: default:
/* handle macros here */ /* handle macros here */
@ -3069,8 +3087,7 @@ evapply:
#endif #endif
#ifdef DEVAL #ifdef DEVAL
debug.info->a.args = scm_cons2 (t.arg1, arg2, debug.info->a.args = scm_cons2 (t.arg1, arg2,
scm_deval_args (x, env, proc, deval_args (x, env, proc, SCM_CDRLOC (SCM_CDR (debug.info->a.args))));
SCM_CDRLOC (SCM_CDR (debug.info->a.args))));
#endif #endif
ENTER_APPLY; ENTER_APPLY;
evap3: evap3:
@ -3387,14 +3404,12 @@ SCM_DEFINE (scm_nconc2last, "apply:nconc2last", 1, 0, 0,
*/ */
#if 0 #if 0
SCM SCM
scm_apply (SCM proc, SCM arg1, SCM args) scm_apply (SCM proc, SCM arg1, SCM args)
{} {}
#endif #endif
#if 0 #if 0
SCM SCM
scm_dapply (SCM proc, SCM arg1, SCM args) scm_dapply (SCM proc, SCM arg1, SCM args)
{ /* empty */ } { /* empty */ }

View file

@ -2,6 +2,7 @@
#ifndef SCM_GOOPS_H #ifndef SCM_GOOPS_H
#define SCM_GOOPS_H #define SCM_GOOPS_H
/* Copyright (C) 1998,1999,2000,2001 Free Software Foundation, Inc. /* Copyright (C) 1998,1999,2000,2001 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -42,6 +43,7 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * If you do not wish that, delete this exception notice. */
/* This software is a derivative work of other copyrighted softwares; the /* This software is a derivative work of other copyrighted softwares; the
@ -313,4 +315,10 @@ SCM_API void scm_init_goops (void);
#endif #endif
#endif /* SCM_GOOPS_H */ #endif /* SCM_GOOPS_H */
/*
Local Variables:
c-file-style: "gnu"
End:
*/