This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patches to eval.c


Good afternoon.

If nobody objects, I am going to apply the below patch to eval.c.  

The patch removes a call to bodycheck, which performs a redundant test:  The
SCM_ASSYNT assertion preceding the call to bodycheck performs exactly the same
test as is performed within bodycheck.  Since this is the only place where
bodycheck is called, the function can then be removed completely.

Further, the ASRTSYNTAX macro is replaced by the more explicit SCM_ASSYNT
form, because ASRTSYNTAX is only used few times and makes implicit assumptions
about existing variables.  In contrast, SCM_ASSYNT is much clearer and is used
all over eval.c.

Best regards
Dirk Herrmann


Index: eval.c
===================================================================
RCS file: /cvs/guile/guile/guile-core/libguile/eval.c,v
retrieving revision 1.157
diff -u -r1.157 eval.c
--- eval.c      2000/05/05 11:10:57     1.157
+++ eval.c      2000/05/05 14:12:00
@@ -459,18 +459,7 @@
 SCM scm_sym_trace;
 #endif
 
-#define ASRTSYNTAX(cond_, msg_) if(!(cond_))scm_wta(xorig, (msg_), what);
 
-
-
-static void  bodycheck (SCM xorig, SCM *bodyloc, const char *what);
-
-static void 
-bodycheck (SCM xorig, SCM *bodyloc, const char *what)
-{
-  ASRTSYNTAX (scm_ilength (*bodyloc) >= 1, scm_s_expression);
-}
-
 /* Check that the body denoted by XORIG is valid and rewrite it into
    its internal form.  The internal form of a body is just the body
    itself, but prefixed with an ISYM that denotes to what kind of
@@ -487,7 +476,7 @@
 static SCM
 scm_m_body (SCM op, SCM xorig, const char *what)
 {
-  ASRTSYNTAX (scm_ilength (xorig) >= 1, scm_s_expression);
+  SCM_ASSYNT (scm_ilength (xorig) >= 1, xorig, scm_s_expression, what);
 
   /* Don't add another ISYM if one is present already. */
   if (SCM_ISYMP (SCM_CAR (xorig)))
@@ -789,7 +778,6 @@
   SCM_ASSYNT (scm_ilength (SCM_CAR (x)) >= 1, xorig, scm_s_test, "do");
   x = scm_cons2 (SCM_CAR (x), SCM_CDR (x), steps);
   x = scm_cons2 (vars, inits, x);
-  bodycheck (xorig, SCM_CARLOC (SCM_CDR (SCM_CDR (x))), "do");
   return scm_cons (SCM_IM_DO, x);
 }
 
@@ -942,14 +930,13 @@
   SCM vars = SCM_EOL, inits = SCM_EOL, *initloc = &inits;
 
   proc = SCM_CAR (x);
-  ASRTSYNTAX (scm_ilength (proc) >= 1, scm_s_bindings);
+  SCM_ASSYNT (scm_ilength (proc) >= 1, xorig, scm_s_bindings, what);
   do
     {
       /* vars scm_list reversed here, inits reversed at evaluation */
       arg1 = SCM_CAR (proc);
-      ASRTSYNTAX (2 == scm_ilength (arg1), scm_s_bindings);
-      ASRTSYNTAX (SCM_SYMBOLP (SCM_CAR (arg1)),
-                 scm_s_variable);
+      SCM_ASSYNT (2 == scm_ilength (arg1), xorig, scm_s_bindings, what);
+      SCM_ASSYNT (SCM_SYMBOLP (SCM_CAR (arg1)), xorig, scm_s_variable, what);
       vars = scm_cons (SCM_CAR (arg1), vars);
       *initloc = scm_cons (SCM_CAR (SCM_CDR (arg1)), SCM_EOL);
       initloc = SCM_CDRLOC (*initloc);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]