MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / pmain

Function pmain

lib/lua/src/luac.c:168–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168static int pmain(lua_State* L)
169{
170 int argc=(int)lua_tointeger(L,1);
171 char** argv=(char**)lua_touserdata(L,2);
172 const Proto* f;
173 int i;
174 tmname=G(L)->tmname;
175 if (!lua_checkstack(L,argc)) fatal("too many input files");
176 for (i=0; i<argc; i++)
177 {
178 const char* filename=IS("-") ? NULL : argv[i];
179 if (luaL_loadfile(L,filename)!=LUA_OK) fatal(lua_tostring(L,-1));
180 }
181 f=combine(L,argc);
182 if (listing) luaU_print(f,listing>1);
183 if (dumping)
184 {
185 FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
186 if (D==NULL) cannot("open");
187 lua_lock(L);
188 luaU_dump(L,f,writer,D,stripping);
189 lua_unlock(L);
190 if (ferror(D)) cannot("write");
191 if (fclose(D)) cannot("close");
192 }
193 return 0;
194}
195
196int main(int argc, char* argv[])
197{

Callers

nothing calls this directly

Calls 7

lua_touserdataFunction · 0.85
lua_checkstackFunction · 0.85
fatalFunction · 0.85
combineFunction · 0.85
cannotFunction · 0.85
luaU_dumpFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected