diff options
Diffstat (limited to '')
| -rw-r--r-- | ldo.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -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); |
