MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / main

Function main

test/core/test_inlinejs3.c:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15int main(int argc, char **argv) {
16 EM_ASM(out('hello dere1'));
17 EM_ASM("out('hello dere2');");
18 emscripten_debugger(); // does nothing in shells; check for validation error though
19 for (int i = 0; i < 3; i++) {
20 EM_ASM(out('hello dere3'); out('hello dere' + 4););
21 }
22 EM_ASM({ out('hello input ' + $0) }, 123);
23 int sum = 0;
24 for (int i = 0; i < argc * 3; i++) {
25 sum += EM_ASM_INT({
26 out('i: ' + [ $0, ($1).toFixed(2) ]);
27 return $0 * 2;
28 },
29 i, (double)i / 12);
30 }
31 EM_ASM_INT({ globalThis.globalVar = $0 }, sum); // no outputs, just input
32 sum = 0;
33 sum = EM_ASM_INT(return globalVar); // no inputs, just output
34 printf("sum: %d\n", sum);
35 printf("|%.2f|\n", EM_ASM_DOUBLE({
36 return $0; // return double properly
37 }, 1.2));
38 for (int i = 0; i < argc*2; i++) loop_iter();
39 return 0;
40}

Callers

nothing calls this directly

Calls 4

printfFunction · 0.85
loop_iterFunction · 0.85
EM_ASMFunction · 0.50
outFunction · 0.50

Tested by

no test coverage detected