lua5.4
lundump.h
浏览该文件的文档.
1 /*
2 ** $Id: lundump.h $
3 ** load precompiled Lua chunks
4 ** See Copyright Notice in lua.h
5 */
6 
7 #ifndef lundump_h
8 #define lundump_h
9 
10 #include "llimits.h"
11 #include "lobject.h"
12 #include "lzio.h"
13 
14 
15 /* data to catch conversion errors */
16 #define LUAC_DATA "\x19\x93\r\n\x1a\n"
17 
18 #define LUAC_INT 0x5678
19 #define LUAC_NUM cast_num(370.5)
20 
21 /*
22 ** Encode major-minor version in one byte, one nibble for each
23 */
24 #define MYINT(s) (s[0]-'0') /* assume one-digit numerals */
25 #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR))
26 
27 #define LUAC_FORMAT 0 /* this is the official format */
28 
29 /* load one chunk; from lundump.c */
30 LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
31 
32 /* dump one chunk; from ldump.c */
33 LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
34  void* data, int strip);
35 
36 #endif
LUAC_INT
#define LUAC_INT
Definition: lundump.h:18
Proto::upvalues
Upvaldesc * upvalues
Definition: lobject.h:547
Upvaldesc::kind
lu_byte kind
Definition: lobject.h:497
lua_assert
#define lua_assert(c)
Definition: lauxlib.h:169
loadUpvalues
static void loadUpvalues(LoadState *S, Proto *f)
Definition: lundump.c:212
ls_byte
signed char ls_byte
Definition: llimits.h:37
LUAI_FUNC
#define LUAI_FUNC
Definition: luaconf.h:307
cast_byte
#define cast_byte(i)
Definition: llimits.h:130
l_noret
#define l_noret
Definition: llimits.h:178
Proto::code
Instruction * code
Definition: lobject.h:545
luaU_undump
LClosure * luaU_undump(lua_State *L, ZIO *Z, const char *name)
Definition: lundump.c:311
luai_verifycode
#define luai_verifycode(L, f)
Definition: lundump.c:29
loadVar
#define loadVar(S, x)
Definition: lundump.c:58
AbsLineInfo::pc
int pc
Definition: lobject.h:523
LUAI_MAXSHORTLEN
#define LUAI_MAXSHORTLEN
Definition: llimits.h:205
Proto::sizeabslineinfo
int sizeabslineinfo
Definition: lobject.h:541
checkHeader
static void checkHeader(LoadState *S)
Definition: lundump.c:290
luaM_newvectorchecked
#define luaM_newvectorchecked(L, n, t)
Definition: lmem.h:61
luaS_newlstr
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
Definition: lstring.c:221
loadDebug
static void loadDebug(LoadState *S, Proto *f)
Definition: lundump.c:227
loadProtos
static void loadProtos(LoadState *S, Proto *f)
Definition: lundump.c:191
luaC_objbarrier
#define luaC_objbarrier(L, p, o)
Definition: lgc.h:173
LocVar::varname
TString * varname
Definition: lobject.h:506
Proto::lastlinedefined
int lastlinedefined
Definition: lobject.h:543
lua_Writer
int(* lua_Writer)(lua_State *L, const void *p, size_t sz, void *ud)
Definition: lua.h:119
LUA_VNUMINT
#define LUA_VNUMINT
Definition: lobject.h:301
Proto::p
struct Proto ** p
Definition: lobject.h:546
LUA_VNUMFLT
#define LUA_VNUMFLT
Definition: lobject.h:302
Proto::is_vararg
lu_byte is_vararg
Definition: lobject.h:533
LUAC_DATA
#define LUAC_DATA
Definition: lundump.h:16
lua_Number
LUA_NUMBER lua_Number
Definition: lua.h:90
llimits.h
luaZ_read
size_t luaZ_read(ZIO *z, void *b, size_t n)
Definition: lzio.c:48
luaU_dump
LUAI_FUNC int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, int strip)
Definition: ldump.c:213
fchecksize
static void fchecksize(LoadState *S, size_t size, const char *tname)
Definition: lundump.c:282
checksize
#define checksize(S, t)
Definition: lundump.c:288
LUA_VFALSE
#define LUA_VFALSE
Definition: lobject.h:217
Upvaldesc::name
TString * name
Definition: lobject.h:494
Proto::sizecode
int sizecode
Definition: lobject.h:537
loadFunction
static void loadFunction(LoadState *S, Proto *f, TString *psource)
Definition: lundump.c:256
error
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:40
Proto::sizep
int sizep
Definition: lobject.h:539
Proto::source
TString * source
Definition: lobject.h:551
loadUnsigned
static size_t loadUnsigned(LoadState *S, size_t limit)
Definition: lundump.c:69
LUAC_NUM
#define LUAC_NUM
Definition: lundump.h:19
LocVar::startpc
int startpc
Definition: lobject.h:507
Proto::numparams
lu_byte numparams
Definition: lobject.h:532
LUAC_VERSION
#define LUAC_VERSION
Definition: lundump.h:25
setnilvalue
#define setnilvalue(obj)
Definition: lobject.h:178
loadString
static TString * loadString(LoadState *S, Proto *p)
Definition: lundump.c:136
Proto::linedefined
int linedefined
Definition: lobject.h:542
lua.h
loadBlock
static void loadBlock(LoadState *S, void *b, size_t size)
Definition: lundump.c:52
setbfvalue
#define setbfvalue(obj)
Definition: lobject.h:228
LoadState::Z
ZIO * Z
Definition: lundump.c:35
Proto::abslineinfo
AbsLineInfo * abslineinfo
Definition: lobject.h:549
LoadState::L
lua_State * L
Definition: lundump.c:34
loadConstants
static void loadConstants(LoadState *S, Proto *f)
Definition: lundump.c:155
loadStringN
static TString * loadStringN(LoadState *S, Proto *p)
Definition: lundump.c:110
AbsLineInfo::line
int line
Definition: lobject.h:524
LUA_VLNGSTR
#define LUA_VLNGSTR
Definition: lobject.h:339
LUA_VSHRSTR
#define LUA_VSHRSTR
Definition: lobject.h:338
TString
Definition: lobject.h:364
lprefix.h
LUA_VTRUE
#define LUA_VTRUE
Definition: lobject.h:218
setclLvalue2s
#define setclLvalue2s(L, o, cl)
Definition: lobject.h:592
loadInt
static int loadInt(LoadState *S)
Definition: lundump.c:88
setsvalue2s
#define setsvalue2s(L, o, s)
Definition: lobject.h:355
ldebug.h
Proto::sizek
int sizek
Definition: lobject.h:536
lu_byte
unsigned char lu_byte
Definition: llimits.h:36
getstr
#define getstr(ts)
Definition: lobject.h:381
LUA_SIGNATURE
#define LUA_SIGNATURE
Definition: lua.h:33
luaD_inctop
void luaD_inctop(lua_State *L)
Definition: ldo.c:281
Proto::lineinfo
ls_byte * lineinfo
Definition: lobject.h:548
LUA_VNIL
#define LUA_VNIL
Definition: lobject.h:161
luaU_undump
LUAI_FUNC LClosure * luaU_undump(lua_State *L, ZIO *Z, const char *name)
Definition: lundump.c:311
lobject.h
LUAC_FORMAT
#define LUAC_FORMAT
Definition: lundump.h:27
lua_State
Definition: lstate.h:273
lua_Integer
LUA_INTEGER lua_Integer
Definition: lua.h:94
LClosure::p
struct Proto * p
Definition: lobject.h:633
lundump.h
loadCode
static void loadCode(LoadState *S, Proto *f)
Definition: lundump.c:144
TValue
Definition: lobject.h:65
AbsLineInfo
Definition: lobject.h:522
Proto::k
TValue * k
Definition: lobject.h:544
luaF_newproto
Proto * luaF_newproto(lua_State *L)
Definition: lfunc.c:246
LClosure
Definition: lobject.h:631
Proto::sizelineinfo
int sizelineinfo
Definition: lobject.h:538
Proto::maxstacksize
lu_byte maxstacksize
Definition: lobject.h:534
loadSize
static size_t loadSize(LoadState *S)
Definition: lundump.c:83
Upvaldesc::instack
lu_byte instack
Definition: lobject.h:495
LUA_ERRSYNTAX
#define LUA_ERRSYNTAX
Definition: lua.h:52
luaO_pushfstring
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
Definition: lobject.c:539
LoadState::name
const char * name
Definition: lundump.c:36
loadByte
static lu_byte loadByte(LoadState *S)
Definition: lundump.c:61
Proto::sizeupvalues
int sizeupvalues
Definition: lobject.h:535
Instruction
l_uint32 Instruction
Definition: llimits.h:194
luaD_throw
l_noret luaD_throw(lua_State *L, int errcode)
Definition: ldo.c:114
setivalue
#define setivalue(obj, x)
Definition: lobject.h:322
loadVector
#define loadVector(S, b, n)
Definition: lundump.c:50
Proto
Definition: lobject.h:530
loadInteger
static lua_Integer loadInteger(LoadState *S)
Definition: lundump.c:100
lstring.h
luaF_newLclosure
LClosure * luaF_newLclosure(lua_State *L, int nupvals)
Definition: lfunc.c:35
Upvaldesc
Definition: lobject.h:493
Upvaldesc::idx
lu_byte idx
Definition: lobject.h:496
setsvalue2n
#define setsvalue2n
Definition: lobject.h:358
LoadState
Definition: lundump.c:33
lmem.h
lua_State::top
StkId top
Definition: lstate.h:278
LocVar
Definition: lobject.h:505
setfltvalue
#define setfltvalue(obj, x)
Definition: lobject.h:316
Zio
Definition: lzio.h:55
luaS_createlngstrobj
TString * luaS_createlngstrobj(lua_State *L, size_t l)
Definition: lstring.c:157
setbtvalue
#define setbtvalue(obj)
Definition: lobject.h:229
lzio.h
loadNumber
static lua_Number loadNumber(LoadState *S)
Definition: lundump.c:93
Proto::locvars
LocVar * locvars
Definition: lobject.h:550
zgetc
#define zgetc(z)
Definition: lzio.h:20
LocVar::endpc
int endpc
Definition: lobject.h:508
Proto::sizelocvars
int sizelocvars
Definition: lobject.h:540
checkliteral
static void checkliteral(LoadState *S, const char *s, const char *msg)
Definition: lundump.c:273
lfunc.h
EOZ
#define EOZ
Definition: lzio.h:16
ldo.h
cast_int
#define cast_int(i)
Definition: llimits.h:128