mirror of
https://github.com/lua/lua.git
synced 2025-07-04 23:19:38 +00:00
new implementation for global variable values (separated from strings)
This commit is contained in:
parent
80b39d83c3
commit
cde179b369
12 changed files with 166 additions and 145 deletions
27
lobject.h
27
lobject.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lobject.h,v 1.33 1999/10/14 19:13:31 roberto Exp roberto $
|
||||
** $Id: lobject.h,v 1.34 1999/10/19 13:33:22 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -87,25 +87,30 @@ typedef struct TObject {
|
|||
|
||||
|
||||
|
||||
typedef struct GlobalVar {
|
||||
TObject value;
|
||||
struct GlobalVar *next;
|
||||
struct TaggedString *name;
|
||||
} GlobalVar;
|
||||
|
||||
|
||||
/*
|
||||
** String headers for string table
|
||||
*/
|
||||
|
||||
typedef struct TaggedString {
|
||||
struct TaggedString *nexthash; /* chain hash table */
|
||||
struct TaggedString *nextglobal; /* chain global variables */
|
||||
unsigned long hash;
|
||||
int constindex; /* hint to reuse constants (= -1 if this is a userdata) */
|
||||
union {
|
||||
struct {
|
||||
TObject globalval;
|
||||
long len; /* if this is a string, here is its length */
|
||||
struct { /* for strings */
|
||||
GlobalVar *gv; /* eventual global value with this name */
|
||||
long len;
|
||||
} s;
|
||||
struct {
|
||||
struct { /* for userdata */
|
||||
int tag;
|
||||
void *v; /* if this is a userdata, here is its value */
|
||||
void *value;
|
||||
} d;
|
||||
} u;
|
||||
struct TaggedString *nexthash; /* chain for hash table */
|
||||
unsigned long hash;
|
||||
int constindex; /* hint to reuse constants (= -1 if this is a userdata) */
|
||||
unsigned char marked;
|
||||
char str[1]; /* \0 byte already reserved */
|
||||
} TaggedString;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue