diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-04 15:23:12 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-04 15:23:12 -0200 |
commit | cde179b36979c58d9380d3c4dd29b61412d13b51 (patch) | |
tree | 804c457691024d797a7479eddf711e103966b513 /lobject.h | |
parent | 80b39d83c3512e1dd627842e64c69841638d9088 (diff) | |
download | lua-cde179b36979c58d9380d3c4dd29b61412d13b51.tar.gz lua-cde179b36979c58d9380d3c4dd29b61412d13b51.tar.bz2 lua-cde179b36979c58d9380d3c4dd29b61412d13b51.zip |
new implementation for global variable values (separated from strings)
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.33 1999/10/14 19:13:31 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.34 1999/10/19 13:33:22 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 | */ |
@@ -87,25 +87,30 @@ typedef struct TObject { | |||
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | typedef struct GlobalVar { | ||
91 | TObject value; | ||
92 | struct GlobalVar *next; | ||
93 | struct TaggedString *name; | ||
94 | } GlobalVar; | ||
95 | |||
96 | |||
90 | /* | 97 | /* |
91 | ** String headers for string table | 98 | ** String headers for string table |
92 | */ | 99 | */ |
93 | |||
94 | typedef struct TaggedString { | 100 | typedef struct TaggedString { |
95 | struct TaggedString *nexthash; /* chain hash table */ | ||
96 | struct TaggedString *nextglobal; /* chain global variables */ | ||
97 | unsigned long hash; | ||
98 | int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ | ||
99 | union { | 101 | union { |
100 | struct { | 102 | struct { /* for strings */ |
101 | TObject globalval; | 103 | GlobalVar *gv; /* eventual global value with this name */ |
102 | long len; /* if this is a string, here is its length */ | 104 | long len; |
103 | } s; | 105 | } s; |
104 | struct { | 106 | struct { /* for userdata */ |
105 | int tag; | 107 | int tag; |
106 | void *v; /* if this is a userdata, here is its value */ | 108 | void *value; |
107 | } d; | 109 | } d; |
108 | } u; | 110 | } u; |
111 | struct TaggedString *nexthash; /* chain for hash table */ | ||
112 | unsigned long hash; | ||
113 | int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ | ||
109 | unsigned char marked; | 114 | unsigned char marked; |
110 | char str[1]; /* \0 byte already reserved */ | 115 | char str[1]; /* \0 byte already reserved */ |
111 | } TaggedString; | 116 | } TaggedString; |