diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-09 11:50:16 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-09 11:50:16 -0300 |
| commit | 44b71ca81696dbec561c0172d1b81533f1c2153e (patch) | |
| tree | 1394282cedc0766c214d6a15d0e3503ab4684a1d | |
| parent | bad6365540ad9e17e51137a6797ff196d6b8d2a1 (diff) | |
| download | lua-44b71ca81696dbec561c0172d1b81533f1c2153e.tar.gz lua-44b71ca81696dbec561c0172d1b81533f1c2153e.tar.bz2 lua-44b71ca81696dbec561c0172d1b81533f1c2153e.zip | |
defines for _ERRORMESSAGE and _ALERT
| -rw-r--r-- | lbuiltin.c | 14 | ||||
| -rw-r--r-- | ldo.c | 4 | ||||
| -rw-r--r-- | liolib.c | 6 | ||||
| -rw-r--r-- | lua.h | 6 |
4 files changed, 17 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.107 2000/04/25 16:55:09 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.108 2000/05/08 19:32:53 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -106,7 +106,7 @@ void luaB__ALERT (lua_State *L) { | |||
| 106 | ** The library `liolib' redefines _ERRORMESSAGE for better error information. | 106 | ** The library `liolib' redefines _ERRORMESSAGE for better error information. |
| 107 | */ | 107 | */ |
| 108 | void luaB__ERRORMESSAGE (lua_State *L) { | 108 | void luaB__ERRORMESSAGE (lua_State *L) { |
| 109 | lua_Object al = lua_rawgetglobal(L, "_ALERT"); | 109 | lua_Object al = lua_rawgetglobal(L, LUA_ALERT); |
| 110 | if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */ | 110 | if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */ |
| 111 | const char *s = luaL_check_string(L, 1); | 111 | const char *s = luaL_check_string(L, 1); |
| 112 | char *buff = luaL_openspace(L, strlen(s)+sizeof("error: \n")); | 112 | char *buff = luaL_openspace(L, strlen(s)+sizeof("error: \n")); |
| @@ -301,9 +301,9 @@ void luaB_call (lua_State *L) { | |||
| 301 | int narg = (int)getnarg(L, arg); | 301 | int narg = (int)getnarg(L, arg); |
| 302 | int i, status; | 302 | int i, status; |
| 303 | if (err != LUA_NOOBJECT) { /* set new error method */ | 303 | if (err != LUA_NOOBJECT) { /* set new error method */ |
| 304 | lua_Object oldem = lua_getglobal(L, "_ERRORMESSAGE"); | 304 | lua_Object oldem = lua_getglobal(L, LUA_ERRORMESSAGE); |
| 305 | lua_pushobject(L, err); | 305 | lua_pushobject(L, err); |
| 306 | lua_setglobal(L, "_ERRORMESSAGE"); | 306 | lua_setglobal(L, LUA_ERRORMESSAGE); |
| 307 | err = oldem; | 307 | err = oldem; |
| 308 | } | 308 | } |
| 309 | /* push arg[1...n] */ | 309 | /* push arg[1...n] */ |
| @@ -313,7 +313,7 @@ void luaB_call (lua_State *L) { | |||
| 313 | status = lua_callfunction(L, f); | 313 | status = lua_callfunction(L, f); |
| 314 | if (err != LUA_NOOBJECT) { /* restore old error method */ | 314 | if (err != LUA_NOOBJECT) { /* restore old error method */ |
| 315 | lua_pushobject(L, err); | 315 | lua_pushobject(L, err); |
| 316 | lua_setglobal(L, "_ERRORMESSAGE"); | 316 | lua_setglobal(L, LUA_ERRORMESSAGE); |
| 317 | } | 317 | } |
| 318 | if (status != 0) { /* error in call? */ | 318 | if (status != 0) { /* error in call? */ |
| 319 | if (strchr(options, 'x')) { | 319 | if (strchr(options, 'x')) { |
| @@ -596,8 +596,8 @@ static void deprecated_funcs (lua_State *L) { | |||
| 596 | /* }====================================================== */ | 596 | /* }====================================================== */ |
| 597 | 597 | ||
| 598 | static const struct luaL_reg builtin_funcs[] = { | 598 | static const struct luaL_reg builtin_funcs[] = { |
| 599 | {"_ALERT", luaB__ALERT}, | 599 | {LUA_ALERT, luaB__ALERT}, |
| 600 | {"_ERRORMESSAGE", luaB__ERRORMESSAGE}, | 600 | {LUA_ERRORMESSAGE, luaB__ERRORMESSAGE}, |
| 601 | {"call", luaB_call}, | 601 | {"call", luaB_call}, |
| 602 | {"collectgarbage", luaB_collectgarbage}, | 602 | {"collectgarbage", luaB_collectgarbage}, |
| 603 | {"copytagmethods", luaB_copytagmethods}, | 603 | {"copytagmethods", luaB_copytagmethods}, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.73 2000/04/14 18:12:35 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.74 2000/05/08 19:32:53 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -223,7 +223,7 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
| 223 | 223 | ||
| 224 | 224 | ||
| 225 | static void message (lua_State *L, const char *s) { | 225 | static void message (lua_State *L, const char *s) { |
| 226 | const TObject *em = luaH_getglobal(L, "_ERRORMESSAGE"); | 226 | const TObject *em = luaH_getglobal(L, LUA_ERRORMESSAGE); |
| 227 | if (*luaO_typename(em) == 'f') { | 227 | if (*luaO_typename(em) == 'f') { |
| 228 | *L->top = *em; | 228 | *L->top = *em; |
| 229 | incr_top; | 229 | incr_top; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 1.61 2000/03/30 17:19:48 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.62 2000/04/24 21:05:11 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -537,7 +537,7 @@ static void errorfb (lua_State *L) { | |||
| 537 | char buff[MAXMESSAGE]; | 537 | char buff[MAXMESSAGE]; |
| 538 | int level = 1; /* skip level 0 (it's this function) */ | 538 | int level = 1; /* skip level 0 (it's this function) */ |
| 539 | lua_Debug ar; | 539 | lua_Debug ar; |
| 540 | lua_Object alertfunc = lua_rawgetglobal(L, "_ALERT"); | 540 | lua_Object alertfunc = lua_rawgetglobal(L, LUA_ALERT); |
| 541 | sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1))); | 541 | sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1))); |
| 542 | while (lua_getstack(L, level++, &ar)) { | 542 | while (lua_getstack(L, level++, &ar)) { |
| 543 | char buffchunk[60]; | 543 | char buffchunk[60]; |
| @@ -585,7 +585,7 @@ static void errorfb (lua_State *L) { | |||
| 585 | 585 | ||
| 586 | 586 | ||
| 587 | static const struct luaL_reg iolib[] = { | 587 | static const struct luaL_reg iolib[] = { |
| 588 | {"_ERRORMESSAGE", errorfb}, | 588 | {LUA_ERRORMESSAGE, errorfb}, |
| 589 | {"clock", io_clock}, | 589 | {"clock", io_clock}, |
| 590 | {"date", io_date}, | 590 | {"date", io_date}, |
| 591 | {"debug", io_debug}, | 591 | {"debug", io_debug}, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.49 2000/05/08 19:32:53 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.50 2000/05/08 19:37:10 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
| 5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
| @@ -16,6 +16,10 @@ | |||
| 16 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" | 16 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #define LUA_ALERT "_ALERT" | ||
| 20 | #define LUA_ERRORMESSAGE "_ERRORMESSAGE" | ||
| 21 | |||
| 22 | |||
| 19 | #define LUA_NOREF (-2) | 23 | #define LUA_NOREF (-2) |
| 20 | #define LUA_REFNIL (-1) | 24 | #define LUA_REFNIL (-1) |
| 21 | 25 | ||
