| |
| |
| |
| |
| |
|
|
| |
| |
|
|
| #if !BOOTSTRAPPING_STRUCT_INFO |
| assert(false, "libbootstrap.js only designed for use with BOOTSTRAPPING_STRUCT_INFO") |
| #endif |
|
|
| assert(Object.keys(LibraryManager.library).length === 0); |
| addToLibrary({ |
| $callRuntimeCallbacks: () => {}, |
|
|
| $HEAP8: undefined, |
| $HEAPU8: undefined, |
| $HEAP16: undefined, |
| $HEAPU16: undefined, |
| $HEAP32: undefined, |
| $HEAPU32: undefined, |
| $HEAPF32: undefined, |
| $HEAPF64: undefined, |
| #if WASM_BIGINT |
| $HEAP64: undefined, |
| $HEAPU64: undefined, |
| #endif |
|
|
| $wasmMemory: 'memory', |
|
|
| $ExitStatus: class { |
| name = 'ExitStatus'; |
| constructor(status) { |
| this.message = `Program terminated with exit(${status})`; |
| this.status = status; |
| } |
| }, |
|
|
| $exitJS__deps: ['$ExitStatus'], |
| $exitJS: (code) => quit_(code, new ExitStatus(code)), |
|
|
| $handleException: (e) => { |
| if (e instanceof ExitStatus || e == 'unwind') { |
| return EXITSTATUS; |
| } |
| quit_(1, e); |
| }, |
|
|
| fd_write__sig: 'iippp', |
| fd_write: (fd, iov, iovcnt, pnum) => { |
| |
| |
| var num = 0; |
| for (var i = 0; i < iovcnt; i++) { |
| var ptr = {{{ makeGetValue('iov', 0, '*') }}}; |
| var len = {{{ makeGetValue('iov', POINTER_SIZE, '*') }}}; |
| iov += {{{ POINTER_SIZE }}} * 2; |
| process.stdout.write(HEAPU8.subarray(ptr, ptr + len)); |
| num += len; |
| } |
| {{{ makeSetValue('pnum', 0, 'num', '*') }}}; |
| return 0; |
| }, |
| }); |
|
|