renamed 'hf mfdes readdata, writedata' to 'read/write'
[RRG-proxmark3.git] / client / deps / liblua / ldo.c
blob081f42bd271c3a35f845327d5b10c4e9a389853a
1 /*
2 ** $Id: ldo.c,v 2.108 2012/10/01 14:05:04 roberto Exp $
3 ** Stack and Call structure of Lua
4 ** See Copyright Notice in lua.h
5 */
8 #include <setjmp.h>
9 #include <stdlib.h>
10 #include <string.h>
12 #define ldo_c
13 #define LUA_CORE
15 #include "lua.h"
17 #include "lapi.h"
18 #include "ldebug.h"
19 #include "ldo.h"
20 #include "lfunc.h"
21 #include "lgc.h"
22 #include "lmem.h"
23 #include "lobject.h"
24 #include "lopcodes.h"
25 #include "lparser.h"
26 #include "lstate.h"
27 #include "lstring.h"
28 #include "ltable.h"
29 #include "ltm.h"
30 #include "lundump.h"
31 #include "lvm.h"
32 #include "lzio.h"
38 ** {======================================================
39 ** Error-recovery functions
40 ** =======================================================
44 ** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By
45 ** default, Lua handles errors with exceptions when compiling as
46 ** C++ code, with _longjmp/_setjmp when asked to use them, and with
47 ** longjmp/setjmp otherwise.
49 #if !defined(LUAI_THROW)
51 #if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
52 /* C++ exceptions */
53 #define LUAI_THROW(L,c) throw(c)
54 #define LUAI_TRY(L,c,a) \
55 try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
56 #define luai_jmpbuf int /* dummy variable */
58 #elif defined(LUA_USE_ULONGJMP)
59 /* in Unix, try _longjmp/_setjmp (more efficient) */
60 #define LUAI_THROW(L,c) _longjmp((c)->b, 1)
61 #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
62 #define luai_jmpbuf jmp_buf
64 #else
65 /* default handling with long jumps */
66 #define LUAI_THROW(L,c) longjmp((c)->b, 1)
67 #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
68 #define luai_jmpbuf jmp_buf
70 #endif
72 #endif
76 /* chain list of long jump buffers */
77 struct lua_longjmp {
78 struct lua_longjmp *previous;
79 luai_jmpbuf b;
80 volatile int status; /* error code */
84 static void seterrorobj(lua_State *L, int errcode, StkId oldtop) {
85 switch (errcode) {
86 case LUA_ERRMEM: { /* memory error? */
87 setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
88 break;
90 case LUA_ERRERR: {
91 setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
92 break;
94 default: {
95 setobjs2s(L, oldtop, L->top - 1); /* error message on current top */
96 break;
99 L->top = oldtop + 1;
103 l_noret luaD_throw(lua_State *L, int errcode) {
104 if (L->errorJmp) { /* thread has an error handler? */
105 L->errorJmp->status = errcode; /* set status */
106 LUAI_THROW(L, L->errorJmp); /* jump to it */
107 } else { /* thread has no error handler */
108 L->status = cast_byte(errcode); /* mark it as dead */
109 if (G(L)->mainthread->errorJmp) { /* main thread has a handler? */
110 setobjs2s(L, G(L)->mainthread->top++, L->top - 1); /* copy error obj. */
111 luaD_throw(G(L)->mainthread, errcode); /* re-throw in main thread */
112 } else { /* no handler at all; abort */
113 if (G(L)->panic) { /* panic function? */
114 lua_unlock(L);
115 G(L)->panic(L); /* call it (last chance to jump out) */
117 abort();
123 int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud) {
124 unsigned short oldnCcalls = L->nCcalls;
125 struct lua_longjmp lj;
126 lj.status = LUA_OK;
127 lj.previous = L->errorJmp; /* chain new error handler */
128 L->errorJmp = &lj;
129 LUAI_TRY(L, &lj,
130 (*f)(L, ud);
132 L->errorJmp = lj.previous; /* restore old error handler */
133 L->nCcalls = oldnCcalls;
134 return lj.status;
137 /* }====================================================== */
140 static void correctstack(lua_State *L, TValue *oldstack) {
141 CallInfo *ci;
142 GCObject *up;
143 L->top = (L->top - oldstack) + L->stack;
144 for (up = L->openupval; up != NULL; up = up->gch.next)
145 gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;
146 for (ci = L->ci; ci != NULL; ci = ci->previous) {
147 ci->top = (ci->top - oldstack) + L->stack;
148 ci->func = (ci->func - oldstack) + L->stack;
149 if (isLua(ci))
150 ci->u.l.base = (ci->u.l.base - oldstack) + L->stack;
155 /* some space for error handling */
156 #define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
159 void luaD_reallocstack(lua_State *L, int newsize) {
160 TValue *oldstack = L->stack;
161 int lim = L->stacksize;
162 lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE);
163 lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK);
164 luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue);
165 for (; lim < newsize; lim++)
166 setnilvalue(L->stack + lim); /* erase new segment */
167 L->stacksize = newsize;
168 L->stack_last = L->stack + newsize - EXTRA_STACK;
169 correctstack(L, oldstack);
173 void luaD_growstack(lua_State *L, int n) {
174 int size = L->stacksize;
175 if (size > LUAI_MAXSTACK) /* error after extra size? */
176 luaD_throw(L, LUA_ERRERR);
177 else {
178 int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK;
179 int newsize = 2 * size;
180 if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK;
181 if (newsize < needed) newsize = needed;
182 if (newsize > LUAI_MAXSTACK) { /* stack overflow? */
183 luaD_reallocstack(L, ERRORSTACKSIZE);
184 luaG_runerror(L, "stack overflow");
185 } else
186 luaD_reallocstack(L, newsize);
191 static int stackinuse(lua_State *L) {
192 CallInfo *ci;
193 StkId lim = L->top;
194 for (ci = L->ci; ci != NULL; ci = ci->previous) {
195 lua_assert(ci->top <= L->stack_last);
196 if (lim < ci->top) lim = ci->top;
198 return cast_int(lim - L->stack) + 1; /* part of stack in use */
202 void luaD_shrinkstack(lua_State *L) {
203 int inuse = stackinuse(L);
204 int goodsize = inuse + (inuse / 8) + 2 * EXTRA_STACK;
205 if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK;
206 if (inuse > LUAI_MAXSTACK || /* handling stack overflow? */
207 goodsize >= L->stacksize) /* would grow instead of shrink? */
208 condmovestack(L); /* don't change stack (change only for debugging) */
209 else
210 luaD_reallocstack(L, goodsize); /* shrink it */
214 void luaD_hook(lua_State *L, int event, int line) {
215 lua_Hook hook = L->hook;
216 if (hook && L->allowhook) {
217 CallInfo *ci = L->ci;
218 ptrdiff_t top = savestack(L, L->top);
219 ptrdiff_t ci_top = savestack(L, ci->top);
220 lua_Debug ar;
221 ar.event = event;
222 ar.currentline = line;
223 ar.i_ci = ci;
224 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
225 ci->top = L->top + LUA_MINSTACK;
226 lua_assert(ci->top <= L->stack_last);
227 L->allowhook = 0; /* cannot call hooks inside a hook */
228 ci->callstatus |= CIST_HOOKED;
229 lua_unlock(L);
230 (*hook)(L, &ar);
231 lua_lock(L);
232 lua_assert(!L->allowhook);
233 L->allowhook = 1;
234 ci->top = restorestack(L, ci_top);
235 L->top = restorestack(L, top);
236 ci->callstatus &= ~CIST_HOOKED;
241 static void callhook(lua_State *L, CallInfo *ci) {
242 int hook = LUA_HOOKCALL;
243 ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */
244 if (isLua(ci->previous) &&
245 GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) {
246 ci->callstatus |= CIST_TAIL;
247 hook = LUA_HOOKTAILCALL;
249 luaD_hook(L, hook, -1);
250 ci->u.l.savedpc--; /* correct 'pc' */
254 static StkId adjust_varargs(lua_State *L, Proto *p, int actual) {
255 int i;
256 int nfixargs = p->numparams;
257 StkId base, fixed;
258 lua_assert(actual >= nfixargs);
259 /* move fixed parameters to final position */
260 fixed = L->top - actual; /* first fixed argument */
261 base = L->top; /* final position of first argument */
262 for (i = 0; i < nfixargs; i++) {
263 setobjs2s(L, L->top++, fixed + i);
264 setnilvalue(fixed + i);
266 return base;
270 static StkId tryfuncTM(lua_State *L, StkId func) {
271 const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
272 StkId p;
273 ptrdiff_t funcr = savestack(L, func);
274 if (!ttisfunction(tm))
275 luaG_typeerror(L, func, "call");
276 /* Open a hole inside the stack at `func' */
277 for (p = L->top; p > func; p--) setobjs2s(L, p, p - 1);
278 incr_top(L);
279 func = restorestack(L, funcr); /* previous call may change stack */
280 setobj2s(L, func, tm); /* tag method is the new function to be called */
281 return func;
286 #define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))
290 ** returns true if function has been executed (C function)
292 int luaD_precall(lua_State *L, StkId func, int nresults) {
293 lua_CFunction f;
294 CallInfo *ci;
295 int n; /* number of arguments (Lua) or returns (C) */
296 ptrdiff_t funcr = savestack(L, func);
297 switch (ttype(func)) {
298 case LUA_TLCF: /* light C function */
299 f = fvalue(func);
300 goto Cfunc;
301 case LUA_TCCL: { /* C closure */
302 f = clCvalue(func)->f;
303 Cfunc:
304 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
305 ci = next_ci(L); /* now 'enter' new function */
306 ci->nresults = nresults;
307 ci->func = restorestack(L, funcr);
308 ci->top = L->top + LUA_MINSTACK;
309 lua_assert(ci->top <= L->stack_last);
310 ci->callstatus = 0;
311 luaC_checkGC(L); /* stack grow uses memory */
312 if (L->hookmask & LUA_MASKCALL)
313 luaD_hook(L, LUA_HOOKCALL, -1);
314 lua_unlock(L);
315 n = (*f)(L); /* do the actual call */
316 lua_lock(L);
317 api_checknelems(L, n);
318 luaD_poscall(L, L->top - n);
319 return 1;
321 case LUA_TLCL: { /* Lua function: prepare its call */
322 StkId base;
323 Proto *p = clLvalue(func)->p;
324 luaD_checkstack(L, p->maxstacksize);
325 func = restorestack(L, funcr);
326 n = cast_int(L->top - func) - 1; /* number of real arguments */
327 for (; n < p->numparams; n++)
328 setnilvalue(L->top++); /* complete missing arguments */
329 base = (!p->is_vararg) ? func + 1 : adjust_varargs(L, p, n);
330 ci = next_ci(L); /* now 'enter' new function */
331 ci->nresults = nresults;
332 ci->func = func;
333 ci->u.l.base = base;
334 ci->top = base + p->maxstacksize;
335 lua_assert(ci->top <= L->stack_last);
336 ci->u.l.savedpc = p->code; /* starting point */
337 ci->callstatus = CIST_LUA;
338 L->top = ci->top;
339 luaC_checkGC(L); /* stack grow uses memory */
340 if (L->hookmask & LUA_MASKCALL)
341 callhook(L, ci);
342 return 0;
344 default: { /* not a function */
345 func = tryfuncTM(L, func); /* retry with 'function' tag method */
346 return luaD_precall(L, func, nresults); /* now it must be a function */
352 int luaD_poscall(lua_State *L, StkId firstResult) {
353 StkId res;
354 int wanted, i;
355 CallInfo *ci = L->ci;
356 if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
357 if (L->hookmask & LUA_MASKRET) {
358 ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */
359 luaD_hook(L, LUA_HOOKRET, -1);
360 firstResult = restorestack(L, fr);
362 L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */
364 res = ci->func; /* res == final position of 1st result */
365 wanted = ci->nresults;
366 L->ci = ci = ci->previous; /* back to caller */
367 /* move results to correct place */
368 for (i = wanted; i != 0 && firstResult < L->top; i--)
369 setobjs2s(L, res++, firstResult++);
370 while (i-- > 0)
371 setnilvalue(res++);
372 L->top = res;
373 return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */
378 ** Call a function (C or Lua). The function to be called is at *func.
379 ** The arguments are on the stack, right after the function.
380 ** When returns, all the results are on the stack, starting at the original
381 ** function position.
383 void luaD_call(lua_State *L, StkId func, int nResults, int allowyield) {
384 if (++L->nCcalls >= LUAI_MAXCCALLS) {
385 if (L->nCcalls == LUAI_MAXCCALLS)
386 luaG_runerror(L, "C stack overflow");
387 else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS >> 3)))
388 luaD_throw(L, LUA_ERRERR); /* error while handing stack error */
390 if (!allowyield) L->nny++;
391 if (!luaD_precall(L, func, nResults)) /* is a Lua function? */
392 luaV_execute(L); /* call it */
393 if (!allowyield) L->nny--;
394 L->nCcalls--;
398 static void finishCcall(lua_State *L) {
399 CallInfo *ci = L->ci;
400 int n;
401 lua_assert(ci->u.c.k != NULL); /* must have a continuation */
402 lua_assert(L->nny == 0);
403 if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */
404 ci->callstatus &= ~CIST_YPCALL; /* finish 'lua_pcall' */
405 L->errfunc = ci->u.c.old_errfunc;
407 /* finish 'lua_callk'/'lua_pcall' */
408 adjustresults(L, ci->nresults);
409 /* call continuation function */
410 if (!(ci->callstatus & CIST_STAT)) /* no call status? */
411 ci->u.c.status = LUA_YIELD; /* 'default' status */
412 lua_assert(ci->u.c.status != LUA_OK);
413 ci->callstatus = (ci->callstatus & ~(CIST_YPCALL | CIST_STAT)) | CIST_YIELDED;
414 lua_unlock(L);
415 n = (*ci->u.c.k)(L);
416 lua_lock(L);
417 api_checknelems(L, n);
418 /* finish 'luaD_precall' */
419 luaD_poscall(L, L->top - n);
423 static void unroll(lua_State *L, void *ud) {
424 UNUSED(ud);
425 for (;;) {
426 if (L->ci == &L->base_ci) /* stack is empty? */
427 return; /* coroutine finished normally */
428 if (!isLua(L->ci)) /* C function? */
429 finishCcall(L);
430 else { /* Lua function */
431 luaV_finishOp(L); /* finish interrupted instruction */
432 luaV_execute(L); /* execute down to higher C 'boundary' */
439 ** check whether thread has a suspended protected call
441 static CallInfo *findpcall(lua_State *L) {
442 CallInfo *ci;
443 for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */
444 if (ci->callstatus & CIST_YPCALL)
445 return ci;
447 return NULL; /* no pending pcall */
451 static int recover(lua_State *L, int status) {
452 StkId oldtop;
453 CallInfo *ci = findpcall(L);
454 if (ci == NULL) return 0; /* no recovery point */
455 /* "finish" luaD_pcall */
456 oldtop = restorestack(L, ci->extra);
457 luaF_close(L, oldtop);
458 seterrorobj(L, status, oldtop);
459 L->ci = ci;
460 L->allowhook = ci->u.c.old_allowhook;
461 L->nny = 0; /* should be zero to be yieldable */
462 luaD_shrinkstack(L);
463 L->errfunc = ci->u.c.old_errfunc;
464 ci->callstatus |= CIST_STAT; /* call has error status */
465 ci->u.c.status = status; /* (here it is) */
466 return 1; /* continue running the coroutine */
471 ** signal an error in the call to 'resume', not in the execution of the
472 ** coroutine itself. (Such errors should not be handled by any coroutine
473 ** error handler and should not kill the coroutine.)
475 static l_noret resume_error(lua_State *L, const char *msg, StkId firstArg) {
476 L->top = firstArg; /* remove args from the stack */
477 setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */
478 api_incr_top(L);
479 luaD_throw(L, -1); /* jump back to 'lua_resume' */
484 ** do the work for 'lua_resume' in protected mode
486 static void resume(lua_State *L, void *ud) {
487 int nCcalls = L->nCcalls;
488 StkId firstArg = cast(StkId, ud);
489 CallInfo *ci = L->ci;
490 if (nCcalls >= LUAI_MAXCCALLS)
491 resume_error(L, "C stack overflow", firstArg);
492 if (L->status == LUA_OK) { /* may be starting a coroutine */
493 if (ci != &L->base_ci) /* not in base level? */
494 resume_error(L, "cannot resume non-suspended coroutine", firstArg);
495 /* coroutine is in base level; start running it */
496 if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */
497 luaV_execute(L); /* call it */
498 } else if (L->status != LUA_YIELD)
499 resume_error(L, "cannot resume dead coroutine", firstArg);
500 else { /* resuming from previous yield */
501 L->status = LUA_OK;
502 ci->func = restorestack(L, ci->extra);
503 if (isLua(ci)) /* yielded inside a hook? */
504 luaV_execute(L); /* just continue running Lua code */
505 else { /* 'common' yield */
506 if (ci->u.c.k != NULL) { /* does it have a continuation? */
507 int n;
508 ci->u.c.status = LUA_YIELD; /* 'default' status */
509 ci->callstatus |= CIST_YIELDED;
510 lua_unlock(L);
511 n = (*ci->u.c.k)(L); /* call continuation */
512 lua_lock(L);
513 api_checknelems(L, n);
514 firstArg = L->top - n; /* yield results come from continuation */
516 luaD_poscall(L, firstArg); /* finish 'luaD_precall' */
518 unroll(L, NULL);
520 lua_assert(nCcalls == L->nCcalls);
524 LUA_API int lua_resume(lua_State *L, lua_State *from, int nargs) {
525 int status;
526 lua_lock(L);
527 luai_userstateresume(L, nargs);
528 L->nCcalls = (from) ? from->nCcalls + 1 : 1;
529 L->nny = 0; /* allow yields */
530 api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
531 status = luaD_rawrunprotected(L, resume, L->top - nargs);
532 if (status == -1) /* error calling 'lua_resume'? */
533 status = LUA_ERRRUN;
534 else { /* yield or regular error */
535 while (status != LUA_OK && status != LUA_YIELD) { /* error? */
536 if (recover(L, status)) /* recover point? */
537 status = luaD_rawrunprotected(L, unroll, NULL); /* run continuation */
538 else { /* unrecoverable error */
539 L->status = cast_byte(status); /* mark thread as `dead' */
540 seterrorobj(L, status, L->top);
541 L->ci->top = L->top;
542 break;
545 lua_assert(status == L->status);
547 L->nny = 1; /* do not allow yields */
548 L->nCcalls--;
549 lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
550 lua_unlock(L);
551 return status;
555 LUA_API int lua_yieldk(lua_State *L, int nresults, int ctx, lua_CFunction k) {
556 CallInfo *ci = L->ci;
557 luai_userstateyield(L, nresults);
558 lua_lock(L);
559 api_checknelems(L, nresults);
560 if (L->nny > 0) {
561 if (L != G(L)->mainthread)
562 luaG_runerror(L, "attempt to yield across a C-call boundary");
563 else
564 luaG_runerror(L, "attempt to yield from outside a coroutine");
566 L->status = LUA_YIELD;
567 ci->extra = savestack(L, ci->func); /* save current 'func' */
568 if (isLua(ci)) { /* inside a hook? */
569 api_check(L, k == NULL, "hooks cannot continue after yielding");
570 } else {
571 if ((ci->u.c.k = k) != NULL) /* is there a continuation? */
572 ci->u.c.ctx = ctx; /* save context */
573 ci->func = L->top - nresults - 1; /* protect stack below results */
574 luaD_throw(L, LUA_YIELD);
576 lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */
577 lua_unlock(L);
578 return 0; /* return to 'luaD_hook' */
582 int luaD_pcall(lua_State *L, Pfunc func, void *u,
583 ptrdiff_t old_top, ptrdiff_t ef) {
584 int status;
585 CallInfo *old_ci = L->ci;
586 lu_byte old_allowhooks = L->allowhook;
587 unsigned short old_nny = L->nny;
588 ptrdiff_t old_errfunc = L->errfunc;
589 L->errfunc = ef;
590 status = luaD_rawrunprotected(L, func, u);
591 if (status != LUA_OK) { /* an error occurred? */
592 StkId oldtop = restorestack(L, old_top);
593 luaF_close(L, oldtop); /* close possible pending closures */
594 seterrorobj(L, status, oldtop);
595 L->ci = old_ci;
596 L->allowhook = old_allowhooks;
597 L->nny = old_nny;
598 luaD_shrinkstack(L);
600 L->errfunc = old_errfunc;
601 return status;
607 ** Execute a protected parser.
609 struct SParser { /* data to `f_parser' */
610 ZIO *z;
611 Mbuffer buff; /* dynamic structure used by the scanner */
612 Dyndata dyd; /* dynamic structures used by the parser */
613 const char *mode;
614 const char *name;
618 static void checkmode(lua_State *L, const char *mode, const char *x) {
619 if (mode && strchr(mode, x[0]) == NULL) {
620 luaO_pushfstring(L,
621 "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
622 luaD_throw(L, LUA_ERRSYNTAX);
627 static void f_parser(lua_State *L, void *ud) {
628 int i;
629 Closure *cl;
630 struct SParser *p = cast(struct SParser *, ud);
631 int c = zgetc(p->z); /* read first character */
632 if (c == LUA_SIGNATURE[0]) {
633 checkmode(L, p->mode, "binary");
634 cl = luaU_undump(L, p->z, &p->buff, p->name);
635 } else {
636 checkmode(L, p->mode, "text");
637 cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
639 lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues);
640 for (i = 0; i < cl->l.nupvalues; i++) { /* initialize upvalues */
641 UpVal *up = luaF_newupval(L);
642 cl->l.upvals[i] = up;
643 luaC_objbarrier(L, cl, up);
648 int luaD_protectedparser(lua_State *L, ZIO *z, const char *name,
649 const char *mode) {
650 struct SParser p;
651 int status;
652 L->nny++; /* cannot yield during parsing */
653 p.z = z;
654 p.name = name;
655 p.mode = mode;
656 p.dyd.actvar.arr = NULL;
657 p.dyd.actvar.size = 0;
658 p.dyd.gt.arr = NULL;
659 p.dyd.gt.size = 0;
660 p.dyd.label.arr = NULL;
661 p.dyd.label.size = 0;
662 luaZ_initbuffer(L, &p.buff);
663 status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);
664 luaZ_freebuffer(L, &p.buff);
665 luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);
666 luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size);
667 luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size);
668 L->nny--;
669 return status;