mirror of https://github.com/rusefi/lua.git
fallback to unary minus is 'arith' with operation code 'unm'
This commit is contained in:
parent
93ccdd52ef
commit
96ea2e0fb4
|
@ -3,7 +3,7 @@
|
||||||
** TecCGraf - PUC-Rio
|
** 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>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ struct FB luaI_fallBacks[] = {
|
||||||
{"arith", {LUA_T_CFUNCTION, arithFB}},
|
{"arith", {LUA_T_CFUNCTION, arithFB}},
|
||||||
{"order", {LUA_T_CFUNCTION, orderFB}},
|
{"order", {LUA_T_CFUNCTION, orderFB}},
|
||||||
{"concat", {LUA_T_CFUNCTION, concatFB}},
|
{"concat", {LUA_T_CFUNCTION, concatFB}},
|
||||||
{"unminus", {LUA_T_CFUNCTION, arithFB}},
|
|
||||||
{"settable", {LUA_T_CFUNCTION, gettableFB}},
|
{"settable", {LUA_T_CFUNCTION, gettableFB}},
|
||||||
{"gc", {LUA_T_CFUNCTION, GDFB}}
|
{"gc", {LUA_T_CFUNCTION, GDFB}}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
#ifndef fallback_h
|
||||||
|
@ -18,9 +18,8 @@ extern struct FB {
|
||||||
#define FB_ARITH 3
|
#define FB_ARITH 3
|
||||||
#define FB_ORDER 4
|
#define FB_ORDER 4
|
||||||
#define FB_CONCAT 5
|
#define FB_CONCAT 5
|
||||||
#define FB_UNMINUS 6
|
#define FB_SETTABLE 6
|
||||||
#define FB_SETTABLE 7
|
#define FB_GC 7
|
||||||
#define FB_GC 8
|
|
||||||
|
|
||||||
void luaI_setfallback (void);
|
void luaI_setfallback (void);
|
||||||
int luaI_lock (Object *object);
|
int luaI_lock (Object *object);
|
||||||
|
|
7
opcode.c
7
opcode.c
|
@ -3,7 +3,7 @@
|
||||||
** TecCGraf - PUC-Rio
|
** 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 <setjmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -989,7 +989,10 @@ static int lua_execute (Byte *pc, int base)
|
||||||
|
|
||||||
case MINUSOP:
|
case MINUSOP:
|
||||||
if (tonumber(top-1))
|
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
|
else
|
||||||
nvalue(top-1) = - nvalue(top-1);
|
nvalue(top-1) = - nvalue(top-1);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue