Lines Matching +full:- +full:d
32 ** All high-level dumps go through DumpVector; you can change it to
35 #define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) argument
37 #define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) argument
40 static void DumpBlock (const void *b, size_t size, DumpState *D) { in DumpBlock() argument
41 if (D->status == 0 && size > 0) { in DumpBlock()
42 lua_unlock(D->L); in DumpBlock()
43 D->status = (*D->writer)(D->L, b, size, D->data); in DumpBlock()
44 lua_lock(D->L); in DumpBlock()
49 #define DumpVar(x,D) DumpVector(&x,1,D) argument
52 static void DumpByte (int y, DumpState *D) { in DumpByte() argument
54 DumpVar(x, D); in DumpByte()
58 static void DumpInt (int x, DumpState *D) { in DumpInt() argument
59 DumpVar(x, D); in DumpInt()
63 static void DumpNumber (lua_Number x, DumpState *D) { in DumpNumber() argument
64 DumpVar(x, D); in DumpNumber()
68 static void DumpInteger (lua_Integer x, DumpState *D) { in DumpInteger() argument
69 DumpVar(x, D); in DumpInteger()
73 static void DumpString (const TString *s, DumpState *D) { in DumpString() argument
75 DumpByte(0, D); in DumpString()
80 DumpByte(cast_int(size), D); in DumpString()
82 DumpByte(0xFF, D); in DumpString()
83 DumpVar(size, D); in DumpString()
85 DumpVector(str, size - 1, D); /* no need to save '\0' */ in DumpString()
90 static void DumpCode (const Proto *f, DumpState *D) { in DumpCode() argument
91 DumpInt(f->sizecode, D); in DumpCode()
92 DumpVector(f->code, f->sizecode, D); in DumpCode()
96 static void DumpFunction(const Proto *f, TString *psource, DumpState *D);
98 static void DumpConstants (const Proto *f, DumpState *D) { in DumpConstants() argument
100 int n = f->sizek; in DumpConstants()
101 DumpInt(n, D); in DumpConstants()
103 const TValue *o = &f->k[i]; in DumpConstants()
104 DumpByte(ttype(o), D); in DumpConstants()
109 DumpByte(bvalue(o), D); in DumpConstants()
112 DumpNumber(fltvalue(o), D); in DumpConstants()
115 DumpInteger(ivalue(o), D); in DumpConstants()
119 DumpString(tsvalue(o), D); in DumpConstants()
128 static void DumpProtos (const Proto *f, DumpState *D) { in DumpProtos() argument
130 int n = f->sizep; in DumpProtos()
131 DumpInt(n, D); in DumpProtos()
133 DumpFunction(f->p[i], f->source, D); in DumpProtos()
137 static void DumpUpvalues (const Proto *f, DumpState *D) { in DumpUpvalues() argument
138 int i, n = f->sizeupvalues; in DumpUpvalues()
139 DumpInt(n, D); in DumpUpvalues()
141 DumpByte(f->upvalues[i].instack, D); in DumpUpvalues()
142 DumpByte(f->upvalues[i].idx, D); in DumpUpvalues()
147 static void DumpDebug (const Proto *f, DumpState *D) { in DumpDebug() argument
149 n = (D->strip) ? 0 : f->sizelineinfo; in DumpDebug()
150 DumpInt(n, D); in DumpDebug()
151 DumpVector(f->lineinfo, n, D); in DumpDebug()
152 n = (D->strip) ? 0 : f->sizelocvars; in DumpDebug()
153 DumpInt(n, D); in DumpDebug()
155 DumpString(f->locvars[i].varname, D); in DumpDebug()
156 DumpInt(f->locvars[i].startpc, D); in DumpDebug()
157 DumpInt(f->locvars[i].endpc, D); in DumpDebug()
159 n = (D->strip) ? 0 : f->sizeupvalues; in DumpDebug()
160 DumpInt(n, D); in DumpDebug()
162 DumpString(f->upvalues[i].name, D); in DumpDebug()
166 static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { in DumpFunction() argument
167 if (D->strip || f->source == psource) in DumpFunction()
168 DumpString(NULL, D); /* no debug info or same source as its parent */ in DumpFunction()
170 DumpString(f->source, D); in DumpFunction()
171 DumpInt(f->linedefined, D); in DumpFunction()
172 DumpInt(f->lastlinedefined, D); in DumpFunction()
173 DumpByte(f->numparams, D); in DumpFunction()
174 DumpByte(f->is_vararg, D); in DumpFunction()
175 DumpByte(f->maxstacksize, D); in DumpFunction()
176 DumpCode(f, D); in DumpFunction()
177 DumpConstants(f, D); in DumpFunction()
178 DumpUpvalues(f, D); in DumpFunction()
179 DumpProtos(f, D); in DumpFunction()
180 DumpDebug(f, D); in DumpFunction()
184 static void DumpHeader (DumpState *D) { in DumpHeader() argument
185 DumpLiteral(LUA_SIGNATURE, D); in DumpHeader()
186 DumpByte(LUAC_VERSION, D); in DumpHeader()
187 DumpByte(LUAC_FORMAT, D); in DumpHeader()
188 DumpLiteral(LUAC_DATA, D); in DumpHeader()
189 DumpByte(sizeof(int), D); in DumpHeader()
190 DumpByte(sizeof(size_t), D); in DumpHeader()
191 DumpByte(sizeof(Instruction), D); in DumpHeader()
192 DumpByte(sizeof(lua_Integer), D); in DumpHeader()
193 DumpByte(sizeof(lua_Number), D); in DumpHeader()
194 DumpInteger(LUAC_INT, D); in DumpHeader()
195 DumpNumber(LUAC_NUM, D); in DumpHeader()
204 DumpState D; in luaU_dump() local
205 D.L = L; in luaU_dump()
206 D.writer = w; in luaU_dump()
207 D.data = data; in luaU_dump()
208 D.strip = strip; in luaU_dump()
209 D.status = 0; in luaU_dump()
210 DumpHeader(&D); in luaU_dump()
211 DumpByte(f->sizeupvalues, &D); in luaU_dump()
212 DumpFunction(f, NULL, &D); in luaU_dump()
213 return D.status; in luaU_dump()