Add wasm.cArgvToJs() to support sqlite3_module::xConnect().
FossilOrigin-Name: c3ebdccf94d5e63c229bf91056c08052d78732e663334070ef3b0ef6fb4bfb8f
This commit is contained in:
parent
b849832a79
commit
671386c637
@ -1131,6 +1131,27 @@ self.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
target.allocMainArgv = (list)=>__allocMainArgv(false, list);
|
||||
|
||||
/**
|
||||
Expects to be given a C-style string array and its length. It
|
||||
returns a JS array of strings and/or nulls: any entry in the
|
||||
pArgv array which is NULL results in a null entry in the result
|
||||
array. If argc is 0 then an empty array is returned.
|
||||
|
||||
Results are undefined if any entry in the first argc entries of
|
||||
pArgv are neither 0 (NULL) nor legal UTF-format C strings.
|
||||
|
||||
To be clear, the expected C-style arguments to be passed to this
|
||||
function are `(int, char **)` (optionally const-qualified).
|
||||
*/
|
||||
target.cArgvToJs = (argc, pArgv)=>{
|
||||
const list = [];
|
||||
for(let i = 0; i < argc; ++i){
|
||||
const arg = target.getPtrValue(pArgv + (target.ptrSizeof * i));
|
||||
list.push( arg ? target.cstringToJs(arg) : null );
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
/**
|
||||
Wraps function call func() in a scopedAllocPush() and
|
||||
scopedAllocPop() block, such that all calls to scopedAlloc() and
|
||||
|
@ -1544,6 +1544,11 @@ self.sqlite3InitModule = sqlite3InitModule;
|
||||
const tmplMethods = {
|
||||
xConnect: function(pDb, pAux, argc, argv, ppVtab, pzErr){
|
||||
try{
|
||||
const args = wasm.cArgvToJs(argc, argv);
|
||||
T.assert(args.length>=3)
|
||||
.assert(args[0] === 'testvtab')
|
||||
.assert(args[1] === 'main')
|
||||
.assert(args[2] === 'testvtab');
|
||||
const rc = capi.sqlite3_declare_vtab(
|
||||
pDb, "CREATE TABLE ignored(a,b)"
|
||||
);
|
||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Minor\sinternal\sJS\scode/docs\scleanups.
|
||||
D 2022-12-06T08:21:23.652
|
||||
C Add\swasm.cArgvToJs()\sto\ssupport\ssqlite3_module::xConnect().
|
||||
D 2022-12-06T08:39:17.647
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -521,7 +521,7 @@ F ext/wasm/c-pp.c 92285f7bce67ed7b7020b40fde8ed0982c442b63dc33df9dfd4b658d4a6c07
|
||||
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
|
||||
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
|
||||
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
|
||||
F ext/wasm/common/whwasmutil.js cedbdb2162db129fd95951025572e087066d5457adc27ffd8083610a26306fc9
|
||||
F ext/wasm/common/whwasmutil.js 8be1a3a3ebca51ab5d02fc89f6d45f974b99f0d99262227094e8af4b7ade3234
|
||||
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
||||
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
||||
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
|
||||
@ -555,7 +555,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
|
||||
F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac
|
||||
F ext/wasm/tester1-worker.html d43f3c131d88f10d00aff3e328fed13c858d674ea2ff1ff90225506137f85aa9
|
||||
F ext/wasm/tester1.c-pp.html d34bef3d48e5cbc1c7c06882ad240fec49bf88f5f65696cc2c72c416933aa406
|
||||
F ext/wasm/tester1.c-pp.js 411a120a4e57b5f43c3f7448d72c48b4fedb7b4b62efe0c617dd412c192c2810
|
||||
F ext/wasm/tester1.c-pp.js 51d396bc0a4e6abc700def5529ce290ea84ba2018741fc7e701c5162b0f1e5fb
|
||||
F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
|
||||
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
|
||||
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
|
||||
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d106edb956bbe22bddc2c6e5bcdf4fb8f797794c725c2e359e3fa4b31d881843
|
||||
R 9cc98a74b7c97dbae209498a8d29cfcb
|
||||
P 21331bdd36a91b07a687ffadce392dcf2ccd0fd824b35d9dd027d4289a40fc96
|
||||
R f99279163c9ea24b92a1c120dee81c3c
|
||||
U stephan
|
||||
Z 5e0b6a6419517a5a90c958328ab9c938
|
||||
Z 5af57eae4e4ffe17648ac57b69cb7a17
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
21331bdd36a91b07a687ffadce392dcf2ccd0fd824b35d9dd027d4289a40fc96
|
||||
c3ebdccf94d5e63c229bf91056c08052d78732e663334070ef3b0ef6fb4bfb8f
|
Loading…
Reference in New Issue
Block a user