sql.js 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +7 -7
- package/.devcontainer/devcontainer.json +2 -2
- package/CONTRIBUTING.md +2 -2
- package/dist/sql-asm-debug.js +4868 -4674
- package/dist/sql-asm-memory-growth.js +104 -110
- package/dist/sql-asm.js +103 -110
- package/dist/sql-wasm-browser-debug.js +7122 -0
- package/dist/sql-wasm-browser-debug.wasm +0 -0
- package/dist/sql-wasm-browser.js +181 -0
- package/dist/sql-wasm-browser.wasm +0 -0
- package/dist/sql-wasm-debug.js +1215 -974
- package/dist/sql-wasm-debug.wasm +0 -0
- package/dist/sql-wasm.js +92 -95
- package/dist/sql-wasm.wasm +0 -0
- package/dist/worker.sql-asm-debug.js +4868 -4676
- package/dist/worker.sql-asm.js +103 -112
- package/dist/worker.sql-wasm-debug.js +1215 -976
- package/dist/worker.sql-wasm.js +92 -97
- package/eslint.config.cjs +57 -0
- package/package.json +12 -6
- package/dist/sqljs-all.zip +0 -0
- package/dist/sqljs-wasm.zip +0 -0
- package/dist/sqljs-worker-wasm.zip +0 -0
|
@@ -70,6 +70,50 @@ var initSqlJs = function (moduleConfig) {
|
|
|
70
70
|
// The emcc-generated code and shell-post.js code goes below,
|
|
71
71
|
// meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort
|
|
72
72
|
// include: shell.js
|
|
73
|
+
// include: minimum_runtime_check.js
|
|
74
|
+
(function() {
|
|
75
|
+
// "30.0.0" -> 300000
|
|
76
|
+
function humanReadableVersionToPacked(str) {
|
|
77
|
+
str = str.split('-')[0]; // Remove any trailing part from e.g. "12.53.3-alpha"
|
|
78
|
+
var vers = str.split('.').slice(0, 3);
|
|
79
|
+
while(vers.length < 3) vers.push('00');
|
|
80
|
+
vers = vers.map((n, i, arr) => n.padStart(2, '0'));
|
|
81
|
+
return vers.join('');
|
|
82
|
+
}
|
|
83
|
+
// 300000 -> "30.0.0"
|
|
84
|
+
var packedVersionToHumanReadable = n => [n / 10000 | 0, (n / 100 | 0) % 100, n % 100].join('.');
|
|
85
|
+
|
|
86
|
+
var TARGET_NOT_SUPPORTED = 2147483647;
|
|
87
|
+
|
|
88
|
+
// Note: We use a typeof check here instead of optional chaining using
|
|
89
|
+
// globalThis because older browsers might not have globalThis defined.
|
|
90
|
+
var currentNodeVersion = typeof process !== 'undefined' && process.versions?.node ? humanReadableVersionToPacked(process.versions.node) : TARGET_NOT_SUPPORTED;
|
|
91
|
+
if (currentNodeVersion < 160000) {
|
|
92
|
+
throw new Error(`This emscripten-generated code requires node v${ packedVersionToHumanReadable(160000) } (detected v${packedVersionToHumanReadable(currentNodeVersion)})`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent;
|
|
96
|
+
if (!userAgent) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var currentSafariVersion = userAgent.includes("Safari/") && !userAgent.includes("Chrome/") && userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/) ? humanReadableVersionToPacked(userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/)[1]) : TARGET_NOT_SUPPORTED;
|
|
101
|
+
if (currentSafariVersion < 150000) {
|
|
102
|
+
throw new Error(`This emscripten-generated code requires Safari v${ packedVersionToHumanReadable(150000) } (detected v${currentSafariVersion})`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var currentFirefoxVersion = userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
|
|
106
|
+
if (currentFirefoxVersion < 79) {
|
|
107
|
+
throw new Error(`This emscripten-generated code requires Firefox v79 (detected v${currentFirefoxVersion})`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var currentChromeVersion = userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
|
|
111
|
+
if (currentChromeVersion < 85) {
|
|
112
|
+
throw new Error(`This emscripten-generated code requires Chrome v85 (detected v${currentChromeVersion})`);
|
|
113
|
+
}
|
|
114
|
+
})();
|
|
115
|
+
|
|
116
|
+
// end include: minimum_runtime_check.js
|
|
73
117
|
// The Module object: Our interface to the outside world. We import
|
|
74
118
|
// and export values on it. There are various ways Module can be used:
|
|
75
119
|
// 1. Not defined. We create it here
|
|
@@ -89,17 +133,13 @@ var Module = typeof Module != 'undefined' ? Module : {};
|
|
|
89
133
|
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
|
90
134
|
|
|
91
135
|
// Attempt to auto-detect the environment
|
|
92
|
-
var ENVIRONMENT_IS_WEB =
|
|
93
|
-
var ENVIRONMENT_IS_WORKER =
|
|
136
|
+
var ENVIRONMENT_IS_WEB = !!globalThis.window;
|
|
137
|
+
var ENVIRONMENT_IS_WORKER = !!globalThis.WorkerGlobalScope;
|
|
94
138
|
// N.b. Electron.js environment is simultaneously a NODE-environment, but
|
|
95
139
|
// also a web environment.
|
|
96
|
-
var ENVIRONMENT_IS_NODE =
|
|
140
|
+
var ENVIRONMENT_IS_NODE = globalThis.process?.versions?.node && globalThis.process?.type != 'renderer';
|
|
97
141
|
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
|
|
98
142
|
|
|
99
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
143
|
// --pre-jses are emitted after the Module integration code, so that they can
|
|
104
144
|
// refer to Module (if they choose; they can also define Module)
|
|
105
145
|
// include: src/api.js
|
|
@@ -110,19 +150,15 @@ if (ENVIRONMENT_IS_NODE) {
|
|
|
110
150
|
_malloc
|
|
111
151
|
_free
|
|
112
152
|
getValue
|
|
113
|
-
intArrayFromString
|
|
114
153
|
setValue
|
|
115
154
|
stackAlloc
|
|
116
155
|
stackRestore
|
|
117
156
|
stackSave
|
|
118
157
|
UTF8ToString
|
|
119
|
-
|
|
120
|
-
lengthBytesUTF8
|
|
121
|
-
allocate
|
|
122
|
-
ALLOC_NORMAL
|
|
123
|
-
allocateUTF8OnStack
|
|
158
|
+
stringToNewUTF8
|
|
124
159
|
removeFunction
|
|
125
160
|
addFunction
|
|
161
|
+
writeArrayToMemory
|
|
126
162
|
*/
|
|
127
163
|
|
|
128
164
|
"use strict";
|
|
@@ -650,14 +686,13 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
650
686
|
pos = this.pos;
|
|
651
687
|
this.pos += 1;
|
|
652
688
|
}
|
|
653
|
-
var
|
|
654
|
-
var strptr = allocate(bytes, ALLOC_NORMAL);
|
|
689
|
+
var strptr = stringToNewUTF8(string);
|
|
655
690
|
this.allocatedmem.push(strptr);
|
|
656
691
|
this.db.handleError(sqlite3_bind_text(
|
|
657
692
|
this.stmt,
|
|
658
693
|
pos,
|
|
659
694
|
strptr,
|
|
660
|
-
|
|
695
|
+
-1,
|
|
661
696
|
0
|
|
662
697
|
));
|
|
663
698
|
return true;
|
|
@@ -668,7 +703,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
668
703
|
pos = this.pos;
|
|
669
704
|
this.pos += 1;
|
|
670
705
|
}
|
|
671
|
-
var blobptr =
|
|
706
|
+
var blobptr = _malloc(array.length);
|
|
707
|
+
writeArrayToMemory(array, blobptr);
|
|
672
708
|
this.allocatedmem.push(blobptr);
|
|
673
709
|
this.db.handleError(sqlite3_bind_blob(
|
|
674
710
|
this.stmt,
|
|
@@ -839,12 +875,10 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
839
875
|
*/
|
|
840
876
|
function StatementIterator(sql, db) {
|
|
841
877
|
this.db = db;
|
|
842
|
-
|
|
843
|
-
this.sqlPtr = _malloc(sz);
|
|
878
|
+
this.sqlPtr = stringToNewUTF8(sql);
|
|
844
879
|
if (this.sqlPtr === null) {
|
|
845
880
|
throw new Error("Unable to allocate memory for the SQL string");
|
|
846
881
|
}
|
|
847
|
-
stringToUTF8(sql, this.sqlPtr, sz);
|
|
848
882
|
this.nextSqlPtr = this.sqlPtr;
|
|
849
883
|
this.nextSqlString = null;
|
|
850
884
|
this.activeStatement = null;
|
|
@@ -1057,25 +1091,27 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1057
1091
|
if (!this.db) {
|
|
1058
1092
|
throw "Database closed";
|
|
1059
1093
|
}
|
|
1060
|
-
var stack = stackSave();
|
|
1061
1094
|
var stmt = null;
|
|
1095
|
+
var originalSqlPtr = null;
|
|
1096
|
+
var currentSqlPtr = null;
|
|
1062
1097
|
try {
|
|
1063
|
-
|
|
1098
|
+
originalSqlPtr = stringToNewUTF8(sql);
|
|
1099
|
+
currentSqlPtr = originalSqlPtr;
|
|
1064
1100
|
var pzTail = stackAlloc(4);
|
|
1065
1101
|
var results = [];
|
|
1066
|
-
while (getValue(
|
|
1102
|
+
while (getValue(currentSqlPtr, "i8") !== NULL) {
|
|
1067
1103
|
setValue(apiTemp, 0, "i32");
|
|
1068
1104
|
setValue(pzTail, 0, "i32");
|
|
1069
1105
|
this.handleError(sqlite3_prepare_v2_sqlptr(
|
|
1070
1106
|
this.db,
|
|
1071
|
-
|
|
1107
|
+
currentSqlPtr,
|
|
1072
1108
|
-1,
|
|
1073
1109
|
apiTemp,
|
|
1074
1110
|
pzTail
|
|
1075
1111
|
));
|
|
1076
1112
|
// pointer to a statement, or null
|
|
1077
1113
|
var pStmt = getValue(apiTemp, "i32");
|
|
1078
|
-
|
|
1114
|
+
currentSqlPtr = getValue(pzTail, "i32");
|
|
1079
1115
|
// Empty statement
|
|
1080
1116
|
if (pStmt !== NULL) {
|
|
1081
1117
|
var curresult = null;
|
|
@@ -1101,7 +1137,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1101
1137
|
if (stmt) stmt["free"]();
|
|
1102
1138
|
throw errCaught;
|
|
1103
1139
|
} finally {
|
|
1104
|
-
|
|
1140
|
+
if (originalSqlPtr) _free(originalSqlPtr);
|
|
1105
1141
|
}
|
|
1106
1142
|
};
|
|
1107
1143
|
|
|
@@ -1309,7 +1345,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1309
1345
|
if (result === null) {
|
|
1310
1346
|
sqlite3_result_null(cx);
|
|
1311
1347
|
} else if (result.length != null) {
|
|
1312
|
-
var blobptr =
|
|
1348
|
+
var blobptr = _malloc(result.length);
|
|
1349
|
+
writeArrayToMemory(result, blobptr);
|
|
1313
1350
|
sqlite3_result_blob(cx, blobptr, result.length, -1);
|
|
1314
1351
|
_free(blobptr);
|
|
1315
1352
|
} else {
|
|
@@ -1504,28 +1541,71 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1504
1541
|
return this;
|
|
1505
1542
|
};
|
|
1506
1543
|
|
|
1507
|
-
/** Registers
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1544
|
+
/** Registers an update hook with SQLite.
|
|
1545
|
+
*
|
|
1546
|
+
* Every time a row is changed by whatever means, the callback is called
|
|
1547
|
+
* once with the change (`'insert'`, `'update'` or `'delete'`), the database
|
|
1548
|
+
* name and table name where the change happened and the
|
|
1549
|
+
* [rowid](https://www.sqlite.org/rowidtable.html)
|
|
1550
|
+
* of the row that has been changed.
|
|
1551
|
+
*
|
|
1552
|
+
* The rowid is cast to a plain number. If it exceeds
|
|
1553
|
+
* `Number.MAX_SAFE_INTEGER` (2^53 - 1), an error will be thrown.
|
|
1554
|
+
*
|
|
1555
|
+
* **Important notes:**
|
|
1556
|
+
* - The callback **MUST NOT** modify the database in any way
|
|
1557
|
+
* - Only a single callback can be registered at a time
|
|
1558
|
+
* - Unregister the callback by passing `null`
|
|
1559
|
+
* - Not called for some updates like `ON REPLACE CONFLICT` and `TRUNCATE`
|
|
1560
|
+
* (a `DELETE FROM` without a `WHERE` clause)
|
|
1561
|
+
*
|
|
1562
|
+
* See SQLite documentation on
|
|
1563
|
+
* [sqlite3_update_hook](https://www.sqlite.org/c3ref/update_hook.html)
|
|
1564
|
+
* for more details
|
|
1565
|
+
*
|
|
1566
|
+
* @example
|
|
1567
|
+
* // Create a database and table
|
|
1568
|
+
* var db = new SQL.Database();
|
|
1569
|
+
* db.exec(`
|
|
1570
|
+
* CREATE TABLE users (
|
|
1571
|
+
* id INTEGER PRIMARY KEY, -- this is the rowid column
|
|
1572
|
+
* name TEXT,
|
|
1573
|
+
* active INTEGER
|
|
1574
|
+
* )
|
|
1575
|
+
* `);
|
|
1576
|
+
*
|
|
1577
|
+
* // Register an update hook
|
|
1578
|
+
* var changes = [];
|
|
1579
|
+
* db.updateHook(function(operation, database, table, rowId) {
|
|
1580
|
+
* changes.push({operation, database, table, rowId});
|
|
1581
|
+
* console.log(`${operation} on ${database}.${table} row ${rowId}`);
|
|
1582
|
+
* });
|
|
1583
|
+
*
|
|
1584
|
+
* // Insert a row - triggers the update hook with 'insert'
|
|
1585
|
+
* db.run("INSERT INTO users VALUES (1, 'Alice', 1)");
|
|
1586
|
+
* // Logs: "insert on main.users row 1"
|
|
1587
|
+
*
|
|
1588
|
+
* // Update a row - triggers the update hook with 'update'
|
|
1589
|
+
* db.run("UPDATE users SET active = 0 WHERE id = 1");
|
|
1590
|
+
* // Logs: "update on main.users row 1"
|
|
1591
|
+
*
|
|
1592
|
+
* // Delete a row - triggers the update hook with 'delete'
|
|
1593
|
+
* db.run("DELETE FROM users WHERE id = 1");
|
|
1594
|
+
* // Logs: "delete on main.users row 1"
|
|
1595
|
+
*
|
|
1596
|
+
* // Unregister the update hook
|
|
1597
|
+
* db.updateHook(null);
|
|
1598
|
+
*
|
|
1599
|
+
* // This won't trigger any callback
|
|
1600
|
+
* db.run("INSERT INTO users VALUES (2, 'Bob', 1)");
|
|
1601
|
+
*
|
|
1602
|
+
* @param {Database~UpdateHookCallback|null} callback
|
|
1603
|
+
* - Callback to be executed when a row changes. Takes the type of change,
|
|
1604
|
+
* the name of the database, the name of the table, and the row id of the
|
|
1605
|
+
* changed row.
|
|
1606
|
+
* - Set to `null` to unregister.
|
|
1607
|
+
* @returns {Database} The database object. Useful for method chaining
|
|
1608
|
+
*/
|
|
1529
1609
|
Database.prototype["updateHook"] = function updateHook(callback) {
|
|
1530
1610
|
if (this.updateHookFunctionPtr) {
|
|
1531
1611
|
// unregister and cleanup a previously registered update hook
|
|
@@ -1536,7 +1616,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1536
1616
|
|
|
1537
1617
|
if (!callback) {
|
|
1538
1618
|
// no new callback to register
|
|
1539
|
-
return;
|
|
1619
|
+
return this;
|
|
1540
1620
|
}
|
|
1541
1621
|
|
|
1542
1622
|
// void(*)(void *,int ,char const *,char const *,sqlite3_int64)
|
|
@@ -1583,27 +1663,44 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
|
|
|
1583
1663
|
this.updateHookFunctionPtr,
|
|
1584
1664
|
0 // passed as the first arg to wrappedCallback
|
|
1585
1665
|
);
|
|
1666
|
+
return this;
|
|
1586
1667
|
};
|
|
1587
1668
|
|
|
1669
|
+
/**
|
|
1670
|
+
* @callback Database~UpdateHookCallback
|
|
1671
|
+
* @param {'insert'|'update'|'delete'} operation
|
|
1672
|
+
* - The type of change that occurred
|
|
1673
|
+
* @param {string} database
|
|
1674
|
+
* - The name of the database where the change occurred
|
|
1675
|
+
* @param {string} table
|
|
1676
|
+
* - The name of the database's table where the change occurred
|
|
1677
|
+
* @param {number} rowId
|
|
1678
|
+
* - The [rowid](https://www.sqlite.org/rowidtable.html) of the changed row
|
|
1679
|
+
*/
|
|
1680
|
+
|
|
1588
1681
|
// export Database to Module
|
|
1589
1682
|
Module.Database = Database;
|
|
1590
1683
|
};
|
|
1591
1684
|
// end include: src/api.js
|
|
1592
1685
|
|
|
1593
1686
|
|
|
1594
|
-
// Sometimes an existing Module object exists with properties
|
|
1595
|
-
// meant to overwrite the default module functionality. Here
|
|
1596
|
-
// we collect those properties and reapply _after_ we configure
|
|
1597
|
-
// the current environment's defaults to avoid having to be so
|
|
1598
|
-
// defensive during initialization.
|
|
1599
|
-
var moduleOverrides = {...Module};
|
|
1600
|
-
|
|
1601
1687
|
var arguments_ = [];
|
|
1602
1688
|
var thisProgram = './this.program';
|
|
1603
1689
|
var quit_ = (status, toThrow) => {
|
|
1604
1690
|
throw toThrow;
|
|
1605
1691
|
};
|
|
1606
1692
|
|
|
1693
|
+
// In MODULARIZE mode _scriptName needs to be captured already at the very top of the page immediately when the page is parsed, so it is generated there
|
|
1694
|
+
// before the page load. In non-MODULARIZE modes generate it here.
|
|
1695
|
+
var _scriptName = globalThis.document?.currentScript?.src;
|
|
1696
|
+
|
|
1697
|
+
if (typeof __filename != 'undefined') { // Node
|
|
1698
|
+
_scriptName = __filename;
|
|
1699
|
+
} else
|
|
1700
|
+
if (ENVIRONMENT_IS_WORKER) {
|
|
1701
|
+
_scriptName = self.location.href;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1607
1704
|
// `/` should be present at the end if `scriptDirectory` is not empty
|
|
1608
1705
|
var scriptDirectory = '';
|
|
1609
1706
|
function locateFile(path) {
|
|
@@ -1617,20 +1714,12 @@ function locateFile(path) {
|
|
|
1617
1714
|
var readAsync, readBinary;
|
|
1618
1715
|
|
|
1619
1716
|
if (ENVIRONMENT_IS_NODE) {
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
var nodeVersion = process.versions.node;
|
|
1623
|
-
var numericVersion = nodeVersion.split('.').slice(0, 3);
|
|
1624
|
-
numericVersion = (numericVersion[0] * 10000) + (numericVersion[1] * 100) + (numericVersion[2].split('-')[0] * 1);
|
|
1625
|
-
var minVersion = 160000;
|
|
1626
|
-
if (numericVersion < 160000) {
|
|
1627
|
-
throw new Error('This emscripten-generated code requires node v16.0.0 (detected v' + nodeVersion + ')');
|
|
1628
|
-
}
|
|
1717
|
+
const isNode = globalThis.process?.versions?.node && globalThis.process?.type != 'renderer';
|
|
1718
|
+
if (!isNode) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
|
|
1629
1719
|
|
|
1630
1720
|
// These modules will usually be used on Node.js. Load them eagerly to avoid
|
|
1631
1721
|
// the complexity of lazy-loading.
|
|
1632
|
-
var fs = require('fs');
|
|
1633
|
-
var nodePath = require('path');
|
|
1722
|
+
var fs = require('node:fs');
|
|
1634
1723
|
|
|
1635
1724
|
scriptDirectory = __dirname + '/';
|
|
1636
1725
|
|
|
@@ -1651,12 +1740,13 @@ readAsync = async (filename, binary = true) => {
|
|
|
1651
1740
|
return ret;
|
|
1652
1741
|
};
|
|
1653
1742
|
// end include: node_shell_read.js
|
|
1654
|
-
if (
|
|
1743
|
+
if (process.argv.length > 1) {
|
|
1655
1744
|
thisProgram = process.argv[1].replace(/\\/g, '/');
|
|
1656
1745
|
}
|
|
1657
1746
|
|
|
1658
1747
|
arguments_ = process.argv.slice(2);
|
|
1659
1748
|
|
|
1749
|
+
// MODULARIZE will export the module in the proper place outside, we don't need to export here
|
|
1660
1750
|
if (typeof module != 'undefined') {
|
|
1661
1751
|
module['exports'] = Module;
|
|
1662
1752
|
}
|
|
@@ -1669,32 +1759,20 @@ readAsync = async (filename, binary = true) => {
|
|
|
1669
1759
|
} else
|
|
1670
1760
|
if (ENVIRONMENT_IS_SHELL) {
|
|
1671
1761
|
|
|
1672
|
-
if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof WorkerGlobalScope != 'undefined') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
|
|
1673
|
-
|
|
1674
1762
|
} else
|
|
1675
1763
|
|
|
1676
1764
|
// Note that this includes Node.js workers when relevant (pthreads is enabled).
|
|
1677
1765
|
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
1678
1766
|
// ENVIRONMENT_IS_NODE.
|
|
1679
1767
|
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
1680
|
-
|
|
1681
|
-
scriptDirectory =
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
// blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
|
|
1686
|
-
// otherwise, slice off the final part of the url to find the script directory.
|
|
1687
|
-
// if scriptDirectory does not contain a slash, lastIndexOf will return -1,
|
|
1688
|
-
// and scriptDirectory will correctly be replaced with an empty string.
|
|
1689
|
-
// If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
|
|
1690
|
-
// they are removed because they could contain a slash.
|
|
1691
|
-
if (scriptDirectory.startsWith('blob:')) {
|
|
1692
|
-
scriptDirectory = '';
|
|
1693
|
-
} else {
|
|
1694
|
-
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);
|
|
1768
|
+
try {
|
|
1769
|
+
scriptDirectory = new URL('.', _scriptName).href; // includes trailing slash
|
|
1770
|
+
} catch {
|
|
1771
|
+
// Must be a `blob:` or `data:` URL (e.g. `blob:http://site.com/etc/etc`), we cannot
|
|
1772
|
+
// infer anything from them.
|
|
1695
1773
|
}
|
|
1696
1774
|
|
|
1697
|
-
if (!(
|
|
1775
|
+
if (!(globalThis.window || globalThis.WorkerGlobalScope)) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
|
|
1698
1776
|
|
|
1699
1777
|
{
|
|
1700
1778
|
// include: web_or_worker_shell_read.js
|
|
@@ -1742,40 +1820,9 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
1742
1820
|
throw new Error('environment detection error');
|
|
1743
1821
|
}
|
|
1744
1822
|
|
|
1745
|
-
var out =
|
|
1746
|
-
var err =
|
|
1747
|
-
|
|
1748
|
-
// Merge back in the overrides
|
|
1749
|
-
Object.assign(Module, moduleOverrides);
|
|
1750
|
-
// Free the object hierarchy contained in the overrides, this lets the GC
|
|
1751
|
-
// reclaim data used.
|
|
1752
|
-
moduleOverrides = null;
|
|
1753
|
-
checkIncomingModuleAPI();
|
|
1754
|
-
|
|
1755
|
-
// Emit code to handle expected values on the Module object. This applies Module.x
|
|
1756
|
-
// to the proper local x. This has two benefits: first, we only emit it if it is
|
|
1757
|
-
// expected to arrive, and second, by using a local everywhere else that can be
|
|
1758
|
-
// minified.
|
|
1759
|
-
|
|
1760
|
-
if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_');
|
|
1761
|
-
|
|
1762
|
-
if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram');
|
|
1763
|
-
|
|
1764
|
-
// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
|
|
1765
|
-
// Assertions on removed incoming Module JS APIs.
|
|
1766
|
-
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
1767
|
-
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
|
|
1768
|
-
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
1769
|
-
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
|
|
1770
|
-
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
|
|
1771
|
-
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
|
|
1772
|
-
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
|
|
1773
|
-
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
|
|
1774
|
-
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
|
|
1775
|
-
legacyModuleProp('asm', 'wasmExports');
|
|
1776
|
-
legacyModuleProp('readAsync', 'readAsync');
|
|
1777
|
-
legacyModuleProp('readBinary', 'readBinary');
|
|
1778
|
-
legacyModuleProp('setWindowTitle', 'setWindowTitle');
|
|
1823
|
+
var out = console.log.bind(console);
|
|
1824
|
+
var err = console.error.bind(console);
|
|
1825
|
+
|
|
1779
1826
|
var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
|
|
1780
1827
|
var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
|
|
1781
1828
|
var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
|
|
@@ -1786,6 +1833,9 @@ var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
|
|
|
1786
1833
|
|
|
1787
1834
|
var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
|
|
1788
1835
|
|
|
1836
|
+
// perform assertions in shell.js after we set up out() and err(), as otherwise
|
|
1837
|
+
// if an assertion fails it cannot print the message
|
|
1838
|
+
|
|
1789
1839
|
assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
|
|
1790
1840
|
|
|
1791
1841
|
// end include: shell.js
|
|
@@ -1801,16 +1851,14 @@ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at bui
|
|
|
1801
1851
|
// An online HTML version (which may be of a different version of Emscripten)
|
|
1802
1852
|
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
|
|
1803
1853
|
|
|
1804
|
-
var wasmBinary
|
|
1854
|
+
var wasmBinary;
|
|
1805
1855
|
|
|
1806
|
-
if (
|
|
1856
|
+
if (!globalThis.WebAssembly) {
|
|
1807
1857
|
err('no native wasm support detected');
|
|
1808
1858
|
}
|
|
1809
1859
|
|
|
1810
1860
|
// Wasm globals
|
|
1811
1861
|
|
|
1812
|
-
var wasmMemory;
|
|
1813
|
-
|
|
1814
1862
|
//========================================
|
|
1815
1863
|
// Runtime essentials
|
|
1816
1864
|
//========================================
|
|
@@ -1820,7 +1868,7 @@ var wasmMemory;
|
|
|
1820
1868
|
var ABORT = false;
|
|
1821
1869
|
|
|
1822
1870
|
// set by exit() and abort(). Passed to 'onExit' handler.
|
|
1823
|
-
// NOTE: This is also used as the process return code
|
|
1871
|
+
// NOTE: This is also used as the process return code in shell environments
|
|
1824
1872
|
// but only when noExitRuntime is false.
|
|
1825
1873
|
var EXITSTATUS;
|
|
1826
1874
|
|
|
@@ -1838,41 +1886,13 @@ function assert(condition, text) {
|
|
|
1838
1886
|
// We used to include malloc/free by default in the past. Show a helpful error in
|
|
1839
1887
|
// builds with assertions.
|
|
1840
1888
|
|
|
1841
|
-
// Memory management
|
|
1842
|
-
|
|
1843
|
-
var HEAP,
|
|
1844
|
-
/** @type {!Int8Array} */
|
|
1845
|
-
HEAP8,
|
|
1846
|
-
/** @type {!Uint8Array} */
|
|
1847
|
-
HEAPU8,
|
|
1848
|
-
/** @type {!Int16Array} */
|
|
1849
|
-
HEAP16,
|
|
1850
|
-
/** @type {!Uint16Array} */
|
|
1851
|
-
HEAPU16,
|
|
1852
|
-
/** @type {!Int32Array} */
|
|
1853
|
-
HEAP32,
|
|
1854
|
-
/** @type {!Uint32Array} */
|
|
1855
|
-
HEAPU32,
|
|
1856
|
-
/** @type {!Float32Array} */
|
|
1857
|
-
HEAPF32,
|
|
1858
|
-
/* BigInt64Array type is not correctly defined in closure
|
|
1859
|
-
/** not-@type {!BigInt64Array} */
|
|
1860
|
-
HEAP64,
|
|
1861
|
-
/* BigUint64Array type is not correctly defined in closure
|
|
1862
|
-
/** not-t@type {!BigUint64Array} */
|
|
1863
|
-
HEAPU64,
|
|
1864
|
-
/** @type {!Float64Array} */
|
|
1865
|
-
HEAPF64;
|
|
1866
|
-
|
|
1867
|
-
var runtimeInitialized = false;
|
|
1868
|
-
|
|
1869
1889
|
/**
|
|
1870
1890
|
* Indicates whether filename is delivered via file protocol (as opposed to http/https)
|
|
1871
1891
|
* @noinline
|
|
1872
1892
|
*/
|
|
1873
1893
|
var isFileURI = (filename) => filename.startsWith('file://');
|
|
1874
1894
|
|
|
1875
|
-
// include:
|
|
1895
|
+
// include: runtime_common.js
|
|
1876
1896
|
// include: runtime_stack_check.js
|
|
1877
1897
|
// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
|
|
1878
1898
|
function writeStackCookie() {
|
|
@@ -1914,31 +1934,24 @@ function checkStackCookie() {
|
|
|
1914
1934
|
// include: runtime_exceptions.js
|
|
1915
1935
|
// end include: runtime_exceptions.js
|
|
1916
1936
|
// include: runtime_debug.js
|
|
1937
|
+
var runtimeDebug = true; // Switch to false at runtime to disable logging at the right times
|
|
1938
|
+
|
|
1939
|
+
// Used by XXXXX_DEBUG settings to output debug messages.
|
|
1940
|
+
function dbg(...args) {
|
|
1941
|
+
if (!runtimeDebug && typeof runtimeDebug != 'undefined') return;
|
|
1942
|
+
// TODO(sbc): Make this configurable somehow. Its not always convenient for
|
|
1943
|
+
// logging to show up as warnings.
|
|
1944
|
+
console.warn(...args);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1917
1947
|
// Endianness check
|
|
1918
1948
|
(() => {
|
|
1919
1949
|
var h16 = new Int16Array(1);
|
|
1920
1950
|
var h8 = new Int8Array(h16.buffer);
|
|
1921
1951
|
h16[0] = 0x6373;
|
|
1922
|
-
if (h8[0] !== 0x73 || h8[1] !== 0x63)
|
|
1952
|
+
if (h8[0] !== 0x73 || h8[1] !== 0x63) abort('Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)');
|
|
1923
1953
|
})();
|
|
1924
1954
|
|
|
1925
|
-
if (Module['ENVIRONMENT']) {
|
|
1926
|
-
throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
function legacyModuleProp(prop, newName, incoming=true) {
|
|
1930
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
1931
|
-
Object.defineProperty(Module, prop, {
|
|
1932
|
-
configurable: true,
|
|
1933
|
-
get() {
|
|
1934
|
-
let extra = incoming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : '';
|
|
1935
|
-
abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
|
|
1936
|
-
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
1955
|
function consumedModuleProp(prop) {
|
|
1943
1956
|
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
1944
1957
|
Object.defineProperty(Module, prop, {
|
|
@@ -1951,6 +1964,11 @@ function consumedModuleProp(prop) {
|
|
|
1951
1964
|
}
|
|
1952
1965
|
}
|
|
1953
1966
|
|
|
1967
|
+
function makeInvalidEarlyAccess(name) {
|
|
1968
|
+
return () => assert(false, `call to '${name}' via reference taken before Wasm module initialization`);
|
|
1969
|
+
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1954
1972
|
function ignoredModuleProp(prop) {
|
|
1955
1973
|
if (Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
1956
1974
|
abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
|
|
@@ -1962,6 +1980,7 @@ function isExportedByForceFilesystem(name) {
|
|
|
1962
1980
|
return name === 'FS_createPath' ||
|
|
1963
1981
|
name === 'FS_createDataFile' ||
|
|
1964
1982
|
name === 'FS_createPreloadedFile' ||
|
|
1983
|
+
name === 'FS_preloadFile' ||
|
|
1965
1984
|
name === 'FS_unlink' ||
|
|
1966
1985
|
name === 'addRunDependency' ||
|
|
1967
1986
|
// The old FS has some functionality that WasmFS lacks.
|
|
@@ -1971,12 +1990,15 @@ function isExportedByForceFilesystem(name) {
|
|
|
1971
1990
|
}
|
|
1972
1991
|
|
|
1973
1992
|
/**
|
|
1974
|
-
* Intercept access to a global symbol. This enables us to give
|
|
1975
|
-
* warnings/errors when folks attempt to use symbols they did not
|
|
1976
|
-
* their build, or no symbols that no longer exist.
|
|
1993
|
+
* Intercept access to a symbols in the global symbol. This enables us to give
|
|
1994
|
+
* informative warnings/errors when folks attempt to use symbols they did not
|
|
1995
|
+
* include in their build, or no symbols that no longer exist.
|
|
1996
|
+
*
|
|
1997
|
+
* We don't define this in MODULARIZE mode since in that mode emscripten symbols
|
|
1998
|
+
* are never placed in the global scope.
|
|
1977
1999
|
*/
|
|
1978
2000
|
function hookGlobalSymbolAccess(sym, func) {
|
|
1979
|
-
if (
|
|
2001
|
+
if (!Object.getOwnPropertyDescriptor(globalThis, sym)) {
|
|
1980
2002
|
Object.defineProperty(globalThis, sym, {
|
|
1981
2003
|
configurable: true,
|
|
1982
2004
|
get() {
|
|
@@ -1989,7 +2011,7 @@ function hookGlobalSymbolAccess(sym, func) {
|
|
|
1989
2011
|
|
|
1990
2012
|
function missingGlobal(sym, msg) {
|
|
1991
2013
|
hookGlobalSymbolAccess(sym, () => {
|
|
1992
|
-
warnOnce(`\`${sym}\` is
|
|
2014
|
+
warnOnce(`\`${sym}\` is no longer defined by emscripten. ${msg}`);
|
|
1993
2015
|
});
|
|
1994
2016
|
}
|
|
1995
2017
|
|
|
@@ -2030,7 +2052,7 @@ function unexportedRuntimeSymbol(sym) {
|
|
|
2030
2052
|
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
2031
2053
|
}
|
|
2032
2054
|
abort(msg);
|
|
2033
|
-
}
|
|
2055
|
+
},
|
|
2034
2056
|
});
|
|
2035
2057
|
}
|
|
2036
2058
|
}
|
|
@@ -2060,44 +2082,58 @@ var checkInt32 = (value) => checkInt(value, 32, MIN_INT32, MAX_UINT32);
|
|
|
2060
2082
|
var checkInt53 = (value) => checkInt(value, 53, MIN_INT53, MAX_UINT53);
|
|
2061
2083
|
var checkInt64 = (value) => checkInt(value, 64, MIN_INT64, MAX_UINT64);
|
|
2062
2084
|
|
|
2063
|
-
var runtimeDebug = true; // Switch to false at runtime to disable logging at the right times
|
|
2064
|
-
|
|
2065
|
-
// Used by XXXXX_DEBUG settings to output debug messages.
|
|
2066
|
-
function dbg(...args) {
|
|
2067
|
-
if (!runtimeDebug && typeof runtimeDebug != 'undefined') return;
|
|
2068
|
-
// TODO(sbc): Make this configurable somehow. Its not always convenient for
|
|
2069
|
-
// logging to show up as warnings.
|
|
2070
|
-
console.warn(...args);
|
|
2071
|
-
}
|
|
2072
2085
|
// end include: runtime_debug.js
|
|
2073
|
-
//
|
|
2074
|
-
|
|
2086
|
+
// Memory management
|
|
2087
|
+
var
|
|
2088
|
+
/** @type {!Int8Array} */
|
|
2089
|
+
HEAP8,
|
|
2090
|
+
/** @type {!Uint8Array} */
|
|
2091
|
+
HEAPU8,
|
|
2092
|
+
/** @type {!Int16Array} */
|
|
2093
|
+
HEAP16,
|
|
2094
|
+
/** @type {!Uint16Array} */
|
|
2095
|
+
HEAPU16,
|
|
2096
|
+
/** @type {!Int32Array} */
|
|
2097
|
+
HEAP32,
|
|
2098
|
+
/** @type {!Uint32Array} */
|
|
2099
|
+
HEAPU32,
|
|
2100
|
+
/** @type {!Float32Array} */
|
|
2101
|
+
HEAPF32,
|
|
2102
|
+
/** @type {!Float64Array} */
|
|
2103
|
+
HEAPF64;
|
|
2104
|
+
|
|
2105
|
+
// BigInt64Array type is not correctly defined in closure
|
|
2106
|
+
var
|
|
2107
|
+
/** not-@type {!BigInt64Array} */
|
|
2108
|
+
HEAP64,
|
|
2109
|
+
/* BigUint64Array type is not correctly defined in closure
|
|
2110
|
+
/** not-@type {!BigUint64Array} */
|
|
2111
|
+
HEAPU64;
|
|
2112
|
+
|
|
2113
|
+
var runtimeInitialized = false;
|
|
2114
|
+
|
|
2075
2115
|
|
|
2076
2116
|
|
|
2077
2117
|
function updateMemoryViews() {
|
|
2078
2118
|
var b = wasmMemory.buffer;
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2119
|
+
HEAP8 = new Int8Array(b);
|
|
2120
|
+
HEAP16 = new Int16Array(b);
|
|
2121
|
+
HEAPU8 = new Uint8Array(b);
|
|
2122
|
+
HEAPU16 = new Uint16Array(b);
|
|
2123
|
+
HEAP32 = new Int32Array(b);
|
|
2124
|
+
HEAPU32 = new Uint32Array(b);
|
|
2125
|
+
HEAPF32 = new Float32Array(b);
|
|
2126
|
+
HEAPF64 = new Float64Array(b);
|
|
2127
|
+
HEAP64 = new BigInt64Array(b);
|
|
2128
|
+
HEAPU64 = new BigUint64Array(b);
|
|
2089
2129
|
}
|
|
2090
2130
|
|
|
2091
|
-
//
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
assert(
|
|
2131
|
+
// include: memoryprofiler.js
|
|
2132
|
+
// end include: memoryprofiler.js
|
|
2133
|
+
// end include: runtime_common.js
|
|
2134
|
+
assert(globalThis.Int32Array && globalThis.Float64Array && Int32Array.prototype.subarray && Int32Array.prototype.set,
|
|
2095
2135
|
'JS engine does not provide full typed array support');
|
|
2096
2136
|
|
|
2097
|
-
// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY
|
|
2098
|
-
assert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');
|
|
2099
|
-
assert(!Module['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');
|
|
2100
|
-
|
|
2101
2137
|
function preRun() {
|
|
2102
2138
|
if (Module['preRun']) {
|
|
2103
2139
|
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
|
|
@@ -2106,27 +2142,34 @@ function preRun() {
|
|
|
2106
2142
|
}
|
|
2107
2143
|
}
|
|
2108
2144
|
consumedModuleProp('preRun');
|
|
2145
|
+
// Begin ATPRERUNS hooks
|
|
2109
2146
|
callRuntimeCallbacks(onPreRuns);
|
|
2147
|
+
// End ATPRERUNS hooks
|
|
2110
2148
|
}
|
|
2111
2149
|
|
|
2112
2150
|
function initRuntime() {
|
|
2113
2151
|
assert(!runtimeInitialized);
|
|
2114
2152
|
runtimeInitialized = true;
|
|
2115
2153
|
|
|
2116
|
-
checkStackCookie();
|
|
2117
|
-
|
|
2118
2154
|
setStackLimits();
|
|
2119
2155
|
|
|
2156
|
+
checkStackCookie();
|
|
2157
|
+
|
|
2158
|
+
// Begin ATINITS hooks
|
|
2120
2159
|
if (!Module['noFSInit'] && !FS.initialized) FS.init();
|
|
2121
2160
|
TTY.init();
|
|
2161
|
+
// End ATINITS hooks
|
|
2122
2162
|
|
|
2123
2163
|
wasmExports['__wasm_call_ctors']();
|
|
2124
2164
|
|
|
2165
|
+
// Begin ATPOSTCTORS hooks
|
|
2125
2166
|
FS.ignorePermissions = false;
|
|
2167
|
+
// End ATPOSTCTORS hooks
|
|
2126
2168
|
}
|
|
2127
2169
|
|
|
2128
2170
|
function postRun() {
|
|
2129
2171
|
checkStackCookie();
|
|
2172
|
+
// PThreads reuse the runtime from the main thread.
|
|
2130
2173
|
|
|
2131
2174
|
if (Module['postRun']) {
|
|
2132
2175
|
if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
|
|
@@ -2136,85 +2179,9 @@ function postRun() {
|
|
|
2136
2179
|
}
|
|
2137
2180
|
consumedModuleProp('postRun');
|
|
2138
2181
|
|
|
2182
|
+
// Begin ATPOSTRUNS hooks
|
|
2139
2183
|
callRuntimeCallbacks(onPostRuns);
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
// A counter of dependencies for calling run(). If we need to
|
|
2143
|
-
// do asynchronous work before running, increment this and
|
|
2144
|
-
// decrement it. Incrementing must happen in a place like
|
|
2145
|
-
// Module.preRun (used by emcc to add file preloading).
|
|
2146
|
-
// Note that you can add dependencies in preRun, even though
|
|
2147
|
-
// it happens right before run - run will be postponed until
|
|
2148
|
-
// the dependencies are met.
|
|
2149
|
-
var runDependencies = 0;
|
|
2150
|
-
var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
|
|
2151
|
-
var runDependencyTracking = {};
|
|
2152
|
-
var runDependencyWatcher = null;
|
|
2153
|
-
|
|
2154
|
-
function getUniqueRunDependency(id) {
|
|
2155
|
-
var orig = id;
|
|
2156
|
-
while (1) {
|
|
2157
|
-
if (!runDependencyTracking[id]) return id;
|
|
2158
|
-
id = orig + Math.random();
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
function addRunDependency(id) {
|
|
2163
|
-
runDependencies++;
|
|
2164
|
-
|
|
2165
|
-
Module['monitorRunDependencies']?.(runDependencies);
|
|
2166
|
-
|
|
2167
|
-
if (id) {
|
|
2168
|
-
assert(!runDependencyTracking[id]);
|
|
2169
|
-
runDependencyTracking[id] = 1;
|
|
2170
|
-
if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
|
|
2171
|
-
// Check for missing dependencies every few seconds
|
|
2172
|
-
runDependencyWatcher = setInterval(() => {
|
|
2173
|
-
if (ABORT) {
|
|
2174
|
-
clearInterval(runDependencyWatcher);
|
|
2175
|
-
runDependencyWatcher = null;
|
|
2176
|
-
return;
|
|
2177
|
-
}
|
|
2178
|
-
var shown = false;
|
|
2179
|
-
for (var dep in runDependencyTracking) {
|
|
2180
|
-
if (!shown) {
|
|
2181
|
-
shown = true;
|
|
2182
|
-
err('still waiting on run dependencies:');
|
|
2183
|
-
}
|
|
2184
|
-
err(`dependency: ${dep}`);
|
|
2185
|
-
}
|
|
2186
|
-
if (shown) {
|
|
2187
|
-
err('(end of list)');
|
|
2188
|
-
}
|
|
2189
|
-
}, 10000);
|
|
2190
|
-
}
|
|
2191
|
-
} else {
|
|
2192
|
-
err('warning: run dependency added without ID');
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
function removeRunDependency(id) {
|
|
2197
|
-
runDependencies--;
|
|
2198
|
-
|
|
2199
|
-
Module['monitorRunDependencies']?.(runDependencies);
|
|
2200
|
-
|
|
2201
|
-
if (id) {
|
|
2202
|
-
assert(runDependencyTracking[id]);
|
|
2203
|
-
delete runDependencyTracking[id];
|
|
2204
|
-
} else {
|
|
2205
|
-
err('warning: run dependency removed without ID');
|
|
2206
|
-
}
|
|
2207
|
-
if (runDependencies == 0) {
|
|
2208
|
-
if (runDependencyWatcher !== null) {
|
|
2209
|
-
clearInterval(runDependencyWatcher);
|
|
2210
|
-
runDependencyWatcher = null;
|
|
2211
|
-
}
|
|
2212
|
-
if (dependenciesFulfilled) {
|
|
2213
|
-
var callback = dependenciesFulfilled;
|
|
2214
|
-
dependenciesFulfilled = null;
|
|
2215
|
-
callback(); // can add another dependenciesFulfilled
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2184
|
+
// End ATPOSTRUNS hooks
|
|
2218
2185
|
}
|
|
2219
2186
|
|
|
2220
2187
|
/** @param {string|number=} what */
|
|
@@ -2264,7 +2231,7 @@ function createExportWrapper(name, nargs) {
|
|
|
2264
2231
|
var wasmBinaryFile;
|
|
2265
2232
|
|
|
2266
2233
|
function findWasmBinary() {
|
|
2267
|
-
|
|
2234
|
+
return locateFile('sql-wasm-debug.wasm');
|
|
2268
2235
|
}
|
|
2269
2236
|
|
|
2270
2237
|
function getBinarySync(file) {
|
|
@@ -2274,6 +2241,8 @@ function getBinarySync(file) {
|
|
|
2274
2241
|
if (readBinary) {
|
|
2275
2242
|
return readBinary(file);
|
|
2276
2243
|
}
|
|
2244
|
+
// Throwing a plain string here, even though it not normally advisable since
|
|
2245
|
+
// this gets turning into an `abort` in instantiateArrayBuffer.
|
|
2277
2246
|
throw 'both async and sync fetching of the wasm failed';
|
|
2278
2247
|
}
|
|
2279
2248
|
|
|
@@ -2302,15 +2271,15 @@ async function instantiateArrayBuffer(binaryFile, imports) {
|
|
|
2302
2271
|
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
2303
2272
|
|
|
2304
2273
|
// Warn on some common problems.
|
|
2305
|
-
if (isFileURI(
|
|
2306
|
-
err(`warning: Loading from a file URI (${
|
|
2274
|
+
if (isFileURI(binaryFile)) {
|
|
2275
|
+
err(`warning: Loading from a file URI (${binaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);
|
|
2307
2276
|
}
|
|
2308
2277
|
abort(reason);
|
|
2309
2278
|
}
|
|
2310
2279
|
}
|
|
2311
2280
|
|
|
2312
2281
|
async function instantiateAsync(binary, binaryFile, imports) {
|
|
2313
|
-
if (!binary
|
|
2282
|
+
if (!binary
|
|
2314
2283
|
// Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
|
|
2315
2284
|
&& !isFileURI(binaryFile)
|
|
2316
2285
|
// Avoid instantiateStreaming() on Node.js environment for now, as while
|
|
@@ -2338,10 +2307,11 @@ async function instantiateAsync(binary, binaryFile, imports) {
|
|
|
2338
2307
|
|
|
2339
2308
|
function getWasmImports() {
|
|
2340
2309
|
// prepare imports
|
|
2341
|
-
|
|
2310
|
+
var imports = {
|
|
2342
2311
|
'env': wasmImports,
|
|
2343
2312
|
'wasi_snapshot_preview1': wasmImports,
|
|
2344
|
-
}
|
|
2313
|
+
};
|
|
2314
|
+
return imports;
|
|
2345
2315
|
}
|
|
2346
2316
|
|
|
2347
2317
|
// Create the wasm instance.
|
|
@@ -2354,21 +2324,13 @@ async function createWasm() {
|
|
|
2354
2324
|
function receiveInstance(instance, module) {
|
|
2355
2325
|
wasmExports = instance.exports;
|
|
2356
2326
|
|
|
2357
|
-
|
|
2327
|
+
assignWasmExports(wasmExports);
|
|
2358
2328
|
|
|
2359
|
-
wasmMemory = wasmExports['memory'];
|
|
2360
|
-
|
|
2361
|
-
assert(wasmMemory, 'memory not found in wasm exports');
|
|
2362
2329
|
updateMemoryViews();
|
|
2363
2330
|
|
|
2364
|
-
wasmTable = wasmExports['__indirect_function_table'];
|
|
2365
|
-
|
|
2366
|
-
assert(wasmTable, 'table not found in wasm exports');
|
|
2367
|
-
|
|
2368
2331
|
removeRunDependency('wasm-instantiate');
|
|
2369
2332
|
return wasmExports;
|
|
2370
2333
|
}
|
|
2371
|
-
// wait for the pthread pool (if any)
|
|
2372
2334
|
addRunDependency('wasm-instantiate');
|
|
2373
2335
|
|
|
2374
2336
|
// Prefer streaming instantiation if available.
|
|
@@ -2397,9 +2359,8 @@ async function createWasm() {
|
|
|
2397
2359
|
if (Module['instantiateWasm']) {
|
|
2398
2360
|
return new Promise((resolve, reject) => {
|
|
2399
2361
|
try {
|
|
2400
|
-
Module['instantiateWasm'](info, (
|
|
2401
|
-
receiveInstance(
|
|
2402
|
-
resolve(mod.exports);
|
|
2362
|
+
Module['instantiateWasm'](info, (inst, mod) => {
|
|
2363
|
+
resolve(receiveInstance(inst, mod));
|
|
2403
2364
|
});
|
|
2404
2365
|
} catch(e) {
|
|
2405
2366
|
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
@@ -2409,9 +2370,9 @@ async function createWasm() {
|
|
|
2409
2370
|
}
|
|
2410
2371
|
|
|
2411
2372
|
wasmBinaryFile ??= findWasmBinary();
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2373
|
+
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
|
|
2374
|
+
var exports = receiveInstantiationResult(result);
|
|
2375
|
+
return exports;
|
|
2415
2376
|
}
|
|
2416
2377
|
|
|
2417
2378
|
// end include: preamble.js
|
|
@@ -2434,17 +2395,82 @@ async function createWasm() {
|
|
|
2434
2395
|
}
|
|
2435
2396
|
};
|
|
2436
2397
|
var onPostRuns = [];
|
|
2437
|
-
var addOnPostRun = (cb) => onPostRuns.
|
|
2398
|
+
var addOnPostRun = (cb) => onPostRuns.push(cb);
|
|
2438
2399
|
|
|
2439
2400
|
var onPreRuns = [];
|
|
2440
|
-
var addOnPreRun = (cb) => onPreRuns.
|
|
2401
|
+
var addOnPreRun = (cb) => onPreRuns.push(cb);
|
|
2402
|
+
|
|
2403
|
+
var runDependencies = 0;
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
var dependenciesFulfilled = null;
|
|
2407
|
+
|
|
2408
|
+
var runDependencyTracking = {
|
|
2409
|
+
};
|
|
2410
|
+
|
|
2411
|
+
var runDependencyWatcher = null;
|
|
2412
|
+
var removeRunDependency = (id) => {
|
|
2413
|
+
runDependencies--;
|
|
2414
|
+
|
|
2415
|
+
Module['monitorRunDependencies']?.(runDependencies);
|
|
2416
|
+
|
|
2417
|
+
assert(id, 'removeRunDependency requires an ID');
|
|
2418
|
+
assert(runDependencyTracking[id]);
|
|
2419
|
+
delete runDependencyTracking[id];
|
|
2420
|
+
if (runDependencies == 0) {
|
|
2421
|
+
if (runDependencyWatcher !== null) {
|
|
2422
|
+
clearInterval(runDependencyWatcher);
|
|
2423
|
+
runDependencyWatcher = null;
|
|
2424
|
+
}
|
|
2425
|
+
if (dependenciesFulfilled) {
|
|
2426
|
+
var callback = dependenciesFulfilled;
|
|
2427
|
+
dependenciesFulfilled = null;
|
|
2428
|
+
callback(); // can add another dependenciesFulfilled
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
var addRunDependency = (id) => {
|
|
2435
|
+
runDependencies++;
|
|
2436
|
+
|
|
2437
|
+
Module['monitorRunDependencies']?.(runDependencies);
|
|
2438
|
+
|
|
2439
|
+
assert(id, 'addRunDependency requires an ID')
|
|
2440
|
+
assert(!runDependencyTracking[id]);
|
|
2441
|
+
runDependencyTracking[id] = 1;
|
|
2442
|
+
if (runDependencyWatcher === null && globalThis.setInterval) {
|
|
2443
|
+
// Check for missing dependencies every few seconds
|
|
2444
|
+
runDependencyWatcher = setInterval(() => {
|
|
2445
|
+
if (ABORT) {
|
|
2446
|
+
clearInterval(runDependencyWatcher);
|
|
2447
|
+
runDependencyWatcher = null;
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
var shown = false;
|
|
2451
|
+
for (var dep in runDependencyTracking) {
|
|
2452
|
+
if (!shown) {
|
|
2453
|
+
shown = true;
|
|
2454
|
+
err('still waiting on run dependencies:');
|
|
2455
|
+
}
|
|
2456
|
+
err(`dependency: ${dep}`);
|
|
2457
|
+
}
|
|
2458
|
+
if (shown) {
|
|
2459
|
+
err('(end of list)');
|
|
2460
|
+
}
|
|
2461
|
+
}, 10000);
|
|
2462
|
+
// Prevent this timer from keeping the runtime alive if nothing
|
|
2463
|
+
// else is.
|
|
2464
|
+
runDependencyWatcher.unref?.()
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2441
2467
|
|
|
2442
2468
|
|
|
2443
2469
|
|
|
2444
2470
|
/**
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2471
|
+
* @param {number} ptr
|
|
2472
|
+
* @param {string} type
|
|
2473
|
+
*/
|
|
2448
2474
|
function getValue(ptr, type = 'i8') {
|
|
2449
2475
|
if (type.endsWith('*')) type = '*';
|
|
2450
2476
|
switch (type) {
|
|
@@ -2460,15 +2486,16 @@ async function createWasm() {
|
|
|
2460
2486
|
}
|
|
2461
2487
|
}
|
|
2462
2488
|
|
|
2463
|
-
var noExitRuntime =
|
|
2489
|
+
var noExitRuntime = true;
|
|
2464
2490
|
|
|
2465
2491
|
var ptrToString = (ptr) => {
|
|
2466
|
-
assert(typeof ptr === 'number');
|
|
2467
|
-
//
|
|
2492
|
+
assert(typeof ptr === 'number', `ptrToString expects a number, got ${typeof ptr}`);
|
|
2493
|
+
// Convert to 32-bit unsigned value
|
|
2468
2494
|
ptr >>>= 0;
|
|
2469
2495
|
return '0x' + ptr.toString(16).padStart(8, '0');
|
|
2470
2496
|
};
|
|
2471
2497
|
|
|
2498
|
+
|
|
2472
2499
|
var setStackLimits = () => {
|
|
2473
2500
|
var stackLow = _emscripten_stack_get_base();
|
|
2474
2501
|
var stackHigh = _emscripten_stack_get_end();
|
|
@@ -2477,10 +2504,10 @@ async function createWasm() {
|
|
|
2477
2504
|
|
|
2478
2505
|
|
|
2479
2506
|
/**
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2507
|
+
* @param {number} ptr
|
|
2508
|
+
* @param {number} value
|
|
2509
|
+
* @param {string} type
|
|
2510
|
+
*/
|
|
2484
2511
|
function setValue(ptr, value, type = 'i8') {
|
|
2485
2512
|
if (type.endsWith('*')) type = '*';
|
|
2486
2513
|
switch (type) {
|
|
@@ -2509,33 +2536,41 @@ async function createWasm() {
|
|
|
2509
2536
|
}
|
|
2510
2537
|
};
|
|
2511
2538
|
|
|
2512
|
-
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
|
|
2513
2539
|
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
* @param {number=} maxBytesToRead
|
|
2521
|
-
* @return {string}
|
|
2522
|
-
*/
|
|
2523
|
-
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {
|
|
2524
|
-
var endIdx = idx + maxBytesToRead;
|
|
2525
|
-
var endPtr = idx;
|
|
2540
|
+
|
|
2541
|
+
var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
|
|
2542
|
+
|
|
2543
|
+
var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
|
|
2544
|
+
var maxIdx = idx + maxBytesToRead;
|
|
2545
|
+
if (ignoreNul) return maxIdx;
|
|
2526
2546
|
// TextDecoder needs to know the byte length in advance, it doesn't stop on
|
|
2527
|
-
// null terminator by itself.
|
|
2528
|
-
//
|
|
2529
|
-
//
|
|
2530
|
-
|
|
2531
|
-
|
|
2547
|
+
// null terminator by itself.
|
|
2548
|
+
// As a tiny code save trick, compare idx against maxIdx using a negation,
|
|
2549
|
+
// so that maxBytesToRead=undefined/NaN means Infinity.
|
|
2550
|
+
while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
|
|
2551
|
+
return idx;
|
|
2552
|
+
};
|
|
2532
2553
|
|
|
2554
|
+
|
|
2555
|
+
/**
|
|
2556
|
+
* Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
|
|
2557
|
+
* array that contains uint8 values, returns a copy of that string as a
|
|
2558
|
+
* Javascript String object.
|
|
2559
|
+
* heapOrArray is either a regular array, or a JavaScript typed array view.
|
|
2560
|
+
* @param {number=} idx
|
|
2561
|
+
* @param {number=} maxBytesToRead
|
|
2562
|
+
* @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
|
|
2563
|
+
* @return {string}
|
|
2564
|
+
*/
|
|
2565
|
+
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
|
|
2566
|
+
|
|
2567
|
+
var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
|
|
2568
|
+
|
|
2569
|
+
// When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
|
|
2533
2570
|
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
2534
2571
|
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
2535
2572
|
}
|
|
2536
2573
|
var str = '';
|
|
2537
|
-
// If building with TextDecoder, we have already computed the string length
|
|
2538
|
-
// above, so test loop end condition against that
|
|
2539
2574
|
while (idx < endPtr) {
|
|
2540
2575
|
// For UTF8 byte structure, see:
|
|
2541
2576
|
// http://en.wikipedia.org/wiki/UTF-8#Description
|
|
@@ -2564,23 +2599,21 @@ async function createWasm() {
|
|
|
2564
2599
|
};
|
|
2565
2600
|
|
|
2566
2601
|
/**
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
*/
|
|
2581
|
-
var UTF8ToString = (ptr, maxBytesToRead) => {
|
|
2602
|
+
* Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
|
|
2603
|
+
* emscripten HEAP, returns a copy of that string as a Javascript String object.
|
|
2604
|
+
*
|
|
2605
|
+
* @param {number} ptr
|
|
2606
|
+
* @param {number=} maxBytesToRead - An optional length that specifies the
|
|
2607
|
+
* maximum number of bytes to read. You can omit this parameter to scan the
|
|
2608
|
+
* string until the first 0 byte. If maxBytesToRead is passed, and the string
|
|
2609
|
+
* at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
|
|
2610
|
+
* string will cut short at that byte index.
|
|
2611
|
+
* @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
|
|
2612
|
+
* @return {string}
|
|
2613
|
+
*/
|
|
2614
|
+
var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
|
|
2582
2615
|
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
|
|
2583
|
-
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
2616
|
+
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : '';
|
|
2584
2617
|
};
|
|
2585
2618
|
var ___assert_fail = (condition, filename, line, func) =>
|
|
2586
2619
|
abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
|
|
@@ -2652,153 +2685,148 @@ async function createWasm() {
|
|
|
2652
2685
|
return root + dir;
|
|
2653
2686
|
},
|
|
2654
2687
|
basename:(path) => path && path.match(/([^\/]+|\/)\/*$/)[1],
|
|
2655
|
-
|
|
2656
|
-
|
|
2688
|
+
join:(...paths) => PATH.normalize(paths.join('/')),
|
|
2689
|
+
join2:(l, r) => PATH.normalize(l + '/' + r),
|
|
2690
|
+
};
|
|
2691
|
+
|
|
2692
|
+
var initRandomFill = () => {
|
|
2693
|
+
// This block is not needed on v19+ since crypto.getRandomValues is builtin
|
|
2694
|
+
if (ENVIRONMENT_IS_NODE) {
|
|
2695
|
+
var nodeCrypto = require('node:crypto');
|
|
2696
|
+
return (view) => nodeCrypto.randomFillSync(view);
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
return (view) => crypto.getRandomValues(view);
|
|
2657
2700
|
};
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
2662
|
-
var nodeCrypto = require('crypto');
|
|
2663
|
-
return (view) => nodeCrypto.randomFillSync(view);
|
|
2664
|
-
}
|
|
2665
|
-
|
|
2666
|
-
return (view) => crypto.getRandomValues(view);
|
|
2667
|
-
};
|
|
2668
|
-
var randomFill = (view) => {
|
|
2669
|
-
// Lazily init on the first invocation.
|
|
2670
|
-
(randomFill = initRandomFill())(view);
|
|
2671
|
-
};
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
var PATH_FS = {
|
|
2676
|
-
resolve:(...args) => {
|
|
2677
|
-
var resolvedPath = '',
|
|
2678
|
-
resolvedAbsolute = false;
|
|
2679
|
-
for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
2680
|
-
var path = (i >= 0) ? args[i] : FS.cwd();
|
|
2681
|
-
// Skip empty and invalid entries
|
|
2682
|
-
if (typeof path != 'string') {
|
|
2683
|
-
throw new TypeError('Arguments to path.resolve must be strings');
|
|
2684
|
-
} else if (!path) {
|
|
2685
|
-
return ''; // an invalid portion invalidates the whole thing
|
|
2686
|
-
}
|
|
2687
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
2688
|
-
resolvedAbsolute = PATH.isAbs(path);
|
|
2689
|
-
}
|
|
2690
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
2691
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
2692
|
-
resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter((p) => !!p), !resolvedAbsolute).join('/');
|
|
2693
|
-
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
|
2694
|
-
},
|
|
2695
|
-
relative:(from, to) => {
|
|
2696
|
-
from = PATH_FS.resolve(from).slice(1);
|
|
2697
|
-
to = PATH_FS.resolve(to).slice(1);
|
|
2698
|
-
function trim(arr) {
|
|
2699
|
-
var start = 0;
|
|
2700
|
-
for (; start < arr.length; start++) {
|
|
2701
|
-
if (arr[start] !== '') break;
|
|
2702
|
-
}
|
|
2703
|
-
var end = arr.length - 1;
|
|
2704
|
-
for (; end >= 0; end--) {
|
|
2705
|
-
if (arr[end] !== '') break;
|
|
2706
|
-
}
|
|
2707
|
-
if (start > end) return [];
|
|
2708
|
-
return arr.slice(start, end - start + 1);
|
|
2709
|
-
}
|
|
2710
|
-
var fromParts = trim(from.split('/'));
|
|
2711
|
-
var toParts = trim(to.split('/'));
|
|
2712
|
-
var length = Math.min(fromParts.length, toParts.length);
|
|
2713
|
-
var samePartsLength = length;
|
|
2714
|
-
for (var i = 0; i < length; i++) {
|
|
2715
|
-
if (fromParts[i] !== toParts[i]) {
|
|
2716
|
-
samePartsLength = i;
|
|
2717
|
-
break;
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
var outputParts = [];
|
|
2721
|
-
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
2722
|
-
outputParts.push('..');
|
|
2723
|
-
}
|
|
2724
|
-
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
2725
|
-
return outputParts.join('/');
|
|
2726
|
-
},
|
|
2701
|
+
var randomFill = (view) => {
|
|
2702
|
+
// Lazily init on the first invocation.
|
|
2703
|
+
(randomFill = initRandomFill())(view);
|
|
2727
2704
|
};
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
for (var i =
|
|
2736
|
-
|
|
2737
|
-
//
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
len++;
|
|
2743
|
-
} else if (c <= 0x7FF) {
|
|
2744
|
-
len += 2;
|
|
2745
|
-
} else if (c >= 0xD800 && c <= 0xDFFF) {
|
|
2746
|
-
len += 4; ++i;
|
|
2747
|
-
} else {
|
|
2748
|
-
len += 3;
|
|
2705
|
+
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
var PATH_FS = {
|
|
2709
|
+
resolve:(...args) => {
|
|
2710
|
+
var resolvedPath = '',
|
|
2711
|
+
resolvedAbsolute = false;
|
|
2712
|
+
for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
2713
|
+
var path = (i >= 0) ? args[i] : FS.cwd();
|
|
2714
|
+
// Skip empty and invalid entries
|
|
2715
|
+
if (typeof path != 'string') {
|
|
2716
|
+
throw new TypeError('Arguments to path.resolve must be strings');
|
|
2717
|
+
} else if (!path) {
|
|
2718
|
+
return ''; // an invalid portion invalidates the whole thing
|
|
2749
2719
|
}
|
|
2720
|
+
resolvedPath = path + '/' + resolvedPath;
|
|
2721
|
+
resolvedAbsolute = PATH.isAbs(path);
|
|
2750
2722
|
}
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
// and https://tools.ietf.org/html/rfc3629
|
|
2771
|
-
var u = str.charCodeAt(i); // possibly a lead surrogate
|
|
2772
|
-
if (u >= 0xD800 && u <= 0xDFFF) {
|
|
2773
|
-
var u1 = str.charCodeAt(++i);
|
|
2774
|
-
u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF);
|
|
2775
|
-
}
|
|
2776
|
-
if (u <= 0x7F) {
|
|
2777
|
-
if (outIdx >= endIdx) break;
|
|
2778
|
-
heap[outIdx++] = u;
|
|
2779
|
-
} else if (u <= 0x7FF) {
|
|
2780
|
-
if (outIdx + 1 >= endIdx) break;
|
|
2781
|
-
heap[outIdx++] = 0xC0 | (u >> 6);
|
|
2782
|
-
heap[outIdx++] = 0x80 | (u & 63);
|
|
2783
|
-
} else if (u <= 0xFFFF) {
|
|
2784
|
-
if (outIdx + 2 >= endIdx) break;
|
|
2785
|
-
heap[outIdx++] = 0xE0 | (u >> 12);
|
|
2786
|
-
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
2787
|
-
heap[outIdx++] = 0x80 | (u & 63);
|
|
2788
|
-
} else {
|
|
2789
|
-
if (outIdx + 3 >= endIdx) break;
|
|
2790
|
-
if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
|
|
2791
|
-
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2792
|
-
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2793
|
-
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
2794
|
-
heap[outIdx++] = 0x80 | (u & 63);
|
|
2795
|
-
}
|
|
2723
|
+
// At this point the path should be resolved to a full absolute path, but
|
|
2724
|
+
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
2725
|
+
resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter((p) => !!p), !resolvedAbsolute).join('/');
|
|
2726
|
+
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
|
2727
|
+
},
|
|
2728
|
+
relative:(from, to) => {
|
|
2729
|
+
from = PATH_FS.resolve(from).slice(1);
|
|
2730
|
+
to = PATH_FS.resolve(to).slice(1);
|
|
2731
|
+
function trim(arr) {
|
|
2732
|
+
var start = 0;
|
|
2733
|
+
for (; start < arr.length; start++) {
|
|
2734
|
+
if (arr[start] !== '') break;
|
|
2735
|
+
}
|
|
2736
|
+
var end = arr.length - 1;
|
|
2737
|
+
for (; end >= 0; end--) {
|
|
2738
|
+
if (arr[end] !== '') break;
|
|
2739
|
+
}
|
|
2740
|
+
if (start > end) return [];
|
|
2741
|
+
return arr.slice(start, end - start + 1);
|
|
2796
2742
|
}
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2743
|
+
var fromParts = trim(from.split('/'));
|
|
2744
|
+
var toParts = trim(to.split('/'));
|
|
2745
|
+
var length = Math.min(fromParts.length, toParts.length);
|
|
2746
|
+
var samePartsLength = length;
|
|
2747
|
+
for (var i = 0; i < length; i++) {
|
|
2748
|
+
if (fromParts[i] !== toParts[i]) {
|
|
2749
|
+
samePartsLength = i;
|
|
2750
|
+
break;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
var outputParts = [];
|
|
2754
|
+
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
2755
|
+
outputParts.push('..');
|
|
2756
|
+
}
|
|
2757
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
2758
|
+
return outputParts.join('/');
|
|
2759
|
+
},
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
|
|
2764
|
+
var FS_stdin_getChar_buffer = [];
|
|
2765
|
+
|
|
2766
|
+
var lengthBytesUTF8 = (str) => {
|
|
2767
|
+
var len = 0;
|
|
2768
|
+
for (var i = 0; i < str.length; ++i) {
|
|
2769
|
+
// Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
|
|
2770
|
+
// unit, not a Unicode code point of the character! So decode
|
|
2771
|
+
// UTF16->UTF32->UTF8.
|
|
2772
|
+
// See http://unicode.org/faq/utf_bom.html#utf16-3
|
|
2773
|
+
var c = str.charCodeAt(i); // possibly a lead surrogate
|
|
2774
|
+
if (c <= 0x7F) {
|
|
2775
|
+
len++;
|
|
2776
|
+
} else if (c <= 0x7FF) {
|
|
2777
|
+
len += 2;
|
|
2778
|
+
} else if (c >= 0xD800 && c <= 0xDFFF) {
|
|
2779
|
+
len += 4; ++i;
|
|
2780
|
+
} else {
|
|
2781
|
+
len += 3;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
return len;
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
2788
|
+
assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
|
|
2789
|
+
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
2790
|
+
// undefined and false each don't write out any bytes.
|
|
2791
|
+
if (!(maxBytesToWrite > 0))
|
|
2792
|
+
return 0;
|
|
2793
|
+
|
|
2794
|
+
var startIdx = outIdx;
|
|
2795
|
+
var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
|
|
2796
|
+
for (var i = 0; i < str.length; ++i) {
|
|
2797
|
+
// For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
|
|
2798
|
+
// and https://www.ietf.org/rfc/rfc2279.txt
|
|
2799
|
+
// and https://tools.ietf.org/html/rfc3629
|
|
2800
|
+
var u = str.codePointAt(i);
|
|
2801
|
+
if (u <= 0x7F) {
|
|
2802
|
+
if (outIdx >= endIdx) break;
|
|
2803
|
+
heap[outIdx++] = u;
|
|
2804
|
+
} else if (u <= 0x7FF) {
|
|
2805
|
+
if (outIdx + 1 >= endIdx) break;
|
|
2806
|
+
heap[outIdx++] = 0xC0 | (u >> 6);
|
|
2807
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
2808
|
+
} else if (u <= 0xFFFF) {
|
|
2809
|
+
if (outIdx + 2 >= endIdx) break;
|
|
2810
|
+
heap[outIdx++] = 0xE0 | (u >> 12);
|
|
2811
|
+
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
2812
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
2813
|
+
} else {
|
|
2814
|
+
if (outIdx + 3 >= endIdx) break;
|
|
2815
|
+
if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
|
|
2816
|
+
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2817
|
+
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2818
|
+
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
2819
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
2820
|
+
// Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
|
|
2821
|
+
// We need to manually skip over the second code unit for correct iteration.
|
|
2822
|
+
i++;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
// Null-terminate the pointer to the buffer.
|
|
2826
|
+
heap[outIdx] = 0;
|
|
2827
|
+
return outIdx - startIdx;
|
|
2828
|
+
};
|
|
2829
|
+
/** @type {function(string, boolean=, number=)} */
|
|
2802
2830
|
var intArrayFromString = (stringy, dontAddNull, length) => {
|
|
2803
2831
|
var len = length > 0 ? length : lengthBytesUTF8(stringy)+1;
|
|
2804
2832
|
var u8array = new Array(len);
|
|
@@ -2838,8 +2866,7 @@ async function createWasm() {
|
|
|
2838
2866
|
result = buf.slice(0, bytesRead).toString('utf-8');
|
|
2839
2867
|
}
|
|
2840
2868
|
} else
|
|
2841
|
-
if (
|
|
2842
|
-
typeof window.prompt == 'function') {
|
|
2869
|
+
if (globalThis.window?.prompt) {
|
|
2843
2870
|
// Browser.
|
|
2844
2871
|
result = window.prompt('Input: '); // returns null on cancel
|
|
2845
2872
|
if (result !== null) {
|
|
@@ -3016,7 +3043,7 @@ async function createWasm() {
|
|
|
3016
3043
|
},
|
|
3017
3044
|
createNode(parent, name, mode, dev) {
|
|
3018
3045
|
if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
|
|
3019
|
-
//
|
|
3046
|
+
// not supported
|
|
3020
3047
|
throw new FS.ErrnoError(63);
|
|
3021
3048
|
}
|
|
3022
3049
|
MEMFS.ops_table ||= {
|
|
@@ -3236,7 +3263,7 @@ async function createWasm() {
|
|
|
3236
3263
|
// If the buffer is located in main memory (HEAP), and if
|
|
3237
3264
|
// memory can grow, we can't hold on to references of the
|
|
3238
3265
|
// memory buffer, as they may get invalidated. That means we
|
|
3239
|
-
// need to
|
|
3266
|
+
// need to copy its contents.
|
|
3240
3267
|
if (buffer.buffer === HEAP8.buffer) {
|
|
3241
3268
|
canOwn = false;
|
|
3242
3269
|
}
|
|
@@ -3329,62 +3356,6 @@ async function createWasm() {
|
|
|
3329
3356
|
},
|
|
3330
3357
|
};
|
|
3331
3358
|
|
|
3332
|
-
var asyncLoad = async (url) => {
|
|
3333
|
-
var arrayBuffer = await readAsync(url);
|
|
3334
|
-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
3335
|
-
return new Uint8Array(arrayBuffer);
|
|
3336
|
-
};
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
|
|
3340
|
-
FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
|
|
3341
|
-
};
|
|
3342
|
-
|
|
3343
|
-
var preloadPlugins = Module['preloadPlugins'] || [];
|
|
3344
|
-
var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => {
|
|
3345
|
-
// Ensure plugins are ready.
|
|
3346
|
-
if (typeof Browser != 'undefined') Browser.init();
|
|
3347
|
-
|
|
3348
|
-
var handled = false;
|
|
3349
|
-
preloadPlugins.forEach((plugin) => {
|
|
3350
|
-
if (handled) return;
|
|
3351
|
-
if (plugin['canHandle'](fullname)) {
|
|
3352
|
-
plugin['handle'](byteArray, fullname, finish, onerror);
|
|
3353
|
-
handled = true;
|
|
3354
|
-
}
|
|
3355
|
-
});
|
|
3356
|
-
return handled;
|
|
3357
|
-
};
|
|
3358
|
-
var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
|
|
3359
|
-
// TODO we should allow people to just pass in a complete filename instead
|
|
3360
|
-
// of parent and name being that we just join them anyways
|
|
3361
|
-
var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
|
|
3362
|
-
var dep = getUniqueRunDependency(`cp ${fullname}`); // might have several active requests for the same fullname
|
|
3363
|
-
function processData(byteArray) {
|
|
3364
|
-
function finish(byteArray) {
|
|
3365
|
-
preFinish?.();
|
|
3366
|
-
if (!dontCreateFile) {
|
|
3367
|
-
FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
|
|
3368
|
-
}
|
|
3369
|
-
onload?.();
|
|
3370
|
-
removeRunDependency(dep);
|
|
3371
|
-
}
|
|
3372
|
-
if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => {
|
|
3373
|
-
onerror?.();
|
|
3374
|
-
removeRunDependency(dep);
|
|
3375
|
-
})) {
|
|
3376
|
-
return;
|
|
3377
|
-
}
|
|
3378
|
-
finish(byteArray);
|
|
3379
|
-
}
|
|
3380
|
-
addRunDependency(dep);
|
|
3381
|
-
if (typeof url == 'string') {
|
|
3382
|
-
asyncLoad(url).then(processData, onerror);
|
|
3383
|
-
} else {
|
|
3384
|
-
processData(url);
|
|
3385
|
-
}
|
|
3386
|
-
};
|
|
3387
|
-
|
|
3388
3359
|
var FS_modeStringToFlags = (str) => {
|
|
3389
3360
|
var flagModes = {
|
|
3390
3361
|
'r': 0,
|
|
@@ -3411,8 +3382,6 @@ async function createWasm() {
|
|
|
3411
3382
|
|
|
3412
3383
|
|
|
3413
3384
|
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
3385
|
var strError = (errno) => UTF8ToString(_strerror(errno));
|
|
3417
3386
|
|
|
3418
3387
|
var ERRNO_CODES = {
|
|
@@ -3538,6 +3507,66 @@ async function createWasm() {
|
|
|
3538
3507
|
'EOWNERDEAD': 62,
|
|
3539
3508
|
'ESTRPIPE': 135,
|
|
3540
3509
|
};
|
|
3510
|
+
|
|
3511
|
+
var asyncLoad = async (url) => {
|
|
3512
|
+
var arrayBuffer = await readAsync(url);
|
|
3513
|
+
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
3514
|
+
return new Uint8Array(arrayBuffer);
|
|
3515
|
+
};
|
|
3516
|
+
|
|
3517
|
+
|
|
3518
|
+
var FS_createDataFile = (...args) => FS.createDataFile(...args);
|
|
3519
|
+
|
|
3520
|
+
var getUniqueRunDependency = (id) => {
|
|
3521
|
+
var orig = id;
|
|
3522
|
+
while (1) {
|
|
3523
|
+
if (!runDependencyTracking[id]) return id;
|
|
3524
|
+
id = orig + Math.random();
|
|
3525
|
+
}
|
|
3526
|
+
};
|
|
3527
|
+
|
|
3528
|
+
|
|
3529
|
+
|
|
3530
|
+
var preloadPlugins = [];
|
|
3531
|
+
var FS_handledByPreloadPlugin = async (byteArray, fullname) => {
|
|
3532
|
+
// Ensure plugins are ready.
|
|
3533
|
+
if (typeof Browser != 'undefined') Browser.init();
|
|
3534
|
+
|
|
3535
|
+
for (var plugin of preloadPlugins) {
|
|
3536
|
+
if (plugin['canHandle'](fullname)) {
|
|
3537
|
+
assert(plugin['handle'].constructor.name === 'AsyncFunction', 'Filesystem plugin handlers must be async functions (See #24914)')
|
|
3538
|
+
return plugin['handle'](byteArray, fullname);
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
// If no plugin handled this file then return the original/unmodified
|
|
3542
|
+
// byteArray.
|
|
3543
|
+
return byteArray;
|
|
3544
|
+
};
|
|
3545
|
+
var FS_preloadFile = async (parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish) => {
|
|
3546
|
+
// TODO we should allow people to just pass in a complete filename instead
|
|
3547
|
+
// of parent and name being that we just join them anyways
|
|
3548
|
+
var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
|
|
3549
|
+
var dep = getUniqueRunDependency(`cp ${fullname}`); // might have several active requests for the same fullname
|
|
3550
|
+
addRunDependency(dep);
|
|
3551
|
+
|
|
3552
|
+
try {
|
|
3553
|
+
var byteArray = url;
|
|
3554
|
+
if (typeof url == 'string') {
|
|
3555
|
+
byteArray = await asyncLoad(url);
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
byteArray = await FS_handledByPreloadPlugin(byteArray, fullname);
|
|
3559
|
+
preFinish?.();
|
|
3560
|
+
if (!dontCreateFile) {
|
|
3561
|
+
FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
|
|
3562
|
+
}
|
|
3563
|
+
} finally {
|
|
3564
|
+
removeRunDependency(dep);
|
|
3565
|
+
}
|
|
3566
|
+
};
|
|
3567
|
+
var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
|
|
3568
|
+
FS_preloadFile(parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish).then(onload).catch(onerror);
|
|
3569
|
+
};
|
|
3541
3570
|
var FS = {
|
|
3542
3571
|
root:null,
|
|
3543
3572
|
mounts:[],
|
|
@@ -3671,7 +3700,15 @@ async function createWasm() {
|
|
|
3671
3700
|
|
|
3672
3701
|
if (parts[i] === '..') {
|
|
3673
3702
|
current_path = PATH.dirname(current_path);
|
|
3674
|
-
current
|
|
3703
|
+
if (FS.isRoot(current)) {
|
|
3704
|
+
path = current_path + '/' + parts.slice(i + 1).join('/');
|
|
3705
|
+
// We're making progress here, don't let many consecutive ..'s
|
|
3706
|
+
// lead to ELOOP
|
|
3707
|
+
nlinks--;
|
|
3708
|
+
continue linkloop;
|
|
3709
|
+
} else {
|
|
3710
|
+
current = current.parent;
|
|
3711
|
+
}
|
|
3675
3712
|
continue;
|
|
3676
3713
|
}
|
|
3677
3714
|
|
|
@@ -4000,12 +4037,13 @@ async function createWasm() {
|
|
|
4000
4037
|
};
|
|
4001
4038
|
|
|
4002
4039
|
// sync all mounts
|
|
4003
|
-
|
|
4004
|
-
if (
|
|
4005
|
-
|
|
4040
|
+
for (var mount of mounts) {
|
|
4041
|
+
if (mount.type.syncfs) {
|
|
4042
|
+
mount.type.syncfs(mount, populate, done);
|
|
4043
|
+
} else {
|
|
4044
|
+
done(null);
|
|
4006
4045
|
}
|
|
4007
|
-
|
|
4008
|
-
});
|
|
4046
|
+
}
|
|
4009
4047
|
},
|
|
4010
4048
|
mount(type, opts, mountpoint) {
|
|
4011
4049
|
if (typeof type == 'string') {
|
|
@@ -4072,9 +4110,7 @@ async function createWasm() {
|
|
|
4072
4110
|
var mount = node.mounted;
|
|
4073
4111
|
var mounts = FS.getMounts(mount);
|
|
4074
4112
|
|
|
4075
|
-
Object.
|
|
4076
|
-
var current = FS.nameTable[hash];
|
|
4077
|
-
|
|
4113
|
+
for (var [hash, current] of Object.entries(FS.nameTable)) {
|
|
4078
4114
|
while (current) {
|
|
4079
4115
|
var next = current.name_next;
|
|
4080
4116
|
|
|
@@ -4084,7 +4120,7 @@ async function createWasm() {
|
|
|
4084
4120
|
|
|
4085
4121
|
current = next;
|
|
4086
4122
|
}
|
|
4087
|
-
}
|
|
4123
|
+
}
|
|
4088
4124
|
|
|
4089
4125
|
// no longer a mountpoint
|
|
4090
4126
|
node.mounted = null;
|
|
@@ -4162,7 +4198,8 @@ async function createWasm() {
|
|
|
4162
4198
|
var d = '';
|
|
4163
4199
|
for (var dir of dirs) {
|
|
4164
4200
|
if (!dir) continue;
|
|
4165
|
-
d += '/'
|
|
4201
|
+
if (d || PATH.isAbs(path)) d += '/';
|
|
4202
|
+
d += dir;
|
|
4166
4203
|
try {
|
|
4167
4204
|
FS.mkdir(d, mode);
|
|
4168
4205
|
} catch(e) {
|
|
@@ -4491,7 +4528,7 @@ async function createWasm() {
|
|
|
4491
4528
|
} else {
|
|
4492
4529
|
// node doesn't exist, try to create it
|
|
4493
4530
|
// Ignore the permission bits here to ensure we can `open` this new
|
|
4494
|
-
// file below. We use chmod below
|
|
4531
|
+
// file below. We use chmod below to apply the permissions once the
|
|
4495
4532
|
// file is open.
|
|
4496
4533
|
node = FS.mknod(path, mode | 0o777, 0);
|
|
4497
4534
|
created = true;
|
|
@@ -4681,33 +4718,29 @@ async function createWasm() {
|
|
|
4681
4718
|
opts.flags = opts.flags || 0;
|
|
4682
4719
|
opts.encoding = opts.encoding || 'binary';
|
|
4683
4720
|
if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
|
|
4684
|
-
|
|
4721
|
+
abort(`Invalid encoding type "${opts.encoding}"`);
|
|
4685
4722
|
}
|
|
4686
|
-
var ret;
|
|
4687
4723
|
var stream = FS.open(path, opts.flags);
|
|
4688
4724
|
var stat = FS.stat(path);
|
|
4689
4725
|
var length = stat.size;
|
|
4690
4726
|
var buf = new Uint8Array(length);
|
|
4691
4727
|
FS.read(stream, buf, 0, length, 0);
|
|
4692
4728
|
if (opts.encoding === 'utf8') {
|
|
4693
|
-
|
|
4694
|
-
} else if (opts.encoding === 'binary') {
|
|
4695
|
-
ret = buf;
|
|
4729
|
+
buf = UTF8ArrayToString(buf);
|
|
4696
4730
|
}
|
|
4697
4731
|
FS.close(stream);
|
|
4698
|
-
return
|
|
4732
|
+
return buf;
|
|
4699
4733
|
},
|
|
4700
4734
|
writeFile(path, data, opts = {}) {
|
|
4701
4735
|
opts.flags = opts.flags || 577;
|
|
4702
4736
|
var stream = FS.open(path, opts.flags, opts.mode);
|
|
4703
4737
|
if (typeof data == 'string') {
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
} else if (ArrayBuffer.isView(data)) {
|
|
4738
|
+
data = new Uint8Array(intArrayFromString(data, true));
|
|
4739
|
+
}
|
|
4740
|
+
if (ArrayBuffer.isView(data)) {
|
|
4708
4741
|
FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
|
|
4709
4742
|
} else {
|
|
4710
|
-
|
|
4743
|
+
abort('Unsupported data type');
|
|
4711
4744
|
}
|
|
4712
4745
|
FS.close(stream);
|
|
4713
4746
|
},
|
|
@@ -5002,12 +5035,11 @@ async function createWasm() {
|
|
|
5002
5035
|
},
|
|
5003
5036
|
forceLoadFile(obj) {
|
|
5004
5037
|
if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
|
|
5005
|
-
if (
|
|
5006
|
-
|
|
5038
|
+
if (globalThis.XMLHttpRequest) {
|
|
5039
|
+
abort("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.");
|
|
5007
5040
|
} else { // Command-line.
|
|
5008
5041
|
try {
|
|
5009
5042
|
obj.contents = readBinary(obj.url);
|
|
5010
|
-
obj.usedBytes = obj.contents.length;
|
|
5011
5043
|
} catch (e) {
|
|
5012
5044
|
throw new FS.ErrnoError(29);
|
|
5013
5045
|
}
|
|
@@ -5035,7 +5067,7 @@ async function createWasm() {
|
|
|
5035
5067
|
var xhr = new XMLHttpRequest();
|
|
5036
5068
|
xhr.open('HEAD', url, false);
|
|
5037
5069
|
xhr.send(null);
|
|
5038
|
-
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))
|
|
5070
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr.status);
|
|
5039
5071
|
var datalength = Number(xhr.getResponseHeader("Content-length"));
|
|
5040
5072
|
var header;
|
|
5041
5073
|
var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
|
|
@@ -5047,8 +5079,8 @@ async function createWasm() {
|
|
|
5047
5079
|
|
|
5048
5080
|
// Function to get a range from the remote URL.
|
|
5049
5081
|
var doXHR = (from, to) => {
|
|
5050
|
-
if (from > to)
|
|
5051
|
-
if (to > datalength-1)
|
|
5082
|
+
if (from > to) abort("invalid range (" + from + ", " + to + ") or no bytes requested!");
|
|
5083
|
+
if (to > datalength-1) abort("only " + datalength + " bytes available! programmer error!");
|
|
5052
5084
|
|
|
5053
5085
|
// TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
|
|
5054
5086
|
var xhr = new XMLHttpRequest();
|
|
@@ -5062,7 +5094,7 @@ async function createWasm() {
|
|
|
5062
5094
|
}
|
|
5063
5095
|
|
|
5064
5096
|
xhr.send(null);
|
|
5065
|
-
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))
|
|
5097
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr.status);
|
|
5066
5098
|
if (xhr.response !== undefined) {
|
|
5067
5099
|
return new Uint8Array(/** @type{Array<number>} */(xhr.response || []));
|
|
5068
5100
|
}
|
|
@@ -5076,7 +5108,7 @@ async function createWasm() {
|
|
|
5076
5108
|
if (typeof lazyArray.chunks[chunkNum] == 'undefined') {
|
|
5077
5109
|
lazyArray.chunks[chunkNum] = doXHR(start, end);
|
|
5078
5110
|
}
|
|
5079
|
-
if (typeof lazyArray.chunks[chunkNum] == 'undefined')
|
|
5111
|
+
if (typeof lazyArray.chunks[chunkNum] == 'undefined') abort('doXHR failed!');
|
|
5080
5112
|
return lazyArray.chunks[chunkNum];
|
|
5081
5113
|
});
|
|
5082
5114
|
|
|
@@ -5106,8 +5138,8 @@ async function createWasm() {
|
|
|
5106
5138
|
}
|
|
5107
5139
|
}
|
|
5108
5140
|
|
|
5109
|
-
if (
|
|
5110
|
-
if (!ENVIRONMENT_IS_WORKER)
|
|
5141
|
+
if (globalThis.XMLHttpRequest) {
|
|
5142
|
+
if (!ENVIRONMENT_IS_WORKER) abort('Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc');
|
|
5111
5143
|
var lazyArray = new LazyUint8Array();
|
|
5112
5144
|
var properties = { isDevice: false, contents: lazyArray };
|
|
5113
5145
|
} else {
|
|
@@ -5132,14 +5164,12 @@ async function createWasm() {
|
|
|
5132
5164
|
});
|
|
5133
5165
|
// override each stream op with one that tries to force load the lazy file first
|
|
5134
5166
|
var stream_ops = {};
|
|
5135
|
-
|
|
5136
|
-
keys.forEach((key) => {
|
|
5137
|
-
var fn = node.stream_ops[key];
|
|
5167
|
+
for (const [key, fn] of Object.entries(node.stream_ops)) {
|
|
5138
5168
|
stream_ops[key] = (...args) => {
|
|
5139
5169
|
FS.forceLoadFile(node);
|
|
5140
5170
|
return fn(...args);
|
|
5141
5171
|
};
|
|
5142
|
-
}
|
|
5172
|
+
}
|
|
5143
5173
|
function writeChunks(stream, buffer, offset, length, position) {
|
|
5144
5174
|
var contents = stream.node.contents;
|
|
5145
5175
|
if (position >= contents.length)
|
|
@@ -5196,7 +5226,6 @@ async function createWasm() {
|
|
|
5196
5226
|
};
|
|
5197
5227
|
|
|
5198
5228
|
var SYSCALLS = {
|
|
5199
|
-
DEFAULT_POLLMASK:5,
|
|
5200
5229
|
calculateAt(dirfd, path, allowEmpty) {
|
|
5201
5230
|
if (PATH.isAbs(path)) {
|
|
5202
5231
|
return path;
|
|
@@ -5218,12 +5247,12 @@ async function createWasm() {
|
|
|
5218
5247
|
return dir + '/' + path;
|
|
5219
5248
|
},
|
|
5220
5249
|
writeStat(buf, stat) {
|
|
5221
|
-
|
|
5222
|
-
|
|
5250
|
+
HEAPU32[((buf)>>2)] = stat.dev;checkInt32(stat.dev);
|
|
5251
|
+
HEAPU32[(((buf)+(4))>>2)] = stat.mode;checkInt32(stat.mode);
|
|
5223
5252
|
HEAPU32[(((buf)+(8))>>2)] = stat.nlink;checkInt32(stat.nlink);
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5253
|
+
HEAPU32[(((buf)+(12))>>2)] = stat.uid;checkInt32(stat.uid);
|
|
5254
|
+
HEAPU32[(((buf)+(16))>>2)] = stat.gid;checkInt32(stat.gid);
|
|
5255
|
+
HEAPU32[(((buf)+(20))>>2)] = stat.rdev;checkInt32(stat.rdev);
|
|
5227
5256
|
HEAP64[(((buf)+(24))>>3)] = BigInt(stat.size);checkInt64(stat.size);
|
|
5228
5257
|
HEAP32[(((buf)+(32))>>2)] = 4096;checkInt32(4096);
|
|
5229
5258
|
HEAP32[(((buf)+(36))>>2)] = stat.blocks;checkInt32(stat.blocks);
|
|
@@ -5240,16 +5269,16 @@ async function createWasm() {
|
|
|
5240
5269
|
return 0;
|
|
5241
5270
|
},
|
|
5242
5271
|
writeStatFs(buf, stats) {
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5272
|
+
HEAPU32[(((buf)+(4))>>2)] = stats.bsize;checkInt32(stats.bsize);
|
|
5273
|
+
HEAPU32[(((buf)+(60))>>2)] = stats.bsize;checkInt32(stats.bsize);
|
|
5274
|
+
HEAP64[(((buf)+(8))>>3)] = BigInt(stats.blocks);checkInt64(stats.blocks);
|
|
5275
|
+
HEAP64[(((buf)+(16))>>3)] = BigInt(stats.bfree);checkInt64(stats.bfree);
|
|
5276
|
+
HEAP64[(((buf)+(24))>>3)] = BigInt(stats.bavail);checkInt64(stats.bavail);
|
|
5277
|
+
HEAP64[(((buf)+(32))>>3)] = BigInt(stats.files);checkInt64(stats.files);
|
|
5278
|
+
HEAP64[(((buf)+(40))>>3)] = BigInt(stats.ffree);checkInt64(stats.ffree);
|
|
5279
|
+
HEAPU32[(((buf)+(48))>>2)] = stats.fsid;checkInt32(stats.fsid);
|
|
5280
|
+
HEAPU32[(((buf)+(64))>>2)] = stats.flags;checkInt32(stats.flags); // ST_NOSUID
|
|
5281
|
+
HEAPU32[(((buf)+(56))>>2)] = stats.namelen;checkInt32(stats.namelen);
|
|
5253
5282
|
},
|
|
5254
5283
|
doMsync(addr, stream, len, flags, offset) {
|
|
5255
5284
|
if (!FS.isFile(stream.node.mode)) {
|
|
@@ -5288,7 +5317,7 @@ async function createWasm() {
|
|
|
5288
5317
|
try {
|
|
5289
5318
|
|
|
5290
5319
|
path = SYSCALLS.getStr(path);
|
|
5291
|
-
assert(flags
|
|
5320
|
+
assert(!flags || flags == 512);
|
|
5292
5321
|
path = SYSCALLS.calculateAt(dirfd, path);
|
|
5293
5322
|
if (amode & ~7) {
|
|
5294
5323
|
// need a valid mode
|
|
@@ -5335,7 +5364,6 @@ async function createWasm() {
|
|
|
5335
5364
|
}
|
|
5336
5365
|
}
|
|
5337
5366
|
|
|
5338
|
-
/** @suppress {duplicate } */
|
|
5339
5367
|
var syscallGetVarargI = () => {
|
|
5340
5368
|
assert(SYSCALLS.varargs != undefined);
|
|
5341
5369
|
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
@@ -5416,7 +5444,7 @@ async function createWasm() {
|
|
|
5416
5444
|
|
|
5417
5445
|
try {
|
|
5418
5446
|
|
|
5419
|
-
if (isNaN(length)) return 61;
|
|
5447
|
+
if (isNaN(length)) return -61;
|
|
5420
5448
|
FS.ftruncate(fd, length);
|
|
5421
5449
|
return 0;
|
|
5422
5450
|
} catch (e) {
|
|
@@ -5552,12 +5580,12 @@ async function createWasm() {
|
|
|
5552
5580
|
|
|
5553
5581
|
path = SYSCALLS.getStr(path);
|
|
5554
5582
|
path = SYSCALLS.calculateAt(dirfd, path);
|
|
5555
|
-
if (flags
|
|
5583
|
+
if (!flags) {
|
|
5556
5584
|
FS.unlink(path);
|
|
5557
5585
|
} else if (flags === 512) {
|
|
5558
5586
|
FS.rmdir(path);
|
|
5559
5587
|
} else {
|
|
5560
|
-
|
|
5588
|
+
return -28;
|
|
5561
5589
|
}
|
|
5562
5590
|
return 0;
|
|
5563
5591
|
} catch (e) {
|
|
@@ -5574,7 +5602,7 @@ async function createWasm() {
|
|
|
5574
5602
|
try {
|
|
5575
5603
|
|
|
5576
5604
|
path = SYSCALLS.getStr(path);
|
|
5577
|
-
assert(flags
|
|
5605
|
+
assert(!flags);
|
|
5578
5606
|
path = SYSCALLS.calculateAt(dirfd, path, true);
|
|
5579
5607
|
var now = Date.now(), atime, mtime;
|
|
5580
5608
|
if (!times) {
|
|
@@ -5666,7 +5694,9 @@ async function createWasm() {
|
|
|
5666
5694
|
|
|
5667
5695
|
try {
|
|
5668
5696
|
|
|
5669
|
-
|
|
5697
|
+
// musl's mmap doesn't allow values over a certain limit
|
|
5698
|
+
// see OFF_MASK in mmap.c.
|
|
5699
|
+
assert(!isNaN(offset));
|
|
5670
5700
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
5671
5701
|
var res = FS.mmap(stream, len, offset, prot, flags);
|
|
5672
5702
|
var ptr = res.ptr;
|
|
@@ -5720,7 +5750,7 @@ async function createWasm() {
|
|
|
5720
5750
|
// Coordinated Universal Time (UTC) and local standard time."), the same
|
|
5721
5751
|
// as returned by stdTimezoneOffset.
|
|
5722
5752
|
// See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
|
|
5723
|
-
HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60;
|
|
5753
|
+
HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60;
|
|
5724
5754
|
|
|
5725
5755
|
HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset);checkInt32(Number(winterOffset != summerOffset));
|
|
5726
5756
|
|
|
@@ -5797,15 +5827,15 @@ async function createWasm() {
|
|
|
5797
5827
|
|
|
5798
5828
|
|
|
5799
5829
|
var growMemory = (size) => {
|
|
5800
|
-
var
|
|
5801
|
-
var pages = ((size -
|
|
5830
|
+
var oldHeapSize = wasmMemory.buffer.byteLength;
|
|
5831
|
+
var pages = ((size - oldHeapSize + 65535) / 65536) | 0;
|
|
5802
5832
|
try {
|
|
5803
5833
|
// round size grow request up to wasm page size (fixed 64KB per spec)
|
|
5804
5834
|
wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size
|
|
5805
5835
|
updateMemoryViews();
|
|
5806
5836
|
return 1 /*success*/;
|
|
5807
5837
|
} catch(e) {
|
|
5808
|
-
err(`growMemory: Attempted to grow heap from ${
|
|
5838
|
+
err(`growMemory: Attempted to grow heap from ${oldHeapSize} bytes to ${size} bytes, but got error: ${e}`);
|
|
5809
5839
|
}
|
|
5810
5840
|
// implicit 0 return to save code size (caller will cast "undefined" into 0
|
|
5811
5841
|
// anyhow)
|
|
@@ -5874,7 +5904,7 @@ async function createWasm() {
|
|
|
5874
5904
|
if (!getEnvStrings.strings) {
|
|
5875
5905
|
// Default values.
|
|
5876
5906
|
// Browser language detection #8751
|
|
5877
|
-
var lang = (
|
|
5907
|
+
var lang = (globalThis.navigator?.language ?? 'C').replace('-', '_') + '.UTF-8';
|
|
5878
5908
|
var env = {
|
|
5879
5909
|
'USER': 'web_user',
|
|
5880
5910
|
'LOGNAME': 'web_user',
|
|
@@ -5901,30 +5931,26 @@ async function createWasm() {
|
|
|
5901
5931
|
return getEnvStrings.strings;
|
|
5902
5932
|
};
|
|
5903
5933
|
|
|
5904
|
-
var stringToAscii = (str, buffer) => {
|
|
5905
|
-
for (var i = 0; i < str.length; ++i) {
|
|
5906
|
-
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff));
|
|
5907
|
-
HEAP8[buffer++] = str.charCodeAt(i);checkInt8(str.charCodeAt(i));
|
|
5908
|
-
}
|
|
5909
|
-
// Null-terminate the string
|
|
5910
|
-
HEAP8[buffer] = 0;checkInt8(0);
|
|
5911
|
-
};
|
|
5912
5934
|
var _environ_get = (__environ, environ_buf) => {
|
|
5913
5935
|
var bufSize = 0;
|
|
5914
|
-
|
|
5936
|
+
var envp = 0;
|
|
5937
|
+
for (var string of getEnvStrings()) {
|
|
5915
5938
|
var ptr = environ_buf + bufSize;
|
|
5916
|
-
HEAPU32[(((__environ)+(
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
}
|
|
5939
|
+
HEAPU32[(((__environ)+(envp))>>2)] = ptr;
|
|
5940
|
+
bufSize += stringToUTF8(string, ptr, Infinity) + 1;
|
|
5941
|
+
envp += 4;
|
|
5942
|
+
}
|
|
5920
5943
|
return 0;
|
|
5921
5944
|
};
|
|
5922
5945
|
|
|
5946
|
+
|
|
5923
5947
|
var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
|
|
5924
5948
|
var strings = getEnvStrings();
|
|
5925
5949
|
HEAPU32[((penviron_count)>>2)] = strings.length;checkInt32(strings.length);
|
|
5926
5950
|
var bufSize = 0;
|
|
5927
|
-
|
|
5951
|
+
for (var string of strings) {
|
|
5952
|
+
bufSize += lengthBytesUTF8(string) + 1;
|
|
5953
|
+
}
|
|
5928
5954
|
HEAPU32[((penviron_buf_size)>>2)] = bufSize;checkInt32(bufSize);
|
|
5929
5955
|
return 0;
|
|
5930
5956
|
};
|
|
@@ -6022,10 +6048,8 @@ async function createWasm() {
|
|
|
6022
6048
|
try {
|
|
6023
6049
|
|
|
6024
6050
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
}
|
|
6028
|
-
return 0; // we can't do anything synchronously; the in-memory FS is already synced to
|
|
6051
|
+
var rtn = stream.stream_ops?.fsync?.(stream);
|
|
6052
|
+
return rtn;
|
|
6029
6053
|
} catch (e) {
|
|
6030
6054
|
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
6031
6055
|
return e.errno;
|
|
@@ -6072,7 +6096,6 @@ async function createWasm() {
|
|
|
6072
6096
|
return func;
|
|
6073
6097
|
};
|
|
6074
6098
|
|
|
6075
|
-
|
|
6076
6099
|
var writeArrayToMemory = (array, buffer) => {
|
|
6077
6100
|
assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
6078
6101
|
HEAP8.set(array, buffer);
|
|
@@ -6093,11 +6116,11 @@ async function createWasm() {
|
|
|
6093
6116
|
|
|
6094
6117
|
|
|
6095
6118
|
/**
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6119
|
+
* @param {string|null=} returnType
|
|
6120
|
+
* @param {Array=} argTypes
|
|
6121
|
+
* @param {Array=} args
|
|
6122
|
+
* @param {Object=} opts
|
|
6123
|
+
*/
|
|
6101
6124
|
var ccall = (ident, returnType, argTypes, args, opts) => {
|
|
6102
6125
|
// For fast lookup of conversion functions
|
|
6103
6126
|
var toC = {
|
|
@@ -6149,10 +6172,10 @@ async function createWasm() {
|
|
|
6149
6172
|
};
|
|
6150
6173
|
|
|
6151
6174
|
/**
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6175
|
+
* @param {string=} returnType
|
|
6176
|
+
* @param {Array=} argTypes
|
|
6177
|
+
* @param {Object=} opts
|
|
6178
|
+
*/
|
|
6156
6179
|
var cwrap = (ident, returnType, argTypes, opts) => {
|
|
6157
6180
|
return (...args) => ccall(ident, returnType, argTypes, args, opts);
|
|
6158
6181
|
};
|
|
@@ -6161,42 +6184,23 @@ async function createWasm() {
|
|
|
6161
6184
|
|
|
6162
6185
|
|
|
6163
6186
|
|
|
6164
|
-
var ALLOC_NORMAL = 0;
|
|
6165
|
-
|
|
6166
|
-
var ALLOC_STACK = 1;
|
|
6167
|
-
|
|
6168
6187
|
|
|
6169
6188
|
|
|
6170
|
-
var
|
|
6171
|
-
var
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
if (allocator == ALLOC_STACK) {
|
|
6176
|
-
ret = stackAlloc(slab.length);
|
|
6177
|
-
} else {
|
|
6178
|
-
ret = _malloc(slab.length);
|
|
6179
|
-
}
|
|
6180
|
-
|
|
6181
|
-
if (!slab.subarray && !slab.slice) {
|
|
6182
|
-
slab = new Uint8Array(slab);
|
|
6183
|
-
}
|
|
6184
|
-
HEAPU8.set(slab, ret);
|
|
6189
|
+
var stringToNewUTF8 = (str) => {
|
|
6190
|
+
var size = lengthBytesUTF8(str) + 1;
|
|
6191
|
+
var ret = _malloc(size);
|
|
6192
|
+
if (ret) stringToUTF8(str, ret, size);
|
|
6185
6193
|
return ret;
|
|
6186
6194
|
};
|
|
6187
6195
|
|
|
6188
6196
|
|
|
6189
|
-
|
|
6190
|
-
var allocateUTF8OnStack = stringToUTF8OnStack;
|
|
6191
|
-
|
|
6192
6197
|
var functionsInTableMap;
|
|
6193
6198
|
|
|
6194
6199
|
var freeTableIndexes = [];
|
|
6195
6200
|
|
|
6196
6201
|
var wasmTableMirror = [];
|
|
6197
6202
|
|
|
6198
|
-
|
|
6199
|
-
var wasmTable;
|
|
6203
|
+
|
|
6200
6204
|
var getWasmTableEntry = (funcPtr) => {
|
|
6201
6205
|
var func = wasmTableMirror[funcPtr];
|
|
6202
6206
|
if (!func) {
|
|
@@ -6225,108 +6229,6 @@ async function createWasm() {
|
|
|
6225
6229
|
freeTableIndexes.push(index);
|
|
6226
6230
|
};
|
|
6227
6231
|
|
|
6228
|
-
var uleb128Encode = (n, target) => {
|
|
6229
|
-
assert(n < 16384);
|
|
6230
|
-
if (n < 128) {
|
|
6231
|
-
target.push(n);
|
|
6232
|
-
} else {
|
|
6233
|
-
target.push((n % 128) | 128, n >> 7);
|
|
6234
|
-
}
|
|
6235
|
-
};
|
|
6236
|
-
|
|
6237
|
-
var sigToWasmTypes = (sig) => {
|
|
6238
|
-
var typeNames = {
|
|
6239
|
-
'i': 'i32',
|
|
6240
|
-
'j': 'i64',
|
|
6241
|
-
'f': 'f32',
|
|
6242
|
-
'd': 'f64',
|
|
6243
|
-
'e': 'externref',
|
|
6244
|
-
'p': 'i32',
|
|
6245
|
-
};
|
|
6246
|
-
var type = {
|
|
6247
|
-
parameters: [],
|
|
6248
|
-
results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
|
|
6249
|
-
};
|
|
6250
|
-
for (var i = 1; i < sig.length; ++i) {
|
|
6251
|
-
assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
|
|
6252
|
-
type.parameters.push(typeNames[sig[i]]);
|
|
6253
|
-
}
|
|
6254
|
-
return type;
|
|
6255
|
-
};
|
|
6256
|
-
|
|
6257
|
-
var generateFuncType = (sig, target) => {
|
|
6258
|
-
var sigRet = sig.slice(0, 1);
|
|
6259
|
-
var sigParam = sig.slice(1);
|
|
6260
|
-
var typeCodes = {
|
|
6261
|
-
'i': 0x7f, // i32
|
|
6262
|
-
'p': 0x7f, // i32
|
|
6263
|
-
'j': 0x7e, // i64
|
|
6264
|
-
'f': 0x7d, // f32
|
|
6265
|
-
'd': 0x7c, // f64
|
|
6266
|
-
'e': 0x6f, // externref
|
|
6267
|
-
};
|
|
6268
|
-
|
|
6269
|
-
// Parameters, length + signatures
|
|
6270
|
-
target.push(0x60 /* form: func */);
|
|
6271
|
-
uleb128Encode(sigParam.length, target);
|
|
6272
|
-
for (var paramType of sigParam) {
|
|
6273
|
-
assert(paramType in typeCodes, `invalid signature char: ${paramType}`);
|
|
6274
|
-
target.push(typeCodes[paramType]);
|
|
6275
|
-
}
|
|
6276
|
-
|
|
6277
|
-
// Return values, length + signatures
|
|
6278
|
-
// With no multi-return in MVP, either 0 (void) or 1 (anything else)
|
|
6279
|
-
if (sigRet == 'v') {
|
|
6280
|
-
target.push(0x00);
|
|
6281
|
-
} else {
|
|
6282
|
-
target.push(0x01, typeCodes[sigRet]);
|
|
6283
|
-
}
|
|
6284
|
-
};
|
|
6285
|
-
var convertJsFunctionToWasm = (func, sig) => {
|
|
6286
|
-
|
|
6287
|
-
// If the type reflection proposal is available, use the new
|
|
6288
|
-
// "WebAssembly.Function" constructor.
|
|
6289
|
-
// Otherwise, construct a minimal wasm module importing the JS function and
|
|
6290
|
-
// re-exporting it.
|
|
6291
|
-
if (typeof WebAssembly.Function == "function") {
|
|
6292
|
-
return new WebAssembly.Function(sigToWasmTypes(sig), func);
|
|
6293
|
-
}
|
|
6294
|
-
|
|
6295
|
-
// The module is static, with the exception of the type section, which is
|
|
6296
|
-
// generated based on the signature passed in.
|
|
6297
|
-
var typeSectionBody = [
|
|
6298
|
-
0x01, // count: 1
|
|
6299
|
-
];
|
|
6300
|
-
generateFuncType(sig, typeSectionBody);
|
|
6301
|
-
|
|
6302
|
-
// Rest of the module is static
|
|
6303
|
-
var bytes = [
|
|
6304
|
-
0x00, 0x61, 0x73, 0x6d, // magic ("\0asm")
|
|
6305
|
-
0x01, 0x00, 0x00, 0x00, // version: 1
|
|
6306
|
-
0x01, // Type section code
|
|
6307
|
-
];
|
|
6308
|
-
// Write the overall length of the type section followed by the body
|
|
6309
|
-
uleb128Encode(typeSectionBody.length, bytes);
|
|
6310
|
-
bytes.push(...typeSectionBody);
|
|
6311
|
-
|
|
6312
|
-
// The rest of the module is static
|
|
6313
|
-
bytes.push(
|
|
6314
|
-
0x02, 0x07, // import section
|
|
6315
|
-
// (import "e" "f" (func 0 (type 0)))
|
|
6316
|
-
0x01, 0x01, 0x65, 0x01, 0x66, 0x00, 0x00,
|
|
6317
|
-
0x07, 0x05, // export section
|
|
6318
|
-
// (export "f" (func 0 (type 0)))
|
|
6319
|
-
0x01, 0x01, 0x66, 0x00, 0x00,
|
|
6320
|
-
);
|
|
6321
|
-
|
|
6322
|
-
// We can compile this wasm module synchronously because it is very small.
|
|
6323
|
-
// This accepts an import (at "e.f"), that it reroutes to an export (at "f")
|
|
6324
|
-
var module = new WebAssembly.Module(new Uint8Array(bytes));
|
|
6325
|
-
var instance = new WebAssembly.Instance(module, { 'e': { 'f': func } });
|
|
6326
|
-
var wrappedFunc = instance.exports['f'];
|
|
6327
|
-
return wrappedFunc;
|
|
6328
|
-
};
|
|
6329
|
-
|
|
6330
6232
|
|
|
6331
6233
|
var updateTableMap = (offset, count) => {
|
|
6332
6234
|
if (functionsInTableMap) {
|
|
@@ -6357,20 +6259,74 @@ async function createWasm() {
|
|
|
6357
6259
|
if (freeTableIndexes.length) {
|
|
6358
6260
|
return freeTableIndexes.pop();
|
|
6359
6261
|
}
|
|
6360
|
-
// Grow the table
|
|
6361
6262
|
try {
|
|
6362
|
-
|
|
6363
|
-
wasmTable
|
|
6263
|
+
// Grow the table
|
|
6264
|
+
return wasmTable['grow'](1);
|
|
6364
6265
|
} catch (err) {
|
|
6365
6266
|
if (!(err instanceof RangeError)) {
|
|
6366
6267
|
throw err;
|
|
6367
6268
|
}
|
|
6368
|
-
|
|
6269
|
+
abort('Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.');
|
|
6369
6270
|
}
|
|
6370
|
-
return wasmTable.length - 1;
|
|
6371
6271
|
};
|
|
6372
6272
|
|
|
6373
6273
|
|
|
6274
|
+
var uleb128EncodeWithLen = (arr) => {
|
|
6275
|
+
const n = arr.length;
|
|
6276
|
+
assert(n < 16384);
|
|
6277
|
+
// Note: this LEB128 length encoding produces extra byte for n < 128,
|
|
6278
|
+
// but we don't care as it's only used in a temporary representation.
|
|
6279
|
+
return [(n % 128) | 128, n >> 7, ...arr];
|
|
6280
|
+
};
|
|
6281
|
+
|
|
6282
|
+
|
|
6283
|
+
var wasmTypeCodes = {
|
|
6284
|
+
'i': 0x7f, // i32
|
|
6285
|
+
'p': 0x7f, // i32
|
|
6286
|
+
'j': 0x7e, // i64
|
|
6287
|
+
'f': 0x7d, // f32
|
|
6288
|
+
'd': 0x7c, // f64
|
|
6289
|
+
'e': 0x6f, // externref
|
|
6290
|
+
};
|
|
6291
|
+
var generateTypePack = (types) => uleb128EncodeWithLen(Array.from(types, (type) => {
|
|
6292
|
+
var code = wasmTypeCodes[type];
|
|
6293
|
+
assert(code, `invalid signature char: ${type}`);
|
|
6294
|
+
return code;
|
|
6295
|
+
}));
|
|
6296
|
+
var convertJsFunctionToWasm = (func, sig) => {
|
|
6297
|
+
|
|
6298
|
+
// Rest of the module is static
|
|
6299
|
+
var bytes = Uint8Array.of(
|
|
6300
|
+
0x00, 0x61, 0x73, 0x6d, // magic ("\0asm")
|
|
6301
|
+
0x01, 0x00, 0x00, 0x00, // version: 1
|
|
6302
|
+
0x01, // Type section code
|
|
6303
|
+
// The module is static, with the exception of the type section, which is
|
|
6304
|
+
// generated based on the signature passed in.
|
|
6305
|
+
...uleb128EncodeWithLen([
|
|
6306
|
+
0x01, // count: 1
|
|
6307
|
+
0x60 /* form: func */,
|
|
6308
|
+
// param types
|
|
6309
|
+
...generateTypePack(sig.slice(1)),
|
|
6310
|
+
// return types (for now only supporting [] if `void` and single [T] otherwise)
|
|
6311
|
+
...generateTypePack(sig[0] === 'v' ? '' : sig[0])
|
|
6312
|
+
]),
|
|
6313
|
+
// The rest of the module is static
|
|
6314
|
+
0x02, 0x07, // import section
|
|
6315
|
+
// (import "e" "f" (func 0 (type 0)))
|
|
6316
|
+
0x01, 0x01, 0x65, 0x01, 0x66, 0x00, 0x00,
|
|
6317
|
+
0x07, 0x05, // export section
|
|
6318
|
+
// (export "f" (func 0 (type 0)))
|
|
6319
|
+
0x01, 0x01, 0x66, 0x00, 0x00,
|
|
6320
|
+
);
|
|
6321
|
+
|
|
6322
|
+
// We can compile this wasm module synchronously because it is very small.
|
|
6323
|
+
// This accepts an import (at "e.f"), that it reroutes to an export (at "f")
|
|
6324
|
+
var module = new WebAssembly.Module(bytes);
|
|
6325
|
+
var instance = new WebAssembly.Instance(module, { 'e': { 'f': func } });
|
|
6326
|
+
var wrappedFunc = instance.exports['f'];
|
|
6327
|
+
return wrappedFunc;
|
|
6328
|
+
};
|
|
6329
|
+
|
|
6374
6330
|
|
|
6375
6331
|
|
|
6376
6332
|
/** @param {string=} sig */
|
|
@@ -6396,7 +6352,7 @@ async function createWasm() {
|
|
|
6396
6352
|
|
|
6397
6353
|
// Set the new value.
|
|
6398
6354
|
try {
|
|
6399
|
-
// Attempting to call this with JS function will cause
|
|
6355
|
+
// Attempting to call this with JS function will cause table.set() to fail
|
|
6400
6356
|
setWasmTableEntry(ret, func);
|
|
6401
6357
|
} catch (err) {
|
|
6402
6358
|
if (!(err instanceof TypeError)) {
|
|
@@ -6413,165 +6369,65 @@ async function createWasm() {
|
|
|
6413
6369
|
};
|
|
6414
6370
|
|
|
6415
6371
|
FS.createPreloadedFile = FS_createPreloadedFile;
|
|
6416
|
-
FS.
|
|
6417
|
-
|
|
6418
|
-
;
|
|
6372
|
+
FS.preloadFile = FS_preloadFile;
|
|
6373
|
+
FS.staticInit();;
|
|
6419
6374
|
// End JS library code
|
|
6420
6375
|
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
var wasmImports = {
|
|
6425
|
-
/** @export */
|
|
6426
|
-
__assert_fail: ___assert_fail,
|
|
6427
|
-
/** @export */
|
|
6428
|
-
__handle_stack_overflow: ___handle_stack_overflow,
|
|
6429
|
-
/** @export */
|
|
6430
|
-
__syscall_chmod: ___syscall_chmod,
|
|
6431
|
-
/** @export */
|
|
6432
|
-
__syscall_faccessat: ___syscall_faccessat,
|
|
6433
|
-
/** @export */
|
|
6434
|
-
__syscall_fchmod: ___syscall_fchmod,
|
|
6435
|
-
/** @export */
|
|
6436
|
-
__syscall_fchown32: ___syscall_fchown32,
|
|
6437
|
-
/** @export */
|
|
6438
|
-
__syscall_fcntl64: ___syscall_fcntl64,
|
|
6439
|
-
/** @export */
|
|
6440
|
-
__syscall_fstat64: ___syscall_fstat64,
|
|
6441
|
-
/** @export */
|
|
6442
|
-
__syscall_ftruncate64: ___syscall_ftruncate64,
|
|
6443
|
-
/** @export */
|
|
6444
|
-
__syscall_getcwd: ___syscall_getcwd,
|
|
6445
|
-
/** @export */
|
|
6446
|
-
__syscall_lstat64: ___syscall_lstat64,
|
|
6447
|
-
/** @export */
|
|
6448
|
-
__syscall_mkdirat: ___syscall_mkdirat,
|
|
6449
|
-
/** @export */
|
|
6450
|
-
__syscall_newfstatat: ___syscall_newfstatat,
|
|
6451
|
-
/** @export */
|
|
6452
|
-
__syscall_openat: ___syscall_openat,
|
|
6453
|
-
/** @export */
|
|
6454
|
-
__syscall_readlinkat: ___syscall_readlinkat,
|
|
6455
|
-
/** @export */
|
|
6456
|
-
__syscall_rmdir: ___syscall_rmdir,
|
|
6457
|
-
/** @export */
|
|
6458
|
-
__syscall_stat64: ___syscall_stat64,
|
|
6459
|
-
/** @export */
|
|
6460
|
-
__syscall_unlinkat: ___syscall_unlinkat,
|
|
6461
|
-
/** @export */
|
|
6462
|
-
__syscall_utimensat: ___syscall_utimensat,
|
|
6463
|
-
/** @export */
|
|
6464
|
-
_abort_js: __abort_js,
|
|
6465
|
-
/** @export */
|
|
6466
|
-
_localtime_js: __localtime_js,
|
|
6467
|
-
/** @export */
|
|
6468
|
-
_mmap_js: __mmap_js,
|
|
6469
|
-
/** @export */
|
|
6470
|
-
_munmap_js: __munmap_js,
|
|
6471
|
-
/** @export */
|
|
6472
|
-
_tzset_js: __tzset_js,
|
|
6473
|
-
/** @export */
|
|
6474
|
-
clock_time_get: _clock_time_get,
|
|
6475
|
-
/** @export */
|
|
6476
|
-
emscripten_date_now: _emscripten_date_now,
|
|
6477
|
-
/** @export */
|
|
6478
|
-
emscripten_get_heap_max: _emscripten_get_heap_max,
|
|
6479
|
-
/** @export */
|
|
6480
|
-
emscripten_get_now: _emscripten_get_now,
|
|
6481
|
-
/** @export */
|
|
6482
|
-
emscripten_resize_heap: _emscripten_resize_heap,
|
|
6483
|
-
/** @export */
|
|
6484
|
-
environ_get: _environ_get,
|
|
6485
|
-
/** @export */
|
|
6486
|
-
environ_sizes_get: _environ_sizes_get,
|
|
6487
|
-
/** @export */
|
|
6488
|
-
fd_close: _fd_close,
|
|
6489
|
-
/** @export */
|
|
6490
|
-
fd_fdstat_get: _fd_fdstat_get,
|
|
6491
|
-
/** @export */
|
|
6492
|
-
fd_read: _fd_read,
|
|
6493
|
-
/** @export */
|
|
6494
|
-
fd_seek: _fd_seek,
|
|
6495
|
-
/** @export */
|
|
6496
|
-
fd_sync: _fd_sync,
|
|
6497
|
-
/** @export */
|
|
6498
|
-
fd_write: _fd_write
|
|
6499
|
-
};
|
|
6500
|
-
var wasmExports;
|
|
6501
|
-
createWasm();
|
|
6502
|
-
var ___wasm_call_ctors = createExportWrapper('__wasm_call_ctors', 0);
|
|
6503
|
-
var _sqlite3_free = Module['_sqlite3_free'] = createExportWrapper('sqlite3_free', 1);
|
|
6504
|
-
var _sqlite3_value_text = Module['_sqlite3_value_text'] = createExportWrapper('sqlite3_value_text', 1);
|
|
6505
|
-
var _sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = createExportWrapper('sqlite3_prepare_v2', 5);
|
|
6506
|
-
var _sqlite3_step = Module['_sqlite3_step'] = createExportWrapper('sqlite3_step', 1);
|
|
6507
|
-
var _sqlite3_reset = Module['_sqlite3_reset'] = createExportWrapper('sqlite3_reset', 1);
|
|
6508
|
-
var _sqlite3_exec = Module['_sqlite3_exec'] = createExportWrapper('sqlite3_exec', 5);
|
|
6509
|
-
var _sqlite3_finalize = Module['_sqlite3_finalize'] = createExportWrapper('sqlite3_finalize', 1);
|
|
6510
|
-
var _sqlite3_column_name = Module['_sqlite3_column_name'] = createExportWrapper('sqlite3_column_name', 2);
|
|
6511
|
-
var _sqlite3_column_text = Module['_sqlite3_column_text'] = createExportWrapper('sqlite3_column_text', 2);
|
|
6512
|
-
var _sqlite3_column_type = Module['_sqlite3_column_type'] = createExportWrapper('sqlite3_column_type', 2);
|
|
6513
|
-
var _sqlite3_errmsg = Module['_sqlite3_errmsg'] = createExportWrapper('sqlite3_errmsg', 1);
|
|
6514
|
-
var _sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = createExportWrapper('sqlite3_clear_bindings', 1);
|
|
6515
|
-
var _sqlite3_value_blob = Module['_sqlite3_value_blob'] = createExportWrapper('sqlite3_value_blob', 1);
|
|
6516
|
-
var _sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = createExportWrapper('sqlite3_value_bytes', 1);
|
|
6517
|
-
var _sqlite3_value_double = Module['_sqlite3_value_double'] = createExportWrapper('sqlite3_value_double', 1);
|
|
6518
|
-
var _sqlite3_value_int = Module['_sqlite3_value_int'] = createExportWrapper('sqlite3_value_int', 1);
|
|
6519
|
-
var _sqlite3_value_type = Module['_sqlite3_value_type'] = createExportWrapper('sqlite3_value_type', 1);
|
|
6520
|
-
var _sqlite3_result_blob = Module['_sqlite3_result_blob'] = createExportWrapper('sqlite3_result_blob', 4);
|
|
6521
|
-
var _sqlite3_result_double = Module['_sqlite3_result_double'] = createExportWrapper('sqlite3_result_double', 2);
|
|
6522
|
-
var _sqlite3_result_error = Module['_sqlite3_result_error'] = createExportWrapper('sqlite3_result_error', 3);
|
|
6523
|
-
var _sqlite3_result_int = Module['_sqlite3_result_int'] = createExportWrapper('sqlite3_result_int', 2);
|
|
6524
|
-
var _sqlite3_result_int64 = Module['_sqlite3_result_int64'] = createExportWrapper('sqlite3_result_int64', 2);
|
|
6525
|
-
var _sqlite3_result_null = Module['_sqlite3_result_null'] = createExportWrapper('sqlite3_result_null', 1);
|
|
6526
|
-
var _sqlite3_result_text = Module['_sqlite3_result_text'] = createExportWrapper('sqlite3_result_text', 4);
|
|
6527
|
-
var _sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = createExportWrapper('sqlite3_aggregate_context', 2);
|
|
6528
|
-
var _sqlite3_column_count = Module['_sqlite3_column_count'] = createExportWrapper('sqlite3_column_count', 1);
|
|
6529
|
-
var _sqlite3_data_count = Module['_sqlite3_data_count'] = createExportWrapper('sqlite3_data_count', 1);
|
|
6530
|
-
var _sqlite3_column_blob = Module['_sqlite3_column_blob'] = createExportWrapper('sqlite3_column_blob', 2);
|
|
6531
|
-
var _sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = createExportWrapper('sqlite3_column_bytes', 2);
|
|
6532
|
-
var _sqlite3_column_double = Module['_sqlite3_column_double'] = createExportWrapper('sqlite3_column_double', 2);
|
|
6533
|
-
var _sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = createExportWrapper('sqlite3_bind_blob', 5);
|
|
6534
|
-
var _sqlite3_bind_double = Module['_sqlite3_bind_double'] = createExportWrapper('sqlite3_bind_double', 3);
|
|
6535
|
-
var _sqlite3_bind_int = Module['_sqlite3_bind_int'] = createExportWrapper('sqlite3_bind_int', 3);
|
|
6536
|
-
var _sqlite3_bind_text = Module['_sqlite3_bind_text'] = createExportWrapper('sqlite3_bind_text', 5);
|
|
6537
|
-
var _sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = createExportWrapper('sqlite3_bind_parameter_index', 2);
|
|
6538
|
-
var _sqlite3_sql = Module['_sqlite3_sql'] = createExportWrapper('sqlite3_sql', 1);
|
|
6539
|
-
var _sqlite3_normalized_sql = Module['_sqlite3_normalized_sql'] = createExportWrapper('sqlite3_normalized_sql', 1);
|
|
6540
|
-
var _sqlite3_changes = Module['_sqlite3_changes'] = createExportWrapper('sqlite3_changes', 1);
|
|
6541
|
-
var _sqlite3_close_v2 = Module['_sqlite3_close_v2'] = createExportWrapper('sqlite3_close_v2', 1);
|
|
6542
|
-
var _sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = createExportWrapper('sqlite3_create_function_v2', 9);
|
|
6543
|
-
var _sqlite3_update_hook = Module['_sqlite3_update_hook'] = createExportWrapper('sqlite3_update_hook', 3);
|
|
6544
|
-
var _sqlite3_open = Module['_sqlite3_open'] = createExportWrapper('sqlite3_open', 2);
|
|
6545
|
-
var _strerror = createExportWrapper('strerror', 1);
|
|
6546
|
-
var _malloc = Module['_malloc'] = createExportWrapper('malloc', 1);
|
|
6547
|
-
var _free = Module['_free'] = createExportWrapper('free', 1);
|
|
6548
|
-
var _RegisterExtensionFunctions = Module['_RegisterExtensionFunctions'] = createExportWrapper('RegisterExtensionFunctions', 1);
|
|
6549
|
-
var _fflush = createExportWrapper('fflush', 1);
|
|
6550
|
-
var _emscripten_builtin_memalign = createExportWrapper('emscripten_builtin_memalign', 2);
|
|
6551
|
-
var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
|
|
6552
|
-
var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])();
|
|
6553
|
-
var _emscripten_stack_get_base = () => (_emscripten_stack_get_base = wasmExports['emscripten_stack_get_base'])();
|
|
6554
|
-
var _emscripten_stack_get_end = () => (_emscripten_stack_get_end = wasmExports['emscripten_stack_get_end'])();
|
|
6555
|
-
var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
|
|
6556
|
-
var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
|
|
6557
|
-
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
|
6558
|
-
var ___set_stack_limits = Module['___set_stack_limits'] = createExportWrapper('__set_stack_limits', 2);
|
|
6376
|
+
// include: postlibrary.js
|
|
6377
|
+
// This file is included after the automatically-generated JS library code
|
|
6378
|
+
// but before the wasm module is created.
|
|
6559
6379
|
|
|
6380
|
+
{
|
|
6560
6381
|
|
|
6561
|
-
//
|
|
6562
|
-
|
|
6382
|
+
// Begin ATMODULES hooks
|
|
6383
|
+
if (Module['noExitRuntime']) noExitRuntime = Module['noExitRuntime'];
|
|
6384
|
+
if (Module['preloadPlugins']) preloadPlugins = Module['preloadPlugins'];
|
|
6385
|
+
if (Module['print']) out = Module['print'];
|
|
6386
|
+
if (Module['printErr']) err = Module['printErr'];
|
|
6387
|
+
if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];
|
|
6388
|
+
// End ATMODULES hooks
|
|
6389
|
+
|
|
6390
|
+
checkIncomingModuleAPI();
|
|
6391
|
+
|
|
6392
|
+
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
6393
|
+
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
6394
|
+
|
|
6395
|
+
// Assertions on removed incoming Module JS APIs.
|
|
6396
|
+
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
6397
|
+
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
|
|
6398
|
+
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
6399
|
+
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
|
|
6400
|
+
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
|
|
6401
|
+
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
|
|
6402
|
+
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
|
|
6403
|
+
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
|
|
6404
|
+
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
|
|
6405
|
+
assert(typeof Module['ENVIRONMENT'] == 'undefined', 'Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
|
|
6406
|
+
assert(typeof Module['STACK_SIZE'] == 'undefined', 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
|
|
6407
|
+
// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY
|
|
6408
|
+
assert(typeof Module['wasmMemory'] == 'undefined', 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');
|
|
6409
|
+
assert(typeof Module['INITIAL_MEMORY'] == 'undefined', 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');
|
|
6410
|
+
|
|
6411
|
+
if (Module['preInit']) {
|
|
6412
|
+
if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
|
|
6413
|
+
while (Module['preInit'].length > 0) {
|
|
6414
|
+
Module['preInit'].shift()();
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6417
|
+
consumedModuleProp('preInit');
|
|
6418
|
+
}
|
|
6563
6419
|
|
|
6564
|
-
|
|
6565
|
-
Module['
|
|
6566
|
-
Module['
|
|
6567
|
-
Module['
|
|
6568
|
-
Module['
|
|
6569
|
-
Module['
|
|
6570
|
-
Module['
|
|
6571
|
-
Module['
|
|
6572
|
-
Module['
|
|
6573
|
-
Module['
|
|
6574
|
-
var missingLibrarySymbols = [
|
|
6420
|
+
// Begin runtime exports
|
|
6421
|
+
Module['stackSave'] = stackSave;
|
|
6422
|
+
Module['stackRestore'] = stackRestore;
|
|
6423
|
+
Module['stackAlloc'] = stackAlloc;
|
|
6424
|
+
Module['cwrap'] = cwrap;
|
|
6425
|
+
Module['addFunction'] = addFunction;
|
|
6426
|
+
Module['removeFunction'] = removeFunction;
|
|
6427
|
+
Module['UTF8ToString'] = UTF8ToString;
|
|
6428
|
+
Module['stringToNewUTF8'] = stringToNewUTF8;
|
|
6429
|
+
Module['writeArrayToMemory'] = writeArrayToMemory;
|
|
6430
|
+
var missingLibrarySymbols = [
|
|
6575
6431
|
'writeI53ToI64',
|
|
6576
6432
|
'writeI53ToI64Clamped',
|
|
6577
6433
|
'writeI53ToI64Signaling',
|
|
@@ -6583,17 +6439,17 @@ var missingLibrarySymbols = [
|
|
|
6583
6439
|
'convertU32PairToI53',
|
|
6584
6440
|
'getTempRet0',
|
|
6585
6441
|
'setTempRet0',
|
|
6442
|
+
'createNamedFunction',
|
|
6586
6443
|
'exitJS',
|
|
6444
|
+
'withStackSave',
|
|
6587
6445
|
'inetPton4',
|
|
6588
6446
|
'inetNtop4',
|
|
6589
6447
|
'inetPton6',
|
|
6590
6448
|
'inetNtop6',
|
|
6591
6449
|
'readSockaddr',
|
|
6592
6450
|
'writeSockaddr',
|
|
6593
|
-
'emscriptenLog',
|
|
6594
6451
|
'readEmAsmArgs',
|
|
6595
6452
|
'jstoi_q',
|
|
6596
|
-
'listenOnce',
|
|
6597
6453
|
'autoResumeAudioContext',
|
|
6598
6454
|
'getDynCaller',
|
|
6599
6455
|
'dynCall',
|
|
@@ -6605,7 +6461,6 @@ var missingLibrarySymbols = [
|
|
|
6605
6461
|
'maybeExit',
|
|
6606
6462
|
'asmjsMangle',
|
|
6607
6463
|
'HandleAllocator',
|
|
6608
|
-
'getNativeTypeSize',
|
|
6609
6464
|
'addOnInit',
|
|
6610
6465
|
'addOnPostCtor',
|
|
6611
6466
|
'addOnPreMain',
|
|
@@ -6614,20 +6469,15 @@ var missingLibrarySymbols = [
|
|
|
6614
6469
|
'STACK_ALIGN',
|
|
6615
6470
|
'POINTER_SIZE',
|
|
6616
6471
|
'ASSERTIONS',
|
|
6617
|
-
'reallyNegative',
|
|
6618
|
-
'unSign',
|
|
6619
|
-
'strLen',
|
|
6620
|
-
'reSign',
|
|
6621
|
-
'formatString',
|
|
6622
6472
|
'intArrayToString',
|
|
6623
6473
|
'AsciiToString',
|
|
6474
|
+
'stringToAscii',
|
|
6624
6475
|
'UTF16ToString',
|
|
6625
6476
|
'stringToUTF16',
|
|
6626
6477
|
'lengthBytesUTF16',
|
|
6627
6478
|
'UTF32ToString',
|
|
6628
6479
|
'stringToUTF32',
|
|
6629
6480
|
'lengthBytesUTF32',
|
|
6630
|
-
'stringToNewUTF8',
|
|
6631
6481
|
'registerKeyEventCallback',
|
|
6632
6482
|
'maybeCStringToJsString',
|
|
6633
6483
|
'findEventTarget',
|
|
@@ -6665,7 +6515,6 @@ var missingLibrarySymbols = [
|
|
|
6665
6515
|
'registerGamepadEventCallback',
|
|
6666
6516
|
'registerBeforeUnloadEventCallback',
|
|
6667
6517
|
'fillBatteryEventData',
|
|
6668
|
-
'battery',
|
|
6669
6518
|
'registerBatteryEventCallback',
|
|
6670
6519
|
'setCanvasElementSize',
|
|
6671
6520
|
'getCanvasElementSize',
|
|
@@ -6691,7 +6540,6 @@ var missingLibrarySymbols = [
|
|
|
6691
6540
|
'addDays',
|
|
6692
6541
|
'getSocketFromFD',
|
|
6693
6542
|
'getSocketAddress',
|
|
6694
|
-
'FS_unlink',
|
|
6695
6543
|
'FS_mkdirTree',
|
|
6696
6544
|
'_setNetworkCallback',
|
|
6697
6545
|
'heapObjectForWebGLType',
|
|
@@ -6716,24 +6564,36 @@ var missingLibrarySymbols = [
|
|
|
6716
6564
|
'writeGLArray',
|
|
6717
6565
|
'registerWebGlEventCallback',
|
|
6718
6566
|
'runAndAbortIfError',
|
|
6567
|
+
'ALLOC_NORMAL',
|
|
6568
|
+
'ALLOC_STACK',
|
|
6569
|
+
'allocate',
|
|
6719
6570
|
'writeStringToMemory',
|
|
6720
6571
|
'writeAsciiToMemory',
|
|
6721
|
-
'
|
|
6572
|
+
'allocateUTF8',
|
|
6573
|
+
'allocateUTF8OnStack',
|
|
6722
6574
|
'demangle',
|
|
6723
6575
|
'stackTrace',
|
|
6576
|
+
'getNativeTypeSize',
|
|
6724
6577
|
];
|
|
6725
6578
|
missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
6726
6579
|
|
|
6727
|
-
var unexportedSymbols = [
|
|
6580
|
+
var unexportedSymbols = [
|
|
6728
6581
|
'run',
|
|
6729
|
-
'addRunDependency',
|
|
6730
|
-
'removeRunDependency',
|
|
6731
6582
|
'out',
|
|
6732
6583
|
'err',
|
|
6733
6584
|
'callMain',
|
|
6734
6585
|
'abort',
|
|
6735
|
-
'wasmMemory',
|
|
6736
6586
|
'wasmExports',
|
|
6587
|
+
'HEAPF32',
|
|
6588
|
+
'HEAPF64',
|
|
6589
|
+
'HEAP8',
|
|
6590
|
+
'HEAPU8',
|
|
6591
|
+
'HEAP16',
|
|
6592
|
+
'HEAPU16',
|
|
6593
|
+
'HEAP32',
|
|
6594
|
+
'HEAPU32',
|
|
6595
|
+
'HEAP64',
|
|
6596
|
+
'HEAPU64',
|
|
6737
6597
|
'writeStackCookie',
|
|
6738
6598
|
'checkStackCookie',
|
|
6739
6599
|
'readI53FromI64',
|
|
@@ -6754,20 +6614,19 @@ var unexportedSymbols = [
|
|
|
6754
6614
|
'timers',
|
|
6755
6615
|
'warnOnce',
|
|
6756
6616
|
'readEmAsmArgsArray',
|
|
6757
|
-
'jstoi_s',
|
|
6758
6617
|
'getExecutableName',
|
|
6759
6618
|
'asyncLoad',
|
|
6760
6619
|
'alignMemory',
|
|
6761
6620
|
'mmapAlloc',
|
|
6762
6621
|
'wasmTable',
|
|
6622
|
+
'wasmMemory',
|
|
6623
|
+
'getUniqueRunDependency',
|
|
6763
6624
|
'noExitRuntime',
|
|
6625
|
+
'addRunDependency',
|
|
6626
|
+
'removeRunDependency',
|
|
6764
6627
|
'addOnPreRun',
|
|
6765
6628
|
'addOnPostRun',
|
|
6766
|
-
'getCFunc',
|
|
6767
6629
|
'ccall',
|
|
6768
|
-
'uleb128Encode',
|
|
6769
|
-
'sigToWasmTypes',
|
|
6770
|
-
'generateFuncType',
|
|
6771
6630
|
'convertJsFunctionToWasm',
|
|
6772
6631
|
'freeTableIndexes',
|
|
6773
6632
|
'functionsInTableMap',
|
|
@@ -6784,10 +6643,8 @@ var unexportedSymbols = [
|
|
|
6784
6643
|
'stringToUTF8',
|
|
6785
6644
|
'lengthBytesUTF8',
|
|
6786
6645
|
'intArrayFromString',
|
|
6787
|
-
'stringToAscii',
|
|
6788
6646
|
'UTF16Decoder',
|
|
6789
6647
|
'stringToUTF8OnStack',
|
|
6790
|
-
'writeArrayToMemory',
|
|
6791
6648
|
'JSEvents',
|
|
6792
6649
|
'specialHTMLTargets',
|
|
6793
6650
|
'findCanvasEventTarget',
|
|
@@ -6809,6 +6666,11 @@ var unexportedSymbols = [
|
|
|
6809
6666
|
'exceptionLast',
|
|
6810
6667
|
'exceptionCaught',
|
|
6811
6668
|
'Browser',
|
|
6669
|
+
'requestFullscreen',
|
|
6670
|
+
'requestFullScreen',
|
|
6671
|
+
'setCanvasSize',
|
|
6672
|
+
'getUserMedia',
|
|
6673
|
+
'createContext',
|
|
6812
6674
|
'getPreloadedImageData__data',
|
|
6813
6675
|
'wget',
|
|
6814
6676
|
'MONTH_DAYS_REGULAR',
|
|
@@ -6820,16 +6682,128 @@ var unexportedSymbols = [
|
|
|
6820
6682
|
'SYSCALLS',
|
|
6821
6683
|
'preloadPlugins',
|
|
6822
6684
|
'FS_createPreloadedFile',
|
|
6685
|
+
'FS_preloadFile',
|
|
6823
6686
|
'FS_modeStringToFlags',
|
|
6824
6687
|
'FS_getMode',
|
|
6825
6688
|
'FS_stdin_getChar_buffer',
|
|
6826
6689
|
'FS_stdin_getChar',
|
|
6690
|
+
'FS_unlink',
|
|
6827
6691
|
'FS_createPath',
|
|
6828
6692
|
'FS_createDevice',
|
|
6829
6693
|
'FS_readFile',
|
|
6830
6694
|
'FS',
|
|
6695
|
+
'FS_root',
|
|
6696
|
+
'FS_mounts',
|
|
6697
|
+
'FS_devices',
|
|
6698
|
+
'FS_streams',
|
|
6699
|
+
'FS_nextInode',
|
|
6700
|
+
'FS_nameTable',
|
|
6701
|
+
'FS_currentPath',
|
|
6702
|
+
'FS_initialized',
|
|
6703
|
+
'FS_ignorePermissions',
|
|
6704
|
+
'FS_filesystems',
|
|
6705
|
+
'FS_syncFSRequests',
|
|
6706
|
+
'FS_readFiles',
|
|
6707
|
+
'FS_lookupPath',
|
|
6708
|
+
'FS_getPath',
|
|
6709
|
+
'FS_hashName',
|
|
6710
|
+
'FS_hashAddNode',
|
|
6711
|
+
'FS_hashRemoveNode',
|
|
6712
|
+
'FS_lookupNode',
|
|
6713
|
+
'FS_createNode',
|
|
6714
|
+
'FS_destroyNode',
|
|
6715
|
+
'FS_isRoot',
|
|
6716
|
+
'FS_isMountpoint',
|
|
6717
|
+
'FS_isFile',
|
|
6718
|
+
'FS_isDir',
|
|
6719
|
+
'FS_isLink',
|
|
6720
|
+
'FS_isChrdev',
|
|
6721
|
+
'FS_isBlkdev',
|
|
6722
|
+
'FS_isFIFO',
|
|
6723
|
+
'FS_isSocket',
|
|
6724
|
+
'FS_flagsToPermissionString',
|
|
6725
|
+
'FS_nodePermissions',
|
|
6726
|
+
'FS_mayLookup',
|
|
6727
|
+
'FS_mayCreate',
|
|
6728
|
+
'FS_mayDelete',
|
|
6729
|
+
'FS_mayOpen',
|
|
6730
|
+
'FS_checkOpExists',
|
|
6731
|
+
'FS_nextfd',
|
|
6732
|
+
'FS_getStreamChecked',
|
|
6733
|
+
'FS_getStream',
|
|
6734
|
+
'FS_createStream',
|
|
6735
|
+
'FS_closeStream',
|
|
6736
|
+
'FS_dupStream',
|
|
6737
|
+
'FS_doSetAttr',
|
|
6738
|
+
'FS_chrdev_stream_ops',
|
|
6739
|
+
'FS_major',
|
|
6740
|
+
'FS_minor',
|
|
6741
|
+
'FS_makedev',
|
|
6742
|
+
'FS_registerDevice',
|
|
6743
|
+
'FS_getDevice',
|
|
6744
|
+
'FS_getMounts',
|
|
6745
|
+
'FS_syncfs',
|
|
6746
|
+
'FS_mount',
|
|
6747
|
+
'FS_unmount',
|
|
6748
|
+
'FS_lookup',
|
|
6749
|
+
'FS_mknod',
|
|
6750
|
+
'FS_statfs',
|
|
6751
|
+
'FS_statfsStream',
|
|
6752
|
+
'FS_statfsNode',
|
|
6753
|
+
'FS_create',
|
|
6754
|
+
'FS_mkdir',
|
|
6755
|
+
'FS_mkdev',
|
|
6756
|
+
'FS_symlink',
|
|
6757
|
+
'FS_rename',
|
|
6758
|
+
'FS_rmdir',
|
|
6759
|
+
'FS_readdir',
|
|
6760
|
+
'FS_readlink',
|
|
6761
|
+
'FS_stat',
|
|
6762
|
+
'FS_fstat',
|
|
6763
|
+
'FS_lstat',
|
|
6764
|
+
'FS_doChmod',
|
|
6765
|
+
'FS_chmod',
|
|
6766
|
+
'FS_lchmod',
|
|
6767
|
+
'FS_fchmod',
|
|
6768
|
+
'FS_doChown',
|
|
6769
|
+
'FS_chown',
|
|
6770
|
+
'FS_lchown',
|
|
6771
|
+
'FS_fchown',
|
|
6772
|
+
'FS_doTruncate',
|
|
6773
|
+
'FS_truncate',
|
|
6774
|
+
'FS_ftruncate',
|
|
6775
|
+
'FS_utime',
|
|
6776
|
+
'FS_open',
|
|
6777
|
+
'FS_close',
|
|
6778
|
+
'FS_isClosed',
|
|
6779
|
+
'FS_llseek',
|
|
6780
|
+
'FS_read',
|
|
6781
|
+
'FS_write',
|
|
6782
|
+
'FS_mmap',
|
|
6783
|
+
'FS_msync',
|
|
6784
|
+
'FS_ioctl',
|
|
6785
|
+
'FS_writeFile',
|
|
6786
|
+
'FS_cwd',
|
|
6787
|
+
'FS_chdir',
|
|
6788
|
+
'FS_createDefaultDirectories',
|
|
6789
|
+
'FS_createDefaultDevices',
|
|
6790
|
+
'FS_createSpecialDirectories',
|
|
6791
|
+
'FS_createStandardStreams',
|
|
6792
|
+
'FS_staticInit',
|
|
6793
|
+
'FS_init',
|
|
6794
|
+
'FS_quit',
|
|
6795
|
+
'FS_findObject',
|
|
6796
|
+
'FS_analyzePath',
|
|
6797
|
+
'FS_createFile',
|
|
6831
6798
|
'FS_createDataFile',
|
|
6799
|
+
'FS_forceLoadFile',
|
|
6832
6800
|
'FS_createLazyFile',
|
|
6801
|
+
'FS_absolutePath',
|
|
6802
|
+
'FS_createFolder',
|
|
6803
|
+
'FS_createLink',
|
|
6804
|
+
'FS_joinPath',
|
|
6805
|
+
'FS_mmapAlloc',
|
|
6806
|
+
'FS_standardizePath',
|
|
6833
6807
|
'MEMFS',
|
|
6834
6808
|
'TTY',
|
|
6835
6809
|
'PIPEFS',
|
|
@@ -6845,14 +6819,283 @@ var unexportedSymbols = [
|
|
|
6845
6819
|
'IDBStore',
|
|
6846
6820
|
'SDL',
|
|
6847
6821
|
'SDL_gfx',
|
|
6848
|
-
'ALLOC_STACK',
|
|
6849
|
-
'allocateUTF8',
|
|
6850
6822
|
'print',
|
|
6851
6823
|
'printErr',
|
|
6824
|
+
'jstoi_s',
|
|
6852
6825
|
];
|
|
6853
6826
|
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
6854
6827
|
|
|
6828
|
+
// End runtime exports
|
|
6829
|
+
// Begin JS library exports
|
|
6830
|
+
// End JS library exports
|
|
6831
|
+
|
|
6832
|
+
// end include: postlibrary.js
|
|
6833
|
+
|
|
6834
|
+
function checkIncomingModuleAPI() {
|
|
6835
|
+
ignoredModuleProp('fetchSettings');
|
|
6836
|
+
}
|
|
6837
|
+
|
|
6838
|
+
// Imports from the Wasm binary.
|
|
6839
|
+
var _sqlite3_free = Module['_sqlite3_free'] = makeInvalidEarlyAccess('_sqlite3_free');
|
|
6840
|
+
var _sqlite3_value_text = Module['_sqlite3_value_text'] = makeInvalidEarlyAccess('_sqlite3_value_text');
|
|
6841
|
+
var _sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = makeInvalidEarlyAccess('_sqlite3_prepare_v2');
|
|
6842
|
+
var _sqlite3_step = Module['_sqlite3_step'] = makeInvalidEarlyAccess('_sqlite3_step');
|
|
6843
|
+
var _sqlite3_reset = Module['_sqlite3_reset'] = makeInvalidEarlyAccess('_sqlite3_reset');
|
|
6844
|
+
var _sqlite3_exec = Module['_sqlite3_exec'] = makeInvalidEarlyAccess('_sqlite3_exec');
|
|
6845
|
+
var _sqlite3_finalize = Module['_sqlite3_finalize'] = makeInvalidEarlyAccess('_sqlite3_finalize');
|
|
6846
|
+
var _sqlite3_column_name = Module['_sqlite3_column_name'] = makeInvalidEarlyAccess('_sqlite3_column_name');
|
|
6847
|
+
var _sqlite3_column_text = Module['_sqlite3_column_text'] = makeInvalidEarlyAccess('_sqlite3_column_text');
|
|
6848
|
+
var _sqlite3_column_type = Module['_sqlite3_column_type'] = makeInvalidEarlyAccess('_sqlite3_column_type');
|
|
6849
|
+
var _sqlite3_errmsg = Module['_sqlite3_errmsg'] = makeInvalidEarlyAccess('_sqlite3_errmsg');
|
|
6850
|
+
var _sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = makeInvalidEarlyAccess('_sqlite3_clear_bindings');
|
|
6851
|
+
var _sqlite3_value_blob = Module['_sqlite3_value_blob'] = makeInvalidEarlyAccess('_sqlite3_value_blob');
|
|
6852
|
+
var _sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = makeInvalidEarlyAccess('_sqlite3_value_bytes');
|
|
6853
|
+
var _sqlite3_value_double = Module['_sqlite3_value_double'] = makeInvalidEarlyAccess('_sqlite3_value_double');
|
|
6854
|
+
var _sqlite3_value_int = Module['_sqlite3_value_int'] = makeInvalidEarlyAccess('_sqlite3_value_int');
|
|
6855
|
+
var _sqlite3_value_type = Module['_sqlite3_value_type'] = makeInvalidEarlyAccess('_sqlite3_value_type');
|
|
6856
|
+
var _sqlite3_result_blob = Module['_sqlite3_result_blob'] = makeInvalidEarlyAccess('_sqlite3_result_blob');
|
|
6857
|
+
var _sqlite3_result_double = Module['_sqlite3_result_double'] = makeInvalidEarlyAccess('_sqlite3_result_double');
|
|
6858
|
+
var _sqlite3_result_error = Module['_sqlite3_result_error'] = makeInvalidEarlyAccess('_sqlite3_result_error');
|
|
6859
|
+
var _sqlite3_result_int = Module['_sqlite3_result_int'] = makeInvalidEarlyAccess('_sqlite3_result_int');
|
|
6860
|
+
var _sqlite3_result_int64 = Module['_sqlite3_result_int64'] = makeInvalidEarlyAccess('_sqlite3_result_int64');
|
|
6861
|
+
var _sqlite3_result_null = Module['_sqlite3_result_null'] = makeInvalidEarlyAccess('_sqlite3_result_null');
|
|
6862
|
+
var _sqlite3_result_text = Module['_sqlite3_result_text'] = makeInvalidEarlyAccess('_sqlite3_result_text');
|
|
6863
|
+
var _sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = makeInvalidEarlyAccess('_sqlite3_aggregate_context');
|
|
6864
|
+
var _sqlite3_column_count = Module['_sqlite3_column_count'] = makeInvalidEarlyAccess('_sqlite3_column_count');
|
|
6865
|
+
var _sqlite3_data_count = Module['_sqlite3_data_count'] = makeInvalidEarlyAccess('_sqlite3_data_count');
|
|
6866
|
+
var _sqlite3_column_blob = Module['_sqlite3_column_blob'] = makeInvalidEarlyAccess('_sqlite3_column_blob');
|
|
6867
|
+
var _sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = makeInvalidEarlyAccess('_sqlite3_column_bytes');
|
|
6868
|
+
var _sqlite3_column_double = Module['_sqlite3_column_double'] = makeInvalidEarlyAccess('_sqlite3_column_double');
|
|
6869
|
+
var _sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = makeInvalidEarlyAccess('_sqlite3_bind_blob');
|
|
6870
|
+
var _sqlite3_bind_double = Module['_sqlite3_bind_double'] = makeInvalidEarlyAccess('_sqlite3_bind_double');
|
|
6871
|
+
var _sqlite3_bind_int = Module['_sqlite3_bind_int'] = makeInvalidEarlyAccess('_sqlite3_bind_int');
|
|
6872
|
+
var _sqlite3_bind_text = Module['_sqlite3_bind_text'] = makeInvalidEarlyAccess('_sqlite3_bind_text');
|
|
6873
|
+
var _sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = makeInvalidEarlyAccess('_sqlite3_bind_parameter_index');
|
|
6874
|
+
var _sqlite3_sql = Module['_sqlite3_sql'] = makeInvalidEarlyAccess('_sqlite3_sql');
|
|
6875
|
+
var _sqlite3_normalized_sql = Module['_sqlite3_normalized_sql'] = makeInvalidEarlyAccess('_sqlite3_normalized_sql');
|
|
6876
|
+
var _sqlite3_changes = Module['_sqlite3_changes'] = makeInvalidEarlyAccess('_sqlite3_changes');
|
|
6877
|
+
var _sqlite3_close_v2 = Module['_sqlite3_close_v2'] = makeInvalidEarlyAccess('_sqlite3_close_v2');
|
|
6878
|
+
var _sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = makeInvalidEarlyAccess('_sqlite3_create_function_v2');
|
|
6879
|
+
var _sqlite3_update_hook = Module['_sqlite3_update_hook'] = makeInvalidEarlyAccess('_sqlite3_update_hook');
|
|
6880
|
+
var _sqlite3_open = Module['_sqlite3_open'] = makeInvalidEarlyAccess('_sqlite3_open');
|
|
6881
|
+
var _strerror = makeInvalidEarlyAccess('_strerror');
|
|
6882
|
+
var _malloc = Module['_malloc'] = makeInvalidEarlyAccess('_malloc');
|
|
6883
|
+
var _free = Module['_free'] = makeInvalidEarlyAccess('_free');
|
|
6884
|
+
var _RegisterExtensionFunctions = Module['_RegisterExtensionFunctions'] = makeInvalidEarlyAccess('_RegisterExtensionFunctions');
|
|
6885
|
+
var _fflush = makeInvalidEarlyAccess('_fflush');
|
|
6886
|
+
var _emscripten_stack_get_end = makeInvalidEarlyAccess('_emscripten_stack_get_end');
|
|
6887
|
+
var _emscripten_stack_get_base = makeInvalidEarlyAccess('_emscripten_stack_get_base');
|
|
6888
|
+
var _emscripten_builtin_memalign = makeInvalidEarlyAccess('_emscripten_builtin_memalign');
|
|
6889
|
+
var _emscripten_stack_init = makeInvalidEarlyAccess('_emscripten_stack_init');
|
|
6890
|
+
var _emscripten_stack_get_free = makeInvalidEarlyAccess('_emscripten_stack_get_free');
|
|
6891
|
+
var __emscripten_stack_restore = makeInvalidEarlyAccess('__emscripten_stack_restore');
|
|
6892
|
+
var __emscripten_stack_alloc = makeInvalidEarlyAccess('__emscripten_stack_alloc');
|
|
6893
|
+
var _emscripten_stack_get_current = makeInvalidEarlyAccess('_emscripten_stack_get_current');
|
|
6894
|
+
var ___set_stack_limits = Module['___set_stack_limits'] = makeInvalidEarlyAccess('___set_stack_limits');
|
|
6895
|
+
var memory = makeInvalidEarlyAccess('memory');
|
|
6896
|
+
var __indirect_function_table = makeInvalidEarlyAccess('__indirect_function_table');
|
|
6897
|
+
var wasmMemory = makeInvalidEarlyAccess('wasmMemory');
|
|
6898
|
+
var wasmTable = makeInvalidEarlyAccess('wasmTable');
|
|
6899
|
+
|
|
6900
|
+
function assignWasmExports(wasmExports) {
|
|
6901
|
+
assert(typeof wasmExports['sqlite3_free'] != 'undefined', 'missing Wasm export: sqlite3_free');
|
|
6902
|
+
assert(typeof wasmExports['sqlite3_value_text'] != 'undefined', 'missing Wasm export: sqlite3_value_text');
|
|
6903
|
+
assert(typeof wasmExports['sqlite3_prepare_v2'] != 'undefined', 'missing Wasm export: sqlite3_prepare_v2');
|
|
6904
|
+
assert(typeof wasmExports['sqlite3_step'] != 'undefined', 'missing Wasm export: sqlite3_step');
|
|
6905
|
+
assert(typeof wasmExports['sqlite3_reset'] != 'undefined', 'missing Wasm export: sqlite3_reset');
|
|
6906
|
+
assert(typeof wasmExports['sqlite3_exec'] != 'undefined', 'missing Wasm export: sqlite3_exec');
|
|
6907
|
+
assert(typeof wasmExports['sqlite3_finalize'] != 'undefined', 'missing Wasm export: sqlite3_finalize');
|
|
6908
|
+
assert(typeof wasmExports['sqlite3_column_name'] != 'undefined', 'missing Wasm export: sqlite3_column_name');
|
|
6909
|
+
assert(typeof wasmExports['sqlite3_column_text'] != 'undefined', 'missing Wasm export: sqlite3_column_text');
|
|
6910
|
+
assert(typeof wasmExports['sqlite3_column_type'] != 'undefined', 'missing Wasm export: sqlite3_column_type');
|
|
6911
|
+
assert(typeof wasmExports['sqlite3_errmsg'] != 'undefined', 'missing Wasm export: sqlite3_errmsg');
|
|
6912
|
+
assert(typeof wasmExports['sqlite3_clear_bindings'] != 'undefined', 'missing Wasm export: sqlite3_clear_bindings');
|
|
6913
|
+
assert(typeof wasmExports['sqlite3_value_blob'] != 'undefined', 'missing Wasm export: sqlite3_value_blob');
|
|
6914
|
+
assert(typeof wasmExports['sqlite3_value_bytes'] != 'undefined', 'missing Wasm export: sqlite3_value_bytes');
|
|
6915
|
+
assert(typeof wasmExports['sqlite3_value_double'] != 'undefined', 'missing Wasm export: sqlite3_value_double');
|
|
6916
|
+
assert(typeof wasmExports['sqlite3_value_int'] != 'undefined', 'missing Wasm export: sqlite3_value_int');
|
|
6917
|
+
assert(typeof wasmExports['sqlite3_value_type'] != 'undefined', 'missing Wasm export: sqlite3_value_type');
|
|
6918
|
+
assert(typeof wasmExports['sqlite3_result_blob'] != 'undefined', 'missing Wasm export: sqlite3_result_blob');
|
|
6919
|
+
assert(typeof wasmExports['sqlite3_result_double'] != 'undefined', 'missing Wasm export: sqlite3_result_double');
|
|
6920
|
+
assert(typeof wasmExports['sqlite3_result_error'] != 'undefined', 'missing Wasm export: sqlite3_result_error');
|
|
6921
|
+
assert(typeof wasmExports['sqlite3_result_int'] != 'undefined', 'missing Wasm export: sqlite3_result_int');
|
|
6922
|
+
assert(typeof wasmExports['sqlite3_result_int64'] != 'undefined', 'missing Wasm export: sqlite3_result_int64');
|
|
6923
|
+
assert(typeof wasmExports['sqlite3_result_null'] != 'undefined', 'missing Wasm export: sqlite3_result_null');
|
|
6924
|
+
assert(typeof wasmExports['sqlite3_result_text'] != 'undefined', 'missing Wasm export: sqlite3_result_text');
|
|
6925
|
+
assert(typeof wasmExports['sqlite3_aggregate_context'] != 'undefined', 'missing Wasm export: sqlite3_aggregate_context');
|
|
6926
|
+
assert(typeof wasmExports['sqlite3_column_count'] != 'undefined', 'missing Wasm export: sqlite3_column_count');
|
|
6927
|
+
assert(typeof wasmExports['sqlite3_data_count'] != 'undefined', 'missing Wasm export: sqlite3_data_count');
|
|
6928
|
+
assert(typeof wasmExports['sqlite3_column_blob'] != 'undefined', 'missing Wasm export: sqlite3_column_blob');
|
|
6929
|
+
assert(typeof wasmExports['sqlite3_column_bytes'] != 'undefined', 'missing Wasm export: sqlite3_column_bytes');
|
|
6930
|
+
assert(typeof wasmExports['sqlite3_column_double'] != 'undefined', 'missing Wasm export: sqlite3_column_double');
|
|
6931
|
+
assert(typeof wasmExports['sqlite3_bind_blob'] != 'undefined', 'missing Wasm export: sqlite3_bind_blob');
|
|
6932
|
+
assert(typeof wasmExports['sqlite3_bind_double'] != 'undefined', 'missing Wasm export: sqlite3_bind_double');
|
|
6933
|
+
assert(typeof wasmExports['sqlite3_bind_int'] != 'undefined', 'missing Wasm export: sqlite3_bind_int');
|
|
6934
|
+
assert(typeof wasmExports['sqlite3_bind_text'] != 'undefined', 'missing Wasm export: sqlite3_bind_text');
|
|
6935
|
+
assert(typeof wasmExports['sqlite3_bind_parameter_index'] != 'undefined', 'missing Wasm export: sqlite3_bind_parameter_index');
|
|
6936
|
+
assert(typeof wasmExports['sqlite3_sql'] != 'undefined', 'missing Wasm export: sqlite3_sql');
|
|
6937
|
+
assert(typeof wasmExports['sqlite3_normalized_sql'] != 'undefined', 'missing Wasm export: sqlite3_normalized_sql');
|
|
6938
|
+
assert(typeof wasmExports['sqlite3_changes'] != 'undefined', 'missing Wasm export: sqlite3_changes');
|
|
6939
|
+
assert(typeof wasmExports['sqlite3_close_v2'] != 'undefined', 'missing Wasm export: sqlite3_close_v2');
|
|
6940
|
+
assert(typeof wasmExports['sqlite3_create_function_v2'] != 'undefined', 'missing Wasm export: sqlite3_create_function_v2');
|
|
6941
|
+
assert(typeof wasmExports['sqlite3_update_hook'] != 'undefined', 'missing Wasm export: sqlite3_update_hook');
|
|
6942
|
+
assert(typeof wasmExports['sqlite3_open'] != 'undefined', 'missing Wasm export: sqlite3_open');
|
|
6943
|
+
assert(typeof wasmExports['strerror'] != 'undefined', 'missing Wasm export: strerror');
|
|
6944
|
+
assert(typeof wasmExports['malloc'] != 'undefined', 'missing Wasm export: malloc');
|
|
6945
|
+
assert(typeof wasmExports['free'] != 'undefined', 'missing Wasm export: free');
|
|
6946
|
+
assert(typeof wasmExports['RegisterExtensionFunctions'] != 'undefined', 'missing Wasm export: RegisterExtensionFunctions');
|
|
6947
|
+
assert(typeof wasmExports['fflush'] != 'undefined', 'missing Wasm export: fflush');
|
|
6948
|
+
assert(typeof wasmExports['emscripten_stack_get_end'] != 'undefined', 'missing Wasm export: emscripten_stack_get_end');
|
|
6949
|
+
assert(typeof wasmExports['emscripten_stack_get_base'] != 'undefined', 'missing Wasm export: emscripten_stack_get_base');
|
|
6950
|
+
assert(typeof wasmExports['emscripten_builtin_memalign'] != 'undefined', 'missing Wasm export: emscripten_builtin_memalign');
|
|
6951
|
+
assert(typeof wasmExports['emscripten_stack_init'] != 'undefined', 'missing Wasm export: emscripten_stack_init');
|
|
6952
|
+
assert(typeof wasmExports['emscripten_stack_get_free'] != 'undefined', 'missing Wasm export: emscripten_stack_get_free');
|
|
6953
|
+
assert(typeof wasmExports['_emscripten_stack_restore'] != 'undefined', 'missing Wasm export: _emscripten_stack_restore');
|
|
6954
|
+
assert(typeof wasmExports['_emscripten_stack_alloc'] != 'undefined', 'missing Wasm export: _emscripten_stack_alloc');
|
|
6955
|
+
assert(typeof wasmExports['emscripten_stack_get_current'] != 'undefined', 'missing Wasm export: emscripten_stack_get_current');
|
|
6956
|
+
assert(typeof wasmExports['__set_stack_limits'] != 'undefined', 'missing Wasm export: __set_stack_limits');
|
|
6957
|
+
assert(typeof wasmExports['memory'] != 'undefined', 'missing Wasm export: memory');
|
|
6958
|
+
assert(typeof wasmExports['__indirect_function_table'] != 'undefined', 'missing Wasm export: __indirect_function_table');
|
|
6959
|
+
_sqlite3_free = Module['_sqlite3_free'] = createExportWrapper('sqlite3_free', 1);
|
|
6960
|
+
_sqlite3_value_text = Module['_sqlite3_value_text'] = createExportWrapper('sqlite3_value_text', 1);
|
|
6961
|
+
_sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = createExportWrapper('sqlite3_prepare_v2', 5);
|
|
6962
|
+
_sqlite3_step = Module['_sqlite3_step'] = createExportWrapper('sqlite3_step', 1);
|
|
6963
|
+
_sqlite3_reset = Module['_sqlite3_reset'] = createExportWrapper('sqlite3_reset', 1);
|
|
6964
|
+
_sqlite3_exec = Module['_sqlite3_exec'] = createExportWrapper('sqlite3_exec', 5);
|
|
6965
|
+
_sqlite3_finalize = Module['_sqlite3_finalize'] = createExportWrapper('sqlite3_finalize', 1);
|
|
6966
|
+
_sqlite3_column_name = Module['_sqlite3_column_name'] = createExportWrapper('sqlite3_column_name', 2);
|
|
6967
|
+
_sqlite3_column_text = Module['_sqlite3_column_text'] = createExportWrapper('sqlite3_column_text', 2);
|
|
6968
|
+
_sqlite3_column_type = Module['_sqlite3_column_type'] = createExportWrapper('sqlite3_column_type', 2);
|
|
6969
|
+
_sqlite3_errmsg = Module['_sqlite3_errmsg'] = createExportWrapper('sqlite3_errmsg', 1);
|
|
6970
|
+
_sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = createExportWrapper('sqlite3_clear_bindings', 1);
|
|
6971
|
+
_sqlite3_value_blob = Module['_sqlite3_value_blob'] = createExportWrapper('sqlite3_value_blob', 1);
|
|
6972
|
+
_sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = createExportWrapper('sqlite3_value_bytes', 1);
|
|
6973
|
+
_sqlite3_value_double = Module['_sqlite3_value_double'] = createExportWrapper('sqlite3_value_double', 1);
|
|
6974
|
+
_sqlite3_value_int = Module['_sqlite3_value_int'] = createExportWrapper('sqlite3_value_int', 1);
|
|
6975
|
+
_sqlite3_value_type = Module['_sqlite3_value_type'] = createExportWrapper('sqlite3_value_type', 1);
|
|
6976
|
+
_sqlite3_result_blob = Module['_sqlite3_result_blob'] = createExportWrapper('sqlite3_result_blob', 4);
|
|
6977
|
+
_sqlite3_result_double = Module['_sqlite3_result_double'] = createExportWrapper('sqlite3_result_double', 2);
|
|
6978
|
+
_sqlite3_result_error = Module['_sqlite3_result_error'] = createExportWrapper('sqlite3_result_error', 3);
|
|
6979
|
+
_sqlite3_result_int = Module['_sqlite3_result_int'] = createExportWrapper('sqlite3_result_int', 2);
|
|
6980
|
+
_sqlite3_result_int64 = Module['_sqlite3_result_int64'] = createExportWrapper('sqlite3_result_int64', 2);
|
|
6981
|
+
_sqlite3_result_null = Module['_sqlite3_result_null'] = createExportWrapper('sqlite3_result_null', 1);
|
|
6982
|
+
_sqlite3_result_text = Module['_sqlite3_result_text'] = createExportWrapper('sqlite3_result_text', 4);
|
|
6983
|
+
_sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = createExportWrapper('sqlite3_aggregate_context', 2);
|
|
6984
|
+
_sqlite3_column_count = Module['_sqlite3_column_count'] = createExportWrapper('sqlite3_column_count', 1);
|
|
6985
|
+
_sqlite3_data_count = Module['_sqlite3_data_count'] = createExportWrapper('sqlite3_data_count', 1);
|
|
6986
|
+
_sqlite3_column_blob = Module['_sqlite3_column_blob'] = createExportWrapper('sqlite3_column_blob', 2);
|
|
6987
|
+
_sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = createExportWrapper('sqlite3_column_bytes', 2);
|
|
6988
|
+
_sqlite3_column_double = Module['_sqlite3_column_double'] = createExportWrapper('sqlite3_column_double', 2);
|
|
6989
|
+
_sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = createExportWrapper('sqlite3_bind_blob', 5);
|
|
6990
|
+
_sqlite3_bind_double = Module['_sqlite3_bind_double'] = createExportWrapper('sqlite3_bind_double', 3);
|
|
6991
|
+
_sqlite3_bind_int = Module['_sqlite3_bind_int'] = createExportWrapper('sqlite3_bind_int', 3);
|
|
6992
|
+
_sqlite3_bind_text = Module['_sqlite3_bind_text'] = createExportWrapper('sqlite3_bind_text', 5);
|
|
6993
|
+
_sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = createExportWrapper('sqlite3_bind_parameter_index', 2);
|
|
6994
|
+
_sqlite3_sql = Module['_sqlite3_sql'] = createExportWrapper('sqlite3_sql', 1);
|
|
6995
|
+
_sqlite3_normalized_sql = Module['_sqlite3_normalized_sql'] = createExportWrapper('sqlite3_normalized_sql', 1);
|
|
6996
|
+
_sqlite3_changes = Module['_sqlite3_changes'] = createExportWrapper('sqlite3_changes', 1);
|
|
6997
|
+
_sqlite3_close_v2 = Module['_sqlite3_close_v2'] = createExportWrapper('sqlite3_close_v2', 1);
|
|
6998
|
+
_sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = createExportWrapper('sqlite3_create_function_v2', 9);
|
|
6999
|
+
_sqlite3_update_hook = Module['_sqlite3_update_hook'] = createExportWrapper('sqlite3_update_hook', 3);
|
|
7000
|
+
_sqlite3_open = Module['_sqlite3_open'] = createExportWrapper('sqlite3_open', 2);
|
|
7001
|
+
_strerror = createExportWrapper('strerror', 1);
|
|
7002
|
+
_malloc = Module['_malloc'] = createExportWrapper('malloc', 1);
|
|
7003
|
+
_free = Module['_free'] = createExportWrapper('free', 1);
|
|
7004
|
+
_RegisterExtensionFunctions = Module['_RegisterExtensionFunctions'] = createExportWrapper('RegisterExtensionFunctions', 1);
|
|
7005
|
+
_fflush = createExportWrapper('fflush', 1);
|
|
7006
|
+
_emscripten_stack_get_end = wasmExports['emscripten_stack_get_end'];
|
|
7007
|
+
_emscripten_stack_get_base = wasmExports['emscripten_stack_get_base'];
|
|
7008
|
+
_emscripten_builtin_memalign = createExportWrapper('emscripten_builtin_memalign', 2);
|
|
7009
|
+
_emscripten_stack_init = wasmExports['emscripten_stack_init'];
|
|
7010
|
+
_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'];
|
|
7011
|
+
__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'];
|
|
7012
|
+
__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'];
|
|
7013
|
+
_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'];
|
|
7014
|
+
___set_stack_limits = Module['___set_stack_limits'] = createExportWrapper('__set_stack_limits', 2);
|
|
7015
|
+
memory = wasmMemory = wasmExports['memory'];
|
|
7016
|
+
__indirect_function_table = wasmTable = wasmExports['__indirect_function_table'];
|
|
7017
|
+
}
|
|
7018
|
+
|
|
7019
|
+
var wasmImports = {
|
|
7020
|
+
/** @export */
|
|
7021
|
+
__assert_fail: ___assert_fail,
|
|
7022
|
+
/** @export */
|
|
7023
|
+
__handle_stack_overflow: ___handle_stack_overflow,
|
|
7024
|
+
/** @export */
|
|
7025
|
+
__syscall_chmod: ___syscall_chmod,
|
|
7026
|
+
/** @export */
|
|
7027
|
+
__syscall_faccessat: ___syscall_faccessat,
|
|
7028
|
+
/** @export */
|
|
7029
|
+
__syscall_fchmod: ___syscall_fchmod,
|
|
7030
|
+
/** @export */
|
|
7031
|
+
__syscall_fchown32: ___syscall_fchown32,
|
|
7032
|
+
/** @export */
|
|
7033
|
+
__syscall_fcntl64: ___syscall_fcntl64,
|
|
7034
|
+
/** @export */
|
|
7035
|
+
__syscall_fstat64: ___syscall_fstat64,
|
|
7036
|
+
/** @export */
|
|
7037
|
+
__syscall_ftruncate64: ___syscall_ftruncate64,
|
|
7038
|
+
/** @export */
|
|
7039
|
+
__syscall_getcwd: ___syscall_getcwd,
|
|
7040
|
+
/** @export */
|
|
7041
|
+
__syscall_lstat64: ___syscall_lstat64,
|
|
7042
|
+
/** @export */
|
|
7043
|
+
__syscall_mkdirat: ___syscall_mkdirat,
|
|
7044
|
+
/** @export */
|
|
7045
|
+
__syscall_newfstatat: ___syscall_newfstatat,
|
|
7046
|
+
/** @export */
|
|
7047
|
+
__syscall_openat: ___syscall_openat,
|
|
7048
|
+
/** @export */
|
|
7049
|
+
__syscall_readlinkat: ___syscall_readlinkat,
|
|
7050
|
+
/** @export */
|
|
7051
|
+
__syscall_rmdir: ___syscall_rmdir,
|
|
7052
|
+
/** @export */
|
|
7053
|
+
__syscall_stat64: ___syscall_stat64,
|
|
7054
|
+
/** @export */
|
|
7055
|
+
__syscall_unlinkat: ___syscall_unlinkat,
|
|
7056
|
+
/** @export */
|
|
7057
|
+
__syscall_utimensat: ___syscall_utimensat,
|
|
7058
|
+
/** @export */
|
|
7059
|
+
_abort_js: __abort_js,
|
|
7060
|
+
/** @export */
|
|
7061
|
+
_localtime_js: __localtime_js,
|
|
7062
|
+
/** @export */
|
|
7063
|
+
_mmap_js: __mmap_js,
|
|
7064
|
+
/** @export */
|
|
7065
|
+
_munmap_js: __munmap_js,
|
|
7066
|
+
/** @export */
|
|
7067
|
+
_tzset_js: __tzset_js,
|
|
7068
|
+
/** @export */
|
|
7069
|
+
clock_time_get: _clock_time_get,
|
|
7070
|
+
/** @export */
|
|
7071
|
+
emscripten_date_now: _emscripten_date_now,
|
|
7072
|
+
/** @export */
|
|
7073
|
+
emscripten_get_heap_max: _emscripten_get_heap_max,
|
|
7074
|
+
/** @export */
|
|
7075
|
+
emscripten_get_now: _emscripten_get_now,
|
|
7076
|
+
/** @export */
|
|
7077
|
+
emscripten_resize_heap: _emscripten_resize_heap,
|
|
7078
|
+
/** @export */
|
|
7079
|
+
environ_get: _environ_get,
|
|
7080
|
+
/** @export */
|
|
7081
|
+
environ_sizes_get: _environ_sizes_get,
|
|
7082
|
+
/** @export */
|
|
7083
|
+
fd_close: _fd_close,
|
|
7084
|
+
/** @export */
|
|
7085
|
+
fd_fdstat_get: _fd_fdstat_get,
|
|
7086
|
+
/** @export */
|
|
7087
|
+
fd_read: _fd_read,
|
|
7088
|
+
/** @export */
|
|
7089
|
+
fd_seek: _fd_seek,
|
|
7090
|
+
/** @export */
|
|
7091
|
+
fd_sync: _fd_sync,
|
|
7092
|
+
/** @export */
|
|
7093
|
+
fd_write: _fd_write
|
|
7094
|
+
};
|
|
7095
|
+
|
|
6855
7096
|
|
|
7097
|
+
// include: postamble.js
|
|
7098
|
+
// === Auto-generated postamble setup entry stuff ===
|
|
6856
7099
|
|
|
6857
7100
|
var calledRun;
|
|
6858
7101
|
|
|
@@ -6935,7 +7178,7 @@ function checkUnflushedContent() {
|
|
|
6935
7178
|
try { // it doesn't matter if it fails
|
|
6936
7179
|
_fflush(0);
|
|
6937
7180
|
// also flush in the JS FS layer
|
|
6938
|
-
['stdout', 'stderr']
|
|
7181
|
+
for (var name of ['stdout', 'stderr']) {
|
|
6939
7182
|
var info = FS.analyzePath('/dev/' + name);
|
|
6940
7183
|
if (!info) return;
|
|
6941
7184
|
var stream = info.object;
|
|
@@ -6944,7 +7187,7 @@ function checkUnflushedContent() {
|
|
|
6944
7187
|
if (tty?.output?.length) {
|
|
6945
7188
|
has = true;
|
|
6946
7189
|
}
|
|
6947
|
-
}
|
|
7190
|
+
}
|
|
6948
7191
|
} catch(e) {}
|
|
6949
7192
|
out = oldOut;
|
|
6950
7193
|
err = oldErr;
|
|
@@ -6953,13 +7196,11 @@ function checkUnflushedContent() {
|
|
|
6953
7196
|
}
|
|
6954
7197
|
}
|
|
6955
7198
|
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
}
|
|
6962
|
-
consumedModuleProp('preInit');
|
|
7199
|
+
var wasmExports;
|
|
7200
|
+
|
|
7201
|
+
// With async instantation wasmExports is assigned asynchronously when the
|
|
7202
|
+
// instance is received.
|
|
7203
|
+
createWasm();
|
|
6963
7204
|
|
|
6964
7205
|
run();
|
|
6965
7206
|
|
|
@@ -6988,7 +7229,6 @@ else if (typeof exports === 'object'){
|
|
|
6988
7229
|
exports["Module"] = initSqlJs;
|
|
6989
7230
|
}
|
|
6990
7231
|
/* global initSqlJs */
|
|
6991
|
-
/* eslint-env worker */
|
|
6992
7232
|
/* eslint no-restricted-globals: ["error"] */
|
|
6993
7233
|
|
|
6994
7234
|
"use strict";
|
|
@@ -7091,7 +7331,6 @@ if (typeof importScripts === "function") {
|
|
|
7091
7331
|
}
|
|
7092
7332
|
|
|
7093
7333
|
if (typeof require === "function") {
|
|
7094
|
-
// eslint-disable-next-line global-require
|
|
7095
7334
|
var worker_threads = require("worker_threads");
|
|
7096
7335
|
var parentPort = worker_threads.parentPort;
|
|
7097
7336
|
// eslint-disable-next-line no-undef
|