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>
* eval.c (SCM_CEVAL): Minimized scope of variable arg2.

View file

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