lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 96ea2e0fb462789015824823801ba34782364b68
parent 93ccdd52ef83e283f7357c7e9de3a8773b26a16d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 21 Nov 1994 11:29:56 -0200

fallback to unary minus is 'arith' with operation code 'unm'

Diffstat:
Mfallback.c | 3+--
Mfallback.h | 7+++----
Mopcode.c | 7+++++--
3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fallback.c b/fallback.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_fallback="$Id: fallback.c,v 1.6 1994/11/16 17:38:08 roberto Exp roberto $"; +char *rcs_fallback="$Id: fallback.c,v 1.7 1994/11/18 19:46:21 roberto Exp roberto $"; #include <stdio.h> @@ -33,7 +33,6 @@ struct FB luaI_fallBacks[] = { {"arith", {LUA_T_CFUNCTION, arithFB}}, {"order", {LUA_T_CFUNCTION, orderFB}}, {"concat", {LUA_T_CFUNCTION, concatFB}}, -{"unminus", {LUA_T_CFUNCTION, arithFB}}, {"settable", {LUA_T_CFUNCTION, gettableFB}}, {"gc", {LUA_T_CFUNCTION, GDFB}} }; diff --git a/fallback.h b/fallback.h @@ -1,5 +1,5 @@ /* -** $Id: fallback.h,v 1.4 1994/11/10 17:36:54 roberto Exp roberto $ +** $Id: fallback.h,v 1.5 1994/11/18 19:46:21 roberto Exp roberto $ */ #ifndef fallback_h @@ -18,9 +18,8 @@ extern struct FB { #define FB_ARITH 3 #define FB_ORDER 4 #define FB_CONCAT 5 -#define FB_UNMINUS 6 -#define FB_SETTABLE 7 -#define FB_GC 8 +#define FB_SETTABLE 6 +#define FB_GC 7 void luaI_setfallback (void); int luaI_lock (Object *object); diff --git a/opcode.c b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.17 1994/11/17 21:23:43 roberto Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 3.18 1994/11/18 19:46:21 roberto Exp roberto $"; #include <setjmp.h> #include <stdio.h> @@ -989,7 +989,10 @@ static int lua_execute (Byte *pc, int base) case MINUSOP: if (tonumber(top-1)) - do_call(&luaI_fallBacks[FB_UNMINUS].function, (top-stack)-1, 1, (top-stack)-1); + { + tag(top++) = LUA_T_NIL; + call_arith("unm"); + } else nvalue(top-1) = - nvalue(top-1); break;