From d93248bd9f5fc21553a5df451ce90ad31cd629f8 Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Tue, 4 May 2021 16:57:02 +0530 Subject: [PATCH] Get SQLite to build * changed all necessary #includes with find-and-replace. * changed two switch statements involving EACCES to if-else * changed noinline to __noinline__ * commented useless headers, redundant declarations/definitions --- Makefile | 1 + third_party/sqlite3/headers/btreeInt.h | 2 +- third_party/sqlite3/headers/config.h | 12 +- third_party/sqlite3/headers/fts5.h | 2 +- third_party/sqlite3/headers/os.h | 2 +- third_party/sqlite3/headers/os_common.h | 2 +- third_party/sqlite3/headers/os_win.h | 4 +- third_party/sqlite3/headers/sqlite3.h | 3 +- third_party/sqlite3/headers/sqlite3ext.h | 2 +- third_party/sqlite3/headers/sqlite3session.h | 2 +- third_party/sqlite3/headers/sqliteInt.h | 45 +- third_party/sqlite3/headers/test_intarray.h | 2 +- third_party/sqlite3/headers/test_quota.h | 4 +- third_party/sqlite3/headers/test_windirent.h | 12 +- third_party/sqlite3/headers/vdbe.h | 4 +- third_party/sqlite3/headers/wal.h | 2 +- third_party/sqlite3/shell.c | 177 +++--- third_party/sqlite3/sqlite3.c | 617 ++++++++++--------- third_party/sqlite3/sqlite3.mk | 101 +++ third_party/third_party.mk | 1 + 20 files changed, 550 insertions(+), 447 deletions(-) create mode 100644 third_party/sqlite3/sqlite3.mk diff --git a/Makefile b/Makefile index 68ed09649..afd468139 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,7 @@ include libc/testlib/testlib.mk include tool/viz/lib/vizlib.mk include third_party/lua/lua.mk include third_party/quickjs/quickjs.mk +include third_party/sqlite3/sqlite3.mk include third_party/lz4cli/lz4cli.mk include tool/build/lib/buildlib.mk include third_party/chibicc/chibicc.mk diff --git a/third_party/sqlite3/headers/btreeInt.h b/third_party/sqlite3/headers/btreeInt.h index e17b7ec88..ebe4f93f2 100644 --- a/third_party/sqlite3/headers/btreeInt.h +++ b/third_party/sqlite3/headers/btreeInt.h @@ -213,7 +213,7 @@ ** 4 Number of leaf pointers on this page ** * zero or more pages numbers of leaves */ -#include "sqliteInt.h" +#include "third_party/sqlite3/headers/sqliteInt.h" /* The following value is the maximum cell size assuming a maximum page ** size give above. diff --git a/third_party/sqlite3/headers/config.h b/third_party/sqlite3/headers/config.h index ba09abd42..c198b3816 100644 --- a/third_party/sqlite3/headers/config.h +++ b/third_party/sqlite3/headers/config.h @@ -25,7 +25,7 @@ /* Define to 1 if the system has the type `intptr_t'. */ #define HAVE_INTPTR_T 1 -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/calls/weirdtypes.h" header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isnan' function. */ @@ -37,7 +37,7 @@ /* Define to 1 if you have the `localtime_s' function. */ /* #undef HAVE_LOCALTIME_S */ -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/mem/mem.h" header file. */ #define HAVE_MALLOC_H 1 /* Define to 1 if you have the `malloc_usable_size' function. */ @@ -58,10 +58,10 @@ /* Define to 1 if you have the pwrite64() function. */ /* #undef HAVE_PWRITE64 */ -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/calls/weirdtypes.h" header file. */ #define HAVE_STDINT_H 1 -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/mem/mem.h" header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the strchrnul() function */ @@ -70,7 +70,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/str/str.h" header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ @@ -94,7 +94,7 @@ /* Define to 1 if the system has the type `uintptr_t'. */ #define HAVE_UINTPTR_T 1 -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the "libc/isystem/unistd.h" header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `usleep' function. */ diff --git a/third_party/sqlite3/headers/fts5.h b/third_party/sqlite3/headers/fts5.h index 1ac519cd4..f0e303cf7 100644 --- a/third_party/sqlite3/headers/fts5.h +++ b/third_party/sqlite3/headers/fts5.h @@ -20,7 +20,7 @@ #ifndef _FTS5_H #define _FTS5_H -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/headers/os.h b/third_party/sqlite3/headers/os.h index a06d51be6..387dcc0ef 100644 --- a/third_party/sqlite3/headers/os.h +++ b/third_party/sqlite3/headers/os.h @@ -24,7 +24,7 @@ ** Attempt to automatically detect the operating system and setup the ** necessary pre-processor macros for it. */ -#include "os_setup.h" +#include "third_party/sqlite3/headers/os_setup.h" /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op diff --git a/third_party/sqlite3/headers/os_common.h b/third_party/sqlite3/headers/os_common.h index 7738b6ed9..f6315f0cc 100644 --- a/third_party/sqlite3/headers/os_common.h +++ b/third_party/sqlite3/headers/os_common.h @@ -39,7 +39,7 @@ ** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. */ -#include "hwtime.h" +#include "third_party/sqlite3/headers/hwtime.h" static sqlite_uint64 g_start; static sqlite_uint64 g_elapsed; diff --git a/third_party/sqlite3/headers/os_win.h b/third_party/sqlite3/headers/os_win.h index bba496f29..646963211 100644 --- a/third_party/sqlite3/headers/os_win.h +++ b/third_party/sqlite3/headers/os_win.h @@ -18,10 +18,10 @@ /* ** Include the primary Windows SDK header file. */ -#include "windows.h" +#include "third_party/sqlite3/headers/windows.h" #ifdef __CYGWIN__ -#include /* amalgamator: dontcache */ +#include "libc/errno.h" /* amalgamator: dontcache */ #include #endif diff --git a/third_party/sqlite3/headers/sqlite3.h b/third_party/sqlite3/headers/sqlite3.h index 235e0417f..853fd0055 100644 --- a/third_party/sqlite3/headers/sqlite3.h +++ b/third_party/sqlite3/headers/sqlite3.h @@ -32,7 +32,6 @@ */ #ifndef SQLITE3_H #define SQLITE3_H -#include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. @@ -9576,7 +9575,7 @@ SQLITE_API int sqlite3_system_errno(sqlite3 *); ** the most recent version. */ typedef struct sqlite3_snapshot { - unsigned char hidden[48]; + unsigned char dummyhidden[48]; } sqlite3_snapshot; /* diff --git a/third_party/sqlite3/headers/sqlite3ext.h b/third_party/sqlite3/headers/sqlite3ext.h index 8501267a3..abfa217a5 100644 --- a/third_party/sqlite3/headers/sqlite3ext.h +++ b/third_party/sqlite3/headers/sqlite3ext.h @@ -17,7 +17,7 @@ */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" /* ** The following structure holds pointers to all of the SQLite API diff --git a/third_party/sqlite3/headers/sqlite3session.h b/third_party/sqlite3/headers/sqlite3session.h index f59ddf49c..4140fed58 100644 --- a/third_party/sqlite3/headers/sqlite3session.h +++ b/third_party/sqlite3/headers/sqlite3session.h @@ -9,7 +9,7 @@ extern "C" { #endif -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" /* ** CAPI3REF: Session Object Handle diff --git a/third_party/sqlite3/headers/sqliteInt.h b/third_party/sqlite3/headers/sqliteInt.h index 14c42ff3e..78436e0cf 100644 --- a/third_party/sqlite3/headers/sqliteInt.h +++ b/third_party/sqlite3/headers/sqliteInt.h @@ -56,12 +56,12 @@ ** compiler warnings due to subsequent content in this file and other files ** that are included by this file. */ -#include "msvc.h" +#include "third_party/sqlite3/headers/msvc.h" /* ** Special setup for VxWorks */ -#include "vxworks.h" +#include "third_party/sqlite3/headers/vxworks.h" /* ** These #defines should enable >2GB file support on POSIX if the @@ -165,9 +165,9 @@ ** disabled. */ #if defined(_HAVE_MINGW_H) -#include "mingw.h" +#include "third_party/sqlite3/headers/mingw.h" #elif defined(_HAVE__MINGW_H) -#include "_mingw.h" +#include "third_party/sqlite3/headers/_mingw.h" #endif /* @@ -185,18 +185,18 @@ ** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for ** MinGW. */ -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" /* ** Include the configuration header output by 'configure' if we're using the ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" +#include "third_party/sqlite3/headers/config.h" #define SQLITECONFIG_H 1 #endif -#include "sqliteLimit.h" +#include "third_party/sqlite3/headers/sqliteLimit.h" /* Disable nuisance warnings on Borland compilers */ #if defined(__BORLANDC__) @@ -227,10 +227,10 @@ ** Include standard header files as necessary */ #ifdef HAVE_STDINT_H -#include +#include "libc/calls/weirdtypes.h" #endif #ifdef HAVE_INTTYPES_H -#include +#include "libc/calls/weirdtypes.h" #endif /* @@ -585,14 +585,13 @@ extern int sqlite3OSTrace; #define likely(X) (X) #define unlikely(X) (X) -#include -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" -#include "hash.h" -#include "parse.h" +#include "third_party/sqlite3/headers/hash.h" +#include "third_party/sqlite3/headers/parse.h" /* ** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY. @@ -1234,12 +1233,12 @@ typedef int VList; ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque ** pointer types (i.e. FuncDef) defined above. */ -#include "btree.h" -#include "mutex.h" -#include "os.h" -#include "pager.h" -#include "pcache.h" -#include "vdbe.h" +#include "third_party/sqlite3/headers/btree.h" +#include "third_party/sqlite3/headers/mutex.h" +#include "third_party/sqlite3/headers/os.h" +#include "third_party/sqlite3/headers/pager.h" +#include "third_party/sqlite3/headers/pcache.h" +#include "third_party/sqlite3/headers/vdbe.h" /* The SQLITE_EXTRA_DURABLE compile-time option used to set the default ** synchronous setting to EXTRA. It is no longer supported. @@ -4181,7 +4180,7 @@ int sqlite3CorruptPgnoError(int, Pgno); */ #if !defined(SQLITE_ASCII) || \ (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) -#include +#include "libc/str/str.h" #endif /* diff --git a/third_party/sqlite3/headers/test_intarray.h b/third_party/sqlite3/headers/test_intarray.h index 356c16273..3b3c6d1ec 100644 --- a/third_party/sqlite3/headers/test_intarray.h +++ b/third_party/sqlite3/headers/test_intarray.h @@ -81,7 +81,7 @@ ** implemented, it is not allowed to invoke sqlite3_intarray_create(D,N,P) ** more than once with the same D and N values. */ -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" #ifndef SQLITE_INTARRAY_H #define SQLITE_INTARRAY_H diff --git a/third_party/sqlite3/headers/test_quota.h b/third_party/sqlite3/headers/test_quota.h index cad96f08d..b4da7a8b1 100644 --- a/third_party/sqlite3/headers/test_quota.h +++ b/third_party/sqlite3/headers/test_quota.h @@ -27,11 +27,11 @@ ** continues as if nothing had happened. */ #ifndef _QUOTA_H_ -#include +#include "libc/stdio/stdio.h" #include #include -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" /* Make this callable from C++ */ #ifdef __cplusplus diff --git a/third_party/sqlite3/headers/test_windirent.h b/third_party/sqlite3/headers/test_windirent.h index 01d20bad2..44c8dee8d 100644 --- a/third_party/sqlite3/headers/test_windirent.h +++ b/third_party/sqlite3/headers/test_windirent.h @@ -24,23 +24,23 @@ #define WIN32_LEAN_AND_MEAN #endif -#include "windows.h" +#include "third_party/sqlite3/headers/windows.h" /* ** We need several support functions from the SQLite core. */ -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" /* ** We need several things from the ANSI and MSVCRT headers. */ -#include +#include "libc/errno.h" #include -#include -#include -#include +#include "libc/limits.h" +#include "libc/stdio/stdio.h" +#include "libc/mem/mem.h" #include #include diff --git a/third_party/sqlite3/headers/vdbe.h b/third_party/sqlite3/headers/vdbe.h index ea5ba9825..920fa15c6 100644 --- a/third_party/sqlite3/headers/vdbe.h +++ b/third_party/sqlite3/headers/vdbe.h @@ -17,7 +17,7 @@ */ #ifndef SQLITE_VDBE_H #define SQLITE_VDBE_H -#include +#include "libc/stdio/stdio.h" /* ** A single VDBE is an opaque structure named "Vdbe". Only routines @@ -165,7 +165,7 @@ typedef struct VdbeOpList VdbeOpList; ** The makefile scans the vdbe.c source file and creates the "opcodes.h" ** header file that defines a number for each opcode used by the VDBE. */ -#include "opcodes.h" +#include "third_party/sqlite3/headers/opcodes.h" /* ** Additional non-public SQLITE_PREPARE_* flags diff --git a/third_party/sqlite3/headers/wal.h b/third_party/sqlite3/headers/wal.h index 71686ab5a..a34561ebb 100644 --- a/third_party/sqlite3/headers/wal.h +++ b/third_party/sqlite3/headers/wal.h @@ -17,7 +17,7 @@ #ifndef SQLITE_WAL_H #define SQLITE_WAL_H -#include "sqliteInt.h" +#include "third_party/sqlite3/headers/sqliteInt.h" /* Macros for extracting appropriate sync flags for either transaction ** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): diff --git a/third_party/sqlite3/shell.c b/third_party/sqlite3/shell.c index f9322f506..a6b1a1cf3 100644 --- a/third_party/sqlite3/shell.c +++ b/third_party/sqlite3/shell.c @@ -82,30 +82,31 @@ #define _LARGEFILE_SOURCE 1 #endif -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" +#include "libc/fmt/fmt.h" +#include "libc/fmt/conv.h" -#include "sqlite3.h" +#include "third_party/sqlite3/headers/sqlite3.h" typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; #if SQLITE_USER_AUTHENTICATION -#include "sqlite3userauth.h" +#include "third_party/sqlite3/headers/sqlite3userauth.h" #endif -#include -#include +#include "libc/str/str.h" #if !defined(_WIN32) && !defined(WIN32) -#include +#include "libc/calls/sigbits.h" #if !defined(__RTP__) && !defined(_WRS_KERNEL) -#include +#include "third_party/musl/passwd.h" #endif #endif #if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW32__) -#include -#include +#include "libc/calls/calls.h" +#include "libc/isystem/unistd.h" #define GETPID getpid #if defined(__MINGW32__) #define DIRENT dirent @@ -116,8 +117,7 @@ typedef unsigned char u8; #else #define GETPID (int)GetCurrentProcessId #endif -#include -#include +#include "libc/calls/weirdtypes.h" #if HAVE_READLINE #include @@ -138,7 +138,7 @@ typedef unsigned char u8; #elif HAVE_LINENOISE -#include "linenoise.h" +#include "third_party/sqlite3/headers/linenoise.h" #define shell_add_history(X) linenoiseHistoryAdd(X) #define shell_read_history(X) linenoiseHistoryLoad(X) #define shell_write_history(X) linenoiseHistorySave(X) @@ -177,13 +177,13 @@ typedef unsigned char u8; #endif #else /* Make sure isatty() has a prototype. */ -extern int isatty(int); +/* extern int isatty(int); */ #if !defined(__RTP__) && !defined(_WRS_KERNEL) /* popen and pclose are not C89 functions and so are -** sometimes omitted from the header */ -extern FILE *popen(const char *, const char *); -extern int pclose(FILE *); +** sometimes omitted from the "libc/stdio/stdio.h" header */ +/* extern FILE *popen(const char *, const char *); */ +/* extern int pclose(FILE *); */ #else #define SQLITE_OMIT_POPEN 1 #endif @@ -254,8 +254,8 @@ static sqlite3_int64 timeOfDay(void) { } #if !defined(_WIN32) && !defined(WIN32) && !defined(__minux) -#include -#include +#include "libc/sysv/consts/rusage.h" +#include "libc/time/time.h" /* VxWorks does not support getrusage() as far as we can determine */ #if defined(_WRS_KERNEL) || defined(__RTP__) @@ -1050,25 +1050,23 @@ static void shellAddSchemaName(sqlite3_context *pCtx, int nVal, #define WIN32_LEAN_AND_MEAN #endif -#include "windows.h" +/* #include "third_party/sqlite3/headers/windows.h" */ /* ** We need several support functions from the SQLite core. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ /* ** We need several things from the ANSI and MSVCRT headers. */ -#include -#include -#include -#include -#include -#include -#include +#include "libc/errno.h" +#include "libc/limits.h" +#include "libc/stdio/stdio.h" +#include "libc/mem/mem.h" +#include "libc/calls/weirdtypes.h" /* ** We may need several defines that should have been in "sys/stat.h". @@ -1203,7 +1201,7 @@ extern INT closedir(LPDIR dirp); */ #if defined(_WIN32) && defined(_MSC_VER) -/* #include "test_windirent.h" */ +/* #include "third_party/sqlite3/headers/test_windirent.h" */ /* ** Implementation of the POSIX getenv() function using the Win32 API. @@ -1399,11 +1397,10 @@ INT closedir(LPDIR dirp) { ** is used. If SIZE is included it must be one of the integers 224, 256, ** 384, or 512, to determine SHA3 hash variant that is computed. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_AMALGAMATION /* typedef sqlite3_uint64 u64; */ @@ -2152,25 +2149,23 @@ int sqlite3_shathree_init(sqlite3 *db, char **pzErrMsg, ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/calls/calls.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "libc/calls/weirdtypes.h" #if !defined(_WIN32) && !defined(WIN32) -#include -#include -#include -#include +#include "libc/calls/sigbits.h" +#include "libc/time/time.h" +#include "libc/isystem/unistd.h" #else #include #include -/* #include "test_windirent.h" */ -#include "windows.h" +/* #include "third_party/sqlite3/headers/test_windirent.h" */ +#include "third_party/sqlite3/headers/windows.h" #define dirent DIRENT #ifndef chmod #define chmod _chmod @@ -2181,8 +2176,8 @@ SQLITE_EXTENSION_INIT1 #define mkdir(path, mode) _mkdir(path) #define lstat(path, buf) stat(path, buf) #endif -#include -#include +#include "libc/errno.h" +#include "libc/time/time.h" /* ** Structure of the fsdir() table-valued function @@ -3074,11 +3069,11 @@ int sqlite3_fileio_init(sqlite3 *db, char **pzErrMsg, ** faster than any human can type. ** */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -3585,10 +3580,10 @@ int sqlite3_completion_init(sqlite3 *db, char **pzErrMsg, ** If the file being opened is a plain database (not an appended one), then ** this shim is a pass-through into the default underlying VFS. (rule 3) **/ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* The append mark at the end of the database is: ** @@ -4190,9 +4185,9 @@ int sqlite3_appendvfs_init(sqlite3 *db, char **pzErrMsg, ** This extension is used to implement the --memtrace option of the ** command-line shell. */ -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" /* The original memory allocation routines */ static sqlite3_mem_methods memtraceBase; @@ -4300,11 +4295,10 @@ int sqlite3MemTraceDeactivate(void) { ** is *not* limited integers that can be expressed as a ** 64-bit machine integer. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* ** Compare text in lexicographic order, except strings of digits @@ -4380,12 +4374,11 @@ int sqlite3_uint_init(sqlite3 *db, char **pzErrMsg, ** ** The focus here is on simplicity and correctness, not performance. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" +#include "libc/mem/mem.h" /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -5056,10 +5049,10 @@ int sqlite3_decimal_init(sqlite3 *db, char **pzErrMsg, ** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.bin); ** */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -5314,10 +5307,10 @@ int sqlite3_ieee_init(sqlite3 *db, char **pzErrMsg, ** encourages the query planner to order joins such that the bounds of the ** series are well-defined. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -5714,12 +5707,12 @@ int sqlite3_series_init(sqlite3 *db, char **pzErrMsg, ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/zlib/zlib.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -7872,10 +7865,10 @@ int sqlite3_zipfile_init(sqlite3 *db, char **pzErrMsg, ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "third_party/zlib/zlib.h" /* ** Implementation of the "sqlar_compress(X)" SQL function. @@ -7989,7 +7982,7 @@ int sqlite3_sqlar_init(sqlite3 *db, char **pzErrMsg, */ #if !defined(SQLITEEXPERT_H) #define SQLITEEXPERT_H 1 -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ typedef struct sqlite3expert sqlite3expert; @@ -8159,11 +8152,11 @@ void sqlite3_expert_destroy(sqlite3expert *); ** ************************************************************************* */ -/* #include "sqlite3expert.h" */ +/* #include "third_party/sqlite3/headers/sqlite3expert.h" */ -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -10123,14 +10116,14 @@ void sqlite3_expert_destroy(sqlite3expert *p) { ** child page in the database. */ #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ /* typedef unsigned char u8; */ #endif SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #define DBDATA_PADDING_BYTES 100 @@ -20683,6 +20676,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv) { setBinaryMode(stdin, 0); setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ + setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ); + setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ); stdin_is_interactive = isatty(0); stdout_is_console = isatty(1); diff --git a/third_party/sqlite3/sqlite3.c b/third_party/sqlite3/sqlite3.c index 7ee0bca11..795f9ff67 100644 --- a/third_party/sqlite3/sqlite3.c +++ b/third_party/sqlite3/sqlite3.c @@ -46,7 +46,7 @@ ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" +#include "third_party/sqlite3/headers/config.h" #define SQLITECONFIG_H 1 #endif @@ -1041,9 +1041,9 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt) { ** disabled. */ #if defined(_HAVE_MINGW_H) -#include "mingw.h" +#include "third_party/sqlite3/headers/mingw.h" #elif defined(_HAVE__MINGW_H) -#include "_mingw.h" +#include "third_party/sqlite3/headers/_mingw.h" #endif /* @@ -1097,7 +1097,6 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt) { */ #ifndef SQLITE3_H #define SQLITE3_H -#include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. @@ -10681,7 +10680,7 @@ SQLITE_API int sqlite3_system_errno(sqlite3*); ** the most recent version. */ typedef struct sqlite3_snapshot { - unsigned char hidden[48]; + unsigned char dummyhidden[48]; } sqlite3_snapshot; /* @@ -13353,7 +13352,7 @@ struct fts5_api { ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -/* #include "config.h" */ +/* #include "third_party/sqlite3/headers/config.h" */ #define SQLITECONFIG_H 1 #endif @@ -13599,10 +13598,10 @@ struct fts5_api { ** Include standard header files as necessary */ #ifdef HAVE_STDINT_H -#include +#include "libc/calls/weirdtypes.h" #endif #ifdef HAVE_INTTYPES_H -#include +#include "libc/calls/weirdtypes.h" #endif /* @@ -13640,7 +13639,7 @@ struct fts5_api { ** inlined. */ #if defined(__GNUC__) -#define SQLITE_NOINLINE __attribute__((noinline)) +#define SQLITE_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 #define SQLITE_NOINLINE __declspec(noinline) #else @@ -13957,11 +13956,13 @@ SQLITE_PRIVATE int sqlite3OSTrace; #define likely(X) (X) #define unlikely(X) (X) -#include -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/calls/weirdtypes.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "libc/fmt/fmt.h" +#include "libc/fmt/conv.h" +#include "libc/mem/mem.h" /************** Include hash.h in the middle of sqliteInt.h ******************/ /************** Begin file hash.h ********************************************/ @@ -14886,6 +14887,7 @@ typedef u64 Bitmask; ** just an array of integers. */ typedef int VList; +typedef u32 Pgno; /* ** Defer sourcing vdbe.h and btree.h until after the "u8" and @@ -15249,7 +15251,7 @@ SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree *); #endif #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *, int, int *, int *); +/* SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *, int, int *, int *); */ #endif SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *, BtCursor *, i64); @@ -16108,7 +16110,7 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache); */ #ifndef SQLITE_VDBE_H #define SQLITE_VDBE_H -/* #include */ +/* #include "libc/stdio/stdio.h" */ /* ** A single VDBE is an opaque structure named "Vdbe". Only routines @@ -19652,7 +19654,7 @@ SQLITE_PRIVATE int sqlite3CorruptPgnoError(int, Pgno); */ #if !defined(SQLITE_ASCII) || \ (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) -#include +#include "libc/str/str.h" #endif /* @@ -20714,7 +20716,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse *, Expr *, int); SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse *, Expr *); #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); +/* SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); */ #endif #endif /* SQLITEINT_H */ @@ -20735,7 +20737,7 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); ** ** This file contains definitions of global variables and constants. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* An array to map all upper-case characters into their corresponding ** lower-case character. @@ -21068,7 +21070,7 @@ SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; SQLITE_PRIVATE u32 sqlite3SelectTrace = 0; SQLITE_PRIVATE u32 sqlite3WhereTrace = 0; -/* #include "opcodes.h" */ +/* #include "third_party/sqlite3/headers/opcodes.h" */ /* ** Properties of opcodes. The OPFLG_INITIALIZER macro is ** created by mkopcodeh.awk during compilation. Data is obtained @@ -21099,7 +21101,7 @@ SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY"; ** This module implements the sqlite3_status() interface and related ** functionality. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /************** Include vdbeInt.h in the middle of status.c ******************/ /************** Begin file vdbeInt.h *****************************************/ /* @@ -22151,11 +22153,12 @@ SQLITE_API int sqlite3_db_status( ** Willmann-Bell, Inc ** Richmond, Virginia (USA) */ -/* #include */ -/* #include */ -#include +/* #include "libc/assert.h" */ +/* #include "libc/mem/mem.h" */ +#include "libc/time/time.h" +#include "libc/time/struct/tm.h" -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_DATETIME_FUNCS @@ -23360,7 +23363,7 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void) { ** This file contains OS interface code that is common to all ** architectures. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** If we compile with the SQLITE_TEST macro set, then the following block @@ -23788,7 +23791,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs) { ** during a hash table resize is a benign fault. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_UNTESTABLE @@ -23867,7 +23870,7 @@ SQLITE_PRIVATE void sqlite3EndBenignMalloc(void) { ** are merely placeholders. Real drivers must be substituted using ** sqlite3_config() before SQLite will operate. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** This version of the memory allocator is the default. It is @@ -23961,7 +23964,7 @@ SQLITE_PRIVATE void sqlite3MemSetDefault(void) { ** be necessary when compiling for Delphi, ** for example. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** This version of the memory allocator is the default. It is @@ -24023,7 +24026,7 @@ static malloc_zone_t *_sqliteZone_; ** the macro SQLITE_MALLOCSIZE to the desired function name. */ #if defined(SQLITE_USE_MALLOC_H) -#include +#include "libc/mem/mem.h" #if defined(SQLITE_USE_MALLOC_USABLE_SIZE) #if !defined(SQLITE_MALLOCSIZE) #define SQLITE_MALLOCSIZE(x) malloc_usable_size(x) @@ -24224,7 +24227,7 @@ SQLITE_PRIVATE void sqlite3MemSetDefault(void) { ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** This version of the memory allocator is used only if the @@ -24242,7 +24245,7 @@ extern void backtrace_symbols_fd(void *const *, int, int); #define backtrace(A, B) 1 #define backtrace_symbols_fd(A, B, C) #endif -/* #include */ +/* #include "libc/stdio/stdio.h" */ /* ** Each memory allocation looks like this: @@ -24755,7 +24758,7 @@ SQLITE_PRIVATE int sqlite3MemdebugMallocCount() { ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** This version of the memory allocator is only built into the library @@ -25464,7 +25467,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void) { ** The sqlite3_status() logic tracks the maximum values of n and M so ** that an application can, at any time, verify this constraint. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** This version of the memory allocator is used only when @@ -26007,7 +26010,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void) { ** ** This file contains code that is common across all mutex implementations. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT) /* @@ -26373,7 +26376,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p) { ** that does error checking on mutexes to make sure they are being ** called correctly. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_MUTEX_OMIT @@ -26587,7 +26590,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void) { ************************************************************************* ** This file contains the C functions that implement mutexes for pthreads */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** The code in this file is only used if we are compiling threadsafe @@ -26977,7 +26980,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void) { ************************************************************************* ** This file contains the C functions that implement mutexes for Win32. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if SQLITE_OS_WIN /* @@ -27211,11 +27214,11 @@ SQLITE_API extern int sqlite3_open_file_count; /* ** Include the primary Windows SDK header file. */ -#include "windows.h" +/* #include "third_party/sqlite3/headers/windows.h" */ #ifdef __CYGWIN__ -#include /* amalgamator: dontcache */ -#include +#include "libc/errno.h" /* amalgamator: dontcache */ +/* #include */ #endif /* @@ -27664,7 +27667,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void) { */ /* #include */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Attempt to release up to n bytes of non-essential memory currently @@ -28489,7 +28492,7 @@ SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int rc) { ** library, though the implementation here has enhancements to support ** SQLite. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Conversion types fall into various categories as defined by the @@ -29862,7 +29865,7 @@ SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...) { ** The interfaces in this file is only available when compiling ** with SQLITE_DEBUG. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifdef SQLITE_DEBUG /* @@ -30710,7 +30713,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExprList(TreeView *pView, const ExprList *pLi ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* All threads share a single random number generator. ** This structure is the current state of the generator. @@ -30851,9 +30854,9 @@ SQLITE_PRIVATE void sqlite3PrngRestoreState(void) { ** of multiple cores can do so, while also allowing applications to stay ** single-threaded if desired. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if SQLITE_OS_WIN -/* #include "os_win.h" */ +/* #include "third_party/sqlite3/headers/os_win.h" */ #endif #if SQLITE_MAX_WORKER_THREADS > 0 @@ -31136,10 +31139,10 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut) { ** 0xfe 0xff big-endian utf-16 follows ** */ -/* #include */ +/* #include "libc/assert.h" */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #if !defined(SQLITE_AMALGAMATION) && SQLITE_BYTEORDER == 0 /* @@ -31657,9 +31660,9 @@ SQLITE_PRIVATE void sqlite3UtfSelfTest(void) { */ /* #include */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_FLOATING_POINT -#include +#include "libc/math.h" #endif /* @@ -33367,9 +33370,9 @@ SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nNam ** This is the implementation of generic hash-tables ** used in SQLite. */ -/* #include */ +/* #include "libc/assert.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Turn bulk memory into a hash table object by initializing the ** fields of the Hash structure. @@ -33873,7 +33876,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if SQLITE_OS_UNIX /* This file is used on unix only */ /* @@ -33917,16 +33920,22 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* ** standard include files. */ -#include -#include -#include -#include -#include -#include -/* #include */ -#include +#include "libc/calls/calls.h" +#include "libc/calls/struct/flock.h" +#include "libc/calls/weirdtypes.h" +#include "libc/errno.h" +#include "libc/isystem/unistd.h" +#include "libc/runtime/sysconf.h" +#include "libc/sysv/consts/f.h" +#include "libc/sysv/consts/map.h" +#include "libc/sysv/consts/mremap.h" +#include "libc/sysv/consts/o.h" +#include "libc/sysv/consts/ok.h" +#include "libc/sysv/consts/prot.h" +#include "libc/time/time.h" +#include "libc/time/struct/tm.h" #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE > 0 -#include +#include "libc/mem/mem.h" #endif #if SQLITE_ENABLE_LOCKING_STYLE @@ -33963,7 +33972,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ #endif #if OS_VXWORKS -#include +#include "libc/limits.h" #include /* #include */ #endif /* OS_VXWORKS */ @@ -33973,7 +33982,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ #endif #ifdef HAVE_UTIME -#include +#include "libc/time/time.h" #endif /* @@ -34899,23 +34908,18 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) { (sqliteIOErr == SQLITE_IOERR_UNLOCK) || (sqliteIOErr == SQLITE_IOERR_RDLOCK) || (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK)); - switch (posixError) { - case EACCES: - case EAGAIN: - case ETIMEDOUT: - case EBUSY: - case EINTR: - case ENOLCK: - /* random NFS retry error, unless during file system support - * introspection, in which it actually means what it says */ - return SQLITE_BUSY; + // changed switch to if-else + if (posixError == EACCES || posixError == EAGAIN || posixError == ETIMEDOUT || + posixError == EBUSY || posixError == EINTR || posixError == ENOLCK) + /* random NFS retry error, unless during file system support + * introspection, in which it actually means what it says */ + return SQLITE_BUSY; - case EPERM: - return SQLITE_PERM; + else if (posixError == EPERM) + return SQLITE_PERM; - default: - return sqliteIOErr; - } + else + return sqliteIOErr; } /****************************************************************************** @@ -37404,17 +37408,17 @@ static int unixRead(sqlite3_file *id, void *pBuf, int amt, ** prior to returning to the application by the sqlite3ApiExit() ** routine. */ - switch (pFile->lastErrno) { - case ERANGE: - case EIO: + // changed switch to if-else + if (pFile->lastErrno == ERANGE || pFile->lastErrno == EIO #ifdef ENXIO - case ENXIO: + || pFile->lastErrno == ENXIO #endif #ifdef EDEVERR - case EDEVERR: + || pFile->lastErrno == EDEVERR #endif - return SQLITE_IOERR_CORRUPTFS; - } + ) + return SQLITE_IOERR_CORRUPTFS; + return SQLITE_IOERR_READ; } else { storeLastErrno(pFile, 0); /* not a system error */ @@ -38128,8 +38132,8 @@ static void setDeviceCharacteristics(unixFile *pFd) { } } #else -#include -#include +/* #include +#include */ static void setDeviceCharacteristics(unixFile *pFile) { if (pFile->sectorSize == 0) { struct statvfs fsInfo; @@ -40562,7 +40566,7 @@ static int unixFullPathname( ** Interfaces for opening a shared library, finding entry points ** within the shared library, and closing the shared library. */ -#include +/* #include */ static void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename) { UNUSED_PARAMETER(NotUsed); return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL); @@ -42090,7 +42094,7 @@ SQLITE_API int sqlite3_os_end(void) { ** ** This file contains code that is specific to Windows. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if SQLITE_OS_WIN /* This file is used for Windows only */ /* @@ -42302,7 +42306,7 @@ SQLITE_API extern int sqlite3_open_file_count; /* ** Include the header file for the Windows VFS. */ -/* #include "os_win.h" */ +/* #include "third_party/sqlite3/headers/os_win.h" */ /* ** Compiling and using WAL mode requires several APIs that are only @@ -44479,7 +44483,7 @@ static void winLogIoerr(int nRetry, int lineno) { ** The MSVC CRT on Windows CE may not have a localtime() function. ** So define a substitute. */ -/* #include */ +/* #include "libc/time/time.h" */ struct tm *__cdecl localtime(const time_t *t) { static struct tm y; FILETIME uTm, lTm; @@ -48406,7 +48410,7 @@ SQLITE_API int sqlite3_os_end(void) { ** This file also implements interface sqlite3_serialize() and ** sqlite3_deserialize(). */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifdef SQLITE_ENABLE_DESERIALIZE /* @@ -49037,7 +49041,7 @@ SQLITE_PRIVATE int sqlite3MemdbInit(void) { ** start of a transaction, and is thus usually less than a few thousand, ** but can be as large as 2 billion for a really big database. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Size of the Bitvec structure in bytes. */ #define BITVEC_SZ 512 @@ -49427,7 +49431,7 @@ bitvec_end: ************************************************************************* ** This file implements that page cache. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** A complete page cache is an instance of this structure. Every @@ -50391,7 +50395,7 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd ** show that method (3) with N==100 provides about a 5% performance boost for ** common workloads. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ typedef struct PCache1 PCache1; typedef struct PgHdr1 PgHdr1; @@ -51634,7 +51638,7 @@ SQLITE_PRIVATE void sqlite3PcacheStats( ** be possible, but the feature was not used, so it was removed in order ** to simplify the code. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Target size for allocation chunks. @@ -52092,7 +52096,7 @@ SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 ** another is writing. */ #ifndef SQLITE_OMIT_DISKIO -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /************** Include wal.h in the middle of pager.c ***********************/ /************** Begin file wal.h *********************************************/ /* @@ -52114,7 +52118,7 @@ SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 #ifndef SQLITE_WAL_H #define SQLITE_WAL_H -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Macros for extracting appropriate sync flags for either transaction ** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): @@ -60127,7 +60131,7 @@ SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager) { */ #ifndef SQLITE_OMIT_WAL -/* #include "wal.h" */ +/* #include "third_party/sqlite3/headers/wal.h" */ /* ** Trace output macros @@ -64131,7 +64135,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal) { ** 4 Number of leaf pointers on this page ** * zero or more pages numbers of leaves */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* The following value is the maximum cell size assuming a maximum page ** size give above. @@ -64954,7 +64958,7 @@ SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur) { ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ -/* #include "btreeInt.h" */ +/* #include "third_party/sqlite3/headers/btreeInt.h" */ /* ** The header string that appears at the beginning of every @@ -75677,8 +75681,8 @@ SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p) { ** This file contains the implementation of the sqlite3_backup_XXX() ** API functions and the related features. */ -/* #include "btreeInt.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/btreeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Structure allocated for each backup operation. @@ -76449,8 +76453,8 @@ copy_finished: ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* True if X is a power of two. 0 is considered a power of two here. ** In other words, return true if X has at most one bit set. @@ -78355,8 +78359,8 @@ SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc) { ** This file contains code used for creating, destroying, and populating ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* Forward references */ static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef); @@ -83613,8 +83617,8 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( ** This file contains code use to implement APIs that are part of the ** VDBE. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #ifndef SQLITE_OMIT_DEPRECATED /* @@ -85606,8 +85610,8 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt) { ** ** The Vdbe parse-tree explainer is also found here. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #ifndef SQLITE_OMIT_TRACE @@ -85809,8 +85813,8 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* ** Invoke this macro on memory cells just prior to changing the @@ -94158,8 +94162,8 @@ abort_due_to_interrupt: ** This file contains code used to implement incremental BLOB I/O. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #ifndef SQLITE_OMIT_INCRBLOB @@ -94786,8 +94790,8 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow) { ** thread to merge the output of each of the others to a single PMA for ** the main thread to read from. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* ** If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various @@ -97412,9 +97416,9 @@ SQLITE_PRIVATE int sqlite3VdbeSorterCompare( ** This file implements virtual-tables for examining the bytecode content ** of a prepared statement. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if defined(SQLITE_ENABLE_BYTECODE_VTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE) -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* An instance of the bytecode() table-valued function. */ @@ -97838,7 +97842,7 @@ SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db) { ** in the common case, they are usually small and no file I/O needs to ** occur. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Forward references to internal structures */ typedef struct MemJournal MemJournal; @@ -98263,10 +98267,10 @@ SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *pVfs) { ** This file contains routines used for walking the parser tree for ** an SQL statement. */ -/* #include */ -/* #include */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if !defined(SQLITE_OMIT_WINDOWFUNC) /* @@ -98518,7 +98522,7 @@ SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2) { ** resolve all identifiers by associating them with a particular ** table and column. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Magic table number to mean the EXCLUDED table in an UPSERT statement. @@ -100527,7 +100531,7 @@ SQLITE_PRIVATE int sqlite3ResolveSelfReference( ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Forward declarations */ static void exprCodeBetween(Parse *, Expr *, int, @@ -106684,7 +106688,7 @@ SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast) { ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** The code in this file only exists if we are not omitting the @@ -108917,7 +108921,7 @@ SQLITE_PRIVATE void sqlite3AlterFunctions(void) { ** integer in the equivalent columns in sqlite_stat4. */ #ifndef SQLITE_OMIT_ANALYZE -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if defined(SQLITE_ENABLE_STAT4) #define IsStat4 1 @@ -110718,7 +110722,7 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb) { ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_ATTACH /* @@ -111297,7 +111301,7 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep( ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** All of the code in this file may be omitted by defining a single @@ -111568,7 +111572,7 @@ SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext) { ** COMMIT ** ROLLBACK */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_SHARED_CACHE /* @@ -116884,7 +116888,7 @@ SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith) { ** of user defined functions and collation sequences. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Invoke the 'collation needed' callback to request a collation sequence @@ -117417,7 +117421,7 @@ SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt) { ** This file contains C code routines that are called by the parser ** in order to generate code for DELETE FROM statements. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** While a SrcList can in general represent multiple tables and subqueries @@ -118378,14 +118382,14 @@ SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel) { ** functions of SQLite. (Some function, and in particular the date and ** time functions, are implemented separately.) */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/mem/mem.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_FLOATING_POINT -/* #include */ +/* #include "libc/math.h" */ #endif -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ /* ** Return the collating function associated with a function. @@ -120567,7 +120571,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void) { ** This file contains code used by the compiler to add foreign key ** support to compiled SQL statements. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_FOREIGN_KEY #ifndef SQLITE_OMIT_TRIGGER @@ -122014,7 +122018,7 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab) { ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Generate code that will @@ -125073,7 +125077,7 @@ static int xferOptimization( ** accessed by users of the library. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Execute SQL code. Return one of the SQLITE_ success/failure @@ -125239,7 +125243,7 @@ exec_out: */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ /* ** The following structure holds pointers to all of the SQLite API @@ -125910,7 +125914,7 @@ typedef int (*sqlite3_loadext_entry)( /************** End of sqlite3ext.h ******************************************/ /************** Continuing where we left off in loadext.c ********************/ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_LOAD_EXTENSION /* @@ -126757,7 +126761,7 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db) { ************************************************************************* ** This file contains code used to implement the PRAGMA command. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #if !defined(SQLITE_ENABLE_LOCKING_STYLE) #if defined(__APPLE__) @@ -130004,7 +130008,7 @@ SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName) ** interface, and routines that contribute to loading the database schema ** from disk. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Fill the InitData structure with an error message that indicates @@ -131018,7 +131022,7 @@ SQLITE_API int sqlite3_prepare16_v3( ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** An instance of the following object is used to record information about @@ -138325,7 +138329,7 @@ select_end: ** These routines are in a separate files so that they will not be linked ** if they are not used. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_GET_TABLE @@ -138522,7 +138526,7 @@ SQLITE_API void sqlite3_free_table( ************************************************************************* ** This file contains the implementation for TRIGGERs */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_TRIGGER /* @@ -139933,7 +139937,7 @@ SQLITE_PRIVATE u32 sqlite3TriggerColmask( ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_VIRTUALTABLE /* Forward declaration */ @@ -141264,7 +141268,7 @@ static void updateVirtualTable( ** This file contains code to implement various aspects of UPSERT ** processing and handling of the Upsert object. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_UPSERT /* @@ -141580,8 +141584,8 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. */ -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH) @@ -141983,7 +141987,7 @@ end_of_vacuum: ** This file contains code used to help implement virtual tables. */ #ifndef SQLITE_OMIT_VIRTUALTABLE -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Before a virtual table xCreate() or xConnect() method is invoked, the @@ -143300,7 +143304,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...) { ** that actually generate the bulk of the WHERE loop code. The original where.c ** file retains the code that does query planning and analysis. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /************** Include whereInt.h in the middle of wherecode.c **************/ /************** Begin file whereInt.h ****************************************/ /* @@ -146399,8 +146403,8 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** readability and editabiliity. This file contains utility routines for ** analyzing Expr objects in the WHERE clause. */ -/* #include "sqliteInt.h" */ -/* #include "whereInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/whereInt.h" */ /* Forward declarations */ static void exprAnalyze(SrcList *, WhereClause *, int); @@ -148296,8 +148300,8 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". */ -/* #include "sqliteInt.h" */ -/* #include "whereInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/whereInt.h" */ /* ** Extra information appended to the end of sqlite3_index_info but not @@ -153887,7 +153891,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo) { ** ************************************************************************* */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_WINDOWFUNC @@ -156915,7 +156919,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( ** to the original parse.y sources. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* ** Disable all error recovery processing in the parser push-down @@ -158328,8 +158332,8 @@ struct yyParser { typedef struct yyParser yyParser; #ifndef NDEBUG -/* #include */ -/* #include */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/assert.h" */ static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ @@ -162246,9 +162250,9 @@ SQLITE_PRIVATE int sqlite3ParserFallback(int iToken){ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. */ -/* #include */ +/* #include "libc/mem/mem.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Character classes for tokenizing ** @@ -164100,7 +164104,7 @@ SQLITE_PRIVATE char *sqlite3Normalize(Vdbe *pVdbe, /* VM being reprepared */ ** separating it out, the code will be automatically omitted from ** static links that do not use it. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifndef SQLITE_OMIT_COMPLETE /* @@ -164497,7 +164501,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql) { ** other files are for internal use by SQLite and should not be ** accessed by users of the library. */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ #ifdef SQLITE_ENABLE_FTS3 /************** Include fts3.h in the middle of main.c ***********************/ @@ -164517,7 +164521,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql) { ** This header file is used by programs that want to link against the ** FTS3 library. All it does is declare the sqlite3Fts3Init() interface. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #if 0 extern "C" { @@ -164550,7 +164554,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db); ** This header file is used by programs that want to link against the ** RTREE library. All it does is declare the sqlite3RtreeInit() interface. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #ifdef SQLITE_OMIT_VIRTUALTABLE #undef SQLITE_ENABLE_RTREE @@ -164587,7 +164591,7 @@ SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db); ** This header file is used by programs that want to link against the ** ICU extension. All it does is declare the sqlite3IcuInit() interface. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #if 0 extern "C" { @@ -164694,7 +164698,7 @@ SQLITE_API const char *sqlite3_libversion(void) { ** an edited copy of the amalgamation, then the last four characters of ** the hash might be different from SQLITE_SOURCE_ID. */ -/* SQLITE_API const char *sqlite3_sourceid(void) { */ +SQLITE_API const char *sqlite3_sourceid(void) { return SQLITE_SOURCE_ID; } @@ -169348,8 +169352,8 @@ SQLITE_API const char *sqlite3_compileoption_get(int N) { ** This file contains the implementation of the sqlite3_unlock_notify() ** API method and its associated functionality. */ -/* #include "btreeInt.h" */ -/* #include "sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/btreeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ /* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY @@ -169995,7 +169999,7 @@ SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db) { /* If not building as part of the core, include sqlite3ext.h. */ #ifndef SQLITE_CORE -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT3 #endif @@ -170146,7 +170150,7 @@ SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const voi ** If tokenizers are to be allowed to call sqlite3_*() functions, then ** we will need a way to register the API consistently. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ /* ** Structures used by the tokenizer interface. When a new tokenizer @@ -170282,7 +170286,7 @@ int fts3_term_cnt(int iTerm, int iCol); /************** End of fts3_tokenizer.h **************************************/ /************** Continuing where we left off in fts3Int.h ********************/ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ /* ** This constant determines the maximum depth of an FTS expression tree @@ -170894,16 +170898,16 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); #define SQLITE_CORE 1 #endif -/* #include */ +/* #include "libc/assert.h" */ /* #include */ /* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "fts3.h" */ +/* #include "third_party/sqlite3/headers/fts3.h" */ #ifndef SQLITE_CORE -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #endif @@ -176638,11 +176642,11 @@ __declspec(dllexport) ****************************************************************************** ** */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ typedef struct Fts3auxTable Fts3auxTable; typedef struct Fts3auxCursor Fts3auxCursor; @@ -177191,7 +177195,7 @@ SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db) { ** syntax is relatively simple, the whole tokenizer/parser system is ** hand-coded. */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) /* @@ -177254,8 +177258,8 @@ SQLITE_API int sqlite3_fts3_enable_parentheses = 0; */ #define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10 -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ /* ** isNot: @@ -178272,7 +178276,7 @@ SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *pDel) { #ifdef SQLITE_TEST -/* #include */ +/* #include "libc/stdio/stdio.h" */ /* ** Return a pointer to a buffer containing a text representation of the @@ -178467,14 +178471,14 @@ SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash *pHash ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "fts3_hash.h" */ +/* #include "third_party/sqlite3/headers/fts3_hash.h" */ /* ** Malloc and Free functions @@ -178854,15 +178858,15 @@ SQLITE_PRIVATE void *sqlite3Fts3HashInsert(Fts3Hash *pH, /* The hash table to in ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "fts3_tokenizer.h" */ +/* #include "third_party/sqlite3/headers/fts3_tokenizer.h" */ /* ** Class derived from sqlite3_tokenizer @@ -179514,11 +179518,11 @@ SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule( ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ /* ** Return true if the two-argument version of fts3_tokenizer() @@ -179717,11 +179721,11 @@ SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) -#include "sqlite_tcl.h" +#include "third_party/sqlite3/headers/sqlite_tcl.h" #else -#include "tcl.h" +#include "third_party/sqlite3/headers/tcl.h" #endif -/* #include */ +/* #include "libc/str/str.h" */ /* ** Implementation of a special SQL scalar function for testing tokenizers @@ -180015,15 +180019,15 @@ SQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *db, Fts3Hash *pHash, const ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "fts3_tokenizer.h" */ +/* #include "third_party/sqlite3/headers/fts3_tokenizer.h" */ typedef struct simple_tokenizer { sqlite3_tokenizer base; @@ -180259,11 +180263,11 @@ SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule( ** pos: Token offset of token within input. ** */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ typedef struct Fts3tokTable Fts3tokTable; typedef struct Fts3tokCursor Fts3tokCursor; @@ -180688,13 +180692,14 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash) { ** code in fts3.c. */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ +#include "libc/alg/alg.h" #define FTS_MAX_APPENDABLE_HEIGHT 16 @@ -186375,11 +186380,11 @@ SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *p) { ****************************************************************************** */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ #ifndef SQLITE_AMALGAMATION typedef sqlite3_int64 i64; @@ -188113,15 +188118,15 @@ SQLITE_PRIVATE void sqlite3Fts3Matchinfo( #ifndef SQLITE_DISABLE_FTS3_UNICODE -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ -/* #include "fts3_tokenizer.h" */ +/* #include "third_party/sqlite3/headers/fts3_tokenizer.h" */ /* ** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied @@ -188502,7 +188507,7 @@ SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const * #ifndef SQLITE_DISABLE_FTS3_UNICODE #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) -/* #include */ +/* #include "libc/assert.h" */ /* ** Return true if the argument corresponds to a unicode codepoint @@ -188867,13 +188872,13 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic) { */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ #endif SQLITE_EXTENSION_INIT1 -/* #include */ +/* #include "libc/assert.h" */ /* #include */ -/* #include */ -/* #include */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -188902,7 +188907,7 @@ SQLITE_EXTENSION_INIT1 #define safe_isxdigit(x) sqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ -#include /* amalgamator: keep */ +#include "libc/str/str.h" /* amalgamator: keep */ #define safe_isdigit(x) isdigit((unsigned char)(x)) #define safe_isalnum(x) isalnum((unsigned char)(x)) #define safe_isxdigit(x) isxdigit((unsigned char)(x)) @@ -189553,7 +189558,7 @@ static int jsonParseAddNode(JsonParse *, u32, u32, const char *); ** inlined. */ #if defined(__GNUC__) -#define JSON_NOINLINE __attribute__((noinline)) +#define JSON_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 #define JSON_NOINLINE __declspec(noinline) #else @@ -191459,15 +191464,16 @@ __declspec(dllexport) (defined(SQLITE_ENABLE_RTREE) && !defined(SQLITE_OMIT_VIRTUALTABLE)) #ifndef SQLITE_CORE -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #else -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #endif -SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); /* In the SQLite core */ +/* SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); */ +/* In the SQLite core */ #ifndef SQLITE_AMALGAMATION -#include "sqlite3rtree.h" +#include "third_party/sqlite3/headers/sqlite3rtree.h" typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; @@ -191481,10 +191487,10 @@ typedef unsigned int u32; #endif #endif -/* #include */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/mem/mem.h" */ +/* #include "libc/str/str.h" */ /* The following macro is used to suppress compiler warnings. */ @@ -195741,7 +195747,7 @@ static void rtreecheck(sqlite3_context *ctx, int nArg, sqlite3_value **apArg) { ** This file is #include-ed onto the end of "rtree.c" so that it has ** access to all of the R-Tree internals. */ -/* #include */ +/* #include "libc/mem/mem.h" */ /* Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities */ #ifdef GEOPOLY_ENABLE_DEBUG @@ -195765,7 +195771,7 @@ static int geo_debug = 0; #define safe_isxdigit(x) sqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ -#include /* amalgamator: keep */ +#include "libc/str/str.h" /* amalgamator: keep */ #define safe_isdigit(x) isdigit((unsigned char)(x)) #define safe_isalnum(x) isalnum((unsigned char)(x)) #define safe_isxdigit(x) isxdigit((unsigned char)(x)) @@ -197664,17 +197670,18 @@ __declspec(dllexport) defined(SQLITE_ENABLE_ICU_COLLATIONS) /* Include ICU headers */ -/* #include */ -#include -#include -#include -#include +/* #include "libc/assert.h" */ +#include "libc/unicode/unicode.h" +/* #include */ +/* #include */ +/* #include */ +/* #include */ #ifndef SQLITE_CORE -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #else -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #endif /* @@ -198188,18 +198195,18 @@ __declspec(dllexport) ************************************************************************* ** This file implements a tokenizer for fts3 based on the ICU library. */ -/* #include "fts3Int.h" */ +/* #include "third_party/sqlite3/headers/fts3Int.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) #ifdef SQLITE_ENABLE_ICU -/* #include */ -/* #include */ -#include +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ +/* #include */ /* #include */ /* #include */ -#include +/* #include */ -/* #include "fts3_tokenizer.h" */ +/* #include "third_party/sqlite3/headers/fts3_tokenizer.h" */ typedef struct IcuTokenizer IcuTokenizer; typedef struct IcuCursor IcuCursor; @@ -198519,11 +198526,11 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const ** */ -/* #include */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/str/str.h" */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) /************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/ @@ -198797,7 +198804,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const #ifndef _SQLITE3RBU_H #define _SQLITE3RBU_H -/* #include "sqlite3.h" ** Required for error code definitions ** */ +/* #include "third_party/sqlite3/headers/sqlite3.h" ** Required for error code definitions ** */ #if 0 extern "C" { @@ -199136,7 +199143,7 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName); /************** Continuing where we left off in sqlite3rbu.c *****************/ #if defined(_WIN32_WCE) -/* #include "windows.h" */ +/* #include "third_party/sqlite3/headers/windows.h" */ #endif /* Maximum number of prepared UPDATE statements held by this module */ @@ -204264,7 +204271,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu) { ** official SQLite documentation. */ -/* #include "sqliteInt.h" ** Requires access to internal data structures ** */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" ** Requires access to internal data structures ** */ #if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) && \ !defined(SQLITE_OMIT_VIRTUALTABLE) @@ -205113,7 +205120,7 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db) { ** update fails. Rows may not be deleted or inserted. */ -/* #include "sqliteInt.h" ** Requires access to internal data structures ** */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" ** Requires access to internal data structures ** */ #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) && \ !defined(SQLITE_OMIT_VIRTUALTABLE) @@ -205481,14 +205488,14 @@ SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db) { /************** Begin file sqlite3session.c **********************************/ #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK) -/* #include "sqlite3session.h" */ +/* #include "third_party/sqlite3/headers/sqlite3session.h" */ -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ #ifndef SQLITE_AMALGAMATION -/* #include "sqliteInt.h" */ -/* #include "vdbeInt.h" */ +/* #include "third_party/sqlite3/headers/sqliteInt.h" */ +/* #include "third_party/sqlite3/headers/vdbeInt.h" */ #endif typedef struct SessionTable SessionTable; @@ -211158,7 +211165,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg) { #ifndef _FTS5_H #define _FTS5_H -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/headers/sqlite3.h" */ #if 0 extern "C" { @@ -211714,12 +211721,12 @@ struct fts5_api { #ifndef _FTS5INT_H #define _FTS5INT_H -/* #include "fts5.h" */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/fts5.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ #ifndef SQLITE_AMALGAMATION @@ -212531,8 +212538,8 @@ static void sqlite3Fts5UnicodeAscii(u8 *, u8 *); */ /************ Begin %include sections from the grammar ************************/ -/* #include "fts5Int.h" */ -/* #include "fts5parse.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5parse.h" */ /* ** Disable all error recovery processing in the parser push-down @@ -212859,8 +212866,8 @@ struct fts5yyParser { typedef struct fts5yyParser fts5yyParser; #ifndef NDEBUG -/* #include */ -/* #include */ +/* #include "libc/stdio/stdio.h" */ +/* #include "libc/assert.h" */ static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */ @@ -213996,9 +214003,9 @@ static int sqlite3Fts5ParserFallback(int iToken){ ****************************************************************************** */ -#include /* amalgamator: keep */ +#include "libc/math.h" /* amalgamator: keep */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ /* ** Object used to iterate through all "coalesced phrase instances" in @@ -214698,7 +214705,7 @@ static int sqlite3Fts5AuxInit(fts5_api *pApi) { ****************************************************************************** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte) { if ((u32)pBuf->nSpace < nByte) { @@ -215070,7 +215077,7 @@ static void sqlite3Fts5TermsetFree(Fts5Termset *p) { ** This is an SQLite module implementing full-text search. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ #define FTS5_DEFAULT_PAGE_SIZE 4050 #define FTS5_DEFAULT_AUTOMERGE 4 @@ -216007,8 +216014,8 @@ static int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie) { ** */ -/* #include "fts5Int.h" */ -/* #include "fts5parse.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5parse.h" */ /* ** All token types in the generated fts5parse.h file are greater than 0. @@ -216022,14 +216029,14 @@ typedef struct Fts5ExprTerm Fts5ExprTerm; /* ** Functions generated by lemon from fts5parse.y. */ -static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); -static void sqlite3Fts5ParserFree(void *, void (*freeProc)(void *)); -static void sqlite3Fts5Parser(void *, int, Fts5Token, Fts5Parse *); +/* static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); */ +/* static void sqlite3Fts5ParserFree(void *, void (*freeProc)(void *)); */ +/* static void sqlite3Fts5Parser(void *, int, Fts5Token, Fts5Parse *); */ #ifndef NDEBUG -/* #include */ +/* #include "libc/stdio/stdio.h" */ static void sqlite3Fts5ParserTrace(FILE *, char *); #endif -static int sqlite3Fts5ParserFallback(int); +/* static int sqlite3Fts5ParserFallback(int); */ struct Fts5Expr { Fts5Index *pIndex; @@ -218982,7 +218989,7 @@ static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *pExpr, int iPhrase, ** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ typedef struct Fts5HashEntry Fts5HashEntry; @@ -219529,7 +219536,7 @@ static void sqlite3Fts5HashScanEntry( ** the interface defined in fts5Int.h. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ /* ** Overview: @@ -226090,7 +226097,7 @@ static int sqlite3Fts5IndexReset(Fts5Index *p) { ** This is an SQLite module implementing full-text search. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ /* ** This variable is set to false when running tests for which the on disk @@ -228883,7 +228890,7 @@ SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3 *db) { ** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ struct Fts5Storage { Fts5Config *pConfig; @@ -229973,7 +229980,7 @@ static int sqlite3Fts5StorageConfigValue(Fts5Storage *p, const char *z, ****************************************************************************** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ /************************************************************************** ** Start of ascii tokenizer implementation. @@ -231330,7 +231337,7 @@ static int sqlite3Fts5TokenizerInit(fts5_api *pApi) { ** DO NOT EDIT THIS MACHINE GENERATED FILE. */ -/* #include */ +/* #include "libc/assert.h" */ /* ** If the argument is a codepoint corresponding to a lowercase letter @@ -232117,7 +232124,7 @@ static void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii) { ** Routines for varint serialization and deserialization. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ /* ** This is a copy of the sqlite3GetVarint32() routine from the SQLite core. @@ -232472,7 +232479,7 @@ static int sqlite3Fts5GetVarintLen(u32 iVal) { ** One row for each term instance in the database. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/headers/fts5Int.h" */ typedef struct Fts5VocabTable Fts5VocabTable; typedef struct Fts5VocabCursor Fts5VocabCursor; @@ -233227,11 +233234,11 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db) { */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/headers/sqlite3ext.h" */ #endif SQLITE_EXTENSION_INIT1 -/* #include */ -/* #include */ +/* #include "libc/assert.h" */ +/* #include "libc/str/str.h" */ #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -233497,5 +233504,5 @@ __declspec(dllexport) #define SQLITE_SOURCE_ID "2021-05-03 13:35:00 204086a94202fc631371b75c7a8286df2f66116399628ac27ef54533641balt2" #endif /* Return the source-id for this library */ -SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } +/* SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } */ /************************** End of sqlite3.c ******************************/ diff --git a/third_party/sqlite3/sqlite3.mk b/third_party/sqlite3/sqlite3.mk new file mode 100644 index 000000000..ee2c4cc07 --- /dev/null +++ b/third_party/sqlite3/sqlite3.mk @@ -0,0 +1,101 @@ +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ +#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ + +PKGS += THIRD_PARTY_SQLITE3 + +THIRD_PARTY_SQLITE3_ARTIFACTS += THIRD_PARTY_SQLITE3_A +THIRD_PARTY_SQLITE3 = $(THIRD_PARTY_SQLITE3_A_DEPS) $(THIRD_PARTY_SQLITE3_A) $(THIRD_PARTY_SQLITE3_COMS) +THIRD_PARTY_SQLITE3_A = o/$(MODE)/third_party/sqlite3/libsqlite3.a +THIRD_PARTY_SQLITE3_A_FILES := $(wildcard third_party/sqlite3/*) +THIRD_PARTY_SQLITE3_A_HDRS = $(filter %.h,$(THIRD_PARTY_SQLITE3_A_FILES)) +THIRD_PARTY_SQLITE3_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_SQLITE3_A_FILES)) +THIRD_PARTY_SQLITE3_BINS = $(THIRD_PARTY_SQLITE3_COMS) $(THIRD_PARTY_SQLITE3_COMS:%=%.dbg) + +THIRD_PARTY_SQLITE3_A_SRCS = \ + $(THIRD_PARTY_SQLITE3_A_SRCS_C) + +THIRD_PARTY_SQLITE3_A_OBJS = \ + $(THIRD_PARTY_SQLITE3_A_SRCS_C:%.c=o/$(MODE)/%.o) + +THIRD_PARTY_SQLITE3_COMS = \ + o/$(MODE)/third_party/sqlite3/sqlite3.com + +THIRD_PARTY_SQLITE3_A_CHECKS = \ + $(THIRD_PARTY_SQLITE3_A).pkg \ + $(THIRD_PARTY_SQLITE3_A_HDRS:%=o/$(MODE)/%.ok) + +THIRD_PARTY_SQLITE3_A_DIRECTDEPS = \ + LIBC_ALG \ + LIBC_BITS \ + LIBC_CALLS \ + LIBC_FMT \ + LIBC_INTRIN \ + LIBC_MEM \ + LIBC_NEXGEN32E \ + LIBC_RUNTIME \ + LIBC_STDIO \ + LIBC_STR \ + LIBC_STUBS \ + LIBC_SYSV \ + LIBC_SYSV_CALLS \ + LIBC_TIME \ + LIBC_TINYMATH \ + LIBC_UNICODE \ + THIRD_PARTY_MUSL \ + THIRD_PARTY_ZLIB + +THIRD_PARTY_SQLITE3_A_DEPS := \ + $(call uniq,$(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x)))) + +o/$(MODE)/third_party/sqlite3/sqlite3.com.dbg: \ + $(THIRD_PARTY_SQLITE3_A_DEPS) \ + $(THIRD_PARTY_SQLITE3_A) \ + o/$(MODE)/third_party/sqlite3/shell.o \ + $(CRT) \ + $(APE) + -@$(APELINK) + +$(THIRD_PARTY_SQLITE3_A): \ + third_party/sqlite3/ \ + $(THIRD_PARTY_SQLITE3_A).pkg \ + $(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS)) + +$(THIRD_PARTY_SQLITE3_A).pkg: \ + $(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS)) \ + $(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x)_A).pkg) + +$(THIRD_PARTY_SQLITE3_A_OBJS): \ + OVERRIDE_CFLAGS = \ + -DSTACK_FRAME_UNLIMITED \ + -DSQLITE_OS_UNIX=1 \ + -D_HAVE_SQLITE_CONFIG_H \ + -DBUILD_sqlite -DNDEBUG \ + -DSQLITE_THREADSAFE=0 \ + -DSQLITE_OMIT_LOAD_EXTENSION=1 \ + -DSQLITE_ENABLE_MATH_FUNCTIONS \ + -DSQLITE_ENABLE_FTS4 \ + -DSQLITE_ENABLE_FTS5 \ + -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_GEOPOLY \ + -DSQLITE_ENABLE_RTREE \ + -DSQLITE_ENABLE_SESSION \ + -DSQLITE_ENABLE_PREUPDATE_HOOK \ + -DSQLITE_TEMP_STORE=1 \ + -DHAVE_READLINE=0 \ + -DHAVE_EDITLINE=0 \ + -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_FTS4 \ + -DSQLITE_ENABLE_RTREE \ + -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ + -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \ + -DSQLITE_ENABLE_STMTVTAB \ + -DSQLITE_ENABLE_DBPAGE_VTAB \ + -DSQLITE_ENABLE_DBSTAT_VTAB \ + -DSQLITE_ENABLE_BYTECODE_VTAB \ + -DSQLITE_ENABLE_OFFSET_SQL_FUNC \ + -DSQLITE_ENABLE_DESERIALIZE + +.PHONY: o/$(MODE)/third_party/sqlite3 +o/$(MODE)/third_party/sqlite3: \ + $(THIRD_PARTY_SQLITE3_BINS) \ + $(THIRD_PARTY_SQLITE3_CHECKS) diff --git a/third_party/third_party.mk b/third_party/third_party.mk index bd2ba492f..a95700a57 100644 --- a/third_party/third_party.mk +++ b/third_party/third_party.mk @@ -13,6 +13,7 @@ o/$(MODE)/third_party: \ o/$(MODE)/third_party/musl \ o/$(MODE)/third_party/quickjs \ o/$(MODE)/third_party/regex \ + o/$(MODE)/third_party/sqlite3 \ o/$(MODE)/third_party/stb \ o/$(MODE)/third_party/xed \ o/$(MODE)/third_party/zlib