From 7b098e95ad7cdf032ad1b94a27024120aff8ace0 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Wed, 28 Aug 2024 18:21:35 -0400 Subject: [PATCH] Make error messages more consistent. --- src/err.h | 2 +- src/expr.c | 8 ++++---- src/funcs.c | 1 + tests/test.cmp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/err.h b/src/err.h index ccbebb04..c5dd314e 100644 --- a/src/err.h +++ b/src/err.h @@ -204,7 +204,7 @@ EXTERN char *ErrMsg[] /* E_ERR_READING */ "Error reading", /* E_EXPECTING_EOL */ "Expecting end-of-line", /* E_BAD_HEBDATE */ "Invalid Hebrew date", -/* E_IIF_ODD */ "IIF needs odd number of arguments", +/* E_IIF_ODD */ "iif(): odd number of arguments required", /* E_MISS_ENDIF */ "Warning: Missing ENDIF", /* E_EXPECT_COMMA */ "Expecting comma", /* E_WD_TWICE */ "Weekday specified twice", diff --git a/src/expr.c b/src/expr.c index ff815391..ddb2ab91 100644 --- a/src/expr.c +++ b/src/expr.c @@ -426,11 +426,11 @@ eval_builtin(expr_node *node, Value *locals, Value *ans, int *nonconst) /* Check that we have the right number of argumens */ if (node->num_kids < f->minargs) { - Eprint("%s: %s", f->name, ErrMsg[E_2FEW_ARGS]); + Eprint("%s(): %s", f->name, ErrMsg[E_2FEW_ARGS]); return E_2FEW_ARGS; } if (node->num_kids > f->maxargs && f->maxargs != NO_MAX) { - Eprint("%s: %s", f->name, ErrMsg[E_2MANY_ARGS]); + Eprint("%s(): %s", f->name, ErrMsg[E_2MANY_ARGS]); return E_2MANY_ARGS; } @@ -628,12 +628,12 @@ eval_userfunc(expr_node *node, Value *locals, Value *ans, int *nonconst) /* Make sure we have the right number of arguments */ if (node->num_kids < f->nargs) { DBG(fprintf(ErrFp, "%s(...) => %s\n", fname, ErrMsg[E_2FEW_ARGS])); - Eprint("%s: %s", f->name, ErrMsg[E_2FEW_ARGS]); + Eprint("%s(): %s", f->name, ErrMsg[E_2FEW_ARGS]); return E_2FEW_ARGS; } if (node->num_kids > f->nargs) { DBG(fprintf(ErrFp, "%s(...) => %s\n", fname, ErrMsg[E_2MANY_ARGS])); - Eprint("%s: %s", f->name, ErrMsg[E_2MANY_ARGS]); + Eprint("%s(): %s", f->name, ErrMsg[E_2MANY_ARGS]); return E_2MANY_ARGS; } diff --git a/src/funcs.c b/src/funcs.c index e4e019d7..ba7bcf63 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -1284,6 +1284,7 @@ static int FChoose(expr_node *node, Value *locals, Value *ans, int *nonconst) PUT(ErrMsg[E_BAD_TYPE]); OUT(); } + Eprint("choose(): %s", ErrMsg[E_BAD_TYPE]); return E_BAD_TYPE; } n = v.v.val; diff --git a/tests/test.cmp b/tests/test.cmp index b959f4a8..3a4cfec7 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -5687,10 +5687,10 @@ set zxk max() fset dooby(x) 1 set zxk dooby() dooby(...) => Not enough arguments -../tests/test.rem(1118): dooby: Not enough arguments +../tests/test.rem(1118): dooby(): Not enough arguments set zxk dooby(1, 2) dooby(...) => Too many arguments -../tests/test.rem(1119): dooby: Too many arguments +../tests/test.rem(1119): dooby(): Too many arguments set zxk dooby(1) Entering UserFN dooby(1) Leaving UserFN dooby(1) => 1