diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-19 16:41:10 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-19 16:41:10 -0300 |
| commit | 1444d28476af70bc51c4fdba71deb669f41c77a3 (patch) | |
| tree | 6d19c5653702ea341f6650f3e917ed77456f757f /tree.c | |
| parent | 2de803c250de373186afbbea0a5978f54c52850c (diff) | |
| download | lua-1444d28476af70bc51c4fdba71deb669f41c77a3.tar.gz lua-1444d28476af70bc51c4fdba71deb669f41c77a3.tar.bz2 lua-1444d28476af70bc51c4fdba71deb669f41c77a3.zip | |
first full implementation of internal methods
Diffstat (limited to 'tree.c')
| -rw-r--r-- | tree.c | 23 |
1 files changed, 22 insertions, 1 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_tree="$Id: tree.c,v 1.20 1996/03/14 15:56:26 roberto Exp roberto $"; | 6 | char *rcs_tree="$Id: tree.c,v 1.21 1997/02/11 11:35:05 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | #include <string.h> | 9 | #include <string.h> |
| @@ -14,6 +14,7 @@ char *rcs_tree="$Id: tree.c,v 1.20 1996/03/14 15:56:26 roberto Exp roberto $"; | |||
| 14 | #include "lex.h" | 14 | #include "lex.h" |
| 15 | #include "hash.h" | 15 | #include "hash.h" |
| 16 | #include "table.h" | 16 | #include "table.h" |
| 17 | #include "fallback.h" | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | #define NUM_HASHS 64 | 20 | #define NUM_HASHS 64 |
| @@ -45,6 +46,7 @@ static void initialize (void) | |||
| 45 | luaI_addReserved(); | 46 | luaI_addReserved(); |
| 46 | luaI_initsymbol(); | 47 | luaI_initsymbol(); |
| 47 | luaI_initconstant(); | 48 | luaI_initconstant(); |
| 49 | luaI_initfallbacks(); | ||
| 48 | } | 50 | } |
| 49 | 51 | ||
| 50 | 52 | ||
| @@ -120,6 +122,25 @@ TaggedString *lua_createstring (char *str) | |||
| 120 | } | 122 | } |
| 121 | 123 | ||
| 122 | 124 | ||
| 125 | void luaI_strcallIM (void) | ||
| 126 | { | ||
| 127 | int i; | ||
| 128 | Object o; | ||
| 129 | ttype(&o) = LUA_T_USERDATA; | ||
| 130 | for (i=0; i<NUM_HASHS; i++) { | ||
| 131 | stringtable *tb = &string_root[i]; | ||
| 132 | int j; | ||
| 133 | for (j=0; j<tb->size; j++) { | ||
| 134 | TaggedString *t = tb->hash[j]; | ||
| 135 | if (t != NULL && t->tag != LUA_T_STRING && t->marked == 0) { | ||
| 136 | tsvalue(&o) = t; | ||
| 137 | luaI_gcIM(&o); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | |||
| 123 | /* | 144 | /* |
| 124 | ** Garbage collection function. | 145 | ** Garbage collection function. |
| 125 | ** This function traverse the string list freeing unindexed strings | 146 | ** This function traverse the string list freeing unindexed strings |
