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

Function fxLoadModule

xs/platforms/qca4020/xsHost.c:632–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632void fxLoadModule(txMachine* the, txSlot* realm, txID moduleID)
633{
634 txPreparation* preparation = the->preparation;
635 txString path = fxGetKeyName(the, moduleID) + preparation->baseLength;
636 txInteger c = preparation->scriptCount;
637 txScript* script = preparation->scripts;
638#if MODDEF_XS_MODS
639 uint8_t *mod;
640 int modSize;
641
642 mod = findMod(the, path, &modSize);
643 if (mod) {
644 txScript aScript;
645
646 aScript.callback = NULL;
647 aScript.symbolsBuffer = NULL;
648 aScript.symbolsSize = 0;
649 aScript.codeBuffer = mod;
650 aScript.codeSize = modSize;
651 aScript.hostsBuffer = NULL;
652 aScript.hostsSize = 0;
653 aScript.path = path - preparation->baseLength;
654 aScript.version[0] = XS_MAJOR_VERSION;
655 aScript.version[1] = XS_MINOR_VERSION;
656 aScript.version[2] = XS_PATCH_VERSION;
657 aScript.version[3] = 0;
658
659 fxResolveModule(the, realm, moduleID, &aScript, C_NULL, C_NULL);
660 return;
661 }
662#endif
663
664 while (c > 0) {
665 if (!c_strcmp(path, script->path)) {
666 fxResolveModule(the, realm, moduleID, script, C_NULL, C_NULL);
667 return;
668 }
669 c--;
670 script++;
671 }
672
673#if 0
674 path -= preparation->baseLength;
675 if (!c_strncmp(path, "xsbug://", 8))
676 fxDebugImport(the, path);
677#endif
678}
679
680txScript* fxParseScript(txMachine* the, void* stream, txGetter getter, txUnsigned flags)
681{

Callers

nothing calls this directly

Calls 4

fxGetKeyNameFunction · 0.85
fxResolveModuleFunction · 0.85
fxDebugImportFunction · 0.85
findModFunction · 0.70

Tested by

no test coverage detected