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

* eval.c (SCM_CEVAL): Cleaned up the handling of 'slot-ref',

'slot-set!' and 'nil-cond'.  Removed some uses of t.arg1, arg2 and
proc as temporary variables.  Introduced temporary variables with
hopefully descriptive names for clarification.  Replaced SCM_N?IMP
by a more explicit predicate in some places.
This commit is contained in:
Dirk Herrmann 2002-03-10 07:53:27 +00:00
parent f12745b633
commit 1d15ecd303
2 changed files with 56 additions and 33 deletions

View file

@ -1,4 +1,12 @@
2002-03-02 Dirk Herrmann <D.Herrmann@tu-bs.de> 2002-03-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (SCM_CEVAL): Cleaned up the handling of 'slot-ref',
'slot-set!' and 'nil-cond'. Removed some uses of t.arg1, arg2 and
proc as temporary variables. Introduced temporary variables with
hopefully descriptive names for clarification. Replaced SCM_N?IMP
by a more explicit predicate in some places.
2002-03-09 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (SCM_CEVAL): Cleaned up the handling of #@dispatch. * eval.c (SCM_CEVAL): Cleaned up the handling of #@dispatch.
Added lots of comments regarding the implementation of #@dispatch. Added lots of comments regarding the implementation of #@dispatch.

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. /* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -2584,40 +2584,54 @@ dispatch:
} }
} }
case (SCM_ISYMNUM (SCM_IM_SLOT_REF)): case (SCM_ISYMNUM (SCM_IM_SLOT_REF)):
x = SCM_CDR (x); x = SCM_CDR (x);
t.arg1 = EVALCAR (x, env); {
RETURN (SCM_PACK (SCM_STRUCT_DATA (t.arg1) [SCM_INUM (SCM_CADR (x))])); SCM instance = EVALCAR (x, env);
unsigned long int slot = SCM_INUM (SCM_CADR (x));
RETURN (SCM_PACK (SCM_STRUCT_DATA (instance) [slot]));
}
case (SCM_ISYMNUM (SCM_IM_SLOT_SET_X)): case (SCM_ISYMNUM (SCM_IM_SLOT_SET_X)):
x = SCM_CDR (x); x = SCM_CDR (x);
t.arg1 = EVALCAR (x, env); {
x = SCM_CDR (x); SCM instance = EVALCAR (x, env);
proc = SCM_CDR (x); unsigned long int slot = SCM_INUM (SCM_CADR (x));
SCM_STRUCT_DATA (t.arg1) [SCM_INUM (SCM_CAR (x))] SCM value = EVALCAR (SCM_CDDR (x), env);
= SCM_UNPACK (EVALCAR (proc, env)); SCM_STRUCT_DATA (instance) [slot] = SCM_UNPACK (value);
RETURN (SCM_UNSPECIFIED); RETURN (SCM_UNSPECIFIED);
}
#ifdef SCM_ENABLE_ELISP #ifdef SCM_ENABLE_ELISP
case (SCM_ISYMNUM (SCM_IM_NIL_COND)): case (SCM_ISYMNUM (SCM_IM_NIL_COND)):
proc = SCM_CDR (x); {
while (SCM_NIMP (x = SCM_CDR (proc))) SCM test_form = SCM_CDR (x);
{ x = SCM_CDR (test_form);
if (!(SCM_FALSEP (t.arg1 = EVALCAR (proc, env)) while (!SCM_NULL_OR_NIL_P (x))
|| SCM_NILP (t.arg1) {
|| SCM_NULLP (t.arg1))) SCM test_result = EVALCAR (test_form, env);
{ if (!(SCM_FALSEP (test_result)
if (SCM_EQ_P (SCM_CAR (x), SCM_UNSPECIFIED)) || SCM_NULL_OR_NIL_P (test_result)))
RETURN (t.arg1); {
PREP_APPLY (SCM_UNDEFINED, SCM_EOL); if (SCM_EQ_P (SCM_CAR (x), SCM_UNSPECIFIED))
goto carloop; RETURN (test_result);
} PREP_APPLY (SCM_UNDEFINED, SCM_EOL);
proc = SCM_CDR (x); goto carloop;
} }
x = proc; else
PREP_APPLY (SCM_UNDEFINED, SCM_EOL); {
goto carloop; test_form = SCM_CDR (x);
x = SCM_CDR (test_form);
}
}
x = test_form;
PREP_APPLY (SCM_UNDEFINED, SCM_EOL);
goto carloop;
}
#endif /* SCM_ENABLE_ELISP */ #endif /* SCM_ENABLE_ELISP */
@ -2639,12 +2653,12 @@ dispatch:
scm_swap_bindings (vars, vals); scm_swap_bindings (vars, vals);
scm_dynwinds = scm_acons (vars, vals, scm_dynwinds); scm_dynwinds = scm_acons (vars, vals, scm_dynwinds);
arg2 = x = SCM_CDR (x); /* Ignore all but the last evaluation result. */
while (!SCM_NULLP (arg2 = SCM_CDR (arg2))) for (x = SCM_CDR (x); !SCM_NULLP (SCM_CDR (x)); x = SCM_CDR (x))
{ {
SIDEVAL (SCM_CAR (x), env); if (SCM_CONSP (SCM_CAR (x)))
x = arg2; SCM_CEVAL (SCM_CAR (x), env);
} }
proc = EVALCAR (x, env); proc = EVALCAR (x, env);
@ -2654,6 +2668,7 @@ dispatch:
RETURN (proc); RETURN (proc);
} }
case (SCM_ISYMNUM (SCM_IM_CALL_WITH_VALUES)): case (SCM_ISYMNUM (SCM_IM_CALL_WITH_VALUES)):
{ {
proc = SCM_CDR (x); proc = SCM_CDR (x);