aboutsummaryrefslogtreecommitdiff
path: root/opcode.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-02 18:30:53 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-02 18:30:53 -0200
commitfbf887ec2be8b293d6f3ffc88b42c5a9e87bf022 (patch)
tree030c6dd803fff11ae0c368e90b78a9fef2b8b731 /opcode.h
parentae77864844d6b933eb8be68694cbb8498af165dc (diff)
downloadlua-fbf887ec2be8b293d6f3ffc88b42c5a9e87bf022.tar.gz
lua-fbf887ec2be8b293d6f3ffc88b42c5a9e87bf022.tar.bz2
lua-fbf887ec2be8b293d6f3ffc88b42c5a9e87bf022.zip
new way to call functions, plus several small changes. This is
a temporary version!
Diffstat (limited to 'opcode.h')
-rw-r--r--opcode.h41
1 files changed, 15 insertions, 26 deletions
diff --git a/opcode.h b/opcode.h
index f021dac8..4a35ca12 100644
--- a/opcode.h
+++ b/opcode.h
@@ -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
19typedef unsigned char Byte; 23typedef unsigned char Byte;
20 24
21typedef unsigned short Word; 25typedef 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
96typedef 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
108typedef void (*Cfunction) (void); 103typedef void (*Cfunction) (void);
109typedef int (*Input) (void); 104typedef int (*Input) (void);
110 105
111typedef union 106typedef 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 */
160int lua_execute (Byte *pc);
161void lua_markstack (void);
162char *lua_strdup (char *l); 155char *lua_strdup (char *l);
163 156
164void lua_setinput (Input fn); /* from "lex.c" module */ 157void lua_setinput (Input fn); /* from "lex.c" module */
165char *lua_lasttext (void); /* from "lex.c" module */ 158char *lua_lasttext (void); /* from "lex.c" module */
166int lua_parse (void); /* from "lua.stx" module */ 159Byte *lua_parse (void); /* from "lua.stx" module */
167void lua_type (void);
168void lua_obj2number (void); 160void lua_obj2number (void);
169void lua_print (void);
170void lua_internaldofile (void);
171void lua_internaldostring (void);
172void lua_travstack (void (*fn)(Object *)); 161void lua_travstack (void (*fn)(Object *));
173 162
174#endif 163#endif