From e6f14352d61721db83b46e0e56c4d19b731fed95 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 14 Jun 2010 11:57:08 +0000 Subject: 28037: improved error messages for module autoloads of math functions and builtins --- Src/exec.c | 6 ++++-- Src/math.c | 3 ++- Src/module.c | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Src') diff --git a/Src/exec.c b/Src/exec.c index 8fd52420b..6611e9c79 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2274,18 +2274,20 @@ static HashNode resolvebuiltin(const char *cmdarg, HashNode hn) { if (!((Builtin) hn)->handlerfunc) { + char *modname = dupstring(((Builtin) hn)->optstr); /* * Ensure the module is loaded and the * feature corresponding to the builtin * is enabled. */ - (void)ensurefeature(((Builtin) hn)->optstr, "b:", + (void)ensurefeature(modname, "b:", (hn->flags & BINF_AUTOALL) ? NULL : hn->nam); hn = builtintab->getnode(builtintab, cmdarg); if (!hn) { lastval = 1; - zerr("unknown builtin: %s", cmdarg); + zerr("autoloading module %s failed to define builtin: %s", + modname, cmdarg); return NULL; } } diff --git a/Src/math.c b/Src/math.c index a19c8c762..caff06de9 100644 --- a/Src/math.c +++ b/Src/math.c @@ -941,8 +941,9 @@ callmathfunc(char *o) zerr("wrong number of arguments: %s", o); } } - } else + } else { zerr("unknown function: %s", n); + } dummy.type = MN_INTEGER; dummy.u.l = 0; diff --git a/Src/module.c b/Src/module.c index 4f71153b7..219bdfa8e 100644 --- a/Src/module.c +++ b/Src/module.c @@ -1273,7 +1273,10 @@ getmathfunc(const char *name, int autol) (void)ensurefeature(n, "f:", (flags & MFF_AUTOALL) ? NULL : name); - return getmathfunc(name, 0); + p = getmathfunc(name, 0); + if (!p) { + zerr("autoloading module %s failed to define math function: %s", n, name); + } } return p; } -- cgit 1.4.1