$(wasm-testing.include) $(wasm-testing.dest)
ssh wasm-testing 'cd $(wasm-testing.dir) && bash .gzip' || \
echo "SSH failed: it's likely that stale content will be served via old gzip files."
+
+WDOCS.home := $(wildcard ../../../wdoc)
+ifneq (,$(WDOCS.home))
+WDOCS.jswasm += $(WDOCS.home)/jswasm
+update-docs:
+ cp $(sqlite3.wasm) $(WDOCS.jswasm)/.
+ $(bin.stripccomments) -k -k < $(sqlite3.js) > $(WDOCS.jswasm)/sqlite3.js
+ cp demo-123.js demo-123.html demo-123-worker.html $(WDOCS.home)
+ sed -n -e '/EXTRACT_BEGIN/,/EXTRACT_END/p' \
+ module-symbols.html > $(WDOCS.home)/module-symbols.html
+
+else
+update-docs:
+ @echo "Cannot find wasm docs checkout."
+endif
}
/* Clean up temporary references to our APIs... */
- delete sqlite3.capi.util /* arguable, but these are (currently) internal-use APIs */;
+ delete sqlite3.util /* arguable, but these are (currently) internal-use APIs */;
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
pass the sqlite3 object off to the client. */;
}else{
'use strict';
const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = sqlite3.SQLite3Error.toss;
- const capi = sqlite3.capi, wasm = capi.wasm, util = capi.util;
- self.WhWasmUtilInstaller(capi.wasm);
+ const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
+ self.WhWasmUtilInstaller(wasm);
delete self.WhWasmUtilInstaller;
/**
capi[e[0]] = wasm.xWrap.apply(null, e);
}
for(const e of wasm.bindingSignatures.wasm){
- capi.wasm[e[0]] = wasm.xWrap.apply(null, e);
+ wasm[e[0]] = wasm.xWrap.apply(null, e);
}
/* For C API functions which cannot work properly unless
delete wasm.bindingSignatures;
if(wasm.exports.sqlite3_wasm_db_error){
- util.sqlite3_wasm_db_error = capi.wasm.xWrap(
+ util.sqlite3_wasm_db_error = wasm.xWrap(
'sqlite3_wasm_db_error', 'int', 'sqlite3*', 'int', 'string'
);
}else{
}
/* Wrap the callback in a WASM-bound function and convert the callback's
`(char**)` arguments to arrays of strings... */
- const wasm = capi.wasm;
const cbwrap = function(pVoid, nCols, pColVals, pColNames){
let rc = capi.SQLITE_ERROR;
try {
return __dbArgcMismatch(pDb,"sqlite3_create_function_v2",f.length);
}
/* Wrap the callbacks in a WASM-bound functions... */
- const wasm = capi.wasm;
const uninstall = [/*funcs to uninstall on error*/];
let rc;
try{
return __dbArgcMismatch(pDb,"sqlite3_create_window_function",f.length);
}
/* Wrap the callbacks in a WASM-bound functions... */
- const wasm = capi.wasm;
const uninstall = [/*funcs to uninstall on error*/];
let rc;
try{
const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)};
- const capi = sqlite3.capi, wasm = capi.wasm, util = capi.util;
+ const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
/* What follows is colloquially known as "OO API #1". It is a
binding of the sqlite3 API which is designed to be run within
the same thread (main or worker) as the one in which the
*/
exec: function(/*(sql [,obj]) || (obj)*/){
affirmDbOpen(this);
- const wasm = capi.wasm;
const arg = parseExecArgs(arguments);
if(!arg.sql){
return (''===arg.sql) ? this : toss3("exec() requires an SQL string.");
const pApp = opt.pApp;
if(undefined!==pApp &&
null!==pApp &&
- (('number'!==typeof pApp) || !capi.util.isInt32(pApp))){
+ (('number'!==typeof pApp) || !util.isInt32(pApp))){
toss3("Invalid value for pApp property. Must be a legal WASM pointer value.");
}
const xDestroy = opt.xDestroy || 0;
const error = (...args)=>logImpl(0, ...args);
const toss = function(...args){throw new Error(args.join(' '))};
const capi = sqlite3.capi;
- const wasm = capi.wasm;
+ const wasm = sqlite3.wasm;
const sqlite3_vfs = capi.sqlite3_vfs;
const sqlite3_file = capi.sqlite3_file;
const sqlite3_io_methods = capi.sqlite3_io_methods;
cannot add an after-initialize callback mechanism.
*/
opfsUtil.registerVfs = (asDefault=false)=>{
- return capi.wasm.exports.sqlite3_vfs_register(
+ return wasm.exports.sqlite3_vfs_register(
opfsVfs.pointer, asDefault ? 1 : 0
);
};
values.
*/
sqlite3_randomness: (n, outPtr)=>{/*installed later*/},
+ }/*capi*/;
+ /**
+ Various internal-use utilities are added here as needed. They
+ are bound to an object only so that we have access to them in
+ the differently-scoped steps of the API bootstrapping
+ process. At the end of the API setup process, this object gets
+ removed. These are NOT part of the public API.
+ */
+ const util = {
+ affirmBindableTypedArray, flexibleString,
+ bigIntFits32, bigIntFits64, bigIntFitsDouble,
+ isBindableTypedArray,
+ isInt32, isSQLableTypedArray, isTypedArray,
+ typedArrayToString,
+ isUIThread: ()=>'undefined'===typeof WorkerGlobalScope,
+ isSharedTypedArray,
+ typedArrayPart
+ };
+
+ /**
+ Holds state which are specific to the WASM-related
+ infrastructure and glue code. It is not expected that client
+ code will normally need these, but they're exposed here in case
+ it does. These APIs are _not_ to be considered an
+ official/stable part of the sqlite3 WASM API. They may change
+ as the developers' experience suggests appropriate changes.
+
+ Note that a number of members of this object are injected
+ dynamically after the api object is fully constructed, so
+ not all are documented inline here.
+ */
+ const wasm = {
/**
- Various internal-use utilities are added here as needed. They
- are bound to an object only so that we have access to them in
- the differently-scoped steps of the API bootstrapping
- process. At the end of the API setup process, this object gets
- removed. These are NOT part of the public API.
+ Emscripten APIs have a deep-seated assumption that all pointers
+ are 32 bits. We'll remain optimistic that that won't always be
+ the case and will use this constant in places where we might
+ otherwise use a hard-coded 4.
*/
- util:{
- affirmBindableTypedArray, flexibleString,
- bigIntFits32, bigIntFits64, bigIntFitsDouble,
- isBindableTypedArray,
- isInt32, isSQLableTypedArray, isTypedArray,
- typedArrayToString,
- isUIThread: ()=>'undefined'===typeof WorkerGlobalScope,
- isSharedTypedArray,
- typedArrayPart
- },
-
+ ptrSizeof: config.wasmPtrSizeof || 4,
/**
- Holds state which are specific to the WASM-related
- infrastructure and glue code. It is not expected that client
- code will normally need these, but they're exposed here in case
- it does. These APIs are _not_ to be considered an
- official/stable part of the sqlite3 WASM API. They may change
- as the developers' experience suggests appropriate changes.
-
- Note that a number of members of this object are injected
- dynamically after the api object is fully constructed, so
- not all are documented inline here.
+ The WASM IR (Intermediate Representation) value for
+ pointer-type values. It MUST refer to a value type of the
+ size described by this.ptrSizeof _or_ it may be any value
+ which ends in '*', which Emscripten's glue code internally
+ translates to i32.
*/
- wasm: {
- //^^^ TODO?: move wasm from sqlite3.capi.wasm to sqlite3.wasm
- /**
- Emscripten APIs have a deep-seated assumption that all pointers
- are 32 bits. We'll remain optimistic that that won't always be
- the case and will use this constant in places where we might
- otherwise use a hard-coded 4.
- */
- ptrSizeof: config.wasmPtrSizeof || 4,
- /**
- The WASM IR (Intermediate Representation) value for
- pointer-type values. It MUST refer to a value type of the
- size described by this.ptrSizeof _or_ it may be any value
- which ends in '*', which Emscripten's glue code internally
- translates to i32.
- */
- ptrIR: config.wasmPtrIR || "i32",
- /**
- True if BigInt support was enabled via (e.g.) the
- Emscripten -sWASM_BIGINT flag, else false. When
- enabled, certain 64-bit sqlite3 APIs are enabled which
- are not otherwise enabled due to JS/WASM int64
- impedence mismatches.
- */
- bigIntEnabled: !!config.bigIntEnabled,
- /**
- The symbols exported by the WASM environment.
- */
- exports: config.exports
- || toss("Missing API config.exports (WASM module exports)."),
-
- /**
- When Emscripten compiles with `-sIMPORT_MEMORY`, it
- initalizes the heap and imports it into wasm, as opposed to
- the other way around. In this case, the memory is not
- available via this.exports.memory.
- */
- memory: config.memory || config.exports['memory']
- || toss("API config object requires a WebAssembly.Memory object",
- "in either config.exports.memory (exported)",
- "or config.memory (imported)."),
+ ptrIR: config.wasmPtrIR || "i32",
+ /**
+ True if BigInt support was enabled via (e.g.) the
+ Emscripten -sWASM_BIGINT flag, else false. When
+ enabled, certain 64-bit sqlite3 APIs are enabled which
+ are not otherwise enabled due to JS/WASM int64
+ impedence mismatches.
+ */
+ bigIntEnabled: !!config.bigIntEnabled,
+ /**
+ The symbols exported by the WASM environment.
+ */
+ exports: config.exports
+ || toss("Missing API config.exports (WASM module exports)."),
- /**
- The API's one single point of access to the WASM-side memory
- allocator. Works like malloc(3) (and is likely bound to
- malloc()) but throws an WasmAllocError if allocation fails. It is
- important that any code which might pass through the sqlite3 C
- API NOT throw and must instead return SQLITE_NOMEM (or
- equivalent, depending on the context).
-
- That said, very few cases in the API can result in
- client-defined functions propagating exceptions via the C-style
- API. Most notably, this applies ot User-defined SQL Functions
- (UDFs) registered via sqlite3_create_function_v2(). For that
- specific case it is recommended that all UDF creation be
- funneled through a utility function and that a wrapper function
- be added around the UDF which catches any exception and sets
- the error state to OOM. (The overall complexity of registering
- UDFs essentially requires a helper for doing so!)
- */
- alloc: undefined/*installed later*/,
- /**
- The API's one single point of access to the WASM-side memory
- deallocator. Works like free(3) (and is likely bound to
- free()).
- */
- dealloc: undefined/*installed later*/
+ /**
+ When Emscripten compiles with `-sIMPORT_MEMORY`, it
+ initalizes the heap and imports it into wasm, as opposed to
+ the other way around. In this case, the memory is not
+ available via this.exports.memory.
+ */
+ memory: config.memory || config.exports['memory']
+ || toss("API config object requires a WebAssembly.Memory object",
+ "in either config.exports.memory (exported)",
+ "or config.memory (imported)."),
- /* Many more wasm-related APIs get installed later on. */
- }/*wasm*/
- }/*capi*/;
+ /**
+ The API's one single point of access to the WASM-side memory
+ allocator. Works like malloc(3) (and is likely bound to
+ malloc()) but throws an WasmAllocError if allocation fails. It is
+ important that any code which might pass through the sqlite3 C
+ API NOT throw and must instead return SQLITE_NOMEM (or
+ equivalent, depending on the context).
+
+ That said, very few cases in the API can result in
+ client-defined functions propagating exceptions via the C-style
+ API. Most notably, this applies ot User-defined SQL Functions
+ (UDFs) registered via sqlite3_create_function_v2(). For that
+ specific case it is recommended that all UDF creation be
+ funneled through a utility function and that a wrapper function
+ be added around the UDF which catches any exception and sets
+ the error state to OOM. (The overall complexity of registering
+ UDFs essentially requires a helper for doing so!)
+ */
+ alloc: undefined/*installed later*/,
+ /**
+ The API's one single point of access to the WASM-side memory
+ deallocator. Works like free(3) (and is likely bound to
+ free()).
+ */
+ dealloc: undefined/*installed later*/
- const wasm = capi.wasm, util = capi.util;
+ /* Many more wasm-related APIs get installed later on. */
+ }/*wasm*/;
/**
wasm.alloc()'s srcTypedArray.byteLength bytes,
/**
Functions which are intended solely for API-internal use by the
WASM components, not client code. These get installed into
- capi.wasm.
+ sqlite3.wasm.
*/
wasm.bindingSignatures.wasm = [
["sqlite3_wasm_db_reset", "int", "sqlite3*"],
}
return ta;
}
- capi.wasm.exports.sqlite3_randomness(...args);
+ wasm.exports.sqlite3_randomness(...args);
};
/** State for sqlite3_wasmfs_opfs_dir(). */
: 0);
};
- if( capi.util.isUIThread() ){
+ if( util.isUIThread() ){
/* Features specific to the main window thread... */
/**
WasmAllocError: WasmAllocError,
SQLite3Error: SQLite3Error,
capi,
+ util,
+ wasm,
config,
/**
Holds the version info of the sqlite3 source tree from which
this array is deleted.
Note that the order of insertion into this array is significant for
- some pieces. e.g. sqlite3.capi and sqlite3.capi.wasm cannot be fully
+ some pieces. e.g. sqlite3.capi and sqlite3.wasm cannot be fully
utilized until the whwasmutil.js part is plugged in via
sqlite3-api-glue.js.
*/
if(db){
delete this.dbs[getDbId(db)];
const filename = db.filename;
- const pVfs = sqlite3.capi.wasm.sqlite3_wasm_db_vfs(db.pointer, 0);
+ const pVfs = sqlite3.wasm.sqlite3_wasm_db_vfs(db.pointer, 0);
db.close();
if(db===this.defaultDb) this.defaultDb = undefined;
if(alsoUnlink && filename && pVfs){
- sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(pVfs, filename);
+ sqlite3.wasm.sqlite3_wasm_vfs_unlink(pVfs, filename);
}
}
},
- `sqlite3.dir`, if set, treats the given directory name as the
directory from which `sqlite3.js` will be loaded.
-
- By default is loads 'sqlite3.js'.
*/
"use strict";
(()=>{
//console.warn("worker1 theJs =",theJs);
importScripts(theJs);
sqlite3InitModule().then((sqlite3)=>{
- sqlite3.capi.sqlite3_wasmfs_opfs_dir();
+ if(sqlite3.capi.sqlite3_wasmfs_opfs_dir){
+ sqlite3.capi.sqlite3_wasmfs_opfs_dir();
+ }
sqlite3.initWorker1API();
});
})();
// This would be SO much easier with the oo1 API, but we specifically want to
// inject metrics we can't get via that API, and we cannot reliably (OPFS)
// open the same DB twice to clear it using that API, so...
- const rc = sqlite3.capi.wasm.exports.sqlite3_wasm_db_reset(db.handle);
+ const rc = sqlite3.wasm.exports.sqlite3_wasm_db_reset(db.handle);
App.logHtml("reset db rc =",rc,db.id, db.filename);
};
const banner = "========================================";
this.logHtml(banner,
"Running",name,'('+sql.length,'bytes) using',db.id);
- const capi = this.sqlite3.capi, wasm = capi.wasm;
+ const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
let pStmt = 0, pSqlBegin;
const stack = wasm.scopedAllocPush();
const metrics = db.metrics = Object.create(null);
return;
}
if(!db.handle) return;
- const capi = this.sqlite3, wasm = capi.wasm;
+ const capi = this.sqlite3, wasm = this.sqlite3.wasm;
//const scope = wasm.scopedAllocPush(
this.logErr("TODO: clear db");
},
App.logHtml(dbId,"cache_size =",cacheSize);
});
}else{
- const capi = this.sqlite3.capi, wasm = capi.wasm;
+ const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
const stack = wasm.scopedAllocPush();
let pDb = 0;
try{
run: function(sqlite3){
delete this.run;
this.sqlite3 = sqlite3;
- const capi = sqlite3.capi, wasm = capi.wasm;
+ const capi = sqlite3.capi, wasm = sqlite3.wasm;
this.logHtml("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
this.logHtml("WASM heap size =",wasm.heap8().length);
this.loadSqlList();
const runTests = function(sqlite3){
const capi = sqlite3.capi,
oo = sqlite3.oo1,
- wasm = capi.wasm;
+ wasm = sqlite3.wasm;
log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
T.assert( 0 !== capi.sqlite3_vfs_find(null) );
if(!capi.sqlite3_vfs_find('kvvfs')){
const Sqlite3Shell = {
/** Returns the name of the currently-opened db. */
dbFilename: function f(){
- if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_db_filename', "string", ['string']);
+ if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_db_filename', "string", ['string']);
return f._(0);
},
dbHandle: function f(){
- if(!f._) f._ = sqlite3.capi.wasm.xWrap("fiddle_db_handle", "sqlite3*");
+ if(!f._) f._ = sqlite3.wasm.xWrap("fiddle_db_handle", "sqlite3*");
return f._();
},
dbIsOpfs: function f(){
that any argv strings passed to its main() are valid until
the wasm environment shuts down. */
];
- const capi = sqlite3.capi;
+ const capi = sqlite3.capi, wasm = sqlite3.wasm;
/* We need to call sqlite3_shutdown() in order to avoid numerous
legitimate warnings from the shell about it being initialized
after sqlite3_initialize() has been called. This means,
VFSes). We need a more generic approach to running such
init-level code. */
capi.sqlite3_shutdown();
- f.argv.pArgv = capi.wasm.allocMainArgv(f.argv);
- f.argv.rc = capi.wasm.exports.fiddle_main(
+ f.argv.pArgv = wasm.allocMainArgv(f.argv);
+ f.argv.rc = wasm.exports.fiddle_main(
f.argv.length, f.argv.pArgv
);
if(f.argv.rc){
exec: function f(sql){
if(!f._){
if(!this.runMain()) return;
- f._ = sqlite3.capi.wasm.xWrap('fiddle_exec', null, ['string']);
+ f._ = sqlite3.wasm.xWrap('fiddle_exec', null, ['string']);
}
if(fiddleModule.isDead){
stderr("shell module has exit()ed. Cannot run SQL.");
}
},
resetDb: function f(){
- if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_reset_db', null);
+ if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_reset_db', null);
stdout("Resetting database.");
f._();
stdout("Reset",this.dbFilename());
/* Interrupt can't work: this Worker is tied up working, so won't get the
interrupt event which would be needed to perform the interrupt. */
interrupt: function f(){
- if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_interrupt', null);
+ if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_interrupt', null);
stdout("Requesting interrupt.");
f._();
}
*/
sqlite3InitModule(fiddleModule).then((_sqlite3)=>{
sqlite3 = _sqlite3;
- const dbVfs = sqlite3.capi.wasm.xWrap('fiddle_db_vfs', "*", ['string']);
+ const dbVfs = sqlite3.wasm.xWrap('fiddle_db_vfs', "*", ['string']);
fiddleModule.fsUnlink = (fn)=>{
- return sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(dbVfs(0), fn);
+ return sqlite3.wasm.sqlite3_wasm_vfs_unlink(dbVfs(0), fn);
};
wMsg('fiddle-ready');
})/*then()*/;
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
- <script src="jswasm/sqlite3.js"></script>
<title>sqlite3 Module Symbols</title>
</head>
<body>
-<div class="fossil-doc" data-title="sqlite3 Module Symbols">
+
+<div class="fossil-doc" data-title="sqlite3 Module Symbols"><!-- EXTRACT_BEGIN -->
+<!--
+ The part of this doc wrapped in div.fossil-doc gets snipped out
+ from the canonical copy in the main tree (ext/wasm/module-symbols.html)
+ and added to the wasm docs repository, where it's served from
+ fossil.
+ -->
<style>
.pseudolist {
column-count: auto;
<p>Jump to...</p>
<ul>
<li><a href='#sqlite3-namespace'><code>sqlite3</code> namespace</a></li>
- <li><a href='#sqlite3-version'><code>sqlite3.version</code></a></li>
+ <li><a href='#sqlite3-version'><code>sqlite3.version</code> object</a></li>
<li><a href='#sqlite3-functions'><code>sqlite3_...()</code> functions</a></li>
<li><a href='#sqlite3-constants'><code>SQLITE_...</code> functions</a></li>
<li><a href='#sqlite3.oo1'><code>sqlite3.oo1</code></a>
<li><a href='#sqlite3.oo1.Stmt'><code>sqlite3.oo1.Stmt</code></a></li>
</ul-->
</li>
- <li><a href='#sqlite3.capi.wasm'><code>sqlite3.capi.wasm</code></a></li>
- <li><a href='#sqlite3.capi.wasm.pstack'><code>sqlite3.capi.wasm.pstack</code></a></li>
+ <li><a href='#sqlite3.wasm'><code>sqlite3.wasm</code> namespace</a></li>
+ <li><a href='#sqlite3.wasm.pstack'><code>sqlite3.wasm.pstack</code> namespace</a></li>
<li><a href='#compile-options'>Compilation options used in this module build.</a></li>
</ul>
<div id='list-namespace' class='pseudolist'></div>
<a id="sqlite3-version"></a>
- <h1><code>sqlite3.version</code></h1>
+ <h1><code>sqlite3.version</code> Object</h1>
<p>
The <code>sqlite3.version</code> object exposes the following...
</p>
<a id="sqlite3-functions"></a>
<h1><code>sqlite3_...()</code> Function List</h1>
- <p>The <code>sqlite3.capi</code> object exposes the following
+ <p>The <code>sqlite3.capi</code> namespace exposes the following
<a href='https://sqlite.org/c3ref/funclist.html'><code>sqlite3_...()</code>
functions</a>...
</p>
<a id="sqlite3-constants"></a>
<h1><code>SQLITE_...</code> Constants</h1>
- <p>The <code>sqlite3.capi</code> object exposes the following
+ <p>The <code>sqlite3.capi</code> namespace exposes the following
<a href='https://sqlite.org/c3ref/constlist.html'><code>SQLITE_...</code>
constants</a>...
</p>
<div id='list-constants' class='pseudolist'></div>
<a id="sqlite3.oo1"></a>
- <h1><code>sqlite3.oo1</code></h1>
+ <h1><code>sqlite3.oo1</code> Namespace</h1>
<p>
- The <code>sqlite3.oo1</code> object exposes the following...
+ The <code>sqlite3.oo1</code> namespace exposes the following...
</p>
<div id='list-oo1' class='pseudolist'></div>
- <a id="sqlite3.capi.wasm"></a>
- <h1><code>sqlite3.capi.wasm</code></h1>
+ <a id="sqlite3.wasm"></a>
+ <h1><code>sqlite3.wasm</code> Namespace</h1>
<p>
- The <code>sqlite3.capi.wasm</code> object exposes the
+ The <code>sqlite3.wasm</code> namespace exposes the
following...
</p>
<div id='list-wasm' class='pseudolist'></div>
- <a id="sqlite3.capi.wasm.pstack"></a>
- <h1><code>sqlite3.capi.wasm.pstack</code></h1>
+ <a id="sqlite3.wasm.pstack"></a>
+ <h1><code>sqlite3.wasm.pstack</code> Namespace</h1>
<p>
- The <code>sqlite3.capi.wasm.pstack</code> object exposes the
+ The <code>sqlite3.wasm.pstack</code> namespace exposes the
following...
</p>
<div id='list-wasm-pstack' class='pseudolist'></div>
<div id='list-compile-options' class='pseudolist'></div>
</div><!-- .initially-hidden -->
+ <script src="jswasm/sqlite3.js">/* This tag MUST be in side the
+ fossil-doc block so that this part can work without modification in
+ the wasm docs repo. */</script>
<script>(async function(){
const eNew = (tag,parent)=>{
const e = document.createElement(tag);
const renderIt = async function(sqlite3){
self.sqlite3 = sqlite3;
console.warn("sqlite3 installed as global symbol self.sqlite3.");
- const capi = sqlite3.capi;
+ const capi = sqlite3.capi, wasm = sqlite3.wasm;
const cmpIcase = (a,b)=>a.toLowerCase().localeCompare(b.toLowerCase());
const renderX = function(tgtElem, container, keys){
for(const k of keys.sort(cmpIcase)){
const excludeWasm = ['ctype'];
renderX(E('#list-wasm'),
- capi.wasm,
- Object.keys(capi.wasm)
- .filter((v)=>{
+ wasm, Object.keys(wasm).filter((v)=>{
return !v.startsWith('sqlite3_wasm_')
&& excludeWasm.indexOf(v)<0;
}));
- const psKeys = Object.keys(capi.wasm.pstack);
+ const psKeys = Object.keys(wasm.pstack);
psKeys.push('pointer','quota','remaining');
- renderX(E('#list-wasm-pstack'), capi.wasm.pstack, psKeys);
+ renderX(E('#list-wasm-pstack'), wasm.pstack, psKeys);
- const cou = capi.wasm.compileOptionUsed();
+ const cou = wasm.compileOptionUsed();
renderX(E('#list-compile-options'), cou, Object.keys(cou));
};
}/*myModule*/;
self.sqlite3InitModule(myModule).then(renderIt);
})();</script>
-</div><!-- .fossil-doc -->
+</div><!-- .fossil-doc EXTRACT_END -->
</body></html>
const runTests = function(sqlite3){
const capi = sqlite3.capi,
oo = sqlite3.oo1,
- wasm = capi.wasm;
+ wasm = sqlite3.wasm;
stdout("Loaded sqlite3:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
const persistentDir = capi.sqlite3_wasmfs_opfs_dir();
if(persistentDir){
<div id='toolbar-select'>
<select id='select-flags' size='10' multiple></select>
<div>The following flags can be passed as URL parameters:
- vfs=NAME, size=N, journal=MODE, cachesize=BYTES
+ vfs=NAME, size=N, journal=MODE, cachesize=SIZE
</div>
</div>
<div class='toolbar-inner-vertical'>
self.sqlite3InitModule(EmscriptenModule).then((sqlite3)=>{
const S = sqlite3;
App.vfsUnlink = function(pDb, fname){
- const pVfs = S.capi.wasm.sqlite3_wasm_db_vfs(pDb, 0);
- if(pVfs) S.capi.wasm.sqlite3_wasm_vfs_unlink(pVfs, fname||0);
+ const pVfs = S.wasm.sqlite3_wasm_db_vfs(pDb, 0);
+ if(pVfs) S.wasm.sqlite3_wasm_vfs_unlink(pVfs, fname||0);
};
App.pDir = wasmfsDir(S.wasm);
- App.wasm = S.capi.wasm;
+ App.wasm = S.wasm;
//if(App.pDir) log("Persistent storage:",pDir);
//else log("Using transient storage.");
mPost('ready',true);
};
const runTests = function(sqlite3){
- const capi = sqlite3.capi, wasm = capi.wasm;
+ const capi = sqlite3.capi, wasm = sqlite3.wasm;
//console.debug('sqlite3 =',sqlite3);
const pDir = wasmfsDir(wasm);
if(pDir){
/* Predicate for tests/groups. */
const testIsTodo = ()=>false;
const haveWasmCTests = ()=>{
- return !!wasm.exports.sqlite3_wasm_test_int64_max;
+ return !!wasm.exports.sqlite3_wasm_test_intptr;
};
{
const mapToString = (v)=>{
////////////////////////////////////////////////////////////////////
T.g('C/WASM Utilities')
- .t('sqlite3.capi.wasm', function(sqlite3){
+ .t('sqlite3.wasm namespace', function(sqlite3){
const w = wasm;
const chr = (x)=>x.charCodeAt(0);
//log("heap getters...");
////////////////////////////////////////////////////////////////////
.t('sqlite3.StructBinder (jaccwabyt)', function(sqlite3){
- const S = sqlite3, W = S.capi.wasm;
+ const S = sqlite3, W = S.wasm;
const MyStructDef = {
sizeof: 16,
members: {
.t('sqlite3.StructBinder part 2', function(sqlite3){
// https://www.sqlite.org/c3ref/vfs.html
// https://www.sqlite.org/c3ref/io_methods.html
- const W = wasm;
const sqlite3_io_methods = capi.sqlite3_io_methods,
sqlite3_vfs = capi.sqlite3_vfs,
sqlite3_file = capi.sqlite3_file;
this.__ondispose.forEach(
(v)=>{
if('number'===typeof v){
- try{capi.wasm.uninstallFunction(v)}
+ try{wasm.uninstallFunction(v)}
catch(e){/*ignore*/}
}else{/*wasm function wrapper property*/
delete who[v];
tgt.__ondispose = [];
}
const fProxy = callee.argcProxy(func, sigN);
- const pFunc = capi.wasm.installFunction(fProxy, tgt.memberSignature(name, true));
+ const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name, true));
tgt[memKey] = pFunc;
/**
ACHTUNG: function pointer IDs are from a different pool than
/* int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) */
log("xRead(",arguments,")");
if(!(f = instm._requireFileArg(f))) return capi.SQLITE_MISUSE;
- capi.wasm.heap8().fill(0, dest + offset, n);
+ wasm.heap8().fill(0, dest + offset, n);
return 0;
},
xWrite: /*i(Ppij)*/function(f,dest,n,offset){
/* int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize) */
log("xFileSize(",arguments,")");
if(!(f=instm._requireFileArg(f,'xFileSize'))) return capi.SQLITE_MISUSE;
- capi.wasm.setMemValue(pSz, 0/*file size*/);
+ wasm.setMemValue(pSz, 0/*file size*/);
return 0;
},
xLock: /*i(Pi)*/function(f){
.assert(dVfs.$iVersion>0)
.assert('number'===typeof dVfs.$zName)
.assert('number'===typeof dVfs.$xSleep)
- .assert(capi.wasm.functionEntry(dVfs.$xOpen))
+ .assert(wasm.functionEntry(dVfs.$xOpen))
.assert(dVfs.memberIsString('zName'))
.assert(dVfs.memberIsString('$zName'))
.assert(!dVfs.memberIsString('pAppData'))
}
//log(prefix, sep, val);
}else{
- //log(prefix," = funcptr @",addr, capi.wasm.functionEntry(addr));
+ //log(prefix," = funcptr @",addr, wasm.functionEntry(addr));
}
});
}finally{
}/*StructBinder part 2*/)
////////////////////////////////////////////////////////////////////
- .t('sqlite3.capi.wasm.pstack', function(sqlite3){
- const w = sqlite3.capi.wasm, P = w.pstack;
+ .t('sqlite3.wasm.pstack', function(sqlite3){
+ const P = wasm.pstack;
const isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
const stack = P.pointer;
T.assert(0===stack % 8 /* must be 8-byte aligned */);
T.g('sqlite3.oo1')
.t('Create db', function(sqlite3){
const dbFile = '/tester1.db';
- sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(0, dbFile);
+ wasm.sqlite3_wasm_vfs_unlink(0, dbFile);
const db = this.db = new sqlite3.oo1.DB(dbFile);
T.assert(Number.isInteger(db.pointer)).
mustThrowMatching(()=>db.pointer=1, /read-only/).
T.assert(2 === list.length)
.assert('string'===typeof list[1])
.assert(4===db.changes());
- if(capi.wasm.bigIntEnabled){
+ if(wasm.bigIntEnabled){
T.assert(4n===db.changes(false,true));
}
let blob = db.selectValue("select b from t where a='blob'");
db.selectValue("SELECT "+Number.MIN_SAFE_INTEGER)).
assert(Number.MAX_SAFE_INTEGER ===
db.selectValue("SELECT "+Number.MAX_SAFE_INTEGER));
- if(capi.wasm.bigIntEnabled && haveWasmCTests()){
- const mI = capi.wasm.xCall('sqlite3_wasm_test_int64_max');
+ if(wasm.bigIntEnabled && haveWasmCTests()){
+ const mI = wasm.xCall('sqlite3_wasm_test_int64_max');
const b = BigInt(Number.MAX_SAFE_INTEGER * 2);
T.assert(b === db.selectValue("SELECT "+b)).
assert(b === db.selectValue("SELECT ?", b)).
//console.log('sqlite3 =',sqlite3);
log("Done initializing WASM/JS bits. Running tests...");
capi = sqlite3.capi;
- wasm = capi.wasm;
+ wasm = sqlite3.wasm;
log("sqlite3 version:",capi.sqlite3_libversion(),
capi.sqlite3_sourceid());
if(wasm.bigIntEnabled){
-C Fix\sharmless\scompiler\swarnings\sin\stesting\scode.
-D 2022-10-28T18:52:05.114
+C Move\sthe\ssqlite3.capi.wasm\snamespace\sto\ssqlite3.wasm.\sThis\scauses\sa\stiny\sbit\sof\snaming\sconfusion\swith\sthe\ssqlite3.wasm\s*file*,\sbut\sseems\sto\smake\smore\ssense\sthan\shaving\sit\sas\sa\ssub-namespace\sof\scapi.
+D 2022-10-29T07:54:10.497
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 7a8c06f9bdbb791f8ef084ecd47e099da81e5797b9b1d60e33ac9a07eedd5dbd
+F ext/wasm/GNUmakefile 10fabfc07b7eba712dee566de7e62569b020ab11a4dfa5e9bea205fc28f47516
F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b
F ext/wasm/api/pre-js.js 151e0616614a49f3db19ed544fa13b38c87c108959fbcd4029ea8399a562d94f
-F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588
-F ext/wasm/api/sqlite3-api-glue.js c47e86a1b91917cf37de8386e4a94669612565df7f35a5ad7e04028330e5db54
-F ext/wasm/api/sqlite3-api-oo1.js 9ae79193d05712f9883a3e1a1a54f0620354aeb85fef5850fad5e4a9437a5b4d
-F ext/wasm/api/sqlite3-api-opfs.js a4316c04b2eb6ae69fc9a8b33f1d0ff22a0398665d98e6504ee13221cbf5cc5b
-F ext/wasm/api/sqlite3-api-prologue.js 9ca7f1636cc401354e12c13b1f537a1ad9e024c6c0fddfa216f4aabf00bf206b
-F ext/wasm/api/sqlite3-api-worker1.js b2d650514ccc75f80dff666fd3ee68dc8fb4137bcd01caac2c62ff93a7ebf638
+F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34
+F ext/wasm/api/sqlite3-api-glue.js b87543534821ecfa56fc0d0cd153a115fa974e70d6217964baf6e93ef8d25fb1
+F ext/wasm/api/sqlite3-api-oo1.js 612063da9838286310712c5411f97b8b20759b1e31e75a9b25b6381541db79a8
+F ext/wasm/api/sqlite3-api-opfs.js c67cbe0b1451ec43bc6b3199e13453e1ca56d718a75c0498253b0d479c336256
+F ext/wasm/api/sqlite3-api-prologue.js a218dda5e5ced8894f65760131371e4cabd31062af58803af8952cc00ea778d2
+F ext/wasm/api/sqlite3-api-worker1.js efdca1b42299d80b54f366d15a8fc5343f3b3e9e3647e5c1fd6f3ee1015e501b
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js f04cb1eb483c92bc61fe02749f7afcf17ec803968171aedd7d96faf428c26bcb
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 940d576bda7068ba60492e206d06a3567b8a89a3770700aa88690a6e246a0c78
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
-F ext/wasm/api/sqlite3-worker1.js dbe54b69c1520a2d25eae148cd2750ded2dd7f219ea4ee46f83e0a851dca5974
+F ext/wasm/api/sqlite3-worker1.js 1e54ea3d540161bcfb2100368a2fc0cad871a207b8336afee1c445715851ec54
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
-F ext/wasm/batch-runner.js 5bae81684728b6be157d1f92b39824153f0fd019345b39f2ab8930f7ee2a57d8
+F ext/wasm/batch-runner.js 49609e89aaac9989d6c1ad3fae268e4878e1ad7bc5fd3e5c2f44959660780b2e
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/common/testing.css 739b58c44511f642f16f57b701c84dc9ee412d8bc47b3d8a99d947babfa69d9d
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e
-F ext/wasm/demo-jsstorage.js 105596bd2ccd0b1deb5fde8e99b536e8242d4bb5932fac0c8403ff3a6bc547e8
+F ext/wasm/demo-jsstorage.js 44e3ae7ec2483b6c511384c3c290beb6f305c721186bcf5398ca4e00004a06b8
F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98ab22f5786620b3354ed15f
F ext/wasm/demo-worker1-promiser.js f68ffbbe1c6086e18ce7961b8fc2b40dd88db174f59052e228c06b07484945ca
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/dist.make b687dc07db2dc9669369f126ac42c4ff6539dce2531063a0e75405c74a3cee1d
F ext/wasm/fiddle.make 68abe5dcfdd6fdf8dc1b715b94b96fae771b5b28bc1843997b9b1ec79407f2c9
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
-F ext/wasm/fiddle/fiddle-worker.js 41b9796d689fabbef1ad9447496d14645eeb4101b534e54951fa5259c877c341
+F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
F ext/wasm/index-dist.html cb0da16cba0f21cda2c25724c5869102d48eb0af04446acd3cd0ca031f80ed19
F ext/wasm/index.html ce6a68a75532b47e3c0adb83381a06d15de8c0ac0331fb7bf31d33f8e7c77dc4
F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215
F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e
-F ext/wasm/module-symbols.html e521cf07f8d136748e60d91e49b7b956e8bd56c58fc52acbe5ad58eaeaacf719
+F ext/wasm/module-symbols.html 25f6d585ef1d5034447701f18e972c2f3b98785250c9036cef93a4e36648d178
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
-F ext/wasm/scratchpad-wasmfs-main.js 1841c124a58e3f9e7ee580a0868d6e1834c5a01dbb47c8fdd565eda5db362437
+F ext/wasm/scratchpad-wasmfs-main.js 4c140457f4d6da9d646a49addd91edb6e9ad1643c6c48e3258b5bce24725dc18
F ext/wasm/speedtest1-wasmfs.html bc28eb29b69a73864b8d7aae428448f8b7e1de81d8bfb9bba99541322054dbd0
-F ext/wasm/speedtest1-worker.html 7b0cceab6a68b2883738e19f61d21620fe1244ba36c1b2e38d0efde57ecce86d
-F ext/wasm/speedtest1-worker.js 942af0909dee6e6a43af85d3e4a5e6aa74956290ca4b78fd4e753be13673ccd6
-F ext/wasm/speedtest1.html 3b3321eee32b6becf0b2134fd8f17db5802b400b8233c3537527d3c46e4e17b9
+F ext/wasm/speedtest1-worker.html 94246488e10af9daa1ebd0979b1b8d7a22a579e5a983fa2a5ad94591ecf55f2c
+F ext/wasm/speedtest1-worker.js 13b57c4a41729678a1194014afec2bd5b94435dcfc8d1039dfa9a533ac819ee1
+F ext/wasm/speedtest1.html e4c4e5c1c8ec1ad13c995e346e4216a1df152fd2c5cd17e0793b865b2f3c5000
F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f1293583ad5af0cd3a3779e205 x
F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889e8129c6e2548
F ext/wasm/tester1-worker.html d02b9d38876b023854cf8955e77a40912f7e516956b4dbe1ec7f215faac273ee
F ext/wasm/tester1.html c6c47e5a8071eb09cb1301104435c8e44fbb5719c92411f5b2384a461f9793c5
-F ext/wasm/tester1.js 2b971e6dd291513685f38552340adc1d2e09f7b0a5bccf21c81f8037d6242bf3
+F ext/wasm/tester1.js 679013b874152427d302e56f78bf542c47a090a85c8ca010bb4002859431cf61
F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P e65c5bdc5bd6e1989c3de59798ff0a761125fc490fdec8c7671ca70ed688c4f8
-R 2092bbb0212ed06397996f6b20b31c55
-U drh
-Z 91f846334499b4960f1a923dbe22c496
+P 2f53612388507f9b1ecbec3c15281825beab54b8062d97d0ab6f009c5fed347b
+R d0f4845aee84bee01e10da61e480927d
+U stephan
+Z c420db9475e5b45210b3c19ba7dfb33a
# Remove this line to create a well-formed Fossil manifest.
-2f53612388507f9b1ecbec3c15281825beab54b8062d97d0ab6f009c5fed347b
\ No newline at end of file
+3f16eb18d6186ca972fca952ccac18649e7a905213f589e53c0c9333e695448d
\ No newline at end of file