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

Function fxLoadModule

xs/platforms/gecko/xsHost.c:477–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477void fxLoadModule(txMachine* the, txSlot* realm, txID moduleID)
478{
479 txPreparation* preparation = the->preparation;
480 txString path = fxGetKeyName(the, moduleID) + preparation->baseLength;
481 txInteger c = preparation->scriptCount;
482 txScript* script = preparation->scripts;
483#if MODDEF_XS_MODS
484 uint8_t *mod;
485 int modSize;
486
487 mod = findMod(the, path, &modSize);
488 if (mod) {
489 txScript aScript;
490
491 aScript.callback = NULL;
492 aScript.symbolsBuffer = NULL;
493 aScript.symbolsSize = 0;
494 aScript.codeBuffer = mod;
495 aScript.codeSize = modSize;
496 aScript.hostsBuffer = NULL;
497 aScript.hostsSize = 0;
498 aScript.path = path - preparation->baseLength;
499 aScript.version[0] = XS_MAJOR_VERSION;
500 aScript.version[1] = XS_MINOR_VERSION;
501 aScript.version[2] = XS_PATCH_VERSION;
502 aScript.version[3] = 0;
503
504 fxResolveModule(the, realm, moduleID, &aScript, C_NULL, C_NULL);
505 return;
506 }
507#endif
508
509 while (c > 0) {
510 if (!c_strcmp(path, script->path)) {
511 fxResolveModule(the,realm, moduleID, script, C_NULL, C_NULL);
512 return;
513 }
514 c--;
515 script++;
516 }
517}
518
519txScript* fxParseScript(txMachine* the, void* stream, txGetter getter, txUnsigned flags)
520{

Callers

nothing calls this directly

Calls 3

fxGetKeyNameFunction · 0.85
fxResolveModuleFunction · 0.85
findModFunction · 0.70

Tested by

no test coverage detected