diff options
-rw-r--r-- | ldo.c | 5 | ||||
-rw-r--r-- | lundump.c | 8 | ||||
-rw-r--r-- | lundump.h | 4 |
3 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.194 2002/09/02 20:00:41 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.195 2002/10/08 18:46:08 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -426,7 +426,8 @@ struct SParser { /* data to `f_parser' */ | |||
426 | 426 | ||
427 | static void f_parser (lua_State *L, void *ud) { | 427 | static void f_parser (lua_State *L, void *ud) { |
428 | struct SParser *p = cast(struct SParser *, ud); | 428 | struct SParser *p = cast(struct SParser *, ud); |
429 | Proto *tf = p->bin ? luaU_undump(L, p->z) : luaY_parser(L, p->z, &p->buff); | 429 | Proto *tf = p->bin ? luaU_undump(L, p->z, &p->buff) : |
430 | luaY_parser(L, p->z, &p->buff); | ||
430 | Closure *cl = luaF_newLclosure(L, 0, gt(L)); | 431 | Closure *cl = luaF_newLclosure(L, 0, gt(L)); |
431 | cl->l.p = tf; | 432 | cl->l.p = tf; |
432 | setclvalue(L->top, cl); | 433 | setclvalue(L->top, cl); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 1.53 2002/09/19 13:03:53 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 1.54 2002/10/08 18:46:08 roberto Exp roberto $ |
3 | ** load pre-compiled Lua chunks | 3 | ** load pre-compiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -19,6 +19,7 @@ | |||
19 | typedef struct { | 19 | typedef struct { |
20 | lua_State* L; | 20 | lua_State* L; |
21 | ZIO* Z; | 21 | ZIO* Z; |
22 | Mbuffer *buff; | ||
22 | int swap; | 23 | int swap; |
23 | const char* name; | 24 | const char* name; |
24 | } LoadState; | 25 | } LoadState; |
@@ -99,7 +100,7 @@ static TString* LoadString (LoadState* S) | |||
99 | return NULL; | 100 | return NULL; |
100 | else | 101 | else |
101 | { | 102 | { |
102 | char* s=luaZ_openspace(S->L,&G(S->L)->buff,size); | 103 | char* s=luaZ_openspace(S->L,S->buff,size); |
103 | ezread(S,s,size); | 104 | ezread(S,s,size); |
104 | return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ | 105 | return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ |
105 | } | 106 | } |
@@ -245,7 +246,7 @@ static Proto* LoadChunk (LoadState* S) | |||
245 | /* | 246 | /* |
246 | ** load one chunk from a file or buffer | 247 | ** load one chunk from a file or buffer |
247 | */ | 248 | */ |
248 | Proto* luaU_undump (lua_State* L, ZIO* Z) | 249 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer *buff) |
249 | { | 250 | { |
250 | LoadState S; | 251 | LoadState S; |
251 | Proto* f; | 252 | Proto* f; |
@@ -258,6 +259,7 @@ Proto* luaU_undump (lua_State* L, ZIO* Z) | |||
258 | S.name=s; | 259 | S.name=s; |
259 | S.L=L; | 260 | S.L=L; |
260 | S.Z=Z; | 261 | S.Z=Z; |
262 | S.buff=buff; | ||
261 | f=LoadChunk(&S); | 263 | f=LoadChunk(&S); |
262 | if (zgetc(Z)!=EOZ) | 264 | if (zgetc(Z)!=EOZ) |
263 | luaG_runerror(L,"%s apparently contains more than one chunk",S.name); | 265 | luaG_runerror(L,"%s apparently contains more than one chunk",S.name); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.h,v 1.26 2002/08/07 00:36:03 lhf Exp $ | 2 | ** $Id: lundump.h,v 1.27 2002/08/12 13:37:19 roberto Exp roberto $ |
3 | ** load pre-compiled Lua chunks | 3 | ** load pre-compiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -13,7 +13,7 @@ | |||
13 | typedef int (*Writer)(const void* p, size_t size, void* u); | 13 | typedef int (*Writer)(const void* p, size_t size, void* u); |
14 | 14 | ||
15 | /* load one chunk; from lundump.c */ | 15 | /* load one chunk; from lundump.c */ |
16 | Proto* luaU_undump (lua_State* L, ZIO* Z); | 16 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer *buff); |
17 | 17 | ||
18 | /* find byte order; from lundump.c */ | 18 | /* find byte order; from lundump.c */ |
19 | int luaU_endianness (void); | 19 | int luaU_endianness (void); |