summaryrefslogtreecommitdiff
path: root/lundump.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-07-12 16:34:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-07-12 16:34:03 -0300
commit9f25df02d53f6d31d904957bc411ef72d8378dc8 (patch)
treef03105ea6d9bc5f6c9ac0ebeff6d3a3f48479637 /lundump.c
parentae1cf64348ca7bcb6d3abb19a0b97918e343914c (diff)
downloadlua-9f25df02d53f6d31d904957bc411ef72d8378dc8.tar.gz
lua-9f25df02d53f6d31d904957bc411ef72d8378dc8.tar.bz2
lua-9f25df02d53f6d31d904957bc411ef72d8378dc8.zip
new definition for headers of binary files
Diffstat (limited to 'lundump.c')
-rw-r--r--lundump.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lundump.c b/lundump.c
index f365b577..0e09513c 100644
--- a/lundump.c
+++ b/lundump.c
@@ -165,8 +165,7 @@ static void LoadConstants (lua_State* L, Proto* f, ZIO* Z, int swap)
165 n=LoadInt(L,Z,swap); 165 n=LoadInt(L,Z,swap);
166 f->p=luaM_newvector(L,n,Proto*); 166 f->p=luaM_newvector(L,n,Proto*);
167 f->sizep=n; 167 f->sizep=n;
168 for (i=0; i<n; i++) 168 for (i=0; i<n; i++) f->p[i]=LoadFunction(L,Z,swap);
169 f->p[i]=LoadFunction(L,Z,swap);
170} 169}
171 170
172static Proto* LoadFunction (lua_State* L, ZIO* Z, int swap) 171static Proto* LoadFunction (lua_State* L, ZIO* Z, int swap)
@@ -190,7 +189,7 @@ static Proto* LoadFunction (lua_State* L, ZIO* Z, int swap)
190 189
191static void LoadSignature (lua_State* L, ZIO* Z) 190static void LoadSignature (lua_State* L, ZIO* Z)
192{ 191{
193 const l_char* s=l_s(SIGNATURE); 192 const l_char* s=l_s(LUA_SIGNATURE);
194 while (*s!=0 && ezgetc(L,Z)==*s) 193 while (*s!=0 && ezgetc(L,Z)==*s)
195 ++s; 194 ++s;
196 if (*s!=0) luaO_verror(L,l_s("bad signature in `%.99s'"),ZNAME(Z)); 195 if (*s!=0) luaO_verror(L,l_s("bad signature in `%.99s'"),ZNAME(Z));
@@ -245,16 +244,11 @@ static Proto* LoadChunk (lua_State* L, ZIO* Z)
245 244
246/* 245/*
247** load one chunk from a file or buffer 246** load one chunk from a file or buffer
248** return main if ok and NULL at EOF
249*/ 247*/
250Proto* luaU_undump (lua_State* L, ZIO* Z) 248Proto* luaU_undump (lua_State* L, ZIO* Z)
251{ 249{
252 Proto* f=NULL; 250 Proto* f=LoadChunk(L,Z);
253 int c=zgetc(Z); 251 if (zgetc(Z)!=EOZ)
254 if (c==ID_CHUNK)
255 f=LoadChunk(L,Z);
256 c=zgetc(Z);
257 if (c!=EOZ)
258 luaO_verror(L,l_s("`%.99s' apparently contains more than one chunk"),ZNAME(Z)); 252 luaO_verror(L,l_s("`%.99s' apparently contains more than one chunk"),ZNAME(Z));
259 return f; 253 return f;
260} 254}