diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-11-03 19:00:23 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-11-03 19:00:23 -0200 |
commit | 66713181c1506f99cc0dbac186ff873e7799dcba (patch) | |
tree | dc674b3a7d58b67d24dee1ee6a4dc23cf41a8855 /ldo.c | |
parent | 7135803cc87fafe80494bdc094613515487410b9 (diff) | |
download | lua-66713181c1506f99cc0dbac186ff873e7799dcba.tar.gz lua-66713181c1506f99cc0dbac186ff873e7799dcba.tar.bz2 lua-66713181c1506f99cc0dbac186ff873e7799dcba.zip |
no need of "emergency error"...
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 23 |
1 files changed, 3 insertions, 20 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.4 1997/10/23 16:26:37 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.5 1997/10/24 17:17:24 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 | */ |
@@ -45,28 +45,14 @@ static jmp_buf *errorJmp = NULL; /* current error recover point */ | |||
45 | ** Error messages | 45 | ** Error messages |
46 | */ | 46 | */ |
47 | 47 | ||
48 | static void auxerrorim (char *form) | 48 | static void stderrorim (void) |
49 | { | 49 | { |
50 | lua_Object s = lua_getparam(1); | 50 | lua_Object s = lua_getparam(1); |
51 | if (lua_isstring(s)) | 51 | if (lua_isstring(s)) |
52 | fprintf(stderr, form, lua_getstring(s)); | 52 | fprintf(stderr, "lua error: %s\n", lua_getstring(s)); |
53 | } | ||
54 | |||
55 | |||
56 | static void femergencyerror (void) | ||
57 | { | ||
58 | auxerrorim("THERE WAS AN ERROR INSIDE AN ERROR METHOD:\n%s\n"); | ||
59 | } | 53 | } |
60 | 54 | ||
61 | |||
62 | static void stderrorim (void) | ||
63 | { | ||
64 | auxerrorim("lua: %s\n"); | ||
65 | } | ||
66 | |||
67 | |||
68 | TObject luaD_errorim; | 55 | TObject luaD_errorim; |
69 | static TObject emergencyerror; | ||
70 | 56 | ||
71 | 57 | ||
72 | static void initCfunc (TObject *o, lua_CFunction f) | 58 | static void initCfunc (TObject *o, lua_CFunction f) |
@@ -88,7 +74,6 @@ static void initstack (int n) | |||
88 | *luaD_stack.stack = initial_stack; | 74 | *luaD_stack.stack = initial_stack; |
89 | luaB_predefine(); | 75 | luaB_predefine(); |
90 | initCfunc(&luaD_errorim, stderrorim); | 76 | initCfunc(&luaD_errorim, stderrorim); |
91 | initCfunc(&emergencyerror, femergencyerror); | ||
92 | } | 77 | } |
93 | 78 | ||
94 | 79 | ||
@@ -261,10 +246,8 @@ static void message (char *s) | |||
261 | { | 246 | { |
262 | TObject im = luaD_errorim; | 247 | TObject im = luaD_errorim; |
263 | if (ttype(&im) != LUA_T_NIL) { | 248 | if (ttype(&im) != LUA_T_NIL) { |
264 | luaD_errorim = emergencyerror; | ||
265 | lua_pushstring(s); | 249 | lua_pushstring(s); |
266 | luaD_callTM(&im, 1, 0); | 250 | luaD_callTM(&im, 1, 0); |
267 | luaD_errorim = im; | ||
268 | } | 251 | } |
269 | } | 252 | } |
270 | 253 | ||