diff options
Diffstat (limited to 'opcode.h')
-rw-r--r-- | opcode.h | 45 |
1 files changed, 20 insertions, 25 deletions
@@ -1,12 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
3 | ** $Id: opcode.h,v 3.8 1994/11/10 17:36:54 roberto Exp roberto $ | 3 | ** $Id: opcode.h,v 3.9 1994/11/23 14:31:11 roberto Stab $ |
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" | 9 | #include "lua.h" |
10 | #include "types.h" | ||
10 | #include "tree.h" | 11 | #include "tree.h" |
11 | 12 | ||
12 | #ifndef STACKGAP | 13 | #ifndef STACKGAP |
@@ -21,29 +22,6 @@ | |||
21 | 22 | ||
22 | #define MAX_TEMPS 20 | 23 | #define MAX_TEMPS 20 |
23 | 24 | ||
24 | typedef unsigned char Byte; | ||
25 | |||
26 | typedef unsigned short Word; | ||
27 | |||
28 | typedef signed long Long; | ||
29 | |||
30 | typedef union | ||
31 | { | ||
32 | struct {char c1; char c2;} m; | ||
33 | Word w; | ||
34 | } CodeWord; | ||
35 | |||
36 | typedef union | ||
37 | { | ||
38 | struct {char c1; char c2; char c3; char c4;} m; | ||
39 | float f; | ||
40 | } CodeFloat; | ||
41 | |||
42 | typedef union | ||
43 | { | ||
44 | struct {char c1; char c2; char c3; char c4;} m; | ||
45 | Byte *b; | ||
46 | } CodeCode; | ||
47 | 25 | ||
48 | typedef enum | 26 | typedef enum |
49 | { | 27 | { |
@@ -147,12 +125,29 @@ typedef struct | |||
147 | #define s_fvalue(i) (fvalue(&s_object(i))) | 125 | #define s_fvalue(i) (fvalue(&s_object(i))) |
148 | #define s_uvalue(i) (uvalue(&s_object(i))) | 126 | #define s_uvalue(i) (uvalue(&s_object(i))) |
149 | 127 | ||
128 | typedef union | ||
129 | { | ||
130 | struct {char c1; char c2;} m; | ||
131 | Word w; | ||
132 | } CodeWord; | ||
150 | #define get_word(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;} | 133 | #define get_word(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;} |
134 | |||
135 | typedef union | ||
136 | { | ||
137 | struct {char c1; char c2; char c3; char c4;} m; | ||
138 | float f; | ||
139 | } CodeFloat; | ||
151 | #define get_float(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ | 140 | #define get_float(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ |
152 | code.m.c3 = *pc++; code.m.c4 = *pc++;} | 141 | code.m.c3 = *pc++; code.m.c4 = *pc++;} |
142 | |||
143 | typedef union | ||
144 | { | ||
145 | struct {char c1; char c2; char c3; char c4;} m; | ||
146 | Byte *b; | ||
147 | } CodeCode; | ||
153 | #define get_code(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ | 148 | #define get_code(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ |
154 | code.m.c3 = *pc++; code.m.c4 = *pc++;} | 149 | code.m.c3 = *pc++; code.m.c4 = *pc++;} |
155 | 150 | ||
156 | 151 | ||
157 | /* Exported functions */ | 152 | /* Exported functions */ |
158 | char *lua_strdup (char *l); | 153 | char *lua_strdup (char *l); |