aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:23 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:23 -0300
commitf388ee4a822b3d8027ed7c28aa21e9406e4a11eb (patch)
tree33053e6e31ac1dee0fe27ff7fdba64325a624fe1 /lvm.c
parent30ad4c75db38639f52fb1c8be1c5a3f5b58e776f (diff)
downloadlua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.tar.gz
lua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.tar.bz2
lua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.zip
new way to handle errors
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lvm.c b/lvm.c
index 9079b32b..a8f8d983 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.224 2002/04/09 19:47:44 roberto Exp roberto $ 2** $Id: lvm.c,v 1.225 2002/04/10 12:11:07 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -134,7 +134,7 @@ void luaV_gettable (lua_State *L, const TObject *t, TObject *key, StkId res) {
134 if (ttype(tm) == LUA_TFUNCTION) 134 if (ttype(tm) == LUA_TFUNCTION)
135 callTMres(L, tm, t, key, res); 135 callTMres(L, tm, t, key, res);
136 else { 136 else {
137 if (++loop == MAXTAGLOOP) luaD_error(L, "loop in gettable"); 137 if (++loop == MAXTAGLOOP) luaD_runerror(L, "loop in gettable");
138 t = tm; 138 t = tm;
139 goto init; /* return luaV_gettable(L, tm, key, res); */ 139 goto init; /* return luaV_gettable(L, tm, key, res); */
140 } 140 }
@@ -164,7 +164,7 @@ void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val) {
164 if (ttype(tm) == LUA_TFUNCTION) 164 if (ttype(tm) == LUA_TFUNCTION)
165 callTM(L, tm, t, key, val); 165 callTM(L, tm, t, key, val);
166 else { 166 else {
167 if (++loop == MAXTAGLOOP) luaD_error(L, "loop in settable"); 167 if (++loop == MAXTAGLOOP) luaD_runerror(L, "loop in settable");
168 t = tm; 168 t = tm;
169 goto init; /* luaV_settable(L, tm, key, val); */ 169 goto init; /* luaV_settable(L, tm, key, val); */
170 } 170 }
@@ -241,7 +241,7 @@ void luaV_strconc (lua_State *L, int total, int last) {
241 tl += tsvalue(top-n-1)->tsv.len; 241 tl += tsvalue(top-n-1)->tsv.len;
242 n++; 242 n++;
243 } 243 }
244 if (tl > MAX_SIZET) luaD_error(L, "string size overflow"); 244 if (tl > MAX_SIZET) luaD_runerror(L, "string size overflow");
245 buffer = luaO_openspace(L, tl, char); 245 buffer = luaO_openspace(L, tl, char);
246 tl = 0; 246 tl = 0;
247 for (i=n; i>0; i--) { /* concat all strings */ 247 for (i=n; i>0; i--) { /* concat all strings */
@@ -266,7 +266,7 @@ static void powOp (lua_State *L, StkId ra, StkId rb, StkId rc) {
266 setsvalue(&o, luaS_newliteral(L, "pow")); 266 setsvalue(&o, luaS_newliteral(L, "pow"));
267 luaV_gettable(L, gt(L), &o, &f); 267 luaV_gettable(L, gt(L), &o, &f);
268 if (ttype(&f) != LUA_TFUNCTION) 268 if (ttype(&f) != LUA_TFUNCTION)
269 luaD_error(L, "`pow' (for `^' operator) is not a function"); 269 luaD_runerror(L, "`pow' (for `^' operator) is not a function");
270 callTMres(L, &f, b, c, ra); 270 callTMres(L, &f, b, c, ra);
271 } 271 }
272 else 272 else
@@ -535,11 +535,11 @@ StkId luaV_execute (lua_State *L) {
535 const TObject *plimit = ra+1; 535 const TObject *plimit = ra+1;
536 const TObject *pstep = ra+2; 536 const TObject *pstep = ra+2;
537 if (ttype(ra) != LUA_TNUMBER) 537 if (ttype(ra) != LUA_TNUMBER)
538 luaD_error(L, "`for' initial value must be a number"); 538 luaD_runerror(L, "`for' initial value must be a number");
539 if (!tonumber(plimit, ra+1)) 539 if (!tonumber(plimit, ra+1))
540 luaD_error(L, "`for' limit must be a number"); 540 luaD_runerror(L, "`for' limit must be a number");
541 if (!tonumber(pstep, ra+2)) 541 if (!tonumber(pstep, ra+2))
542 luaD_error(L, "`for' step must be a number"); 542 luaD_runerror(L, "`for' step must be a number");
543 step = nvalue(pstep); 543 step = nvalue(pstep);
544 index = nvalue(ra) + step; /* increment index */ 544 index = nvalue(ra) + step; /* increment index */
545 limit = nvalue(plimit); 545 limit = nvalue(plimit);