** requires compiling with -std=c99 (or equivalent, or a later C
** version) because it makes use of features not available in C89.
**
-** At it's simplest, to build sqlite3.wasm either place this file
+** At its simplest, to build sqlite3.wasm either place this file
** in the same directory as sqlite3.c/h before compilation or use the
** -I/path flag to tell the compiler where to find both of those
** files, then compile this file. For example:
** this writing we are tied to Emscripten for various reasons
** and cannot test the library with other build environments.
*/
-#define WASM_KEEP __attribute__((used,visibility("default")))
+#define SQLITE_WASM_KEEP __attribute__((used,visibility("default")))
// See also:
//__attribute__((export_name("theExportedName"), used, visibility("default")))
** Another option is to malloc() a chunk of our own and call that our
** "stack".
*/
-WASM_KEEP void * sqlite3_wasm_stack_end(void){
+SQLITE_WASM_KEEP void * sqlite3_wasm_stack_end(void){
extern void __heap_base
/* see https://stackoverflow.com/questions/10038964 */;
return &__heap_base;
}
-WASM_KEEP void * sqlite3_wasm_stack_begin(void){
+SQLITE_WASM_KEEP void * sqlite3_wasm_stack_begin(void){
extern void __data_end;
return &__data_end;
}
static void * pWasmStackPtr = 0;
-WASM_KEEP void * sqlite3_wasm_stack_ptr(void){
+SQLITE_WASM_KEEP void * sqlite3_wasm_stack_ptr(void){
if(!pWasmStackPtr) pWasmStackPtr = sqlite3_wasm_stack_end();
return pWasmStackPtr;
}
-WASM_KEEP void sqlite3_wasm_stack_restore(void * p){
+SQLITE_WASM_KEEP void sqlite3_wasm_stack_restore(void * p){
pWasmStackPtr = p;
}
-WASM_KEEP void * sqlite3_wasm_stack_alloc(int n){
+SQLITE_WASM_KEEP void * sqlite3_wasm_stack_alloc(int n){
if(n<=0) return 0;
n = (n + 7) & ~7 /* align to 8-byte boundary */;
unsigned char * const p = (unsigned char *)sqlite3_wasm_stack_ptr();
/*
** Returns the current pstack position.
*/
-WASM_KEEP void * sqlite3_wasm_pstack_ptr(void){
+SQLITE_WASM_KEEP void * sqlite3_wasm_pstack_ptr(void){
return PStack.pPos;
}
/*
** Sets the pstack position poitner to p. Results are undefined if the
** given value did not come from sqlite3_wasm_pstack_ptr().
*/
-WASM_KEEP void sqlite3_wasm_pstack_restore(unsigned char * p){
+SQLITE_WASM_KEEP void sqlite3_wasm_pstack_restore(unsigned char * p){
assert(p>=PStack.pBegin && p<=PStack.pEnd && p>=PStack.pPos);
assert(0==(p & 0x7));
if(p>=PStack.pBegin && p<=PStack.pEnd /*&& p>=PStack.pPos*/){
** JS code from having to do so, and most uses of the pstack will
** call for doing so).
*/
-WASM_KEEP void * sqlite3_wasm_pstack_alloc(int n){
+SQLITE_WASM_KEEP void * sqlite3_wasm_pstack_alloc(int n){
if( n<=0 ) return 0;
//if( n & 0x7 ) n += 8 - (n & 0x7) /* align to 8-byte boundary */;
n = (n + 7) & ~7 /* align to 8-byte boundary */;
** Return the number of bytes left which can be
** sqlite3_wasm_pstack_alloc()'d.
*/
-WASM_KEEP int sqlite3_wasm_pstack_remaining(void){
+SQLITE_WASM_KEEP int sqlite3_wasm_pstack_remaining(void){
assert(PStack.pPos >= PStack.pBegin);
assert(PStack.pPos <= PStack.pEnd);
return (int)(PStack.pPos - PStack.pBegin);
** any space which is currently allocated. This value is a
** compile-time constant.
*/
-WASM_KEEP int sqlite3_wasm_pstack_quota(void){
+SQLITE_WASM_KEEP int sqlite3_wasm_pstack_quota(void){
return (int)(PStack.pEnd - PStack.pBegin);
}
**
** Returns err_code.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_db_error(sqlite3*db, int err_code, const char *zMsg){
- if(0!=zMsg){
+ if( 0!=zMsg ){
const int nMsg = sqlite3Strlen30(zMsg);
sqlite3ErrorWithMsg(db, err_code, "%.*s", nMsg, zMsg);
}else{
** buffer is not large enough for the generated JSON and needs to be
** increased. In debug builds that will trigger an assert().
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
const char * sqlite3_wasm_enum_json(void){
static char aBuffer[1024 * 12] = {0} /* where the JSON goes */;
int n = 0, nChildren = 0, nStruct = 0
** This function is NOT part of the sqlite3 public API. It is strictly
** for use by the sqlite project's own JS/WASM bindings.
**
+** Do not use this function, even for internal use: it was
+** ill-conceived and will be removed once the JS code which still
+** calls it has been weeded out.
+**
** This function invokes the xDelete method of the default VFS,
** passing on the given filename. If zName is NULL, no default VFS is
** found, or it has no xDelete method, SQLITE_MISUSE is returned, else
** the result of the xDelete() call is returned.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_vfs_unlink(const char * zName){
int rc = SQLITE_MISUSE /* ??? */;
sqlite3_vfs * const pVfs = sqlite3_vfs_find(0);
** Returns 0 on success, an SQLITE_xxx code on error. Returns
** SQLITE_MISUSE if pDb is NULL.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_db_reset(sqlite3*pDb){
int rc = SQLITE_MISUSE;
if( pDb ){
}
/*
-** Uses the current database's VFS xRead to stream the db file's
+** Uses the given database's VFS xRead to stream the db file's
** contents out to the given callback. The callback gets a single
** chunk of size n (its 2nd argument) on each call and must return 0
** on success, non-0 on error. This function returns 0 on success,
** sqlite3_wasm_db_serialize() is arguably the better way to achieve
** this.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_db_export_chunked( sqlite3* pDb,
int (*xCallback)(unsigned const char *zOut, int n) ){
sqlite3_int64 nSize = 0;
** If `*pOut` is not NULL, the caller is responsible for passing it to
** sqlite3_free() to free it.
*/
-WASM_KEEP
-int sqlite3_wasm_db_serialize( sqlite3* pDb, unsigned char **pOut, sqlite3_int64 * nOut,
- unsigned int mFlags ){
+SQLITE_WASM_KEEP
+int sqlite3_wasm_db_serialize( sqlite3* pDb, unsigned char **pOut,
+ sqlite3_int64 * nOut, unsigned int mFlags ){
unsigned char * z;
if( !pDb || !pOut ) return SQLITE_MISUSE;
if(nOut) *nOut = 0;
** NUL-terminated pointer to that string. It is up to the caller to
** use sqlite3_wasm_pstack_restore() to free the returned pointer.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
char * sqlite3_wasm_kvvfsMakeKeyOnPstack(const char *zClass,
const char *zKeyIn){
assert(sqlite3KvvfsMethods.nKeySize>24);
** Returns the pointer to the singleton object which holds the kvvfs
** I/O methods and associated state.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
sqlite3_kvvfs_methods * sqlite3_wasm_kvvfs_methods(void){
return &sqlite3KvvfsMethods;
}
** This function may be passed a "mount point" name, which must have a
** leading "/" and is currently restricted to a single path component,
** e.g. "/foo" is legal but "/foo/" and "/foo/bar" are not. If it is
-** NULL or empty, it defaults to "/persistent".
+** NULL or empty, it defaults to "/opfs".
**
** Returns 0 on success, SQLITE_NOMEM if instantiation of the backend
** object fails, SQLITE_IOERR if mkdir() of the zMountPoint dir in
** the virtual FS fails. In builds compiled without SQLITE_WASM_WASMFS
** defined, SQLITE_NOTFOUND is returned without side effects.
*/
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_init_wasmfs(const char *zMountPoint){
static backend_t pOpfs = 0;
if( !zMountPoint || !*zMountPoint ) zMountPoint = "/opfs";
return pOpfs ? 0 : SQLITE_NOMEM;
}
#else
-WASM_KEEP
+SQLITE_WASM_KEEP
int sqlite3_wasm_init_wasmfs(const char *zUnused){
emscripten_console_warn("WASMFS OPFS is not compiled in.");
if(zUnused){/*unused*/}
}
#endif /* __EMSCRIPTEN__ && SQLITE_WASM_WASMFS */
-#undef WASM_KEEP
+#undef SQLITE_WASM_KEEP
-C Correct\smismatched\sH1\stags\sin\stest\scode.\sMinor\sCSS\stweaks.
-D 2022-10-12T14:39:15.726
+C Minor\sdoc\scleanups\sand\scorrections\sin\ssqlite3-wasm.c
+D 2022-10-12T15:40:16.122
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/wasm/api/sqlite3-api-prologue.js daf288df965cab1e8eabee4451f6ba3beb03d5a579722b0b0f90e5203962f515
F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
-F ext/wasm/api/sqlite3-wasm.c ea456d398bda1c5f4b2c4a54512de7b9ca4513c2b0ab326b99a46fb51cef0b42
+F ext/wasm/api/sqlite3-wasm.c a321f12ceedac8611c1377ccfb5df0c0547bd9395f7fd7613827de365d994948
F ext/wasm/batch-runner.html cf1a410c92bad50fcec2ddc71390b4e9df63a6ea1bef12a5163a66a0af4d78d9
F ext/wasm/batch-runner.js 5bae81684728b6be157d1f92b39824153f0fd019345b39f2ab8930f7ee2a57d8
F ext/wasm/common/SqliteTestUtil.js 647bf014bd30bdd870a7e9001e251d12fc1c9ec9ce176a1004b838a4b33c5c05
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 56ff42053f7b73b380c103a84f29e285cfbfb6e18a25b3a50a6d78e32610914e
-R 05647e42780f3b3d4973106aac02535b
+P 4d8eb90a370054d4482c20637ab56f5e01f4d10215f2af4e35fb9a1f85ecb700
+R ec480873b71afa3a4f3e56bd5ade8bb5
U stephan
-Z 9edc725f213a1258fdc6680a6f64d9ac
+Z 751b3d56cb87f4b752682f04e4cf1f99
# Remove this line to create a well-formed Fossil manifest.