diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-05-28 18:07:32 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-05-28 18:07:32 -0300 |
commit | 9863223fbf512d903a1677c861e4beb4f8feda4d (patch) | |
tree | 964f1b36a5a7c9aff238d454fa4bffe88dacbe2d /opcode.h | |
parent | 9a1948e67d940d988260e738f2a251087835a318 (diff) | |
download | lua-9863223fbf512d903a1677c861e4beb4f8feda4d.tar.gz lua-9863223fbf512d903a1677c861e4beb4f8feda4d.tar.bz2 lua-9863223fbf512d903a1677c861e4beb4f8feda4d.zip |
first version of vararg facility (plus new function "call").
Diffstat (limited to 'opcode.h')
-rw-r--r-- | opcode.h | 32 |
1 files changed, 8 insertions, 24 deletions
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
3 | ** $Id: opcode.h,v 3.19 1996/03/06 13:11:23 roberto Exp $ | 3 | ** $Id: opcode.h,v 3.20 1996/03/15 13:13:13 roberto Exp roberto $ |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
@@ -65,7 +65,8 @@ typedef enum | |||
65 | CALLFUNC, | 65 | CALLFUNC, |
66 | RETCODE0, | 66 | RETCODE0, |
67 | RETCODE, | 67 | RETCODE, |
68 | SETLINE | 68 | SETLINE, |
69 | VARARGS | ||
69 | } OpCode; | 70 | } OpCode; |
70 | 71 | ||
71 | #define MULT_RET 255 | 72 | #define MULT_RET 255 |
@@ -107,28 +108,10 @@ typedef struct Object | |||
107 | #define s_fvalue(i) (fvalue(&s_object(i))) | 108 | #define s_fvalue(i) (fvalue(&s_object(i))) |
108 | #define s_uvalue(i) (uvalue(&s_object(i))) | 109 | #define s_uvalue(i) (uvalue(&s_object(i))) |
109 | 110 | ||
110 | typedef union | 111 | #define get_word(code,pc) {memcpy(&code, pc, sizeof(Word)); pc+=sizeof(Word);} |
111 | { | 112 | #define get_float(code,pc){memcpy(&code, pc, sizeof(real)); pc+=sizeof(real);} |
112 | struct {Byte c1; Byte c2;} m; | 113 | #define get_code(code,pc) {memcpy(&code, pc, sizeof(TFunc *)); \ |
113 | Word w; | 114 | pc+=sizeof(TFunc *);} |
114 | } CodeWord; | ||
115 | #define get_word(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;} | ||
116 | |||
117 | typedef union | ||
118 | { | ||
119 | struct {Byte c1; Byte c2; Byte c3; Byte c4;} m; | ||
120 | float f; | ||
121 | } CodeFloat; | ||
122 | #define get_float(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ | ||
123 | code.m.c3 = *pc++; code.m.c4 = *pc++;} | ||
124 | |||
125 | typedef union | ||
126 | { | ||
127 | struct {Byte c1; Byte c2; Byte c3; Byte c4;} m; | ||
128 | TFunc *tf; | ||
129 | } CodeCode; | ||
130 | #define get_code(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ | ||
131 | code.m.c3 = *pc++; code.m.c4 = *pc++;} | ||
132 | 115 | ||
133 | 116 | ||
134 | /* Exported functions */ | 117 | /* Exported functions */ |
@@ -139,5 +122,6 @@ Object *luaI_Address (lua_Object o); | |||
139 | void luaI_pushobject (Object *o); | 122 | void luaI_pushobject (Object *o); |
140 | void luaI_gcFB (Object *o); | 123 | void luaI_gcFB (Object *o); |
141 | int luaI_dorun (TFunc *tf); | 124 | int luaI_dorun (TFunc *tf); |
125 | void luaI_packarg (Object *firstelem, Object *arg); | ||
142 | 126 | ||
143 | #endif | 127 | #endif |