File: calls.cpp

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (19 lines) | stat: -rw-r--r-- 418 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <emscripten.h>

extern "C" {

int inner(int x) { return x * x + 2; }

int EMSCRIPTEN_KEEPALIVE simple(int x) { return inner(x); }

int EMSCRIPTEN_KEEPALIVE fibo(int x) {
  if (x == 0 || x == 1)
    return 1;
  return fibo(x - 1) + fibo(x - 2);
}

int EMSCRIPTEN_KEEPALIVE run_script() {
  emscripten_run_script("Module.print('hello from called script')");
  return emscripten_run_script_int("1+2+3+4-1");
}
}