typedef struct UpVal
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
}
TValue *v;
union
{
TValue value;
struct
{
struct UpVal *prev;
struct UpVal *next;
}l;
} u;
} UpVal;
typedef union Value
{
GCObject *gc;
void *p;
int b;
lua_CFunction f;
}Value;
typedef struct lua_TValue
{
TValuefields;
}TValue;
#define TValuefields Value value_; int tt_
#define TValuefields union { struct { int tt__; Value v__; } i; double d__; } u //大
typedef struct lua_TValue
{
Value Value;
int tt_;
}TValue;
typedef struct lua_TValue
{
union
{
struct
{
int tt__;
Value v__;
} i;
double d__;
} u;
}TValue;
typedef union TKey
{
struct
{
TValuefields;
struct Node *next;
} nk;
TValue tvk;
} TKey;
typedef struct Node
{
TValue i_val;
TKey i_key;
} Node;
ypedef struct Table
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
}
unsigned char flags;
unsigned char lsizenode;
struct Table *metatable;
TValue *array;
Node *node;
Node *lastfree;
GCObject *gclist;
int sizearray;
} Table;
typedef union Udata
{
struct
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
}
struct Table *metatable;
struct Table *env;
size_t len;
}uv;
} Udata;
typedef struct CClosure
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
unsigned char nupvalues;
GCObject *gclist;
}
lua_CFunction f;
TValue upvalue[1];
} CClosure;
typedef struct LocVar
{
TString *varname;
int startpc;
int endpc;
} LocVar;
typedef struct Upvaldesc
{
TString *name;
unsigned char instack;
unsigned char idx;
} Upvaldesc;
typedef struct Proto
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
}
TValue *k;
unsigned int *code;
struct Proto **p;
int *lineinfo;
LocVar *locvars;
Upvaldesc *upvalues;
union Closure *cache;
TString *source;
int sizeupvalues;
int sizek;
int sizecode;
int sizelineinfo;
int sizep;
int sizelocvars;
int linedefined;
int lastlinedefined;
GCObject *gclist;
unsigned char numparams;
unsigned char is_vararg;
unsigned char maxstacksize;
} Proto;
typedef struct LClosure
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
unsigned char nupvalues;
GCObject *gclist;
}
unsigned char nupvalues;
struct Proto *p;
UpVal *upvals[1];
} LClosure;
typedef union Closure
{
struct CClosure c;
struct LClosure l;
} Closure;
typedef struct UpVal
{
{
GCObject *next;
unsigned char tt;
unsigned char marked;
}
TValue *v;
union
{
TValue value;
struct
{
struct UpVal *prev;
struct UpVal *next;
}l;
} u;
} UpVal;
typedef union GCObject
{
typedef struct GCheader
{
GCObject *next;
unsigned char tt;
unsigned char marked;
} gch;
union TString ts;
union Udata u;
union Closure cl;
struct Table h;
struct Proto p;
struct UpVal uv;
struct lua_State th;
}GCObject;
typedef union TString
{
struct
{
GCObject *next;
unsigned char tt;
unsigned char marked;
unsigned char extra;
unsigned int hash;
size_t len;
} tsv;
}TString;
typedef struct CallInfo
{
TValue * func;
TValue * top;
struct CallInfo *previous;
struct CallInfo *next;
short nresults;
unsigned char callstatus;
int extra;
union
{
struct
{
TValue * base;
const unsigned int *savedpc;
} l;
struct
{
int ctx;
lua_CFunction k;
int old_errfunc;
unsigned char old_allowhook;
unsigned char status;
} c;
} u;
} CallInfo;
typedef struct stringtable
{
GCObject **hash;
unsigned int nuse;
int size;
} stringtable;
typedef struct Mbuffer
{
char *buffer;
size_t n;
size_t buffsize;
} Mbuffer;
struct lua_longjmp
{
struct lua_longjmp *previous;
int b;
volatile int status;
};
typedef struct lua_State
{
GCObject *next;
unsigned char tt;
unsigned char marked;
unsigned char status;
TValue * top;
global_State *l_G;
CallInfo *ci;
const unsigned int *oldpc;
TValue * stack_last;
TValue * stack;
int stacksize;
unsigned short nny;
unsigned short nCcalls;
unsigned char hookmask;
unsigned char allowhook;
int basehookcount;
int hookcount;
lua_Hook hook;
GCObject *openupval;
GCObject *gclist;
struct lua_longjmp *errorJmp;
int errfunc;
struct CallInfo base_ci;
}lua_State;
typedef struct global_State
{
lua_Alloc frealloc;
void *ud;
size_t totalbytes;
int GCdebt;
size_t GCmemtrav;
size_t GCestimate;
struct stringtable strt;
TValue l_registry;
unsigned int seed;
unsigned char currentwhite;
unsigned char gcstate;
unsigned char gckind;
unsigned char gcrunning;
int sweepstrgc;
GCObject *allgc;
GCObject *finobj;
GCObject **sweepgc;
GCObject **sweepfin;
GCObject *gray;
GCObject *grayagain;
GCObject *weak;
GCObject *ephemeron;
GCObject *allweak;
GCObject *tobefnz;
struct UpVal uvhead;
struct Mbuffer buff;
int gcpause;
int gcmajorinc;
int gcstepmul;
lua_CFunction panic;
struct lua_State *mainthread;
const double *version;
TString *memerrmsg;
TString *tmname[17];
struct Table *mt[9];
}global_State;
LUA源码中涉及到的数据结构
最新推荐文章于 2022-04-13 18:13:35 发布