diff options
Diffstat (limited to 'opcode.h')
| -rw-r--r-- | opcode.h | 41 |
1 files changed, 15 insertions, 26 deletions
| @@ -1,11 +1,13 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
| 3 | ** $Id: opcode.h,v 2.3 1994/08/05 19:31:09 celes Exp celes $ | 3 | ** $Id: opcode.h,v 2.4 1994/10/17 19:00:40 celes Exp roberto $ |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
| 7 | #define opcode_h | 7 | #define opcode_h |
| 8 | 8 | ||
| 9 | #include "lua.h" | ||
| 10 | |||
| 9 | #ifndef STACKGAP | 11 | #ifndef STACKGAP |
| 10 | #define STACKGAP 128 | 12 | #define STACKGAP 128 |
| 11 | #endif | 13 | #endif |
| @@ -16,6 +18,8 @@ | |||
| 16 | 18 | ||
| 17 | #define FIELDS_PER_FLUSH 40 | 19 | #define FIELDS_PER_FLUSH 40 |
| 18 | 20 | ||
| 21 | #define MAX_TEMPS 20 | ||
| 22 | |||
| 19 | typedef unsigned char Byte; | 23 | typedef unsigned char Byte; |
| 20 | 24 | ||
| 21 | typedef unsigned short Word; | 25 | typedef unsigned short Word; |
| @@ -54,8 +58,7 @@ typedef enum | |||
| 54 | PUSHLOCAL, | 58 | PUSHLOCAL, |
| 55 | PUSHGLOBAL, | 59 | PUSHGLOBAL, |
| 56 | PUSHINDEXED, | 60 | PUSHINDEXED, |
| 57 | PUSHMARK, | 61 | PUSHSELF, |
| 58 | PUSHMARKMET, | ||
| 59 | STORELOCAL0, STORELOCAL1, STORELOCAL2, STORELOCAL3, STORELOCAL4, | 62 | STORELOCAL0, STORELOCAL1, STORELOCAL2, STORELOCAL3, STORELOCAL4, |
| 60 | STORELOCAL5, STORELOCAL6, STORELOCAL7, STORELOCAL8, STORELOCAL9, | 63 | STORELOCAL5, STORELOCAL6, STORELOCAL7, STORELOCAL8, STORELOCAL9, |
| 61 | STORELOCAL, | 64 | STORELOCAL, |
| @@ -65,6 +68,7 @@ typedef enum | |||
| 65 | STORELIST0, | 68 | STORELIST0, |
| 66 | STORELIST, | 69 | STORELIST, |
| 67 | STORERECORD, | 70 | STORERECORD, |
| 71 | ADJUST0, | ||
| 68 | ADJUST, | 72 | ADJUST, |
| 69 | CREATEARRAY, | 73 | CREATEARRAY, |
| 70 | EQOP, | 74 | EQOP, |
| @@ -86,34 +90,25 @@ typedef enum | |||
| 86 | IFFUPJMP, | 90 | IFFUPJMP, |
| 87 | POP, | 91 | POP, |
| 88 | CALLFUNC, | 92 | CALLFUNC, |
| 93 | RETCODE0, | ||
| 89 | RETCODE, | 94 | RETCODE, |
| 90 | HALT, | ||
| 91 | SETFUNCTION, | 95 | SETFUNCTION, |
| 92 | SETLINE, | 96 | SETLINE, |
| 93 | RESET | 97 | RESET |
| 94 | } OpCode; | 98 | } OpCode; |
| 95 | 99 | ||
| 96 | typedef enum | 100 | #define MULT_RET 255 |
| 97 | { | 101 | |
| 98 | T_MARK, | ||
| 99 | T_NIL, | ||
| 100 | T_NUMBER, | ||
| 101 | T_STRING, | ||
| 102 | T_ARRAY, | ||
| 103 | T_FUNCTION, | ||
| 104 | T_CFUNCTION, | ||
| 105 | T_USERDATA | ||
| 106 | } Type; | ||
| 107 | 102 | ||
| 108 | typedef void (*Cfunction) (void); | 103 | typedef void (*Cfunction) (void); |
| 109 | typedef int (*Input) (void); | 104 | typedef int (*Input) (void); |
| 110 | 105 | ||
| 111 | typedef union | 106 | typedef union |
| 112 | { | 107 | { |
| 113 | Cfunction f; | 108 | Cfunction f; |
| 114 | real n; | 109 | real n; |
| 115 | char *s; | 110 | char *s; |
| 116 | Byte *b; | 111 | Byte *b; |
| 117 | struct Hash *a; | 112 | struct Hash *a; |
| 118 | void *u; | 113 | void *u; |
| 119 | } Value; | 114 | } Value; |
| @@ -157,18 +152,12 @@ typedef struct | |||
| 157 | 152 | ||
| 158 | 153 | ||
| 159 | /* Exported functions */ | 154 | /* Exported functions */ |
| 160 | int lua_execute (Byte *pc); | ||
| 161 | void lua_markstack (void); | ||
| 162 | char *lua_strdup (char *l); | 155 | char *lua_strdup (char *l); |
| 163 | 156 | ||
| 164 | void lua_setinput (Input fn); /* from "lex.c" module */ | 157 | void lua_setinput (Input fn); /* from "lex.c" module */ |
| 165 | char *lua_lasttext (void); /* from "lex.c" module */ | 158 | char *lua_lasttext (void); /* from "lex.c" module */ |
| 166 | int lua_parse (void); /* from "lua.stx" module */ | 159 | Byte *lua_parse (void); /* from "lua.stx" module */ |
| 167 | void lua_type (void); | ||
| 168 | void lua_obj2number (void); | 160 | void lua_obj2number (void); |
| 169 | void lua_print (void); | ||
| 170 | void lua_internaldofile (void); | ||
| 171 | void lua_internaldostring (void); | ||
| 172 | void lua_travstack (void (*fn)(Object *)); | 161 | void lua_travstack (void (*fn)(Object *)); |
| 173 | 162 | ||
| 174 | #endif | 163 | #endif |
