![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/emscripten/tests/core/ |
Upload File : |
#include <stdio.h> #include <emscripten.h> void loop_iter() { EM_ASM(Module.print('loop iter!')); } int main(int argc, char **argv) { EM_ASM(Module.print('hello dere1')); EM_ASM("Module.print('hello dere2');"); emscripten_debugger(); // does nothing in shells; check for validation error though for (int i = 0; i < 3; i++) { EM_ASM(Module.print('hello dere3'); Module.print('hello dere' + 4);); } EM_ASM_({ Module.print('hello input ' + $0) }, 123); EM_ASM_ARGS({ Module.print('hello input ' + $0) }, 456); int sum = 0; for (int i = 0; i < argc * 3; i++) { sum += EM_ASM_INT({ Module.print('i: ' + [ $0, ($1).toFixed(2) ]); return $0 * 2; }, i, double(i) / 12); } EM_ASM_INT({ globalVar = $0 }, sum); // no outputs, just input sum = 0; sum = EM_ASM_INT_V({ return globalVar }); // no inputs, just output printf("sum: %d\n", sum); for (int i = 0; i < argc*2; i++) loop_iter(); return 0; }