diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:32:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:32:40 -0300 |
commit | 41259bff31dbb904edfb8070006ccb15577f8f04 (patch) | |
tree | 664bf9cbe6394e9074435ecf2bd710712b4537c3 /tree.h | |
parent | afaa98a666acd5f596b50f56bb288815838c096e (diff) | |
download | lua-41259bff31dbb904edfb8070006ccb15577f8f04.tar.gz lua-41259bff31dbb904edfb8070006ccb15577f8f04.tar.bz2 lua-41259bff31dbb904edfb8070006ccb15577f8f04.zip |
BIG CHANGE: new data structure for constants, strings and globals, using
an array of hash tables for all them.
Diffstat (limited to 'tree.h')
-rw-r--r-- | tree.h | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** tree.h | 2 | ** tree.h |
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | ** $Id: tree.h,v 1.10 1995/10/17 11:53:53 roberto Exp roberto $ | 4 | ** $Id: tree.h,v 1.11 1996/01/26 18:03:19 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef tree_h | 7 | #ifndef tree_h |
@@ -14,23 +14,16 @@ | |||
14 | 14 | ||
15 | typedef struct TaggedString | 15 | typedef struct TaggedString |
16 | { | 16 | { |
17 | unsigned short varindex; /* != NOT_USED if this is a symbol */ | ||
18 | unsigned short constindex; /* != NOT_USED if this is a constant */ | ||
17 | unsigned long hash; /* 0 if not initialized */ | 19 | unsigned long hash; /* 0 if not initialized */ |
18 | char marked; /* for garbage collection */ | 20 | char marked; /* for garbage collection; 2 means "never collect" */ |
19 | char str[1]; /* \0 byte already reserved */ | 21 | char str[1]; /* \0 byte already reserved */ |
20 | } TaggedString; | 22 | } TaggedString; |
21 | 23 | ||
22 | typedef struct TreeNode | ||
23 | { | ||
24 | struct TreeNode *right; | ||
25 | struct TreeNode *left; | ||
26 | unsigned short varindex; /* != NOT_USED if this is a symbol */ | ||
27 | unsigned short constindex; /* != NOT_USED if this is a constant */ | ||
28 | TaggedString ts; | ||
29 | } TreeNode; | ||
30 | |||
31 | 24 | ||
32 | TaggedString *lua_createstring (char *str); | 25 | TaggedString *lua_createstring (char *str); |
33 | TreeNode *lua_constcreate (char *str); | 26 | TaggedString *luaI_createfixedstring (char *str); |
34 | Long lua_strcollector (void); | 27 | Long lua_strcollector (void); |
35 | 28 | ||
36 | #endif | 29 | #endif |