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

Function main

examples/js/repl/win/repl.c:78–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78int main(int argc, char* argv[])
79{
80 static txMachine root;
81 int error = 0;
82 txMachine* machine = &root;
83 txPreparation* preparation = xsPreparation();
84
85 c_memset(machine, 0, sizeof(txMachine));
86 machine->preparation = preparation;
87 machine->keyArray = preparation->keys;
88 machine->keyCount = (txID)preparation->keyCount + (txID)preparation->creation.initialKeyCount;
89 machine->keyIndex = (txID)preparation->keyCount;
90 machine->nameModulo = preparation->nameModulo;
91 machine->nameTable = preparation->names;
92 machine->symbolModulo = preparation->symbolModulo;
93 machine->symbolTable = preparation->symbols;
94
95 machine->stack = &preparation->stack[0];
96 machine->stackBottom = &preparation->stack[0];
97 machine->stackTop = &preparation->stack[preparation->stackCount];
98
99 machine->firstHeap = &preparation->heap[0];
100 machine->freeHeap = &preparation->heap[preparation->heapCount - 1];
101 machine->aliasCount = (txID)preparation->aliasCount;
102
103 machine = fxCloneMachine(&preparation->creation, machine, "tool", NULL);
104
105#ifdef mxInstrument
106 fxDescribeInstrumentation(machine, 0, NULL, NULL);
107#endif
108 xsBeginHost(machine);
109 {
110 xsVars(2);
111#ifdef mxInstrument
112 fxSampleInstrumentation(the, 0, NULL);
113#endif
114 {
115 xsTry {
116 xsResult = xsAwaitImport("main", XS_IMPORT_NAMESPACE);
117 }
118 xsCatch {
119 xsStringValue message = xsToString(xsException);
120 fprintf(stderr, "### %s\n", message);
121 error = 1;
122 }
123 }
124 }
125 xsEndHost(the);
126 xsDeleteMachine(machine);
127

Callers

nothing calls this directly

Calls 3

fxCloneMachineFunction · 0.85
fxSampleInstrumentationFunction · 0.85

Tested by

no test coverage detected