diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-10 15:37:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-10 15:37:44 -0300 |
commit | 73aa465a8ed8dee6c6a27a6f8b2f51227b70789d (patch) | |
tree | 496a63ffffe0312f1d0b9882d97944fa38ed7801 /lobject.h | |
parent | 3d0577f4b98908be3f2d697ab75c5fbbd3f6999b (diff) | |
download | lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.gz lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.bz2 lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.zip |
some name changes
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 88 |
1 files changed, 44 insertions, 44 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.49 2000/02/21 18:33:26 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.50 2000/03/03 14:58:26 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -27,14 +27,14 @@ | |||
27 | #define UNUSED(x) (void)x /* to avoid warnings */ | 27 | #define UNUSED(x) (void)x /* to avoid warnings */ |
28 | 28 | ||
29 | /* | 29 | /* |
30 | ** "real" is the type "number" of Lua | 30 | ** Define the type `number' of Lua |
31 | ** GREP LUA_NUMBER to change that | 31 | ** GREP LUA_NUMBER to change that |
32 | */ | 32 | */ |
33 | #ifndef LUA_NUM_TYPE | 33 | #ifndef LUA_NUM_TYPE |
34 | #define LUA_NUM_TYPE double | 34 | #define LUA_NUM_TYPE double |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | typedef LUA_NUM_TYPE real; | 37 | typedef LUA_NUM_TYPE Number; |
38 | 38 | ||
39 | 39 | ||
40 | /* | 40 | /* |
@@ -66,45 +66,45 @@ typedef unsigned long Instruction; | |||
66 | ** grep "ORDER LUA_T" | 66 | ** grep "ORDER LUA_T" |
67 | */ | 67 | */ |
68 | typedef enum { | 68 | typedef enum { |
69 | LUA_T_USERDATA = 0, /* default tag for userdata */ | 69 | TAG_USERDATA = 0, /* default tag for userdata */ |
70 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ | 70 | TAG_NUMBER = -1, /* fixed tag for numbers */ |
71 | LUA_T_STRING = -2, /* fixed tag for strings */ | 71 | TAG_STRING = -2, /* fixed tag for strings */ |
72 | LUA_T_ARRAY = -3, /* default tag for tables (or arrays) */ | 72 | TAG_ARRAY = -3, /* default tag for tables (or arrays) */ |
73 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ | 73 | TAG_LPROTO = -4, /* fixed tag for Lua functions */ |
74 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ | 74 | TAG_CPROTO = -5, /* fixed tag for C functions */ |
75 | LUA_T_NIL = -6, /* last "pre-defined" tag */ | 75 | TAG_NIL = -6, /* last "pre-defined" tag */ |
76 | 76 | ||
77 | LUA_T_LCLOSURE = -7, /* Lua closure */ | 77 | TAG_LCLOSURE = -7, /* Lua closure */ |
78 | LUA_T_CCLOSURE = -8, /* C closure */ | 78 | TAG_CCLOSURE = -8, /* C closure */ |
79 | 79 | ||
80 | LUA_T_LCLMARK = -9 ,/* mark for Lua closures */ | 80 | TAG_LCLMARK = -9 ,/* mark for Lua closures */ |
81 | LUA_T_CCLMARK = -10,/* mark for C closures */ | 81 | TAG_CCLMARK = -10,/* mark for C closures */ |
82 | LUA_T_LMARK = -11,/* mark for Lua prototypes */ | 82 | TAG_LMARK = -11,/* mark for Lua prototypes */ |
83 | LUA_T_CMARK = -12,/* mark for C prototypes */ | 83 | TAG_CMARK = -12,/* mark for C prototypes */ |
84 | 84 | ||
85 | LUA_T_LINE = -13 | 85 | TAG_LINE = -13 |
86 | } lua_Type; | 86 | } lua_Type; |
87 | 87 | ||
88 | #define NUM_TAGS 7 /* tags for values visible from Lua */ | 88 | #define NUM_TAGS 7 /* tags for values visible from Lua */ |
89 | 89 | ||
90 | 90 | ||
91 | #define LAST_REGULAR_TAG LUA_T_CCLOSURE /* after that, are all marks */ | 91 | #define LAST_REGULAR_TAG TAG_CCLOSURE /* after that, are all marks */ |
92 | 92 | ||
93 | /* | 93 | /* |
94 | ** check whether `t' is a mark; ttypes are negative numbers, so the | 94 | ** check whether `t' is a mark; ttypes are negative numbers, so the |
95 | ** comparisons look reversed. (ORDER LUA_T) | 95 | ** comparisons look reversed. (ORDER LUA_T) |
96 | */ | 96 | */ |
97 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) | 97 | #define is_T_MARK(t) (TAG_CMARK <= (t) && (t) <= TAG_LCLMARK) |
98 | 98 | ||
99 | 99 | ||
100 | typedef union { | 100 | typedef union { |
101 | lua_CFunction f; /* LUA_T_CPROTO, LUA_T_CMARK */ | 101 | lua_CFunction f; /* TAG_CPROTO, TAG_CMARK */ |
102 | real n; /* LUA_T_NUMBER */ | 102 | Number n; /* TAG_NUMBER */ |
103 | struct TaggedString *ts; /* LUA_T_STRING, LUA_T_USERDATA */ | 103 | struct TString *ts; /* TAG_STRING, TAG_USERDATA */ |
104 | struct TProtoFunc *tf; /* LUA_T_LPROTO, LUA_T_LMARK */ | 104 | struct Proto *tf; /* TAG_LPROTO, TAG_LMARK */ |
105 | struct Closure *cl; /* LUA_T_[CL]CLOSURE, LUA_T_[CL]CLMARK */ | 105 | struct Closure *cl; /* TAG_[CL]CLOSURE, TAG_[CL]CLMARK */ |
106 | struct Hash *a; /* LUA_T_ARRAY */ | 106 | struct Hash *a; /* TAG_ARRAY */ |
107 | int i; /* LUA_T_LINE */ | 107 | int i; /* TAG_LINE */ |
108 | } Value; | 108 | } Value; |
109 | 109 | ||
110 | 110 | ||
@@ -118,14 +118,14 @@ typedef struct TObject { | |||
118 | typedef struct GlobalVar { | 118 | typedef struct GlobalVar { |
119 | TObject value; | 119 | TObject value; |
120 | struct GlobalVar *next; | 120 | struct GlobalVar *next; |
121 | struct TaggedString *name; | 121 | struct TString *name; |
122 | } GlobalVar; | 122 | } GlobalVar; |
123 | 123 | ||
124 | 124 | ||
125 | /* | 125 | /* |
126 | ** String headers for string table | 126 | ** String headers for string table |
127 | */ | 127 | */ |
128 | typedef struct TaggedString { | 128 | typedef struct TString { |
129 | union { | 129 | union { |
130 | struct { /* for strings */ | 130 | struct { /* for strings */ |
131 | GlobalVar *gv; /* eventual global value with this name */ | 131 | GlobalVar *gv; /* eventual global value with this name */ |
@@ -136,12 +136,12 @@ typedef struct TaggedString { | |||
136 | void *value; | 136 | void *value; |
137 | } d; | 137 | } d; |
138 | } u; | 138 | } u; |
139 | struct TaggedString *nexthash; /* chain for hash table */ | 139 | struct TString *nexthash; /* chain for hash table */ |
140 | unsigned long hash; | 140 | unsigned long hash; |
141 | int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ | 141 | int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ |
142 | unsigned char marked; | 142 | unsigned char marked; |
143 | char str[1]; /* \0 byte already reserved */ | 143 | char str[1]; /* \0 byte already reserved */ |
144 | } TaggedString; | 144 | } TString; |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
@@ -149,27 +149,27 @@ typedef struct TaggedString { | |||
149 | /* | 149 | /* |
150 | ** Function Prototypes | 150 | ** Function Prototypes |
151 | */ | 151 | */ |
152 | typedef struct TProtoFunc { | 152 | typedef struct Proto { |
153 | struct TProtoFunc *next; | 153 | struct Proto *next; |
154 | int marked; | 154 | int marked; |
155 | struct TaggedString **kstr; /* strings used by the function */ | 155 | struct TString **kstr; /* strings used by the function */ |
156 | int nkstr; /* size of `kstr' */ | 156 | int nkstr; /* size of `kstr' */ |
157 | real *knum; /* real numbers used by the function */ | 157 | Number *knum; /* Number numbers used by the function */ |
158 | int nknum; /* size of `knum' */ | 158 | int nknum; /* size of `knum' */ |
159 | struct TProtoFunc **kproto; /* functions defined inside the function */ | 159 | struct Proto **kproto; /* functions defined inside the function */ |
160 | int nkproto; /* size of `kproto' */ | 160 | int nkproto; /* size of `kproto' */ |
161 | Instruction *code; /* ends with opcode ENDCODE */ | 161 | Instruction *code; /* ends with opcode ENDCODE */ |
162 | int lineDefined; | 162 | int lineDefined; |
163 | TaggedString *source; | 163 | TString *source; |
164 | int numparams; | 164 | int numparams; |
165 | int is_vararg; | 165 | int is_vararg; |
166 | int maxstacksize; | 166 | int maxstacksize; |
167 | struct LocVar *locvars; /* ends with line = -1 */ | 167 | struct LocVar *locvars; /* ends with line = -1 */ |
168 | } TProtoFunc; | 168 | } Proto; |
169 | 169 | ||
170 | 170 | ||
171 | typedef struct LocVar { | 171 | typedef struct LocVar { |
172 | TaggedString *varname; /* NULL signals end of scope */ | 172 | TString *varname; /* NULL signals end of scope */ |
173 | int line; | 173 | int line; |
174 | } LocVar; | 174 | } LocVar; |
175 | 175 | ||
@@ -202,10 +202,10 @@ typedef struct Closure { | |||
202 | 202 | ||
203 | 203 | ||
204 | 204 | ||
205 | typedef struct node { | 205 | typedef struct Node { |
206 | TObject key; | 206 | TObject key; |
207 | TObject val; | 207 | TObject val; |
208 | struct node *next; /* for chaining */ | 208 | struct Node *next; /* for chaining */ |
209 | } Node; | 209 | } Node; |
210 | 210 | ||
211 | typedef struct Hash { | 211 | typedef struct Hash { |
@@ -230,7 +230,7 @@ unsigned long luaO_power2 (unsigned long n); | |||
230 | #define luaO_equalObj(t1,t2) (ttype(t1) == ttype(t2) && luaO_equalval(t1,t2)) | 230 | #define luaO_equalObj(t1,t2) (ttype(t1) == ttype(t2) && luaO_equalval(t1,t2)) |
231 | int luaO_equalval (const TObject *t1, const TObject *t2); | 231 | int luaO_equalval (const TObject *t1, const TObject *t2); |
232 | int luaO_redimension (lua_State *L, int oldsize); | 232 | int luaO_redimension (lua_State *L, int oldsize); |
233 | int luaO_str2d (const char *s, real *result); | 233 | int luaO_str2d (const char *s, Number *result); |
234 | 234 | ||
235 | 235 | ||
236 | #endif | 236 | #endif |