Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
59 lines (51 loc) · 1.97 KB

File metadata and controls

59 lines (51 loc) · 1.97 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @license
* Copyright 2015 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// When bootstrapping struct info, we can't use the full library because
// it itself depends on the struct info information.
#if !BOOTSTRAPPING_STRUCT_INFO
assert(false, "library_bootstrap.js only designed for use with BOOTSTRAPPING_STRUCT_INFO")
#endif
assert(Object.keys(LibraryManager.library).length === 0);
addToLibrary({
$callRuntimeCallbacks: () => {},
$ExitStatus__docs: '/** @constructor */',
$ExitStatus: function(status) {
this.name = 'ExitStatus';
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);
},
// printf/puts implementations for when musl is not pulled in - very
// partial, but enough for bootstrapping structInfo
printf__deps: ['$formatString', '$intArrayToString'],
printf__sig: 'ipp',
printf: (format, varargs) => {
// int printf(const char *restrict format, ...);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
// extra effort to support printf, even without a filesystem. very partial, very hackish
var result = formatString(format, varargs);
var string = intArrayToString(result);
if (string[string.length-1] === '\n') string = string.substr(0, string.length-1); // remove a final \n, as Module.print will do that
out(string);
return result.length;
},
puts__sig: 'ip',
puts: (s) => {
// extra effort to support puts, even without a filesystem. very partial, very hackish
var result = UTF8ToString(s);
var string = result.substr(0);
if (string[string.length-1] === '\n') string = string.substr(0, string.length-1); // remove a final \n, as Module.print will do that
out(string);
return result.length;
},
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.