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

Function fxBuildHosts

xs/sources/xsAPI.c:541–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541void fxBuildHosts(txMachine* the, txInteger c, const txHostFunctionBuilder* builder)
542{
543 mxPushInteger(c);
544 mxPushInteger(1);
545 mxPush(mxArrayPrototype);
546 fxNewArrayInstance(the);
547 fxArrayCacheBegin(the, the->stack);
548 while (c) {
549 if (builder->length >= 0) {
550 #if mxHostFunctionPrimitive
551 mxPushUndefined();
552 the->stack->kind = XS_HOST_FUNCTION_KIND;
553 the->stack->value.hostFunction.builder = builder;
554 the->stack->value.hostFunction.profileID = the->profileID;
555 the->profileID++;
556 #else
557 fxNewHostFunction(the, builder->callback, builder->length, builder->id, XS_NO_ID);
558 #endif
559 }
560 else
561 fxNewHostObject(the, (txDestructor)builder->callback);
562 fxArrayCacheItem(the, the->stack + 1, the->stack);
563 mxPop();
564 c--;
565 builder++;
566 }
567 fxArrayCacheEnd(the, the->stack);
568}
569
570txSlot* fxNewHostConstructor(txMachine* the, txCallback theCallback, txInteger theLength, txInteger name)
571{

Callers

nothing calls this directly

Calls 6

fxNewArrayInstanceFunction · 0.85
fxArrayCacheBeginFunction · 0.85
fxNewHostFunctionFunction · 0.85
fxNewHostObjectFunction · 0.85
fxArrayCacheItemFunction · 0.85
fxArrayCacheEndFunction · 0.85

Tested by

no test coverage detected