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

* eval.c (SCM_CEVAL, SCM_APPLY): Eliminated labels wrongnumargs

and the corresponding goto statements.  Removed redundant code.
This commit is contained in:
Dirk Herrmann 2002-03-23 00:39:25 +00:00
parent c44b6ec0d3
commit ab1f10940c
2 changed files with 46 additions and 32 deletions

View file

@ -1,3 +1,8 @@
2002-03-23 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (SCM_CEVAL, SCM_APPLY): Eliminated labels wrongnumargs
and the corresponding goto statements. Removed redundant code.
2002-03-21 Dirk Herrmann <D.Herrmann@tu-bs.de> 2002-03-21 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eval.c (SCM_CEVAL): Minimized scope of variable arg2. * eval.c (SCM_CEVAL): Minimized scope of variable arg2.

View file

@ -2363,7 +2363,7 @@ dispatch:
#endif #endif
#ifndef SCM_RECKLESS #ifndef SCM_RECKLESS
if (scm_badargsp (formals, arg1)) if (scm_badargsp (formals, arg1))
goto wrongnumargs; scm_wrong_num_args (proc);
#endif #endif
ENTER_APPLY; ENTER_APPLY;
/* Copy argument list */ /* Copy argument list */
@ -2903,7 +2903,6 @@ evapply: /* inputs: x, proc */
case scm_tc7_lsubr_2: case scm_tc7_lsubr_2:
umwrongnumargs: umwrongnumargs:
unmemocar (x, env); unmemocar (x, env);
wrongnumargs:
scm_wrong_num_args (proc); scm_wrong_num_args (proc);
default: default:
/* handle macros here */ /* handle macros here */
@ -2917,7 +2916,7 @@ evapply: /* inputs: x, proc */
if (SCM_CONSP (x)) if (SCM_CONSP (x))
arg1 = EVALCAR (x, env); arg1 = EVALCAR (x, env);
else else
goto wrongnumargs; scm_wrong_num_args (proc);
#else #else
arg1 = EVALCAR (x, env); arg1 = EVALCAR (x, env);
#endif #endif
@ -3043,7 +3042,7 @@ evapply: /* inputs: x, proc */
case scm_tc7_subr_0: case scm_tc7_subr_0:
case scm_tc7_subr_3: case scm_tc7_subr_3:
case scm_tc7_lsubr_2: case scm_tc7_lsubr_2:
goto wrongnumargs; scm_wrong_num_args (proc);
default: default:
goto badfun; goto badfun;
} }
@ -3052,7 +3051,7 @@ evapply: /* inputs: x, proc */
if (SCM_CONSP (x)) if (SCM_CONSP (x))
arg2 = EVALCAR (x, env); arg2 = EVALCAR (x, env);
else else
goto wrongnumargs; scm_wrong_num_args (proc);
#else #else
arg2 = EVALCAR (x, env); arg2 = EVALCAR (x, env);
#endif #endif
@ -3138,7 +3137,7 @@ evapply: /* inputs: x, proc */
case scm_tc7_subr_1o: case scm_tc7_subr_1o:
case scm_tc7_subr_1: case scm_tc7_subr_1:
case scm_tc7_subr_3: case scm_tc7_subr_3:
goto wrongnumargs; scm_wrong_num_args (proc);
default: default:
goto badfun; goto badfun;
case scm_tc7_pws: case scm_tc7_pws:
@ -3166,7 +3165,7 @@ evapply: /* inputs: x, proc */
} }
#ifdef SCM_CAUTIOUS #ifdef SCM_CAUTIOUS
if (!SCM_CONSP (x)) if (!SCM_CONSP (x))
goto wrongnumargs; scm_wrong_num_args (proc);
#endif #endif
#ifdef DEVAL #ifdef DEVAL
debug.info->a.args = scm_cons2 (arg1, arg2, debug.info->a.args = scm_cons2 (arg1, arg2,
@ -3179,9 +3178,11 @@ evapply: /* inputs: x, proc */
{ /* have 3 or more arguments */ { /* have 3 or more arguments */
#ifdef DEVAL #ifdef DEVAL
case scm_tc7_subr_3: case scm_tc7_subr_3:
SCM_ASRTGO (SCM_NULLP (SCM_CDR (x)), wrongnumargs); if (!SCM_NULLP (SCM_CDR (x)))
RETURN (SCM_SUBRF (proc) (arg1, arg2, scm_wrong_num_args (proc);
SCM_CADDR (debug.info->a.args))); else
RETURN (SCM_SUBRF (proc) (arg1, arg2,
SCM_CADDR (debug.info->a.args)));
case scm_tc7_asubr: case scm_tc7_asubr:
arg1 = SCM_SUBRF(proc)(arg1, arg2); arg1 = SCM_SUBRF(proc)(arg1, arg2);
arg2 = SCM_CDDR (debug.info->a.args); arg2 = SCM_CDDR (debug.info->a.args);
@ -3233,8 +3234,10 @@ evapply: /* inputs: x, proc */
goto nontoplevel_begin; goto nontoplevel_begin;
#else /* DEVAL */ #else /* DEVAL */
case scm_tc7_subr_3: case scm_tc7_subr_3:
SCM_ASRTGO (SCM_NULLP (SCM_CDR (x)), wrongnumargs); if (!SCM_NULLP (SCM_CDR (x)))
RETURN (SCM_SUBRF (proc) (arg1, arg2, EVALCAR (x, env))); scm_wrong_num_args (proc);
else
RETURN (SCM_SUBRF (proc) (arg1, arg2, EVALCAR (x, env)));
case scm_tc7_asubr: case scm_tc7_asubr:
arg1 = SCM_SUBRF (proc) (arg1, arg2); arg1 = SCM_SUBRF (proc) (arg1, arg2);
do do
@ -3316,7 +3319,7 @@ evapply: /* inputs: x, proc */
case scm_tc7_subr_0: case scm_tc7_subr_0:
case scm_tc7_cxr: case scm_tc7_cxr:
case scm_tc7_subr_1: case scm_tc7_subr_1:
goto wrongnumargs; scm_wrong_num_args (proc);
default: default:
goto badfun; goto badfun;
} }
@ -3583,20 +3586,26 @@ tail:
args = SCM_NULLP (args) ? SCM_UNDEFINED : SCM_CAR (args); args = SCM_NULLP (args) ? SCM_UNDEFINED : SCM_CAR (args);
RETURN (SCM_SUBRF (proc) (arg1, args)); RETURN (SCM_SUBRF (proc) (arg1, args));
case scm_tc7_subr_2: case scm_tc7_subr_2:
SCM_ASRTGO (!SCM_NULLP (args) && SCM_NULLP (SCM_CDR (args)), if (SCM_NULLP (args) || !SCM_NULLP (SCM_CDR (args)))
wrongnumargs); scm_wrong_num_args (proc);
args = SCM_CAR (args); args = SCM_CAR (args);
RETURN (SCM_SUBRF (proc) (arg1, args)); RETURN (SCM_SUBRF (proc) (arg1, args));
case scm_tc7_subr_0: case scm_tc7_subr_0:
SCM_ASRTGO (SCM_UNBNDP (arg1), wrongnumargs); if (!SCM_UNBNDP (arg1))
RETURN (SCM_SUBRF (proc) ()); scm_wrong_num_args (proc);
else
RETURN (SCM_SUBRF (proc) ());
case scm_tc7_subr_1: case scm_tc7_subr_1:
SCM_ASRTGO (!SCM_UNBNDP (arg1), wrongnumargs); if (SCM_UNBNDP (arg1))
scm_wrong_num_args (proc);
case scm_tc7_subr_1o: case scm_tc7_subr_1o:
SCM_ASRTGO (SCM_NULLP (args), wrongnumargs); if (!SCM_NULLP (args))
RETURN (SCM_SUBRF (proc) (arg1)); scm_wrong_num_args (proc);
else
RETURN (SCM_SUBRF (proc) (arg1));
case scm_tc7_cxr: case scm_tc7_cxr:
SCM_ASRTGO (!SCM_UNBNDP (arg1) && SCM_NULLP (args), wrongnumargs); if (SCM_UNBNDP (arg1) || !SCM_NULLP (args))
scm_wrong_num_args (proc);
if (SCM_SUBRF (proc)) if (SCM_SUBRF (proc))
{ {
if (SCM_INUMP (arg1)) if (SCM_INUMP (arg1))
@ -3626,11 +3635,12 @@ tail:
RETURN (arg1); RETURN (arg1);
} }
case scm_tc7_subr_3: case scm_tc7_subr_3:
SCM_ASRTGO (!SCM_NULLP (args) if (SCM_NULLP (args)
&& !SCM_NULLP (SCM_CDR (args)) || SCM_NULLP (SCM_CDR (args))
&& SCM_NULLP (SCM_CDDR (args)), || !SCM_NULLP (SCM_CDDR (args)))
wrongnumargs); scm_wrong_num_args (proc);
RETURN (SCM_SUBRF (proc) (arg1, SCM_CAR (args), SCM_CADR (args))); else
RETURN (SCM_SUBRF (proc) (arg1, SCM_CAR (args), SCM_CADR (args)));
case scm_tc7_lsubr: case scm_tc7_lsubr:
#ifdef DEVAL #ifdef DEVAL
RETURN (SCM_SUBRF (proc) (SCM_UNBNDP (arg1) ? SCM_EOL : debug.vect[0].a.args)); RETURN (SCM_SUBRF (proc) (SCM_UNBNDP (arg1) ? SCM_EOL : debug.vect[0].a.args));
@ -3638,8 +3648,10 @@ tail:
RETURN (SCM_SUBRF (proc) (SCM_UNBNDP (arg1) ? SCM_EOL : scm_cons (arg1, args))); RETURN (SCM_SUBRF (proc) (SCM_UNBNDP (arg1) ? SCM_EOL : scm_cons (arg1, args)));
#endif #endif
case scm_tc7_lsubr_2: case scm_tc7_lsubr_2:
SCM_ASRTGO (SCM_CONSP (args), wrongnumargs); if (!SCM_CONSP (args))
RETURN (SCM_SUBRF (proc) (arg1, SCM_CAR (args), SCM_CDR (args))); scm_wrong_num_args (proc);
else
RETURN (SCM_SUBRF (proc) (arg1, SCM_CAR (args), SCM_CDR (args)));
case scm_tc7_asubr: case scm_tc7_asubr:
if (SCM_NULLP (args)) if (SCM_NULLP (args))
RETURN (SCM_SUBRF (proc) (arg1, SCM_UNDEFINED)); RETURN (SCM_SUBRF (proc) (arg1, SCM_UNDEFINED));
@ -3670,7 +3682,7 @@ tail:
#endif #endif
#ifndef SCM_RECKLESS #ifndef SCM_RECKLESS
if (scm_badargsp (SCM_CLOSURE_FORMALS (proc), arg1)) if (scm_badargsp (SCM_CLOSURE_FORMALS (proc), arg1))
goto wrongnumargs; scm_wrong_num_args (proc);
#endif #endif
/* Copy argument list */ /* Copy argument list */
@ -3771,12 +3783,9 @@ tail:
else else
goto badproc; goto badproc;
} }
wrongnumargs:
scm_wrong_num_args (proc);
default: default:
badproc: badproc:
scm_wrong_type_arg ("apply", SCM_ARG1, proc); scm_wrong_type_arg ("apply", SCM_ARG1, proc);
RETURN (arg1);
} }
#ifdef DEVAL #ifdef DEVAL
exit: exit: