From 110eab7a1aeca27a80f47b8d3c515e4f16e4cd02 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sat, 21 May 2022 18:38:26 +0200 Subject: [PATCH] feat: failed attempt to make emscripten work --- .vscode/launch.json | 29 +++++++++++ .vscode/settings.json | 11 +++++ .vscode/tasks.json | 16 ++++++ Dockerfile | 6 +++ Makefile | 12 ++++- README.md | 11 +++++ docker-compose.yml | 8 +++ examples/sandbox2.ltor | 3 ++ sandbox.c | 92 +++++++++++++++++++--------------- src/config.h | 10 +++- src/config_env.h | 2 + src/config_env_main.h | 2 + src/evaluator.c | 64 ++++++++++++------------ src/funcs.c | 28 +++++------ src/line_processing.c | 13 +++-- src/list.c | 8 +-- src/main.c | 18 +++---- src/number_parsing.c | 14 +++--- src/operate.c | 6 +-- src/stack.c | 61 +++++++++++++++++++++++ src/stack.h | 19 +++++++ src/utils.c | 15 +++++- src/utils.h | 2 + src/var_store.c | 45 +++++++++-------- src/var_store.h | 2 +- tests/test.c | 6 ++- tests/test_evaluation.c | 6 +-- tests/test_line_processing.c | 8 +-- tests/test_stack.c | 4 +- tests/test_utils.c | 2 +- tests/test_var_store.c | 32 +++++++++++- wasm.sh | 1 + wasm/config_env_wasm.h | 2 + wasm/emscripten.c | 81 ++++++++++++++++++++++++++++++ wasm/emscripten_raw.html | 1 + wasm/emscripten_raw.js | 1 + wasm/emscripten_raw.wasm | Bin 0 -> 46383 bytes wasm/index.html | 69 ++++++++++++++++++++++++++ wasm/langatator_adapter.js | 1 + wasm/langatator_adapter.wasm | Bin 0 -> 44403 bytes wasm/script.js | 93 +++++++++++++++++++++++++++++++++++ wasm/style.css | 0 wasm/wasm.c | 44 +++++++++++++++++ 43 files changed, 700 insertions(+), 148 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 examples/sandbox2.ltor create mode 100644 src/config_env.h create mode 100644 src/config_env_main.h create mode 100644 wasm.sh create mode 100644 wasm/config_env_wasm.h create mode 100644 wasm/emscripten.c create mode 100644 wasm/emscripten_raw.html create mode 100644 wasm/emscripten_raw.js create mode 100755 wasm/emscripten_raw.wasm create mode 100644 wasm/index.html create mode 100644 wasm/langatator_adapter.js create mode 100755 wasm/langatator_adapter.wasm create mode 100644 wasm/script.js create mode 100644 wasm/style.css create mode 100644 wasm/wasm.c diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2633203 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "gcc build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/test", + "args": [], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "tasks", + "miDebuggerPath": "/usr/bin/gdb" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7e5860e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "files.associations": { + "*.ts": "typescript", + "*.asm": "python", + "stdio.h": "c", + "string_view": "c", + "state.h": "c", + "stack.h": "c", + "var_store.h": "c" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f445fbf --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "tasks", + "type": "shell", + "command": "make test-debug", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f5fa148 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.14 +RUN apk add gcc +RUN apk add make +RUN mkdir /app +COPY ./ /app +ENTRYPOINT ["sleep", "infinity"] diff --git a/Makefile b/Makefile index e180d25..cb1c27d 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,22 @@ TEST_SRCS_ENC := $(foreach DIR,src,$(patsubst $(DIR)/%,%,$(wildcard ./src/*.c))) TEST_SRCS_ENC := $(filter-out %main.c, $(TEST_SRCS_ENC)) build: + cp src/config_env_main.h src/config_env.h gcc src/* -o ./bin/main ${CXXFLAGS_WITHOUT_PKGS} test: + cp src/config_env_main.h src/config_env.h gcc ${TEST_SRCS_ENC} ./tests/* -o ./bin/test ${CXXFLAGS_WITHOUT_PKGS} ./bin/test -test-no-run: +test-no-run: ./tests/* + cp src/config_env_main.h src/config_env.h gcc ${TEST_SRCS_ENC} ./tests/* -o ./bin/test ${CXXFLAGS_WITHOUT_PKGS} +test-debug: ./tests/* + cp src/config_env_main.h src/config_env.h + gcc -g ${TEST_SRCS_ENC} ./tests/* -o ./bin/test ${CXXFLAGS_WITHOUT_PKGS} +emscripten: + cp wasm/config_env_wasm.h src/config_env.h + emcc -O3 -s WASM=1 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap,getValue,setValue \ + ./wasm/emscripten.c ${TEST_SRCS_ENC} -o wasm/langatator_adapter.js sandbox: gcc ${TEST_SRCS_ENC} ./sandbox.c -o ./bin/sandbox ${CXXFLAGS_WITHOUT_PKGS} ./bin/sandbox diff --git a/README.md b/README.md index 641e266..4e72dbe 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ ToDo List: - [ ] feat: basic number list support - [ ] feat: fully features strings support - [ ] feat: function to access to environment variables +- [ ] feat: hexadecimal and binary constants - [X] feat: REPL environment - [ ] feat: add history to REPL @@ -72,6 +73,14 @@ You will need to compile the code from source. I use GNU Make with GCC, but I'm sure you can use any C compilers though you may need to edit some part of the code to cope with other compilers (eg. binary constants). +## Build to Web assembly + +I use emscripten.org + +It would be great if I'm not using emscripten. + +I have to find implementation for stdlib + ## Unit testing I try to have some sort of code coverage, you can run the unit tests by issuing `make test` @@ -171,3 +180,5 @@ print_string(str) print_newline() print_ascii(nb) ``` + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..08aa019 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.9" +services: + app: + build: + context: ./ + volumes: + - ./:/app + diff --git a/examples/sandbox2.ltor b/examples/sandbox2.ltor new file mode 100644 index 0000000..c935541 --- /dev/null +++ b/examples/sandbox2.ltor @@ -0,0 +1,3 @@ +print_number(2) +print_number(3) + diff --git a/sandbox.c b/sandbox.c index bf60179..39db178 100644 --- a/sandbox.c +++ b/sandbox.c @@ -1,22 +1,36 @@ +// #include +// #include "./src/types.h" +// #include "./src/list.h" +// #include "./src/number_parsing.h" +// #include "./src/funcs.h" +// #include "./src/utils.h" +// #include "./src/var_store.h" +// #include "./src/line_processing.h" +// #include "./src/state.h" +// #include +// #include +// #include #include -#include "./src/types.h" -#include "./src/list.h" -#include "./src/number_parsing.h" -#include "./src/funcs.h" -#include "./src/utils.h" -#include "./src/var_store.h" -#include "./src/line_processing.h" -#include "./src/state.h" -#include + +// #define printf_wrap(f_, ...) \ +// { \ +// printf_wrap("T=%d \t", (unsigned) time(NULL)); \ +// printf_wrap((f_), ##__VA_ARGS__); \ +// }; + +#define eprintf_wrap(template, ...) printf_wrap(template, ##__VA_ARGS__); + int main () { - struct VariableStore* store = var_store_init(); - printf("%d", var_store_hash_name(store, "print_number index")); - int i = -1; - if (i < 0) { - printf("lol jpp \n"); - } + eprintf_wrap("Hello %d %s \n", 13, "World"); + // struct VariableStore* store = var_store_init(); + // printf_wrap("%d", var_store_hash_name(store, "print_number index")); + + // int i = -1; + // if (i < 0) { + // printf_wrap("lol jpp \n"); + // } return 0; //struct List l1; @@ -30,32 +44,32 @@ int main () { // int yes = 1234; // int dst = 0; // memcpy(&dst, &yes, 4); - // printf("yes: %d \n", dst); + // printf_wrap("yes: %d \n", dst); //struct VariableStore* store = var_store_init(); // int hashRes = var_store_hash_name(store, "HelloWorld++"); - // printf("hashRes: %d \n", hashRes); + // printf_wrap("hashRes: %d \n", hashRes); // int val = 1234; // var_store_set(store, "foo", TYPE_INT, &val); // var_store_get_key(store, "while i < 10 then"); - //printf("Pos of var: %d \n", var_store_get_pos(store, "foo")); + //printf_wrap("Pos of var: %d \n", var_store_get_pos(store, "foo")); //byte type = var_store_get_type(store, "foo"); - //printf("Type of var: %d \n", type); + //printf_wrap("Type of var: %d \n", type); //int key = var_store_get_pos(store, "foo"); - //printf("size of type %d \n", get_size_of_type(store->container[key].type)); - //printf("%d \n", *((int*) store->container[key].dataPtr)); + //printf_wrap("size of type %d \n", get_size_of_type(store->container[key].type)); + //printf_wrap("%d \n", *((int*) store->container[key].dataPtr)); // int val2 = 0; // var_store_copy(store, "foo", &val2); - // printf("Value of var: %d \n", val2); + // printf_wrap("Value of var: %d \n", val2); - // printf("==== \n"); - // printf("==== \n"); + // printf_wrap("==== \n"); + // printf_wrap("==== \n"); // char* lines = "# hello world\n" // "set x to 5\n" @@ -65,17 +79,17 @@ int main () { // "end\n" // "\n"; - char* lines1 = "set x to 5\n" - "set y to 1\n" - "if !(x+y = 6) then\n" - " print_number(x+y)\n" - "end\n" - "\n"; + // char* lines1 = "set x to 5\n" + // "set y to 1\n" + // "if !(x+y = 6) then\n" + // " print_number(x+y)\n" + // "end\n" + // "\n"; - printf("%s", lines1); + // printf_wrap("%s", lines1); - struct StateContainer* state = state_init(); - process_script(state, lines1); + // struct StateContainer* state = state_init(); + // process_script(state, lines1); // struct List l1; @@ -97,20 +111,20 @@ int main () { // void* ptr = &res; - // printf("%d\n", sizeof(ptr)); + // printf_wrap("%d\n", sizeof(ptr)); // int found = identify_func_name("ABS"); - // printf("found: %d \n", found); + // printf_wrap("found: %d \n", found); // unsigned char argsType[1] = { TYPE_FLOAT }; // int argsVals[1] = { get_int_rep_from_float(-3.145) }; // int resVal = 0; // unsigned char resType = 0; // execute_func(found, 1, argsType, argsVals, &resVal, &resType); - // printf("func res type: %d \n", resType); - // printf("func res: %f \n", get_float_from_int_rep(resVal)); + // printf_wrap("func res type: %d \n", resType); + // printf_wrap("func res: %f \n", get_float_from_int_rep(resVal)); // int stat = parse_float("1052.254", &res); - // printf("float parsing stat: %d \n", stat); - // printf("final float: %f \n", res); + // printf_wrap("float parsing stat: %d \n", stat); + // printf_wrap("final float: %f \n", res); } diff --git a/src/config.h b/src/config.h index 01e1ec0..b4cb4ee 100644 --- a/src/config.h +++ b/src/config.h @@ -1,12 +1,20 @@ +#include "./config_env.h" + +//#define printf_wrap(template,...) printf_wrap(template, ##__VA_ARGS__); +#define getline_wrap(...) getline(__VA_ARGS__); + #ifndef G_CONFIG_H_ #define G_CONFIG_H_ +#define PRINT_METHOD_CLASSIC 0 +#define PRINT_METHOD_WASM 1 +// #define CONFIG_PRINT_METHOD #define PRESET_ENGLISH 0 #define PRESET_FRENCH 1 // 0: no logs; 1: medium debug; 2: full debug -#define G_DEBUG_LEVEL 0 +#define G_DEBUG_LEVEL 2 #define SYNTAX_PRESET PRESET_ENGLISH // Define your own custom syntax here diff --git a/src/config_env.h b/src/config_env.h new file mode 100644 index 0000000..7a83d9c --- /dev/null +++ b/src/config_env.h @@ -0,0 +1,2 @@ +// the config file for main and test +#define PRINT_MODE 0 diff --git a/src/config_env_main.h b/src/config_env_main.h new file mode 100644 index 0000000..7a83d9c --- /dev/null +++ b/src/config_env_main.h @@ -0,0 +1,2 @@ +// the config file for main and test +#define PRINT_MODE 0 diff --git a/src/evaluator.c b/src/evaluator.c index a787813..310783b 100644 --- a/src/evaluator.c +++ b/src/evaluator.c @@ -49,7 +49,7 @@ int evaluator_reduce_operator_pattern(struct List* evalList) { if (operateStatus != 0) { // the pattern that matched, did not worked as expected // this is a failure - printf("ERR Evaluator: cannot operate \n"); + printf_wrap("ERR Evaluator: cannot operate \n"); return 400; } @@ -64,7 +64,7 @@ int evaluator_reduce_operator_pattern(struct List* evalList) { list_delete(evalList, patternPos+1); list_delete(evalList, patternPos+1); - //printf("END OF THE FIRST OPERATION \n"); + //printf_wrap("END OF THE FIRST OPERATION \n"); //list_print(&evalList); // so we reduced an expression, return 0 @@ -105,7 +105,7 @@ int evaluator_reduce_minus_pattern(struct List* evalList) { unsigned char typeRes = 0; int operateStatus = operate('*', TYPE_INT, -1, type, val, &typeRes, &res); if (operateStatus != 0) { - printf("ERR Evaluator: cannot operate \n"); + printf_wrap("ERR Evaluator: cannot operate \n"); return 400; } @@ -148,7 +148,7 @@ int evaluator_reduce_not_pattern(struct List* evalList) { byte typeRes = 0; int operateStatus = operate('!', 0, 0, type, val, &typeRes, &res); if (operateStatus != 0) { - printf("ERR Evaluator: cannot operate \n"); + printf_wrap("ERR Evaluator: cannot operate \n"); return 400; } @@ -208,7 +208,7 @@ int evaluator_reduce_var(struct StateContainer* state, struct List* evalList) { byte type = var_store_get_type_from_key(state->varStore, varKey); - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("Going to reduce var key %d at pos %d\n", varKey, patternPos); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("Going to reduce var key %d at pos %d\n", varKey, patternPos); byte varVal[get_size_of_type(type)]; var_store_copy_from_key(state->varStore, varKey, &varVal); @@ -268,7 +268,7 @@ int evaluator_reduce_function_call(struct List* evalList, int initialPosition) { // two case: either we have another arguments or we have a closing parenthesis while (1) { if (argsLen > 16) { - printf("ERR Evaluator: too many arguments passed to func (max out the limit) \n"); + printf_wrap("ERR Evaluator: too many arguments passed to func (max out the limit) \n"); return 100; } if ( @@ -335,16 +335,16 @@ int evaluator_reduce_function_call(struct List* evalList, int initialPosition) { // now we can delete in the list from pos+1 patternPos to pos // just delete N-1 times where N is the number of components in the func call - //printf("start: %d, end: %d \n", patternPos, pos); - //printf("patternPos: %d, pos: %d \n", patternPos, pos); + //printf_wrap("start: %d, end: %d \n", patternPos, pos); + //printf_wrap("patternPos: %d, pos: %d \n", patternPos, pos); for (int j = 0; j < (pos-patternPos); j++) { list_delete(evalList, patternPos); } - //printf("list report after deleting after applying a func \n"); + //printf_wrap("list report after deleting after applying a func \n"); //list_print(evalList); - //printf("patternPos: %d, resType: %d \n", patternPos, resType); + //printf_wrap("patternPos: %d, resType: %d \n", patternPos, resType); list_set(evalList, patternPos, resType, &resVal); @@ -402,12 +402,12 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig // display the partition if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("partitionPtr: %d \n", partitionPtr); + printf_wrap("partitionPtr: %d \n", partitionPtr); } for (int j = 0; j < partitionPtr; j++) { if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("start %d ", partitionStartPos[j]); - printf("stop %d ", partitionStopPos[j]); + printf_wrap("start %d ", partitionStartPos[j]); + printf_wrap("stop %d ", partitionStopPos[j]); } int len = partitionStopPos[j] - partitionStartPos[j]; @@ -419,7 +419,7 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig } buff[len] = 0; if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("content %s \n", buff); + printf_wrap("content %s \n", buff); } } @@ -441,29 +441,29 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig parenthesisCount--; } if (parenthesisCount < 0) { - printf("ERR Evaluator: bad parenthesizing \n"); + printf_wrap("ERR Evaluator: bad parenthesizing \n"); return 100; } } if (parenthesisCount > 0) { // there is an open parenthesis, so it's an error - printf("ERR Evaluator: invalid parenthesis stack \n"); + printf_wrap("ERR Evaluator: invalid parenthesis stack \n"); return 100; } struct List evalList; // NOTICE: for some reason the struct don't reset after a usage list_reset(&evalList); - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("\n - constructing list \n"); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("\n - constructing list \n"); // initializing the evaluation list for (int j = 0; j < partitionPtr; j++) { int startPos = partitionStartPos[j]; int stopPos = partitionStopPos[j]; if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("=== %d\n", j); - printf("startPos %d, stopPos %d\n", startPos, stopPos); + printf_wrap("=== %d\n", j); + printf_wrap("startPos %d, stopPos %d\n", startPos, stopPos); } int len = stopPos - startPos; @@ -492,7 +492,7 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig buff[len] = 0; // terminate the buff // TODO: SPLIT INTO A FUNCTION "identify_token(char* str)" - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("buff: '%s' \n", buff); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("buff: '%s' \n", buff); char dumbValue = (char) 0; @@ -510,7 +510,7 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig continue; } if (len == 1 && is_operator(buff[0])) { - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("found op\n"); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("found op\n"); char opValue = buff[0]; list_set(&evalList, evalList.num_elements, TYPE_OPERATOR, &opValue); continue; @@ -520,7 +520,7 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig int st = parse_int(buff, &res); if (st == 0) { // parse int success - //printf("Content aftr parsing %d %d \n", st, res); + //printf_wrap("Content aftr parsing %d %d \n", st, res); list_set(&evalList, evalList.num_elements, TYPE_INT, &res); } if (st != 0) { @@ -537,18 +537,18 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig // identify token // first try a variable then a func name // not a float, check if this is a common function name - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("now going to identify token '%s' \n", buff); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("now going to identify token '%s' \n", buff); if (EVALUATOR_DEBUG_LEVEL >= 2) var_store_print(state->varStore); int varKey = (int) var_store_get_key(state->varStore, buff); - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("got var key '%d' \n", varKey); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("got var key '%d' \n", varKey); if (varKey == -1) { // did not find the var name short funcID = identify_func_name(buff); if (funcID == -1) { // did not find the func name - printf("ERR Evaluator: could not identify token \"%s\" \n", buff); + printf_wrap("ERR Evaluator: could not identify token \"%s\" \n", buff); return 200; } if (funcID >= 0) { @@ -559,13 +559,13 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig list_set(&evalList, evalList.num_elements, TYPE_VAR_NAME, &varKey); } } - if (EVALUATOR_DEBUG_LEVEL >= 2) printf("end of a token identification\n"); + if (EVALUATOR_DEBUG_LEVEL >= 2) printf_wrap("end of a token identification\n"); } // check the content of this thing if (EVALUATOR_DEBUG_LEVEL >= 2) { list_print(&evalList); - printf("Now going to actually evaluate...\n"); + printf_wrap("Now going to actually evaluate...\n"); } while (evalList.num_elements > 1 || !is_type_literal(list_get_type(&evalList, 0))) { @@ -595,9 +595,9 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig if (m == 4) stat = evaluator_reduce_operator_pattern(&evalList); if (m == 5) stat = evaluator_reduce_parenthesis_pattern(&evalList); if (stat > 0) { - printf("ERR Evaluator: mode %d reducing failed \n", m); + printf_wrap("ERR Evaluator: mode %d reducing failed \n", m); if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("dumping evalList: \n"); + printf_wrap("dumping evalList: \n"); list_print(&evalList); } } @@ -607,9 +607,9 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig if (!didReduced) { // all scans failed to find things to reduce // this is actually a failure because we can't do anything to get down to 1 element in the eval list - printf("ERR Evaluator: could not reduce more \n"); + printf_wrap("ERR Evaluator: could not reduce more \n"); if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("dumping evalList: \n"); + printf_wrap("dumping evalList: \n"); list_print(&evalList); } return 400; @@ -620,7 +620,7 @@ int evaluate(struct StateContainer* state, char* inputStr, int* resultPtr, unsig *typePtr = typeRes; list_get(&evalList, 0, resultPtr); if (EVALUATOR_DEBUG_LEVEL >= 2) { - printf("End of evaluation, dumping evalList: \n"); + printf_wrap("End of evaluation, dumping evalList: \n"); list_print(&evalList); } diff --git a/src/funcs.c b/src/funcs.c index 5fbf44c..1291e47 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -92,15 +92,15 @@ int print_number_impl(int* res, unsigned char* resType, unsigned char* types, in return 1; } if (G_DEBUG_LEVEL >= 1) { - printf("REAL_PRINT: "); + printf_wrap("REAL_PRINT: "); } if (types[0] == TYPE_INT) { int val = args[0]; - printf("%d\n", val); + printf_wrap("%d\n", val); } if (types[0] == TYPE_FLOAT) { float val = get_float_from_int_rep(args[0]); - printf("%f\n", val); + printf_wrap("%f\n", val); } *res = 1; return 0; @@ -122,7 +122,7 @@ int print_ascii_impl(int* res, unsigned char* resType, unsigned char* types, int charVal = (int) get_float_from_int_rep(args[0]); } - printf("%c", *((char*) &charVal)); + printf_wrap("%c", *((char*) &charVal)); *res = 1; return 0; } @@ -134,7 +134,7 @@ int print_newline_impl(int* res, unsigned char* resType, unsigned char* types, i *resType = TYPE_INT; *res = 1; - printf("\n"); + printf_wrap("\n"); return 0; } @@ -143,15 +143,15 @@ int input_number_impl(int* res, unsigned char* resType, unsigned char* types, in { UNUSED(types); UNUSED(args); - printf("? "); + printf_wrap("? "); char* line; size_t len = 0; size_t lineSize = 0; - lineSize = getline(&line, &len, stdin); + lineSize = getline_wrap(&line, &len, stdin); - // printf("len=%d, lineSize=%d '%s' \n", len, lineSize, line); + // printf_wrap("len=%d, lineSize=%d '%s' \n", len, lineSize, line); char toParse[lineSize+1]; str_extract((char*) toParse, line, 0, lineSize-1); @@ -377,22 +377,22 @@ short identify_func_name(char* candidate) int execute_func(short funcID, short argsLen, unsigned char* argsTypes, int* argsValues, int* resPtr, unsigned char* resTypePtr) { if (funcID >= nbOfFuncs) { - printf("ERR: Invalid func with index: %d \n", funcID); + printf_wrap("ERR: Invalid func with index: %d \n", funcID); return 1; } int (*impl)(int*, unsigned char*, unsigned char*, int*) = intros[funcID].implementation; if (impl == 0) { - printf("ERR: No implementation for func with index: %d \n", funcID); + printf_wrap("ERR: No implementation for func with index: %d \n", funcID); return 1; } char* name = intros[funcID].name; - if (G_DEBUG_LEVEL >= 2) printf("Executing func '%s' \n", name); + if (G_DEBUG_LEVEL >= 2) printf_wrap("Executing func '%s' \n", name); if (argsLen < intros[funcID].nbArgs) { - printf("ERR: Too few arguments for func call '%s' \n", name); + printf_wrap("ERR: Too few arguments for func call '%s' \n", name); return 1; } if (argsLen > intros[funcID].nbArgs) { - printf("ERR: Too many arguments for func call '%s' \n", name); + printf_wrap("ERR: Too many arguments for func call '%s' \n", name); return 1; } @@ -400,7 +400,7 @@ int execute_func(short funcID, short argsLen, unsigned char* argsTypes, int* arg // first cast the function ptr impl(resPtr, resTypePtr, argsTypes, argsValues); - if (G_DEBUG_LEVEL >= 2) printf("Got %s \n", get_repr(*resTypePtr, resPtr)); + if (G_DEBUG_LEVEL >= 2) printf_wrap("Got %s \n", get_repr(*resTypePtr, resPtr)); return 0; } diff --git a/src/line_processing.c b/src/line_processing.c index b32fe3c..09242f2 100644 --- a/src/line_processing.c +++ b/src/line_processing.c @@ -326,8 +326,8 @@ int process_line(struct StateContainer* state, char* str) } if (recognize_word(str, SYNTAX_END)) { - byte lastBlockType; - int_stack_pop(state->blockStack, (int*) &lastBlockType); // FIXME: use a stack with size byte instead of int + int lastBlockType; + int_stack_pop(state->blockStack, &lastBlockType); // FIXME: use a stack with size byte instead of int if (!state->skipping && lastBlockType == BLOCK_WHILE) { int lastLoopLine; int_stack_pop(state->loopStack, &lastLoopLine); @@ -441,7 +441,7 @@ int process_line(struct StateContainer* state, char* str) state->linePtr = lastLoopLine; // find the last while if the block stack and pop blocks up to that point - byte lastBlockType; + int lastBlockType; while (lastBlockType != BLOCK_WHILE) { if (!int_stack_pop(state->blockStack, &lastBlockType)) { printf("Syntax error: unexpected continue.\n"); @@ -588,5 +588,12 @@ int process_script(struct StateContainer* state, char* script) } } + if (LINE_PROCESSING_DEBUG_LEVEL >= 1) { + // end of run + printf("End of run dumping var_store \n"); + var_store_print(state->varStore); + printf("=== end of dump\n"); + } + return 1; } diff --git a/src/list.c b/src/list.c index 09112b5..3585cb6 100644 --- a/src/list.c +++ b/src/list.c @@ -185,15 +185,15 @@ int list_append_char(struct List* list, char value) void list_print(struct List* list) { - printf("=== LIST REPORT === \n"); - printf("num of elements: %d \n", list->num_elements); + printf_wrap("=== LIST REPORT === \n"); + printf_wrap("num of elements: %d \n", list->num_elements); for (int i = 0; i < list->num_elements; i++) { int type = list_get_type(list, i); int data = 0; list_get(list, i, &data); - printf("- i: %d, %s \n", i, get_repr(type, (void*) &data)); + printf_wrap("- i: %d, %s \n", i, get_repr(type, (void*) &data)); } - printf("=== END === \n"); + printf_wrap("=== END === \n"); } diff --git a/src/main.c b/src/main.c index d54a538..1e7ca37 100644 --- a/src/main.c +++ b/src/main.c @@ -5,8 +5,8 @@ #include #include #include "./config.h" -#include "./types.h" #include "./utils.h" +#include "./types.h" #include "./stack.h" #include "./list.h" #include "./number_parsing.h" @@ -31,13 +31,13 @@ int help_mode(char* cmdName) { " -v --version print version information and exit\n" " -i --interactive force interactive mode\n" " -e --stdin-expression evaluate expression from stdin\n"; - printf(helpStr, cmdName); + printf_wrap(helpStr, cmdName); return 0; } int version_mode() { char* helpStr = "Langatator 0.0.1\n"; - printf(helpStr); + printf_wrap(helpStr); return 0; } @@ -45,7 +45,7 @@ int interactive_mode() { struct StateContainer* state = state_init(); while (state->running) { - printf("? "); + printf_wrap("? "); char* line; size_t len = 0; @@ -54,7 +54,7 @@ int interactive_mode() { lineSize = getline(&line, &len, stdin); if (lineSize == (size_t) -1) { // we received some kind of interrupt? - printf("\n"); + printf_wrap("\n"); return EXIT_SUCCESS; } @@ -64,10 +64,10 @@ int interactive_mode() { int stat = process_line(state, toEvaluate); if (!stat) { - printf("Processing that line failed.\n"); + printf_wrap("Processing that line failed.\n"); } if (state->lastEvaluationType != TYPE_NULL) { - printf("%s\n", get_repr(state->lastEvaluationType, &state->lastEvaluationResult)); + printf_wrap("%s\n", get_repr(state->lastEvaluationType, &state->lastEvaluationResult)); } } @@ -75,7 +75,7 @@ int interactive_mode() { } int stdin_expression_mode() { - printf("This mode is not implemented yet ¯\\_(ツ)_/¯ \n"); + printf_wrap("This mode is not implemented yet ¯\\_(ツ)_/¯ \n"); return 1; } @@ -116,7 +116,7 @@ error: } int file_mode(char* fileName) { - // printf("Open file mode...\n"); + // printf_wrap("Open file mode...\n"); size_t size; char* buff = slurp_file(fileName, &size); diff --git a/src/number_parsing.c b/src/number_parsing.c index 65e82cd..7f93804 100644 --- a/src/number_parsing.c +++ b/src/number_parsing.c @@ -22,7 +22,7 @@ int parse_clean_positive_integer(int inputStrLen, char* inputStr, int* result) { ); i++; } - //printf("parseclean %d \n", value); + //printf_wrap("parseclean %d \n", value); *result = value; @@ -58,13 +58,13 @@ int parse_int(char* inputStr, int* resultPtr) { i++; } cleanStr[cleanStrLen] = 0; - //printf("clean str: %s/ \n", cleanStr); + //printf_wrap("clean str: %s/ \n", cleanStr); int inter = 0; byte stat = parse_clean_positive_integer(cleanStrLen, cleanStr, &inter); if (NB_PARSING_DEBUG_LEVEL >= 2) { - printf("Parse clean positive integer stat: %d\n", stat); - printf("Got value: %d\n", inter); + printf_wrap("Parse clean positive integer stat: %d\n", stat); + printf_wrap("Got value: %d\n", inter); } *resultPtr = inter; @@ -76,7 +76,7 @@ int parse_int(char* inputStr, int* resultPtr) { } int parse_float(char* inputStr, float* resultPtr) { - if (NB_PARSING_DEBUG_LEVEL >= 2) printf("Parsing as float: '%s'\n", inputStr); + if (NB_PARSING_DEBUG_LEVEL >= 2) printf_wrap("Parsing as float: '%s'\n", inputStr); int i = 0; char cleanStrIntPart[strlen(inputStr)+1]; int cleanStrIntPartLen = 0; @@ -135,8 +135,8 @@ int parse_float(char* inputStr, float* resultPtr) { } cleanStrIntPart[cleanStrIntPartLen] = 0; cleanStrFloatPart[cleanStrFloatPartLen] = 0; - // printf("clean str int part: /%s/ \n", cleanStrIntPart); - // printf("clean str float part: /%s/ \n", cleanStrFloatPart); + // printf_wrap("clean str int part: /%s/ \n", cleanStrIntPart); + // printf_wrap("clean str float part: /%s/ \n", cleanStrFloatPart); int intPart = 0; parse_clean_positive_integer(cleanStrIntPartLen, cleanStrIntPart, &intPart); diff --git a/src/operate.c b/src/operate.c index b3ee816..ea6b10b 100644 --- a/src/operate.c +++ b/src/operate.c @@ -72,7 +72,7 @@ int operate( a = convert_to_float(typeA, aRepr); b = convert_to_float(typeB, bRepr); - if (OPERATE_DEBUG_LEVEL) printf("Appling operation: %f %c %f \n", a, operator, b); + if (OPERATE_DEBUG_LEVEL) printf_wrap("Appling operation: %f %c %f \n", a, operator, b); if (operator == '+') { res = a+b; @@ -95,13 +95,13 @@ int operate( } else { return 2; } - if (OPERATE_DEBUG_LEVEL) printf("Got float: %f \n", res); + if (OPERATE_DEBUG_LEVEL) printf_wrap("Got float: %f \n", res); // get int representation of float *resPtr = *(int *)(&res); return 0; } if (typeA == TYPE_INT && typeB == TYPE_INT) { - if (OPERATE_DEBUG_LEVEL) printf("Appling operation %d %c %d \n", aRepr, operator, bRepr); + if (OPERATE_DEBUG_LEVEL) printf_wrap("Appling operation %d %c %d \n", aRepr, operator, bRepr); *typeRes = TYPE_INT; int res = 0; if (operator == '+') { diff --git a/src/stack.c b/src/stack.c index 5035757..fd67cee 100644 --- a/src/stack.c +++ b/src/stack.c @@ -1,3 +1,63 @@ +/* +#include "./utils.h" +#include "./stack.h" +#include +#include + +struct Stack* int_stack_init(byte unitSize) +{ + struct Stack* stack = (struct Stack*) malloc(sizeof(struct Stack)); + stack->unitSize = unitSize; + stack->length = 0; + stack->allocated = 8; + stack->data = (int*) malloc(stack->allocated * stack->unitSize); + + return stack; +} + +byte stack_push(struct Stack* stack, void* valueToPush) +{ + if (stack->length == stack->allocated) { + stack->allocated *= 2; + stack->data = realloc(stack->data, stack->allocated * stack->unitSize); + } + + memcpy(stack->data[stack->length], valueToPush, stack->unitSize); + stack->length++; + + return 1; +} + +byte stack_pop(struct Stack* stack, void* valuePtr) +{ + if (stack->length == 0) { + // error, nothing to pop + return 0; + } + + memcpy(valuePtr, stack->data[stack->length-1], stack->unitSize); + + stack->length--; + + return 1; +} + +int int_stack_length(struct Stack* stack) +{ + return stack->length; +} + +void int_stack_print(struct Stack* stack) +{ + printf_wrap("= STACK REPORT \n"); + for (int i = 0; i < stack->length; i++) { + printf_wrap("%d; ", stack->data[i]); + } + printf_wrap("\n"); +} + + +*/ #include "./utils.h" #include "./stack.h" #include @@ -53,3 +113,4 @@ void int_stack_print(struct IntStack* stack) } printf("\n"); } + diff --git a/src/stack.h b/src/stack.h index 135ad0c..c5aaad5 100644 --- a/src/stack.h +++ b/src/stack.h @@ -2,6 +2,24 @@ #ifndef STACK_H_ #define STACK_H_ +// struct Stack { +// byte unitSize; +// int length; +// int allocated; +// int* data; +// }; + +// struct Stack* stack_init(); + +// byte stack_push(struct Stack* stack, void* valueToPush); + +// byte stack_pop(struct Stack* stack, void* valuePtr); + +// byte stack_get(struct Stack* stack, int index, void* valuePtr); + +// int stack_length(struct Stack* stack); + +// void stack_print(struct Stack* stack); struct IntStack { int length; int allocated; @@ -18,4 +36,5 @@ int int_stack_length(struct IntStack* stack); void int_stack_print(struct IntStack* stack); + #endif diff --git a/src/utils.c b/src/utils.c index 3f39bb1..5b98268 100644 --- a/src/utils.c +++ b/src/utils.c @@ -2,6 +2,17 @@ #include #include "./utils.h" +#include + +#if PRINT_MODE == 0 +int printf_wrap(const char* format, ...) { + va_list args; + va_start(args, format); + vprintf(format, args); + va_end( args ); +} +#endif + int get_int_rep_from_float(float ft) { return *(int *)(&ft); @@ -21,7 +32,7 @@ float get_float_from_int_rep(int representation) int get_int_rep_from_char(char c) { - return *(int *)(&c); + return (int) c; } int is_char_numeral(char candidate) @@ -217,7 +228,7 @@ int m_newton_method(float (*func)(float, float), float param, float startsAt, fl return 0; } if (runs > 100) { - printf("ERR: newton methods failed, coup dur pour newton \n"); + printf_wrap("ERR: newton methods failed, coup dur pour newton \n"); return 100; } cursor = newCursor; diff --git a/src/utils.h b/src/utils.h index 13a5c72..3e477b8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -3,6 +3,8 @@ #ifndef UTILS_H_ #define UTILS_H_ +int printf_wrap(const char* format, ...); + // useful to silent warning of gcc of uunused parameters in functions #define UNUSED(x) (void)(x) diff --git a/src/var_store.c b/src/var_store.c index d49f575..0e3020c 100644 --- a/src/var_store.c +++ b/src/var_store.c @@ -10,14 +10,14 @@ struct VariableStore* var_store_init() { struct VariableStore* store = (struct VariableStore*) malloc(sizeof(struct VariableStore)); if (store == NULL) { - printf("[ERR] VARSTORE: malloc failed for variable store \n"); + printf_wrap("[ERR] VARSTORE: malloc failed for variable store \n"); return NULL; } store->allocatedLength = VAR_STORE_INITIAL_ALLOC_LENGTH; store->length = 0; store->container = (struct VariableContainer*) malloc(sizeof(struct VariableContainer) * store->allocatedLength); if (store->container == NULL) { - printf("[ERR] VARSTORE: malloc failed for first variable container \n"); + printf_wrap("[ERR] VARSTORE: malloc failed for first variable container \n"); return NULL; } for (int i = 0; i < store->allocatedLength; i++) { @@ -39,27 +39,29 @@ int var_store_hash_name(struct VariableStore* store, char* varName) int hash = 0; int i = 0; while (varName[i] != '\0') { - int num = get_int_rep_from_char(varName[i])*integer_pow(9, i); - hash = abs(hash + abs(num)); + int num = get_int_rep_from_char(varName[i])|integer_pow(9, i); + hash += num; i++; } // FIXME: when reallocating, we should copy all variables to their new key // because we use modulus operator, the hash will change whenever we reallocated the table - return hash % store->allocatedLength; + hash = (hash < 0 ? -hash : hash) % store->allocatedLength; + //printf_wrap("Compute a hash for '%s' , allocatd: %d; %d\n", varName, store->allocatedLength, hash); + return hash; } byte var_store_set(struct VariableStore* store, char* varName, byte type, void* valuePtr) { - //printf("set variable at var name: '%s' \n", varName); + //printf_wrap("set variable at var name: '%s' \n", varName); if (!(type == TYPE_FLOAT || type == TYPE_INT || type == TYPE_NULL)) { - printf("[ERR] VARSTORE: unsupported type, cannot store type %d\n", type); + printf_wrap("[ERR] VARSTORE: unsupported type, cannot store type %d\n", type); return 0; } void* dataPtr; if (type == TYPE_FLOAT || type == TYPE_INT) { dataPtr = malloc(sizeof(int)); if (dataPtr == NULL) { - printf("[ERR] VARSTORE: malloc failed for data\n"); + printf_wrap("[ERR] VARSTORE: malloc failed for data\n"); return 1; } @@ -70,7 +72,7 @@ byte var_store_set(struct VariableStore* store, char* varName, byte type, void* char* namePtr = (char*) malloc(strlen(varName)); if (namePtr == NULL) { - printf("[ERR] VARSTORE: malloc failed for var name\n"); + printf_wrap("[ERR] VARSTORE: malloc failed for var name\n"); return 1; } strcpy(namePtr, varName); @@ -82,7 +84,7 @@ byte var_store_set(struct VariableStore* store, char* varName, byte type, void* { if (store->container[key].type == 0) { // we finally found an empty space, but we didn't found a variable with the same name - // we have a new variable + // so we have a new variable store->length++; break; } @@ -93,24 +95,25 @@ byte var_store_set(struct VariableStore* store, char* varName, byte type, void* key = (key+1) % store->allocatedLength; if (key == originalKey) { // end the search to avoid endless loop - printf("[ERR] VARSTORE: cannot set variable, not enough containers \n"); + printf_wrap("[ERR] VARSTORE: cannot set variable, not enough containers \n"); return 1; } } - //printf("set variable at key: %d \n", key); + //printf_wrap("set variable at key: %d \n", key); store->container[key].type = type; store->container[key].namePtr = namePtr; store->container[key].dataPtr = dataPtr; if (2*store->length >= store->allocatedLength) { + printf_wrap("REALLOCATING THE FUCKING VAR STORE\n"); // do smth to double the store->allocatedLength // e.g reallocate the store->container // FIXME: copy all variables to their new keys store->allocatedLength = 2*store->allocatedLength; store->container = (struct VariableContainer*) realloc(store->container, sizeof(struct VariableContainer) * store->allocatedLength); if (store->container == NULL) { - printf("[ERR] VARSTORE: relloc failed for container \n"); + printf_wrap("[ERR] VARSTORE: relloc failed for container \n"); return 1; } } @@ -122,15 +125,15 @@ byte var_store_set(struct VariableStore* store, char* varName, byte type, void* // return -1 if no pos are found int var_store_get_key(struct VariableStore* store, char* varName) { - //printf("get key for %s \n", varName); + //printf_wrap("get key for %s \n", varName); int originalKey = var_store_hash_name(store, varName); + //printf_wrap("got hash for get key: %d\n", originalKey); int key = originalKey; // handle collision, walk along the array while (1) { - //printf("inter key: %d %d \n", key, store->container[key].type); + //printf_wrap("inter key: %d %d \n", key, store->container[key].type); if (store->container[key].type == 0) return -1; - // check if we found the position if (strcmp(store->container[key].namePtr, varName) == 0) return key; @@ -165,13 +168,15 @@ byte var_store_copy_from_key(struct VariableStore* store, int key, void* dst) if (key < 0) { return 1; } + //printf_wrap("Var store: copy from key %d \n", key); memcpy(dst, store->container[key].dataPtr, (size_t) get_size_of_type(store->container[key].type)); return 0; } byte var_store_copy(struct VariableStore* store, char* varName, void* dst) { - return var_store_copy_from_key(store, var_store_get_key(store, varName), dst); + int key = var_store_get_key(store, varName); + return var_store_copy_from_key(store, key, dst); } int var_store_get_int(struct VariableStore* store, char* varName) @@ -196,10 +201,10 @@ float var_store_get_float(struct VariableStore* store, char* varName) void var_store_print(struct VariableStore* store) { - printf("== VarStore report (%d items) ==\n", store->length); + printf_wrap("== VarStore report (%d items) ==\n", store->length); for (int i = 0; i < store->allocatedLength; i++) { if (store->container[i].type != 0) { - printf( + printf_wrap( "key: %d, '%s' = %s; ", i, store->container[i].namePtr, @@ -207,5 +212,5 @@ void var_store_print(struct VariableStore* store) ); } } - printf("== end of report\n"); + printf_wrap("== end of report\n"); } \ No newline at end of file diff --git a/src/var_store.h b/src/var_store.h index c2a6a58..f968925 100644 --- a/src/var_store.h +++ b/src/var_store.h @@ -4,7 +4,7 @@ #define VAR_STORE_H_ #define VAR_STORE_DEBUG_LEVEL (G_DEBUG_LEVEL) -#define VAR_STORE_INITIAL_ALLOC_LENGTH 32 +#define VAR_STORE_INITIAL_ALLOC_LENGTH 64 /** diff --git a/tests/test.c b/tests/test.c index eb907c4..46c48c5 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1,3 +1,5 @@ +#include "../src/config.h" +#include "../src/utils.h" #include "./test_utils.h" #include "./test_evaluation.h" #include "./test_line_processing.h" @@ -7,8 +9,10 @@ int main() { - printf("== UNIT TESTS == \n"); + int var1 = 0x34; + printf_wrap("== UNIT TESTS == \n"); test_utils(); + printf_wrap("ça commence à faire chier jpp\n"); test_var_store(); test_stack(); test_evaluation(); diff --git a/tests/test_evaluation.c b/tests/test_evaluation.c index 2ab949b..c3864b4 100644 --- a/tests/test_evaluation.c +++ b/tests/test_evaluation.c @@ -9,7 +9,7 @@ void test_evaluation() { - printf("== test evaluation == \n"); + printf_wrap("== test evaluation == \n"); struct StateContainer* state = state_init(); @@ -93,7 +93,7 @@ void test_evaluation() evaluate(state, "random_int(1, 100)", &resVal, &resType); assert(resType == TYPE_INT); - printf(" - random int: %d \n", resVal); + printf_wrap(" - random int: %d \n", resVal); evaluate(state, "abs(2)+abs(-2)", &resVal, &resType); assert(resType == TYPE_INT); @@ -201,7 +201,7 @@ void test_evaluation() evaluate(state, "abs((var2^2)-((var-41)^2))+2", &resVal, &resType); assert(resType == TYPE_INT); - printf("actually got: %d \n", resVal); + printf_wrap("actually got: %d \n", resVal); assert(7 == resVal); /* TYPE FUNCS */ diff --git a/tests/test_line_processing.c b/tests/test_line_processing.c index f892a48..ba9ee6c 100644 --- a/tests/test_line_processing.c +++ b/tests/test_line_processing.c @@ -11,7 +11,7 @@ void test_line_processing() { - printf("== test line processing == \n"); + printf_wrap("== test line processing == \n"); // test string manipulation assert(!recognize_word("", "hello")); @@ -49,7 +49,7 @@ void test_line_processing() assert(process_line(state1, "#")); assert(process_line(state1, "# some random comment")); assert(process_line(state1, "set VAR_A to 8.5")); - printf("%d \n", var_store_get_int(state1->varStore, "VAR_A")); + printf_wrap("%d \n", var_store_get_int(state1->varStore, "VAR_A")); assert(float_almost_equal(8.5, var_store_get_float(state1->varStore, "VAR_A"))); assert(process_line(state1, "set VAR_B to 1.5")); @@ -113,7 +113,7 @@ void test_line_processing() process_script(state2, lines4); assert(!state2->skipping); - printf("got i: %d \n", var_store_get_int(state2->varStore, "i")); + printf_wrap("got i: %d \n", var_store_get_int(state2->varStore, "i")); assert(9 == var_store_get_int(state2->varStore, "i")); // test break keyword @@ -127,7 +127,7 @@ void test_line_processing() process_script(state2, lines5); assert(!state2->skipping); - printf("got i: %d \n", var_store_get_int(state2->varStore, "i")); + printf_wrap("got i: %d \n", var_store_get_int(state2->varStore, "i")); assert(10 == var_store_get_int(state2->varStore, "i")); // test continue keyword diff --git a/tests/test_stack.c b/tests/test_stack.c index d48c1d7..181d15f 100644 --- a/tests/test_stack.c +++ b/tests/test_stack.c @@ -6,7 +6,7 @@ void test_stack() { - printf("== test stack == \n"); + printf_wrap("== test stack == \n"); int res; struct IntStack* stack1 = int_stack_init(); @@ -28,7 +28,7 @@ void test_stack() assert(int_stack_push(stack1, 2025)); assert(int_stack_push(stack1, 2026)); assert(16 == stack1->allocated); - printf("%d \n", int_stack_length(stack1)); + printf_wrap("%d \n", int_stack_length(stack1)); assert(9 == int_stack_length(stack1)); int_stack_print(stack1); diff --git a/tests/test_utils.c b/tests/test_utils.c index fa7ab7c..5ac7ba3 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -6,7 +6,7 @@ void test_utils() { - printf("== test utils == \n"); + printf_wrap("== test utils == \n"); // test int parsing char test1[] = "151087"; diff --git a/tests/test_var_store.c b/tests/test_var_store.c index 8e9d6ba..d451788 100644 --- a/tests/test_var_store.c +++ b/tests/test_var_store.c @@ -5,10 +5,40 @@ void test_var_store() { - printf("== test var store == \n"); + printf_wrap("== test var store == \n"); struct VariableStore* store = var_store_init(); + // hash function test + int hash1, hash2, hash3 = 0; + hash1 = var_store_hash_name(store, "a"); + hash2 = var_store_hash_name(store, "a"); + hash3 = var_store_hash_name(store, "a"); + assert(hash1 == hash2); + assert(hash2 == hash3); + assert(hash1 == hash3); + + hash1 = var_store_hash_name(store, "i"); + hash2 = var_store_hash_name(store, "i"); + hash3 = var_store_hash_name(store, "i"); + assert(hash1 == hash2); + assert(hash2 == hash3); + assert(hash1 == hash3); + + var_store_print(store); + + int originalLength = store->length; + int varEx = 42; + int originalHash = var_store_hash_name(store, "i"); + + var_store_set(store, "i", TYPE_INT, &varEx); + assert(originalHash == var_store_hash_name(store, "i")); + assert(TYPE_INT == var_store_get_type(store, "i")); + + assert(originalLength+1 == store->length); + assert(42 == var_store_get_int(store, "i")); + + // sequential assignement int iDest = 0; for (int i = 0; i < 10; i++) { var_store_set(store, "i", TYPE_INT, &i); diff --git a/wasm.sh b/wasm.sh new file mode 100644 index 0000000..bc1b89c --- /dev/null +++ b/wasm.sh @@ -0,0 +1 @@ +clang -Os -fno-builtin -Wall -Wextra -Wswitch-enum --target=wasm32 --no-standard-libraries -Wl,--export=wasm_info -Wl,--no-entry -Wl,--allow-undefined -o wasm/langatator.wasm ./wasm/wasm.c diff --git a/wasm/config_env_wasm.h b/wasm/config_env_wasm.h new file mode 100644 index 0000000..dc8db4b --- /dev/null +++ b/wasm/config_env_wasm.h @@ -0,0 +1,2 @@ +// the config file for wasm +#define PRINT_MODE 1 diff --git a/wasm/emscripten.c b/wasm/emscripten.c new file mode 100644 index 0000000..8292e5e --- /dev/null +++ b/wasm/emscripten.c @@ -0,0 +1,81 @@ +#include "emscripten.h" +#include +#include +#include +#include + +EM_JS(void, log_to_js, (char* buff, size_t len), { + log_intake(buff, len); +}); + +int printf_wrap(const char* format, ...) { + va_list args; + va_start(args, format); + char* out; + vsprintf(out, format, args); + char* sharedPos = (char*) malloc(strlen(out) * sizeof(char)); + strcpy(sharedPos, out); + log_to_js((void*) sharedPos, strlen(out)); + va_end(args); + return 1; +} + +#include "../src/config.h" +#include "../src/utils.h" +#include "../src/types.h" +#include "../src/state.h" +#include "../src/line_processing.h" + +struct Result { + byte type; + int data; +}; + +EMSCRIPTEN_KEEPALIVE +void* wasm_init_state() +{ + struct StateContainer* ptr = state_init(); + return (void*) ptr; +} + +EMSCRIPTEN_KEEPALIVE +void* wasm_process_line(void* state, char* line) +{ + struct Result* res = malloc(sizeof(struct Result)); + + process_line(state, line); + + res->type = ((struct StateContainer*) state)->lastEvaluationType; + res->data = ((struct StateContainer*) state)->lastEvaluationResult; + + return (void*) res; +} + +EMSCRIPTEN_KEEPALIVE +void wasm_process_script(char* scriptLines) +{ + printf_wrap("Will process script \"%s\" \n", scriptLines); + struct StateContainer* state = state_init(); + process_script(state, scriptLines); +} + +// very dangerous indeed +EMSCRIPTEN_KEEPALIVE +int wasm_get_type_from_ref(void* ref) { + return ((struct Result*) ref)->type; +} + +EMSCRIPTEN_KEEPALIVE +int wasm_get_int_from_ref(void* ref) { + return ((struct Result*) ref)->data; +} + +// EMSCRIPTEN_KEEPALIVE +// int wasm_info(char* lines) +// { +// struct StateContainer* state = state_init(); +// process_script(state, lines); + +// return state->lastEvaluationResult; +// } + diff --git a/wasm/emscripten_raw.html b/wasm/emscripten_raw.html new file mode 100644 index 0000000..7b56197 --- /dev/null +++ b/wasm/emscripten_raw.html @@ -0,0 +1 @@ +Emscripten-Generated Codeimage/svg+xml
Downloading...
Resize canvasLock/hide mouse pointer    
\ No newline at end of file diff --git a/wasm/emscripten_raw.js b/wasm/emscripten_raw.js new file mode 100644 index 0000000..428e342 --- /dev/null +++ b/wasm/emscripten_raw.js @@ -0,0 +1 @@ +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}requireNodeFS=(()=>{if(!nodePath){fs=require("fs");nodePath=require("path")}});read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=(filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret});readAsync=((filename,onload,onerror)=>{requireNodeFS();filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})});if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=((status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)});Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText});if(ENVIRONMENT_IS_WORKER){readBinary=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)})}readAsync=((url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=(()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()});xhr.onerror=onerror;xhr.send(null)})}setWindowTitle=(title=>document.title=title)}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}function allocateUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8Array(str,HEAP8,ret,size);return ret}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="emscripten_raw.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["l"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["p"];addOnInit(Module["asm"]["m"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func=="number"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return function(){return crypto_module["randomBytes"](1)[0]}}catch(e){}}return function(){abort("randomDevice")}}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split("/").filter(p=>!!p),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get function(){return this.shared.position},set:function(val){this.shared.position=val}}}}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,address,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,address,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream||!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(ret.exists){return ret.object}else{return null}},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});stream_ops.read=((stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=(()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)});openRequest.onsuccess=(()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=(()=>{ok++;if(ok+fail==total)finish()});putRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=(()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=(()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()});getRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=FS.getStream(dirfd);if(!dirstream)throw new FS.ErrnoError(8);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __emscripten_date_now(){return Date.now()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var stream=SYSCALLS.getStreamFromFD(fd);var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return 61}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"k":___assert_fail,"c":___syscall_fcntl64,"f":___syscall_ioctl,"g":___syscall_openat,"h":__emscripten_date_now,"j":_emscripten_memcpy_big,"d":_emscripten_resize_heap,"a":_fd_close,"e":_fd_read,"i":_fd_seek,"b":_fd_write};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["m"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["n"]).apply(null,arguments)};var _main=Module["_main"]=function(){return(_main=Module["_main"]=Module["asm"]["o"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["q"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["r"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["s"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}var calledMain=false;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args){var entryFunction=Module["_main"];args=args||[];var argc=args.length+1;var argv=stackAlloc((argc+1)*4);HEAP32[argv>>2]=allocateUTF8OnStack(thisProgram);for(var i=1;i>2)+i]=allocateUTF8OnStack(args[i-1])}HEAP32[(argv>>2)+argc]=0;try{var ret=entryFunction(argc,argv);exit(ret,true);return ret}catch(e){return handleException(e)}finally{calledMain=true}}function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){EXITSTATUS=status;procExit(status)}function procExit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run(); diff --git a/wasm/emscripten_raw.wasm b/wasm/emscripten_raw.wasm new file mode 100755 index 0000000000000000000000000000000000000000..2576e45e7c91aae547d872262464cf9456c58fb4 GIT binary patch literal 46383 zcmd_Tdz4+(edoE)<37)=($xzIl`!XCLn9tS!U%z79BK^KYBjh7wA6MMB^a+Wi3Y^Uw4POouyn8ay2wlnt3kc?-w zvyxcz`Tq7f_ueX%h~swmA2S8I=bU}^^Y`Ar{oDJvvH4?>b1wR&=)C*WMgF42`;%~q z?I9{t-2Ks_3whlAymRDxVljH+en*k&;$uZ&7d>`=MfWNfZpco?#rvbjqsQ;B**kmd z9Odkfm+@nZl%%yM?vEc|j2@3~%%ZVq%q9FjKnKU7!!F|Yh^35M%27*s(C!~{%0J;+ z{7$-*-zis3?!PZiDz$VdswQb%P2$>c9H&uSNfO7kQb{W5np%5pEl$&9U3GmFZHVI} zt!`{I;FO?_*{JRsz-sU>PAk#z=z)hJqum*Q%J5%}l6a5~Ovoq9AK zyXctP5zV-tie}veSzUC(-5SlgTcUY)u+fd2kFu@*!%yD*<3|pUJ#hbhKl7%0@3`%! zAA0cU_)om?4fou2=b_u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 zpQ;~pdy_-SOVMz;(Y>cS6g@*&>2=j3@h9Rl@x946)2#NT_zRW)tMaFnzldK|-539y zduu$M%%*?s{_kXS&Yim=YHI6j6d#vCpqTML_e4AsQhhuog0t# zNAGqYt-cV=$9Lm({MaQ~t3%%Kw*!~sS1!q_*YJU+H>S@2pO<9ub6nrLExT`j<^IY{ zWvuGlm!dNNA6EaW`nRMwcfM=7^Uuc^aIT^s=NkIS^rOG?-P$JalV;6Du0ha{YgBoe zxvI*jr2p$}S!dWXTmI&dQiq(2T|>zY$M3N7|K`$+b5Q+9FU>ZtS8n@hv~=tE<<(!3 zqfLF}SVLl}AJ=H>*YV4%cVCu8>!|9o>{V-(YCny2x^?{W{}%4HY}vw=*vm4$O%xvV zntu4FFVCV4)N*;Yag&nlr?Ek|j$dB=5joCt{y$!xU9wTB_R}~|w~k-_-+9$*uHJRc z?rX1mt>1g&P5bsc|Gq1-Xe)l;E3&$LQ~J~A(X-Sj%fD}Xwnl*0zlr(#G+o9mv^`rJ z4<;Ua07dU#+K%tENFIA&-udrs&sxH=3eTUITfiH2Wk!TnNWmaxM-~Y}rDd6zp(7;J ziiE?nRPrqn>P5l=ZWsUd9a&RoR*`9*pWBgTG7Rl`_CXv>JF;~m0VT}AW3$KZV{!wH zkx>{^*O{$3|J@zg5U931`{TWGdotQa(a$!Y>!%(#b9=i~0ktQ9Bl?d`A0qRn{!UXwM2bfN#r5k3t{vb_4Q8AS1u zS7!~G()xqAe(h>2`k||{bw*dDs`$G`_< + + + + + + Langatator demo + + + + + +

