last changes by lhf
This commit is contained in:
9
ldump.c
9
ldump.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldump.c,v 1.3 2003/01/27 15:52:57 roberto Exp roberto $
|
||||
** $Id: ldump.c,v 1.4 2003/02/11 23:52:12 lhf Exp $
|
||||
** save bytecodes
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -90,9 +90,9 @@ static void DumpLines(const Proto* f, DumpState* D)
|
||||
|
||||
static void DumpUpvalues(const Proto* f, DumpState* D)
|
||||
{
|
||||
int i,n=f->sizeupvalues;
|
||||
DumpInt(n,D);
|
||||
for (i=0; i<n; i++) DumpString(f->upvalues[i],D);
|
||||
int i,n=f->sizeupvalues;
|
||||
DumpInt(n,D);
|
||||
for (i=0; i<n; i++) DumpString(f->upvalues[i],D);
|
||||
}
|
||||
|
||||
static void DumpFunction(const Proto* f, const TString* p, DumpState* D);
|
||||
@@ -167,3 +167,4 @@ void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data)
|
||||
DumpHeader(&D);
|
||||
DumpFunction(Main,NULL,&D);
|
||||
}
|
||||
|
||||
|
||||
10
lundump.c
10
lundump.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lundump.c,v 1.59 2003/01/27 15:52:57 roberto Exp roberto $
|
||||
** $Id: lundump.c,v 1.49 2003/04/07 20:34:20 lhf Exp $
|
||||
** load pre-compiled Lua chunks
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ static TString* LoadString (LoadState* S)
|
||||
{
|
||||
char* s=luaZ_openspace(S->L,S->b,size);
|
||||
ezread(S,s,size);
|
||||
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
|
||||
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ static void LoadUpvalues (LoadState* S, Proto* f)
|
||||
luaG_runerror(S->L,"bad nupvalues in %s: read %d; expected %d",
|
||||
S->name,n,f->nups);
|
||||
f->upvalues=luaM_newvector(S->L,n,TString*);
|
||||
f->sizeupvalues = n;
|
||||
f->sizeupvalues=n;
|
||||
for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);
|
||||
}
|
||||
|
||||
@@ -226,14 +226,14 @@ static void TestSize (LoadState* S, int s, const char* what)
|
||||
static void LoadHeader (LoadState* S)
|
||||
{
|
||||
int version;
|
||||
lua_Number x=0,tx=TEST_NUMBER;
|
||||
lua_Number x,tx=TEST_NUMBER;
|
||||
LoadSignature(S);
|
||||
version=LoadByte(S);
|
||||
if (version>VERSION)
|
||||
luaG_runerror(S->L,"%s too new: "
|
||||
"read version %d.%d; expected at most %d.%d",
|
||||
S->name,V(version),V(VERSION));
|
||||
if (version<VERSION0) /* check last major change */
|
||||
if (version<VERSION0) /* check last major change */
|
||||
luaG_runerror(S->L,"%s too old: "
|
||||
"read version %d.%d; expected at least %d.%d",
|
||||
S->name,V(version),V(VERSION0));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lundump.h,v 1.28 2002/12/13 11:12:35 lhf Exp $
|
||||
** $Id: lundump.h,v 1.30 2003/04/07 20:34:20 lhf Exp $
|
||||
** load pre-compiled Lua chunks
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -23,12 +23,12 @@ void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data);
|
||||
void luaU_print (const Proto* Main);
|
||||
|
||||
/* definitions for headers of binary files */
|
||||
#define LUA_SIGNATURE "\033Lua" /* binary files start with <esc>Lua */
|
||||
#define LUA_SIGNATURE "\033Lua" /* binary files start with "<esc>Lua" */
|
||||
#define VERSION 0x50 /* last format change was in 5.0 */
|
||||
#define VERSION0 0x50 /* last major change was in 5.0 */
|
||||
|
||||
/* a multiple of PI for testing native format */
|
||||
/* multiplying by 1E8 gives non-trivial integer values */
|
||||
#define TEST_NUMBER 3.14159265358979323846E8
|
||||
/* multiplying by 1E7 gives non-trivial integer values */
|
||||
#define TEST_NUMBER ((lua_Number)3.14159265358979323846E7)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user