MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / main

Function main

xs/tools/xsc.c:300–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298int mainXSC(int argc, char* argv[])
299#else
300int main(int argc, char* argv[])
301#endif
302{
303 int argi;
304 char path[C_PATH_MAX];
305 txParser _parser;
306 txParser* parser = &_parser;
307 txParserJump jump;
308
309 txUnsigned flags = 0;
310 txString input = NULL;
311 txString output = NULL;
312 txString rename = NULL;
313 txString temporary = NULL;
314 txString name = NULL;
315 txString map = NULL;
316 txString dot = NULL;
317 FILE* file = NULL;
318 txScript* script = NULL;
319 txSize size;
320 txByte byte;
321 txBoolean embed = 0;
322
323 fxInitializeParser(parser, NULL, 1024*1024, 1993);
324 parser->firstJump = &jump;
325 if (c_setjmp(jump.jmp_buf) == 0) {
326 for (argi = 1; argi < argc; argi++) {
327 if (!strcmp(argv[argi], "-c"))
328 flags |= mxCFlag;
329 else if (!strcmp(argv[argi], "-d"))
330 flags |= mxDebugFlag;
331 else if (!strcmp(argv[argi], "-e"))
332 embed = 1;
333 else if (!strcmp(argv[argi], "-eval"))
334 flags |= mxEvalFlag | mxStrictFlag;
335 else if (!strcmp(argv[argi], "-o")) {
336 argi++;
337 if (argi >= argc)
338 fxReportParserError(parser, 0, "no output directory");
339 else if (output)
340 fxReportParserError(parser, 0, "too many output directories");
341 else
342 output = fxRealDirectoryPath(parser, argv[argi]);
343 }
344 else if (!strcmp(argv[argi], "-p"))
345 flags |= mxProgramFlag;
346 else if (!strcmp(argv[argi], "-r")) {
347 argi++;
348 if (argi >= argc)
349 fxReportParserError(parser, 0, "no name");
350 else if (rename)
351 fxReportParserError(parser, 0, "too many names");
352 else
353 rename = fxNewParserString(parser, argv[argi], mxStringLength(argv[argi]));
354 }
355 else if (!strcmp(argv[argi], "-t")) {
356 argi++;
357 if (argi >= argc)

Callers

nothing calls this directly

Calls 15

fxInitializeParserFunction · 0.85
fxReportParserErrorFunction · 0.85
fxNewParserStringFunction · 0.85
fxNewParserSymbolFunction · 0.85
fxParserTreeFunction · 0.85
fxCombinePathFunction · 0.85
fxRealFilePathIfFunction · 0.85
fxParserSourceMapFunction · 0.85
fxParserHoistFunction · 0.85
fxParserBindFunction · 0.85
fxParserCodeFunction · 0.85
fxWriteExternsFunction · 0.85

Tested by

no test coverage detected