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

Function modRunMachineSetup

xs/platforms/mc/xsHosts.c:606–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604}
605
606void modRunMachineSetup(txMachine *the)
607{
608 txPreparation *preparation = xsPreparationAndCreation(NULL);
609 txInteger scriptCount = preparation->scriptCount;
610 txScript* script = preparation->scripts;
611
612#ifdef mxInstrument
613 modInstrumentationSetup(the);
614#endif
615
616 gSetupPending = 1;
617
618 xsBeginHost(the);
619 xsVars(1);
620 xsVar(0) = xsNewHostFunction(setStepDone, 0);
621
622 while (scriptCount--) {
623 if (0 == c_strncmp(script->path, "setup/", 6)) {
624 char path[C_PATH_MAX];
625 char *dot;
626
627 c_strcpy(path, script->path);
628 dot = c_strchr(path, '.');
629 if (dot)
630 *dot = 0;
631
632 xsResult = xsAwaitImport(path, XS_IMPORT_DEFAULT);
633 if (xsTest(xsResult) && xsIsInstanceOf(xsResult, xsFunctionPrototype)) {
634 gSetupPending += 1;
635 xsCallFunction1(xsResult, xsGlobal, xsVar(0));
636 }
637 }
638 script++;
639 }
640 xsEndHost(the);
641
642 setStepDone(the);
643}
644
645#ifdef mxInstrument
646#ifdef mxDebug

Callers

nothing calls this directly

Calls 2

setStepDoneFunction · 0.70
modInstrumentationSetupFunction · 0.50

Tested by

no test coverage detected