+

Langatator demo

+ The git repository +
+ + +
+
+
+            
+
+ +
+ + + + + + \ No newline at end of file diff --git a/wasm/langatator_adapter.js b/wasm/langatator_adapter.js new file mode 100644 index 0000000..f679c0d --- /dev/null +++ b/wasm/langatator_adapter.js @@ -0,0 +1 @@ +var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}requireNodeFS=(()=>{if(!nodePath){fs=require("fs");nodePath=require("path")}});read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=(filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret});readAsync=((filename,onload,onerror)=>{requireNodeFS();filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})});if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=((status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)});Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText});if(ENVIRONMENT_IS_WORKER){readBinary=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)})}readAsync=((url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=(()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()});xhr.onerror=onerror;xhr.send(null)})}setWindowTitle=(title=>document.title=title)}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}function setValue(ptr,value,type="i8",noSafe){if(type.endsWith("*"))type="i32";switch(type){case"i1":HEAP8[ptr>>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}function getValue(ptr,type="i8",noSafe){if(type.endsWith("*"))type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return Number(HEAPF64[ptr>>3]);default:abort("invalid type for getValue: "+type)}}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="langatator_adapter.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["i"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["p"];addOnInit(Module["asm"]["j"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;function log_to_js(buff,len){log_intake(buff,len)}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func=="number"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function __emscripten_date_now(){return Date.now()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return function(){return crypto_module["randomBytes"](1)[0]}}catch(e){}}return function(){abort("randomDevice")}}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split("/").filter(p=>!!p),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get function(){return this.shared.position},set:function(val){this.shared.position=val}}}}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,address,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,address,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream||!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(ret.exists){return ret.object}else{return null}},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});stream_ops.read=((stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=(()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)});openRequest.onsuccess=(()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=(()=>{ok++;if(ok+fail==total)finish()});putRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=(()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=(()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()});getRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=FS.getStream(dirfd);if(!dirstream)throw new FS.ErrnoError(8);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var stream=SYSCALLS.getStreamFromFD(fd);var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return 61}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"f":__emscripten_date_now,"g":_emscripten_memcpy_big,"c":_emscripten_resize_heap,"e":_fd_close,"d":_fd_read,"b":_fd_seek,"a":_fd_write,"h":log_to_js};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["j"]).apply(null,arguments)};var _wasm_init_state=Module["_wasm_init_state"]=function(){return(_wasm_init_state=Module["_wasm_init_state"]=Module["asm"]["k"]).apply(null,arguments)};var _wasm_process_line=Module["_wasm_process_line"]=function(){return(_wasm_process_line=Module["_wasm_process_line"]=Module["asm"]["l"]).apply(null,arguments)};var _wasm_process_script=Module["_wasm_process_script"]=function(){return(_wasm_process_script=Module["_wasm_process_script"]=Module["asm"]["m"]).apply(null,arguments)};var _wasm_get_type_from_ref=Module["_wasm_get_type_from_ref"]=function(){return(_wasm_get_type_from_ref=Module["_wasm_get_type_from_ref"]=Module["asm"]["n"]).apply(null,arguments)};var _wasm_get_int_from_ref=Module["_wasm_get_int_from_ref"]=function(){return(_wasm_get_int_from_ref=Module["_wasm_get_int_from_ref"]=Module["asm"]["o"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["q"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["r"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["s"]).apply(null,arguments)};Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["setValue"]=setValue;Module["getValue"]=getValue;var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); diff --git a/wasm/langatator_adapter.wasm b/wasm/langatator_adapter.wasm new file mode 100755 index 0000000000000000000000000000000000000000..f5d5bc9bdaecb6916b716014f2ffd71291a1fe8a GIT binary patch literal 44403 zcmd_Tdz4*QedoE)<37)=sw=5%msB!3_gcb|k!+C=*$6*s%ht=5WydyHDL{ zqQ~xc?*91E(<*!Hbo5yK)_Qa(Is`0-q6gd%e-FEuzelWO((WI0!<0PaD*Sz)OOv1a z$ux;8jWnvom1;GvCFw|#RN}-%Nh6A*cG_H(CY4&;T%9CQwYH{SPq=Y$wH~EeD~?)G z9LLoJ1cZO}^2WKe5*?4;^rlKRiWcL=xY__6{xiRGF3xJ(vgl~+qA9mIns)Dsj=2NT z!|sk~#@!yxy8SeB(Fu1;H0N%P=G{$=t0L#4?8+POfA7z{`*XdK7Ez*?dfi^(d9`V?TA}EpN*!wF$J;zn+q2% z)ON&YqCD2ir?`6OpNiTWyRkpLBR;_Ml{?~%TzI;hTCx9lG_@n%YPV16_P#vwZl|NW z+;KbZ*S9-VI~z?gMAU9}UAvvT_FMUXEl+%#;_OZU%cE`1b>es;cieQ7-9zdk**oNt z3B8LtbjU?-B07$yI#JHdr#e<|&ydS9<`hq7r=#R_?mCgW^2v#GB6Q$(4>2nmbR$Yt zUFA$HRZsEem_hyNd0_hB&plC}KH(R+K5_y$=+|F}PV7!6G^yzkHH-xj!&!fTme}|} zG@V`HYzjWN7Ie*2yX&%SHj0G)#dx|~+30|dRtK16>KD(Y0F+k%k8xBEMW{&ki}C($ zG~V90E{_K=1$5Wjow!(QZ#_)Owci=Z}MF1hB6!%<&7$c+@prDbVC{{D*#?*H@YJp z4R>QZ;<0eIen-4M+~qssJlt(G7FN%jcf^}R+19|slx^P;Zx3Z}+Y!Gl+}*Gvz9HP* zxFf!inN3W0m<*S0oLBBN{4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?g;qJ;l%vt!sNsATcA_Z z9h`lC{!odSLx&emg1`^tlQ8wkLkpAFUVCk`7L8J+w!A9Xu<8Sc zj^zDn|4?|osJjBgv&SdrU;y4PN5;j|>rE`k@WoyBxVq3G4@>V}RPEu}BW4V&l3*+J zkyYH8ADqpPK79O`@ucZ8R=J5MO zE~{IbCOvM=`;`t%&J;DI{|@ZG_rCm|-FM%0k68!irPAF8Z$k&&q*(^DR;UVqVKz7u zLY>MEAVNDYM)Sh#EDC?-1Nou3hfYes=i!O@c@zr5V7S`+FmA%^$pzCU$BsUHbYTnK zNM=@43MhlEHV-rc^@P{~jbdWfbTfk*v#?1YC`?pQ#YEx0i=mS}GPn+-WrNrjETPH| zPQHI&CM(x{Wb*Jy(<;_YG28L-hBS> z+|lDfm0pa|zSdqgG3hp{yYH@c{_Oh9uXRngcI{fnzl#1i*U+C#fAnvyTh-)!(yY12 zHE=auqsq(7Rn#b)wVy4 zmTnz?dG+t9(WXCYj8K^Bk88B`*YTHEAAeI80r+peDSOi@mD-=iYTY{i^1pT5ty{Ow z`9FD6#xdmKL9cZ{ba-1$G+kX?P5O6^bMa@{)q z^1tnG{gEGi+mG$I{)V^vUANx0dyn&<%(Li9jyle>x*`txr=MNSQh5%%?qnko&GrAI z^Y4{U>HN7)wkjSheE5OMIp<&Pu$fg9A9`Tk`S0@SU0M{(pO{;4{!BN^L@9L#Pm>o* zLA9)MbOt~us1*f=XX)fM3hG6{0$#m;;;O7EGOLecJfFQP%ixLdJo}LIU%Vg<(HRE+Iu%7RfsRCSB=}Vvie2&gRjNyPf`X|b&et36i{_s&6EpE!*E@JmzV1c9_Dbqh= zDXvFnj-OoKA;f)kQ+6fZhg+C+M;~<9r5X2rIScN{tTl&2o_KQ>UFQ6AZ_ZW+q6a3~ zEIuH+;LC5$(m>xQug; { +// wasm = w; + +// console.log(wasm.instance.exports.wasm_info()); + +// //const buffer = wasm.instance.exports.memory.buffer; +// }); + +const consoleOutput = document.getElementById('console-output') + +function log_intake(ptr, len) { + let line = "" + for (var i = 0; i < len; i++) { + let val = Module.getValue(ptr+i, 'i8') + line = line + String.fromCharCode(val) + } + console.log('Got line', line) + + // const pre= document.createElement('pre') + // consoleOutput.appendChild(pre) +} + + +Module.onRuntimeInitialized = async _ => { + const api = { + init: Module.cwrap('wasm_init_state', 'number', []), + processLine: Module.cwrap('wasm_process_line', 'number', ['number', 'string']), + getTypeFromRef: Module.cwrap('wasm_get_type_from_ref', 'number', ['number']), + getIntFromRef: Module.cwrap('wasm_get_int_from_ref', 'number', ['number']), + + // standalone (integrated state initialization) + processScript: Module.cwrap('wasm_process_script', 'number', ['string']), + }; + console.log(api); + + // const ref = api.init(); + // console.log(`Got ref: ${ref}`); + + window.processLine = (line) => { + const resultRef = api.processLine(ref, line); + console.log(`Got result ref: ${resultRef}`); + console.log(api.getTypeFromRef(resultRef)); + console.log(api.getIntFromRef(resultRef)); + } + + window.submitScript = () => { + const textarea = document.getElementById('script-input') + api.processScript(textarea.value) + } + + + +}; diff --git a/wasm/style.css b/wasm/style.css new file mode 100644 index 0000000..e69de29 diff --git a/wasm/wasm.c b/wasm/wasm.c new file mode 100644 index 0000000..55e57be --- /dev/null +++ b/wasm/wasm.c @@ -0,0 +1,44 @@ +#include +#include "../src/config.h" +#define CONFIG_PRINT_METHOD PRINT_METHOD_WASM +#include "../src/utils.h" +#include "../src/types.h" +#include "../src/state.h" +#include "../src/line_processing.h" + +void* wasm_init_state() +{ + struct StateContainer* ptr = state_init(); + return (void*) ptr; +} + +void* wasm_process_line(void* state, char* line) +{ + struct Result* res = malloc(sizeof(struct Result)); + + process_line(state, line); + + res->type = ((struct StateContainer*) state)->lastEvaluationType; + res->data = ((struct StateContainer*) state)->lastEvaluationResult; + + return (void*) res; +} + +// very dangerous indeed +int wasm_get_type_from_ref(void* ref) { + return ((struct Result*) ref)->type; +} + +int wasm_get_int_from_ref(void* ref) { + return ((struct Result*) ref)->data; +} + +// EMSCRIPTEN_KEEPALIVE +// int wasm_info(char* lines) +// { +// struct StateContainer* state = state_init(); +// process_script(state, lines); + +// return state->lastEvaluationResult; +// } +