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

Function fxFindScript

xs/platforms/mc/xsHosts.c:218–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216*/
217
218static txBoolean fxFindScript(txMachine* the, txSlot* realm, txString path, txID* id)
219{
220 txPreparation* preparation = the->preparation;
221 txInteger c = preparation->scriptCount;
222 txScript* script = preparation->scripts;
223#if MODDEF_XS_MODS
224 uint8_t *mod;
225 int modSize;
226
227 mod = findMod(the, path, &modSize);
228 if (mod) {
229 *id = fxNewNameC(the, path);
230 return 1;
231 }
232#endif
233 while (c > 0) {
234 if (!c_strcmp(path, script->path)) {
235 *id = fxNewNameC(the, path);
236 return 1;
237 }
238 c--;
239 script++;
240 }
241 return 0;
242}
243
244#ifndef mxSeparator
245 #define mxSeparator ('/')

Callers 1

fxFindModuleFunction · 0.70

Calls 2

fxNewNameCFunction · 0.85
findModFunction · 0.70

Tested by

no test coverage detected