diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.154 2001/01/18 15:59:09 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.155 2001/01/19 13:20:30 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 | */ |
@@ -219,7 +219,8 @@ static int call_binTM (lua_State *L, StkId top, TMS event) { | |||
219 | return 0; /* error */ | 219 | return 0; /* error */ |
220 | } | 220 | } |
221 | } | 221 | } |
222 | lua_pushstring(L, luaT_eventname[event]); | 222 | setsvalue(L->top, luaS_new(L, luaT_eventname[event])); |
223 | incr_top; | ||
223 | luaD_callTM(L, tm, 3, 1); | 224 | luaD_callTM(L, tm, 3, 1); |
224 | return 1; | 225 | return 1; |
225 | } | 226 | } |
@@ -287,7 +288,7 @@ void luaV_strconc (lua_State *L, int total, StkId top) { | |||
287 | tl += tsvalue(top-n-1)->len; | 288 | tl += tsvalue(top-n-1)->len; |
288 | n++; | 289 | n++; |
289 | } | 290 | } |
290 | if (tl > MAX_SIZET) lua_error(L, "string size overflow"); | 291 | if (tl > MAX_SIZET) luaD_error(L, "string size overflow"); |
291 | buffer = luaO_openspace(L, tl); | 292 | buffer = luaO_openspace(L, tl); |
292 | tl = 0; | 293 | tl = 0; |
293 | for (i=n; i>0; i--) { /* concat all strings */ | 294 | for (i=n; i>0; i--) { /* concat all strings */ |
@@ -520,7 +521,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
520 | } | 521 | } |
521 | case OP_POW: { | 522 | case OP_POW: { |
522 | if (!call_binTM(L, top, TM_POW)) | 523 | if (!call_binTM(L, top, TM_POW)) |
523 | lua_error(L, "undefined operation"); | 524 | luaD_error(L, "undefined operation"); |
524 | top--; | 525 | top--; |
525 | break; | 526 | break; |
526 | } | 527 | } |
@@ -606,11 +607,11 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
606 | } | 607 | } |
607 | case OP_FORPREP: { | 608 | case OP_FORPREP: { |
608 | if (tonumber(top-1)) | 609 | if (tonumber(top-1)) |
609 | lua_error(L, "`for' step must be a number"); | 610 | luaD_error(L, "`for' step must be a number"); |
610 | if (tonumber(top-2)) | 611 | if (tonumber(top-2)) |
611 | lua_error(L, "`for' limit must be a number"); | 612 | luaD_error(L, "`for' limit must be a number"); |
612 | if (tonumber(top-3)) | 613 | if (tonumber(top-3)) |
613 | lua_error(L, "`for' initial value must be a number"); | 614 | luaD_error(L, "`for' initial value must be a number"); |
614 | if (nvalue(top-1) > 0 ? | 615 | if (nvalue(top-1) > 0 ? |
615 | nvalue(top-3) > nvalue(top-2) : | 616 | nvalue(top-3) > nvalue(top-2) : |
616 | nvalue(top-3) < nvalue(top-2)) { /* `empty' loop? */ | 617 | nvalue(top-3) < nvalue(top-2)) { /* `empty' loop? */ |
@@ -623,7 +624,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
623 | lua_assert(ttype(top-1) == LUA_TNUMBER); | 624 | lua_assert(ttype(top-1) == LUA_TNUMBER); |
624 | lua_assert(ttype(top-2) == LUA_TNUMBER); | 625 | lua_assert(ttype(top-2) == LUA_TNUMBER); |
625 | if (ttype(top-3) != LUA_TNUMBER) | 626 | if (ttype(top-3) != LUA_TNUMBER) |
626 | lua_error(L, "`for' index must be a number"); | 627 | luaD_error(L, "`for' index must be a number"); |
627 | nvalue(top-3) += nvalue(top-1); /* increment index */ | 628 | nvalue(top-3) += nvalue(top-1); /* increment index */ |
628 | if (nvalue(top-1) > 0 ? | 629 | if (nvalue(top-1) > 0 ? |
629 | nvalue(top-3) > nvalue(top-2) : | 630 | nvalue(top-3) > nvalue(top-2) : |
@@ -636,7 +637,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
636 | case OP_LFORPREP: { | 637 | case OP_LFORPREP: { |
637 | Node *node; | 638 | Node *node; |
638 | if (ttype(top-1) != LUA_TTABLE) | 639 | if (ttype(top-1) != LUA_TTABLE) |
639 | lua_error(L, "`for' table must be a table"); | 640 | luaD_error(L, "`for' table must be a table"); |
640 | node = luaH_next(L, hvalue(top-1), &luaO_nilobject); | 641 | node = luaH_next(L, hvalue(top-1), &luaO_nilobject); |
641 | if (node == NULL) { /* `empty' loop? */ | 642 | if (node == NULL) { /* `empty' loop? */ |
642 | top--; /* remove table */ | 643 | top--; /* remove table */ |