aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/lobject.h b/lobject.h
index 359055f3..dbabc638 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.113 2001/09/25 17:08:46 roberto Exp $ 2** $Id: lobject.h,v 1.114 2001/10/02 16:45:03 roberto Exp $
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*/
@@ -39,7 +39,7 @@ typedef union {
39 union TString *ts; 39 union TString *ts;
40 union Udata *u; 40 union Udata *u;
41 union Closure *cl; 41 union Closure *cl;
42 struct Hash *h; 42 struct Table *h;
43 struct UpVal *v; 43 struct UpVal *v;
44 lua_Number n; /* LUA_TNUMBER */ 44 lua_Number n; /* LUA_TNUMBER */
45} Value; 45} Value;
@@ -214,7 +214,7 @@ typedef union Closure {
214 214
215 215
216/* 216/*
217** Hash Tables 217** Tables
218*/ 218*/
219 219
220typedef struct Node { 220typedef struct Node {
@@ -224,15 +224,17 @@ typedef struct Node {
224} Node; 224} Node;
225 225
226 226
227typedef struct Hash { 227typedef struct Table {
228 TObject *array; /* array part */
228 Node *node; 229 Node *node;
229 int htag; 230 int htag;
230 int size; 231 int sizearray; /* size of `array' array */
232 lu_byte lsizenode; /* log2 of size of `node' array */
233 lu_byte weakmode;
231 Node *firstfree; /* this position is free; all positions after it are full */ 234 Node *firstfree; /* this position is free; all positions after it are full */
232 struct Hash *next; 235 struct Table *next;
233 struct Hash *mark; /* marked tables (point to itself when not marked) */ 236 struct Table *mark; /* marked tables (point to itself when not marked) */
234 int weakmode; 237} Table;
235} Hash;
236 238
237 239
238/* unmarked tables are represented by pointing `mark' to themselves */ 240/* unmarked tables are represented by pointing `mark' to themselves */
@@ -245,6 +247,10 @@ typedef struct Hash {
245#define lmod(s,size) (cast(int, (s) & ((size)-1))) 247#define lmod(s,size) (cast(int, (s) & ((size)-1)))
246 248
247 249
250#define twoto(x) (1<<(x))
251#define sizenode(t) (twoto((t)->lsizenode))
252#define sizearray(t) ((t)->sizearray)
253
248/* 254/*
249** informations about a call (for debugging) 255** informations about a call (for debugging)
250*/ 256*/
@@ -262,6 +268,8 @@ typedef struct CallInfo {
262 268
263extern const TObject luaO_nilobject; 269extern const TObject luaO_nilobject;
264 270
271int luaO_log2 (unsigned int x);
272
265 273
266#define luaO_openspace(L,n,t) cast(t *, luaO_openspaceaux(L,(n)*sizeof(t))) 274#define luaO_openspace(L,n,t) cast(t *, luaO_openspaceaux(L,(n)*sizeof(t)))
267void *luaO_openspaceaux (lua_State *L, size_t n); 275void *luaO_openspaceaux (lua_State *L, size_t n);