Lines Matching refs:S

30 static l_noret error(LoadState* S, const char* why)  in error()  argument
32 luaO_pushfstring(S->L,"%s: %s precompiled chunk",S->name,why); in error()
33 luaD_throw(S->L,LUA_ERRSYNTAX); in error()
36 #define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) argument
37 #define LoadByte(S) (lu_byte)LoadChar(S) argument
38 #define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) argument
39 #define LoadVector(S,b,n,size) LoadMem(S,b,n,size) argument
45 static void LoadBlock(LoadState* S, void* b, size_t size) in LoadBlock() argument
47 if (luaZ_read(S->Z,b,size)!=0) error(S,"truncated"); in LoadBlock()
50 static int LoadChar(LoadState* S) in LoadChar() argument
53 LoadVar(S,x); in LoadChar()
57 static int LoadInt(LoadState* S) in LoadInt() argument
60 LoadVar(S,x); in LoadInt()
61 if (x<0) error(S,"corrupted"); in LoadInt()
65 static lua_Number LoadNumber(LoadState* S) in LoadNumber() argument
68 LoadVar(S,x); in LoadNumber()
72 static TString* LoadString(LoadState* S) in LoadString() argument
75 LoadVar(S,size); in LoadString()
80 char* s=luaZ_openspace(S->L,S->b,size); in LoadString()
81 LoadBlock(S,s,size*sizeof(char)); in LoadString()
82 return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ in LoadString()
86 static void LoadCode(LoadState* S, Proto* f) in LoadCode() argument
88 int n=LoadInt(S); in LoadCode()
89 f->code=luaM_newvector(S->L,n,Instruction); in LoadCode()
91 LoadVector(S,f->code,n,sizeof(Instruction)); in LoadCode()
94 static void LoadFunction(LoadState* S, Proto* f);
96 static void LoadConstants(LoadState* S, Proto* f) in LoadConstants() argument
99 n=LoadInt(S); in LoadConstants()
100 f->k=luaM_newvector(S->L,n,TValue); in LoadConstants()
106 int t=LoadChar(S); in LoadConstants()
113 setbvalue(o,LoadChar(S)); in LoadConstants()
116 setnvalue(o,LoadNumber(S)); in LoadConstants()
119 setsvalue2n(S->L,o,LoadString(S)); in LoadConstants()
124 n=LoadInt(S); in LoadConstants()
125 f->p=luaM_newvector(S->L,n,Proto*); in LoadConstants()
130 f->p[i]=luaF_newproto(S->L); in LoadConstants()
131 LoadFunction(S,f->p[i]); in LoadConstants()
135 static void LoadUpvalues(LoadState* S, Proto* f) in LoadUpvalues() argument
138 n=LoadInt(S); in LoadUpvalues()
139 f->upvalues=luaM_newvector(S->L,n,Upvaldesc); in LoadUpvalues()
144 f->upvalues[i].instack=LoadByte(S); in LoadUpvalues()
145 f->upvalues[i].idx=LoadByte(S); in LoadUpvalues()
149 static void LoadDebug(LoadState* S, Proto* f) in LoadDebug() argument
152 f->source=LoadString(S); in LoadDebug()
153 n=LoadInt(S); in LoadDebug()
154 f->lineinfo=luaM_newvector(S->L,n,int); in LoadDebug()
156 LoadVector(S,f->lineinfo,n,sizeof(int)); in LoadDebug()
157 n=LoadInt(S); in LoadDebug()
158 f->locvars=luaM_newvector(S->L,n,LocVar); in LoadDebug()
163 f->locvars[i].varname=LoadString(S); in LoadDebug()
164 f->locvars[i].startpc=LoadInt(S); in LoadDebug()
165 f->locvars[i].endpc=LoadInt(S); in LoadDebug()
167 n=LoadInt(S); in LoadDebug()
168 for (i=0; i<n; i++) f->upvalues[i].name=LoadString(S); in LoadDebug()
171 static void LoadFunction(LoadState* S, Proto* f) in LoadFunction() argument
173 f->linedefined=LoadInt(S); in LoadFunction()
174 f->lastlinedefined=LoadInt(S); in LoadFunction()
175 f->numparams=LoadByte(S); in LoadFunction()
176 f->is_vararg=LoadByte(S); in LoadFunction()
177 f->maxstacksize=LoadByte(S); in LoadFunction()
178 LoadCode(S,f); in LoadFunction()
179 LoadConstants(S,f); in LoadFunction()
180 LoadUpvalues(S,f); in LoadFunction()
181 LoadDebug(S,f); in LoadFunction()
190 static void LoadHeader(LoadState* S) in LoadHeader() argument
196 LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char)); in LoadHeader()
198 if (memcmp(h,s,N1)!=0) error(S,"not a"); in LoadHeader()
199 if (memcmp(h,s,N2)!=0) error(S,"version mismatch in"); in LoadHeader()
200 if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted"); in LoadHeader()
208 LoadState S; in luaU_undump() local
211 S.name=name+1; in luaU_undump()
213 S.name="binary string"; in luaU_undump()
215 S.name=name; in luaU_undump()
216 S.L=L; in luaU_undump()
217 S.Z=Z; in luaU_undump()
218 S.b=buff; in luaU_undump()
219 LoadHeader(&S); in luaU_undump()
223 LoadFunction(&S,cl->l.p); in luaU_undump()