From 8332d5c8a5059b85da1adaa3f0197d0f57afae81 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 27 Aug 2003 18:01:44 -0300 Subject: parser fully reentrant(!) --- lundump.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lundump.c') diff --git a/lundump.c b/lundump.c index 30f6f904..0777dc0f 100644 --- a/lundump.c +++ b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 1.62 2003/08/15 13:48:53 roberto Exp roberto $ +** $Id: lundump.c,v 1.63 2003/08/25 19:51:54 roberto Exp roberto $ ** load pre-compiled Lua chunks ** See Copyright Notice in lua.h */ @@ -9,6 +9,7 @@ #include "lua.h" #include "ldebug.h" +#include "ldo.h" #include "lfunc.h" #include "lmem.h" #include "lopcodes.h" @@ -122,6 +123,7 @@ static void LoadLocals (LoadState* S, Proto* f) n=LoadInt(S); f->locvars=luaM_newvector(S->L,n,LocVar); f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; for (i=0; ilocvars[i].varname=LoadString(S); @@ -147,6 +149,7 @@ static void LoadUpvalues (LoadState* S, Proto* f) S->name,n,f->nups); f->upvalues=luaM_newvector(S->L,n,TString*); f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; for (i=0; iupvalues[i]=LoadString(S); } @@ -158,6 +161,7 @@ static void LoadConstants (LoadState* S, Proto* f) n=LoadInt(S); f->k=luaM_newvector(S->L,n,TObject); f->sizek=n; + for (i=0; ik[i]); for (i=0; ik[i]; @@ -181,12 +185,15 @@ static void LoadConstants (LoadState* S, Proto* f) n=LoadInt(S); f->p=luaM_newvector(S->L,n,Proto*); f->sizep=n; + for (i=0; ip[i]=NULL; for (i=0; ip[i]=LoadFunction(S,f->source); } static Proto* LoadFunction (LoadState* S, TString* p) { Proto* f=luaF_newproto(S->L); + setptvalue2s(S->L->top, f); + incr_top(S->L); f->source=LoadString(S); if (f->source==NULL) f->source=p; f->lineDefined=LoadInt(S); f->nups=LoadByte(S); @@ -201,6 +208,7 @@ static Proto* LoadFunction (LoadState* S, TString* p) #ifndef TRUST_BINARIES if (!luaG_checkcode(f)) luaG_runerror(S->L,"bad code in %s",S->name); #endif + S->L->top--; return f; } -- cgit v1.2.3-55-g6feb