diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-25 16:51:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-25 16:51:54 -0300 |
commit | 9fcc48517659c72de43bece515fdd5cea88c07f8 (patch) | |
tree | ad065ea1c7e2c0f6781e366e9a2e95b4cadb1780 | |
parent | 64066359dda2a0920d307e901185faf78cc32b97 (diff) | |
download | lua-9fcc48517659c72de43bece515fdd5cea88c07f8.tar.gz lua-9fcc48517659c72de43bece515fdd5cea88c07f8.tar.bz2 lua-9fcc48517659c72de43bece515fdd5cea88c07f8.zip |
zio does not keep "source" name (nobody uses it)
-rw-r--r-- | lapi.c | 6 | ||||
-rw-r--r-- | ldo.c | 10 | ||||
-rw-r--r-- | ldo.h | 4 | ||||
-rw-r--r-- | lparser.c | 6 | ||||
-rw-r--r-- | lparser.h | 4 | ||||
-rw-r--r-- | lundump.c | 5 | ||||
-rw-r--r-- | lundump.h | 4 | ||||
-rw-r--r-- | lzio.c | 5 | ||||
-rw-r--r-- | lzio.h | 7 |
9 files changed, 24 insertions, 27 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.240 2003/07/07 13:34:25 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.241 2003/08/15 13:48:53 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -718,9 +718,9 @@ LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, | |||
718 | int c; | 718 | int c; |
719 | lua_lock(L); | 719 | lua_lock(L); |
720 | if (!chunkname) chunkname = "?"; | 720 | if (!chunkname) chunkname = "?"; |
721 | luaZ_init(&z, reader, data, chunkname); | 721 | luaZ_init(&z, reader, data); |
722 | c = luaZ_lookahead(&z); | 722 | c = luaZ_lookahead(&z); |
723 | status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0])); | 723 | status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0]), chunkname); |
724 | lua_unlock(L); | 724 | lua_unlock(L); |
725 | return status; | 725 | return status; |
726 | } | 726 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.220 2003/07/16 20:49:02 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.221 2003/07/16 20:51:47 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 | */ |
@@ -431,6 +431,7 @@ struct SParser { /* data to `f_parser' */ | |||
431 | ZIO *z; | 431 | ZIO *z; |
432 | Mbuffer buff; /* buffer to be used by the scanner */ | 432 | Mbuffer buff; /* buffer to be used by the scanner */ |
433 | int bin; | 433 | int bin; |
434 | const char *name; | ||
434 | }; | 435 | }; |
435 | 436 | ||
436 | static void f_parser (lua_State *L, void *ud) { | 437 | static void f_parser (lua_State *L, void *ud) { |
@@ -439,7 +440,8 @@ static void f_parser (lua_State *L, void *ud) { | |||
439 | Closure *cl; | 440 | Closure *cl; |
440 | luaC_checkGC(L); | 441 | luaC_checkGC(L); |
441 | p = cast(struct SParser *, ud); | 442 | p = cast(struct SParser *, ud); |
442 | tf = p->bin ? luaU_undump(L, p->z, &p->buff) : luaY_parser(L, p->z, &p->buff); | 443 | tf = p->bin ? luaU_undump(L, p->z, &p->buff, p->name) : |
444 | luaY_parser(L, p->z, &p->buff, p->name); | ||
443 | cl = luaF_newLclosure(L, 0, gt(L)); | 445 | cl = luaF_newLclosure(L, 0, gt(L)); |
444 | cl->l.p = tf; | 446 | cl->l.p = tf; |
445 | setclvalue(L->top, cl); | 447 | setclvalue(L->top, cl); |
@@ -447,11 +449,11 @@ static void f_parser (lua_State *L, void *ud) { | |||
447 | } | 449 | } |
448 | 450 | ||
449 | 451 | ||
450 | int luaD_protectedparser (lua_State *L, ZIO *z, int bin) { | 452 | int luaD_protectedparser (lua_State *L, ZIO *z, int bin, const char *name) { |
451 | struct SParser p; | 453 | struct SParser p; |
452 | int status; | 454 | int status; |
453 | ptrdiff_t oldtopr = savestack(L, L->top); /* save current top */ | 455 | ptrdiff_t oldtopr = savestack(L, L->top); /* save current top */ |
454 | p.z = z; p.bin = bin; | 456 | p.z = z; p.bin = bin; p.name = name; |
455 | luaZ_initbuffer(L, &p.buff); | 457 | luaZ_initbuffer(L, &p.buff); |
456 | status = luaD_rawrunprotected(L, f_parser, &p); | 458 | status = luaD_rawrunprotected(L, f_parser, &p); |
457 | luaZ_freebuffer(L, &p.buff); | 459 | luaZ_freebuffer(L, &p.buff); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.h,v 1.55 2002/11/21 17:41:25 roberto Exp roberto $ | 2 | ** $Id: ldo.h,v 1.56 2002/12/04 17:29:32 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 | */ |
@@ -42,7 +42,7 @@ | |||
42 | typedef void (*Pfunc) (lua_State *L, void *ud); | 42 | typedef void (*Pfunc) (lua_State *L, void *ud); |
43 | 43 | ||
44 | void luaD_resetprotection (lua_State *L); | 44 | void luaD_resetprotection (lua_State *L); |
45 | int luaD_protectedparser (lua_State *L, ZIO *z, int bin); | 45 | int luaD_protectedparser (lua_State *L, ZIO *z, int bin, const char *name); |
46 | void luaD_callhook (lua_State *L, int event, int line); | 46 | void luaD_callhook (lua_State *L, int event, int line); |
47 | StkId luaD_precall (lua_State *L, StkId func); | 47 | StkId luaD_precall (lua_State *L, StkId func); |
48 | void luaD_call (lua_State *L, StkId func, int nResults); | 48 | void luaD_call (lua_State *L, StkId func, int nResults); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.214 2003/07/28 18:31:20 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.215 2003/07/29 18:51:00 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -348,12 +348,12 @@ static void close_func (LexState *ls) { | |||
348 | } | 348 | } |
349 | 349 | ||
350 | 350 | ||
351 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff) { | 351 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { |
352 | struct LexState lexstate; | 352 | struct LexState lexstate; |
353 | struct FuncState funcstate; | 353 | struct FuncState funcstate; |
354 | lexstate.buff = buff; | 354 | lexstate.buff = buff; |
355 | lexstate.nestlevel = 0; | 355 | lexstate.nestlevel = 0; |
356 | luaX_setinput(L, &lexstate, z, luaS_new(L, zname(z))); | 356 | luaX_setinput(L, &lexstate, z, luaS_new(L, name)); |
357 | open_func(&lexstate, &funcstate); | 357 | open_func(&lexstate, &funcstate); |
358 | next(&lexstate); /* read first token */ | 358 | next(&lexstate); /* read first token */ |
359 | chunk(&lexstate); | 359 | chunk(&lexstate); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.h,v 1.48 2003/07/09 15:36:38 roberto Exp roberto $ | 2 | ** $Id: lparser.h,v 1.49 2003/07/09 20:11:30 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -71,7 +71,7 @@ typedef struct FuncState { | |||
71 | } FuncState; | 71 | } FuncState; |
72 | 72 | ||
73 | 73 | ||
74 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff); | 74 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name); |
75 | 75 | ||
76 | 76 | ||
77 | #endif | 77 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 1.49 2003/04/07 20:34:20 lhf Exp lhf $ | 2 | ** $Id: lundump.c,v 1.62 2003/08/15 13:48:53 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 | */ |
@@ -256,10 +256,9 @@ static Proto* LoadChunk (LoadState* S) | |||
256 | /* | 256 | /* |
257 | ** load precompiled chunk | 257 | ** load precompiled chunk |
258 | */ | 258 | */ |
259 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff) | 259 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char *s) |
260 | { | 260 | { |
261 | LoadState S; | 261 | LoadState S; |
262 | const char* s=zname(Z); | ||
263 | if (*s=='@' || *s=='=') | 262 | if (*s=='@' || *s=='=') |
264 | S.name=s+1; | 263 | S.name=s+1; |
265 | else if (*s==LUA_SIGNATURE[0]) | 264 | else if (*s==LUA_SIGNATURE[0]) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.h,v 1.30 2003/04/07 20:34:20 lhf Exp lhf $ | 2 | ** $Id: lundump.h,v 1.33 2003/08/15 13:48:53 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 | */ |
@@ -11,7 +11,7 @@ | |||
11 | #include "lzio.h" | 11 | #include "lzio.h" |
12 | 12 | ||
13 | /* load one chunk; from lundump.c */ | 13 | /* load one chunk; from lundump.c */ |
14 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff); | 14 | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char *name); |
15 | 15 | ||
16 | /* find byte order; from lundump.c */ | 16 | /* find byte order; from lundump.c */ |
17 | int luaU_endianness (void); | 17 | int luaU_endianness (void); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lzio.c,v 1.23 2002/12/04 17:38:31 roberto Exp roberto $ | 2 | ** $Id: lzio.c,v 1.24 2003/03/20 16:00:56 roberto Exp roberto $ |
3 | ** a generic input stream interface | 3 | ** a generic input stream interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -37,10 +37,9 @@ int luaZ_lookahead (ZIO *z) { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
40 | void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name) { | 40 | void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data) { |
41 | z->reader = reader; | 41 | z->reader = reader; |
42 | z->data = data; | 42 | z->data = data; |
43 | z->name = name; | ||
44 | z->n = 0; | 43 | z->n = 0; |
45 | z->p = NULL; | 44 | z->p = NULL; |
46 | } | 45 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lzio.h,v 1.14 2002/10/08 18:46:08 roberto Exp roberto $ | 2 | ** $Id: lzio.h,v 1.15 2003/03/20 16:00:56 roberto Exp roberto $ |
3 | ** Buffered streams | 3 | ** Buffered streams |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -20,9 +20,7 @@ typedef struct Zio ZIO; | |||
20 | 20 | ||
21 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) | 21 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) |
22 | 22 | ||
23 | #define zname(z) ((z)->name) | 23 | void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data); |
24 | |||
25 | void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name); | ||
26 | size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ | 24 | size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ |
27 | int luaZ_lookahead (ZIO *z); | 25 | int luaZ_lookahead (ZIO *z); |
28 | 26 | ||
@@ -55,7 +53,6 @@ struct Zio { | |||
55 | const char *p; /* current position in buffer */ | 53 | const char *p; /* current position in buffer */ |
56 | lua_Chunkreader reader; | 54 | lua_Chunkreader reader; |
57 | void* data; /* additional data */ | 55 | void* data; /* additional data */ |
58 | const char *name; | ||
59 | }; | 56 | }; |
60 | 57 | ||
61 | 58 | ||