From d8678edddc98beab8eb78e63e698191a9ffd39b8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 18 Jun 2002 12:16:18 -0300 Subject: luaL_verror -> luaL_error --- liolib.c | 16 ++++++++-------- lmathlib.c | 4 ++-- lstrlib.c | 24 ++++++++++++------------ ltablib.c | 6 +++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/liolib.c b/liolib.c index 31fb4202..f0005e43 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.9 2002/06/06 12:43:08 roberto Exp roberto $ +** $Id: liolib.c,v 2.10 2002/06/06 18:17:33 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -124,7 +124,7 @@ static int io_open (lua_State *L) { static int io_popen (lua_State *L) { #ifndef POPEN - luaL_verror(L, "`popen' not supported"); + luaL_error(L, "`popen' not supported"); return 0; #else FILE *f = popen(luaL_check_string(L, 1), luaL_opt_string(L, 2, "r")); @@ -144,7 +144,7 @@ static FILE *getiofile (lua_State *L, const char *name) { lua_rawget(L, lua_upvalueindex(1)); f = tofile(L, -1); if (f == NULL) - luaL_verror(L, "%s is closed", name); + luaL_error(L, "%s is closed", name); return f; } @@ -267,7 +267,7 @@ static int g_read (lua_State *L, FILE *f, int first) { else { const char *p = lua_tostring(L, n); if (!p || p[0] != '*') - return luaL_verror(L, "invalid `read' option"); + return luaL_error(L, "invalid `read' option"); switch (p[1]) { case 'n': /* number */ success = read_number(L, f); @@ -280,7 +280,7 @@ static int g_read (lua_State *L, FILE *f, int first) { success = 1; /* always success */ break; case 'w': /* word */ - return luaL_verror(L, "obsolete option `*w'"); + return luaL_error(L, "obsolete option `*w'"); default: return luaL_argerror(L, n, "invalid format"); } @@ -439,7 +439,7 @@ static int io_rename (lua_State *L) { static int io_tmpname (lua_State *L) { char buff[L_tmpnam]; if (tmpnam(buff) != buff) - return luaL_verror(L, "unable to generate a unique filename"); + return luaL_error(L, "unable to generate a unique filename"); lua_pushstring(L, buff); return 1; } @@ -480,7 +480,7 @@ static int getfield (lua_State *L, const char *key, int d) { res = (int)(lua_tonumber(L, -1)); else { if (d == -2) - return luaL_verror(L, "field `%s' missing in date table", key); + return luaL_error(L, "field `%s' missing in date table", key); res = d; } lua_pop(L, 1); @@ -519,7 +519,7 @@ static int io_date (lua_State *L) { if (strftime(b, sizeof(b), s, stm)) lua_pushstring(L, b); else - return luaL_verror(L, "invalid `date' format"); + return luaL_error(L, "invalid `date' format"); } return 1; } diff --git a/lmathlib.c b/lmathlib.c index c14c5d72..559d3f1b 100644 --- a/lmathlib.c +++ b/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.45 2002/05/06 19:05:10 roberto Exp roberto $ +** $Id: lmathlib.c,v 1.46 2002/06/05 17:24:04 roberto Exp roberto $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -187,7 +187,7 @@ static int math_random (lua_State *L) { lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between `l' and `u' */ break; } - default: return luaL_verror(L, "wrong number of arguments"); + default: return luaL_error(L, "wrong number of arguments"); } return 1; } diff --git a/lstrlib.c b/lstrlib.c index 196a0ce4..a5a281c0 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.83 2002/06/05 17:24:04 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.84 2002/06/13 13:44:50 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -170,7 +170,7 @@ typedef struct MatchState { static int check_capture (MatchState *ms, int l) { l -= '1'; if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED) - return luaL_verror(ms->L, "invalid capture index"); + return luaL_error(ms->L, "invalid capture index"); return l; } @@ -179,7 +179,7 @@ static int capture_to_close (MatchState *ms) { int level = ms->level; for (level--; level>=0; level--) if (ms->capture[level].len == CAP_UNFINISHED) return level; - return luaL_verror(ms->L, "invalid pattern capture"); + return luaL_error(ms->L, "invalid pattern capture"); } @@ -187,13 +187,13 @@ static const char *luaI_classend (MatchState *ms, const char *p) { switch (*p++) { case ESC: if (*p == '\0') - luaL_verror(ms->L, "malformed pattern (ends with `%')"); + luaL_error(ms->L, "malformed pattern (ends with `%')"); return p+1; case '[': if (*p == '^') p++; do { /* look for a `]' */ if (*p == '\0') - luaL_verror(ms->L, "malformed pattern (missing `]')"); + luaL_error(ms->L, "malformed pattern (missing `]')"); if (*(p++) == ESC && *p != '\0') p++; /* skip escapes (e.g. `%]') */ } while (*p != ']'); @@ -266,7 +266,7 @@ static const char *match (MatchState *ms, const char *s, const char *p); static const char *matchbalance (MatchState *ms, const char *s, const char *p) { if (*p == 0 || *(p+1) == 0) - luaL_verror(ms->L, "unbalanced pattern"); + luaL_error(ms->L, "unbalanced pattern"); if (*s != *p) return NULL; else { int b = *p; @@ -315,7 +315,7 @@ static const char *start_capture (MatchState *ms, const char *s, const char *p, int what) { const char *res; int level = ms->level; - if (level >= MAX_CAPTURES) luaL_verror(ms->L, "too many captures"); + if (level >= MAX_CAPTURES) luaL_error(ms->L, "too many captures"); ms->capture[level].init = s; ms->capture[level].len = what; ms->level = level+1; @@ -425,7 +425,7 @@ static const char *lmemfind (const char *s1, size_t l1, static void push_onecapture (MatchState *ms, int i) { int l = ms->capture[i].len; - if (l == CAP_UNFINISHED) luaL_verror(ms->L, "unfinished capture"); + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); if (l == CAP_POSITION) lua_pushnumber(ms->L, ms->capture[i].init - ms->src_init + 1); else @@ -635,9 +635,9 @@ static const char *scanformat (lua_State *L, const char *strfrmt, if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ } if (isdigit(uchar(*p))) - luaL_verror(L, "invalid format (width or precision too long)"); + luaL_error(L, "invalid format (width or precision too long)"); if (p-strfrmt+2 > MAX_FORMAT) /* +2 to include `%' and the specifier */ - luaL_verror(L, "invalid format (too long)"); + luaL_error(L, "invalid format (too long)"); form[0] = '%'; strncpy(form+1, strfrmt, p-strfrmt+1); form[p-strfrmt+2] = 0; @@ -662,7 +662,7 @@ static int str_format (lua_State *L) { char buff[MAX_ITEM]; /* to store the formatted item */ int hasprecision = 0; if (isdigit(uchar(*strfrmt)) && *(strfrmt+1) == '$') - return luaL_verror(L, "obsolete `format' option (d$)"); + return luaL_error(L, "obsolete `format' option (d$)"); arg++; strfrmt = scanformat(L, strfrmt, form, &hasprecision); switch (*strfrmt++) { @@ -695,7 +695,7 @@ static int str_format (lua_State *L) { } } default: /* also treat cases `pnLlh' */ - return luaL_verror(L, "invalid option in `format'"); + return luaL_error(L, "invalid option in `format'"); } luaL_addlstring(&b, buff, strlen(buff)); } diff --git a/ltablib.c b/ltablib.c index e4250d0f..c28bb5bf 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.5 2002/06/05 17:24:04 roberto Exp roberto $ +** $Id: ltablib.c,v 1.6 2002/06/13 13:44:50 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -171,12 +171,12 @@ static void auxsort (lua_State *L, int l, int u) { for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ /* repeat ++i until a[i] >= P */ while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i>u) luaL_verror(L, "invalid order function for sorting"); + if (i>u) luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); /* remove a[i] */ } /* repeat --j until a[j] <= P */ while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { - if (j