|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# peek-luadecls-1.txt
# This is part of peek.lua, that is part of the DaVinci project.
# See: <http://angg.twu.net/davinci.html>
# <http://angg.twu.net/peek.html>
# Author: Eduardo Ochs <eduardoochs@gmail.com>
# Version: 2007aug05
# This is the output of
# (find-lua51sh "cd src/; gcc -E -x c lstate.h")
# (find-lua51sh "cd src/; gcc -E -x c lstate.h | grep -v '^#'")
# after some minimal hand-tuning - empty lines and declarations of
# functions were removed.
# (find-lua51file "src/")
# (find-lua51file "src/lua.h")
# (find-lua51file "src/llimits.h")
# (find-lua51file "src/lobject.h")
# (find-lua51file "src/ltm.h")
# (find-lua51file "src/lzio.h")
# (find-lua51file "src/lstate.h")
# (find-lua51sh "cd src/; ls *.h")
typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef int wchar_t;
union luai_Cast { double l_d; long l_l; };
typedef struct lua_State lua_State;
typedef int (*lua_CFunction) (lua_State *L);
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
typedef double lua_Number;
typedef ptrdiff_t lua_Integer;
typedef struct lua_Debug lua_Debug;
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
struct lua_Debug {
int event;
const char *name;
const char *namewhat;
const char *what;
const char *source;
int currentline;
int nups;
int linedefined;
int lastlinedefined;
char short_src[60];
int i_ci;
};
typedef unsigned int lu_int32;
typedef size_t lu_mem;
typedef ptrdiff_t l_mem;
typedef unsigned char lu_byte;
typedef union { double u; void *s; long l; } L_Umaxalign;
typedef double l_uacNumber;
typedef lu_int32 Instruction;
typedef union GCObject GCObject;
typedef struct GCheader {
GCObject *next; lu_byte tt; lu_byte marked;
} GCheader;
typedef union {
GCObject *gc;
void *p;
lua_Number n;
int b;
} Value;
typedef struct lua_TValue {
Value value; int tt;
} TValue;
typedef TValue *StkId;
typedef union TString {
L_Umaxalign dummy;
struct {
GCObject *next; lu_byte tt; lu_byte marked;
lu_byte reserved;
unsigned int hash;
size_t len;
} tsv;
} TString;
typedef union Udata {
L_Umaxalign dummy;
struct {
GCObject *next; lu_byte tt; lu_byte marked;
struct Table *metatable;
struct Table *env;
size_t len;
} uv;
} Udata;
typedef struct Proto {
GCObject *next; lu_byte tt; lu_byte marked;
TValue *k;
Instruction *code;
struct Proto **p;
int *lineinfo;
struct LocVar *locvars;
TString **upvalues;
TString *source;
int sizeupvalues;
int sizek;
int sizecode;
int sizelineinfo;
int sizep;
int sizelocvars;
int linedefined;
int lastlinedefined;
GCObject *gclist;
lu_byte nups;
lu_byte numparams;
lu_byte is_vararg;
lu_byte maxstacksize;
} Proto;
typedef struct LocVar {
TString *varname;
int startpc;
int endpc;
} LocVar;
typedef struct UpVal {
GCObject *next; lu_byte tt; lu_byte marked;
TValue *v;
union {
TValue value;
struct {
struct UpVal *prev;
struct UpVal *next;
} l;
} u;
} UpVal;
typedef struct CClosure {
GCObject *next; lu_byte tt; lu_byte marked; lu_byte isC; lu_byte nupvalues; GCObject *gclist; struct Table *env;
lua_CFunction f;
TValue upvalue[1];
} CClosure;
typedef struct LClosure {
GCObject *next; lu_byte tt; lu_byte marked; lu_byte isC; lu_byte nupvalues; GCObject *gclist; struct Table *env;
struct Proto *p;
UpVal *upvals[1];
} LClosure;
typedef union Closure {
CClosure c;
LClosure l;
} Closure;
typedef union TKey {
struct {
Value value; int tt;
struct Node *next;
} nk;
TValue tvk;
} TKey;
typedef struct Node {
TValue i_val;
TKey i_key;
} Node;
typedef struct Table {
GCObject *next; lu_byte tt; lu_byte marked;
lu_byte flags;
lu_byte lsizenode;
struct Table *metatable;
TValue *array;
Node *node;
Node *lastfree;
GCObject *gclist;
int sizearray;
} Table;
typedef enum {
TM_INDEX,
TM_NEWINDEX,
TM_GC,
TM_MODE,
TM_EQ,
TM_ADD,
TM_SUB,
TM_MUL,
TM_DIV,
TM_MOD,
TM_POW,
TM_UNM,
TM_LEN,
TM_LT,
TM_LE,
TM_CONCAT,
TM_CALL,
TM_N
} TMS;
typedef struct Zio ZIO;
typedef struct Mbuffer {
char *buffer;
size_t n;
size_t buffsize;
} Mbuffer;
struct Zio {
size_t n;
const char *p;
lua_Reader reader;
void* data;
lua_State *L;
};
struct lua_longjmp;
typedef struct stringtable {
GCObject **hash;
lu_int32 nuse;
int size;
} stringtable;
typedef struct CallInfo {
StkId base;
StkId func;
StkId top;
const Instruction *savedpc;
int nresults;
int tailcalls;
} CallInfo;
typedef struct global_State {
stringtable strt;
lua_Alloc frealloc;
void *ud;
lu_byte currentwhite;
lu_byte gcstate;
int sweepstrgc;
GCObject *rootgc;
GCObject **sweepgc;
GCObject *gray;
GCObject *grayagain;
GCObject *weak;
GCObject *tmudata;
Mbuffer buff;
lu_mem GCthreshold;
lu_mem totalbytes;
lu_mem estimate;
lu_mem gcdept;
int gcpause;
int gcstepmul;
lua_CFunction panic;
TValue l_registry;
struct lua_State *mainthread;
UpVal uvhead;
struct Table *mt[(8 +1)];
TString *tmname[TM_N];
} global_State;
struct lua_State {
GCObject *next; lu_byte tt; lu_byte marked;
lu_byte status;
StkId top;
StkId base;
global_State *l_G;
CallInfo *ci;
const Instruction *savedpc;
StkId stack_last;
StkId stack;
CallInfo *end_ci;
CallInfo *base_ci;
int stacksize;
int size_ci;
unsigned short nCcalls;
lu_byte hookmask;
lu_byte allowhook;
int basehookcount;
int hookcount;
lua_Hook hook;
TValue l_gt;
TValue env;
GCObject *openupval;
GCObject *gclist;
struct lua_longjmp *errorJmp;
ptrdiff_t errfunc;
};
union GCObject {
GCheader gch;
union TString ts;
union Udata u;
union Closure cl;
struct Table h;
struct Proto p;
struct UpVal uv;
struct lua_State th;
};