diff options
Diffstat (limited to 'opcode.c')
-rw-r--r-- | opcode.c | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -3,11 +3,12 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_opcode="$Id: opcode.c,v 2.8 1994/09/27 21:43:30 celes Exp celes $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 2.9 1994/10/11 14:38:17 celes Exp $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | #include <string.h> | 10 | #include <string.h> |
11 | #include <math.h> | ||
11 | #ifdef __GNUC__ | 12 | #ifdef __GNUC__ |
12 | #include <floatingpoint.h> | 13 | #include <floatingpoint.h> |
13 | #endif | 14 | #endif |
@@ -245,8 +246,14 @@ int lua_execute (Byte *pc) | |||
245 | break; | 246 | break; |
246 | 247 | ||
247 | case PUSHMARK: tag(top++) = T_MARK; break; | 248 | case PUSHMARK: tag(top++) = T_MARK; break; |
248 | 249 | case PUSHMARKMET: | |
249 | case PUSHOBJECT: *top = *(top-3); top++; break; | 250 | { |
251 | Object receiver = *(top-2); | ||
252 | if (lua_pushsubscript() == 1) return 1; | ||
253 | tag(top++) = T_MARK; | ||
254 | *(top++) = receiver; | ||
255 | break; | ||
256 | } | ||
250 | 257 | ||
251 | case STORELOCAL0: case STORELOCAL1: case STORELOCAL2: | 258 | case STORELOCAL0: case STORELOCAL1: case STORELOCAL2: |
252 | case STORELOCAL3: case STORELOCAL4: case STORELOCAL5: | 259 | case STORELOCAL3: case STORELOCAL4: case STORELOCAL5: |
@@ -457,6 +464,17 @@ int lua_execute (Byte *pc) | |||
457 | } | 464 | } |
458 | break; | 465 | break; |
459 | 466 | ||
467 | case POWOP: | ||
468 | { | ||
469 | Object *l = top-2; | ||
470 | Object *r = top-1; | ||
471 | if (tonumber(r) || tonumber(l)) | ||
472 | return 1; | ||
473 | nvalue(l) = pow(nvalue(l), nvalue(r)); | ||
474 | --top; | ||
475 | } | ||
476 | break; | ||
477 | |||
460 | case CONCOP: | 478 | case CONCOP: |
461 | { | 479 | { |
462 | Object *l = top-2; | 480 | Object *l = top-2; |
@@ -819,7 +837,7 @@ Object *lua_getfield (Object *object, char *field) | |||
819 | { | 837 | { |
820 | Object ref; | 838 | Object ref; |
821 | tag(&ref) = T_STRING; | 839 | tag(&ref) = T_STRING; |
822 | svalue(&ref) = lua_createstring(field); | 840 | svalue(&ref) = lua_constant[lua_findconstant(field)]; |
823 | return (lua_hashget(avalue(object), &ref)); | 841 | return (lua_hashget(avalue(object), &ref)); |
824 | } | 842 | } |
825 | } | 843 | } |