1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Resolve "already configured" warnings from shell's main() when starting it up in fiddle mode.

FossilOrigin-Name: 114ef3552af977b272a0baddeb9a2326484b60acfc75284e43c55530f86b413f
This commit is contained in:
stephan
2022-09-24 10:15:08 +00:00
parent 56fae744d4
commit ef11fb915d
6 changed files with 62 additions and 36 deletions

View File

@@ -1164,21 +1164,27 @@ self.WhWasmUtilInstaller = function(target){
/** Map of type names to return result conversion functions. */
cache.xWrap.convert.result = Object.create(null);
xcv.arg.i64 = (i)=>BigInt(i);
if(target.bigIntEnabled){
xcv.arg.i64 = (i)=>BigInt(i);
}
xcv.arg.i32 = (i)=>(i | 0);
xcv.arg.i16 = (i)=>((i | 0) & 0xFFFF);
xcv.arg.i8 = (i)=>((i | 0) & 0xFF);
xcv.arg.f32 = xcv.arg.float = (i)=>Number(i).valueOf();
xcv.arg.f64 = xcv.arg.double = xcv.arg.f32;
xcv.arg.int = xcv.arg.i32;
xcv.result['*'] = xcv.result['pointer'] = xcv.arg[ptrIR];
xcv.result['*'] = xcv.result['pointer'] = xcv.arg['**'] = xcv.arg[ptrIR];
xcv.result['number'] = (v)=>Number(v);
for(const t of ['i8', 'i16', 'i32', 'int', 'i64',
'f32', 'float', 'f64', 'double']){
xcv.arg[t+'*'] = xcv.result[t+'*'] = xcv.arg[ptrIR]
xcv.result[t] = xcv.arg[t] || toss("Missing arg converter:",t);
{
const copyToResult = ['i8', 'i16', 'i32', 'int',
'f32', 'float', 'f64', 'double'];
if(target.bigIntEnabled) copyToResult.push('i64');
for(const t of copyToResult){
xcv.arg[t+'*'] = xcv.result[t+'*'] = xcv.arg[ptrIR];
xcv.result[t] = xcv.arg[t] || toss("Missing arg converter:",t);
}
}
xcv.arg['**'] = xcv.arg[ptrIR];
/**
In order for args of type string to work in various contexts in
@@ -1301,12 +1307,18 @@ self.WhWasmUtilInstaller = function(target){
type. It's primarily intended to mark output-pointer arguments.
- `i64` (args and results): passes the value to BigInt() to
convert it to an int64.
convert it to an int64. Only available if bigIntEnabled is
true.
- `f32` (`float`), `f64` (`double`) (args and results): pass
their argument to Number(). i.e. the adaptor does not currently
distinguish between the two types of floating-point numbers.
- `number` (results): converts the result to a JS Number using
Number(theValue).valueOf(). Note that this is for result
conversions only, as it's not possible to generically know
which type of number to convert arguments to.
Non-numeric conversions include:
- `string` (args): has two different semantics in order to