Get SQLite to build

* changed headers
* removed redundant declarations
* ran clang-format
* added sqlite3.mk
This commit is contained in:
ahgamut 2021-05-04 20:09:59 +05:30 committed by Justine Tunney
parent 644f290035
commit 919b6fec10
156 changed files with 2847 additions and 6772 deletions

View file

@ -136,6 +136,7 @@ include third_party/third_party.mk
include libc/testlib/testlib.mk
include tool/viz/lib/vizlib.mk
include third_party/lua/lua.mk
include third_party/sqlite3/sqlite3.mk
include third_party/quickjs/quickjs.mk
include third_party/lz4cli/lz4cli.mk
include tool/build/lib/buildlib.mk

View file

@ -12,7 +12,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** The code in this file only exists if we are not omitting the

View file

@ -30,7 +30,7 @@
** created and used by SQLite versions 3.7.9 through 3.29.0 when
** SQLITE_ENABLE_STAT3 defined. The functionality of sqlite_stat3
** is a superset of sqlite_stat2 and is also now deprecated. The
** sqlite_stat4 is an enhanced version of sqlite_stat3 and is only
** sqlite_stat4 is an enhanced version of sqlite_stat3 and is only
** available when compiled with SQLITE_ENABLE_STAT4 and in SQLite
** versions 3.8.1 and later. STAT4 is the only variant that is still
** supported.
@ -49,7 +49,7 @@
** integer is the average number of rows in the index that have the same
** value in the first column of the index. The third integer is the average
** number of rows in the index that have the same value for the first two
** columns. The N-th integer (for N>1) is the average number of rows in
** columns. The N-th integer (for N>1) is the average number of rows in
** the index which have the same value for the first N-1 columns. For
** a K-column index, there will be K+1 integers in the stat column. If
** the index is unique, then the last integer will be 1.
@ -59,7 +59,7 @@
** must be separated from the last integer by a single space. If the
** "unordered" keyword is present, then the query planner assumes that
** the index is unordered and will not use the index for a range query.
**
**
** If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat
** column contains a single integer which is the (estimated) number of
** rows in the table identified by sqlite_stat1.tbl.
@ -117,9 +117,9 @@
** number of entries that are strictly less than the sample. The first
** integer in nLt contains the number of entries in the index where the
** left-most column is less than the left-most column of the sample.
** The K-th integer in the nLt entry is the number of index entries
** The K-th integer in the nLt entry is the number of index entries
** where the first K columns are less than the first K columns of the
** sample. The nDLt column is like nLt except that it contains the
** sample. The nDLt column is like nLt except that it contains the
** number of distinct entries in the index that are less than the
** sample.
**
@ -140,7 +140,8 @@
** integer in the equivalent columns in sqlite_stat4.
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#if defined(SQLITE_ENABLE_STAT4)
# define IsStat4 1

View file

@ -11,7 +11,8 @@
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_ATTACH
/*

View file

@ -14,7 +14,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** All of the code in this file may be omitted by defining a single

View file

@ -9,11 +9,12 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_backup_XXX()
** This file contains the implementation of the sqlite3_backup_XXX()
** API functions and the related features.
*/
#include "sqliteInt.h"
#include "btreeInt.h"
#include "third_party/sqlite3/btreeInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** Structure allocated for each backup operation.

View file

@ -17,8 +17,8 @@
** property. Usually only a few pages are meet either condition.
** So the bitmap is usually sparse and has low cardinality.
** But sometimes (for example when during a DROP of a large table) most
** or all of the pages in a database can get journalled. In those cases,
** the bitmap becomes dense with high cardinality. The algorithm needs
** or all of the pages in a database can get journalled. In those cases,
** the bitmap becomes dense with high cardinality. The algorithm needs
** to handle both cases well.
**
** The size of the bitmap is fixed when the object is created.
@ -34,7 +34,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/* Size of the Bitvec structure in bytes. */
#define BITVEC_SZ 512

View file

@ -15,7 +15,9 @@
** big and we want to break it down some. This packaged seemed like
** a good breakout.
*/
#include "btreeInt.h"
#include "third_party/sqlite3/btreeInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_SHARED_CACHE
#if SQLITE_THREADSAFE

View file

@ -13,7 +13,9 @@
** 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/btreeInt.h"
/* clang-format off */
/*
** The header string that appears at the beginning of every

View file

@ -1,20 +1,6 @@
/*
** 2001 September 15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
*/
#ifndef SQLITE_BTREE_H
#define SQLITE_BTREE_H
/* clang-format off */
/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
@ -359,7 +345,7 @@ void sqlite3BtreeCursorList(Btree*);
#endif
#ifndef SQLITE_OMIT_WAL
int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
/* int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); */
#endif
int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);

View file

@ -29,16 +29,16 @@
** on Ptr(N) and its subpages have values greater than Key(N-1). And
** so forth.
**
** Finding a particular key requires reading O(log(M)) pages from the
** Finding a particular key requires reading O(log(M)) pages from the
** disk where M is the number of entries in the tree.
**
** In this implementation, a single file can hold one or more separate
** In this implementation, a single file can hold one or more separate
** BTrees. Each BTree is identified by the index of its root page. The
** key and data for any entry are combined to form the "payload". A
** fixed amount of payload can be carried directly on the database
** page. If the payload is larger than the preset amount then surplus
** bytes are stored on overflow pages. The payload for an entry
** and the preceding pointer are combined to form a "Cell". Each
** and the preceding pointer are combined to form a "Cell". Each
** page has a small header which contains the Ptr(N) pointer and other
** information such as the size of key and data.
**
@ -168,7 +168,7 @@
** contiguous or in order, but cell pointers are contiguous and in order.
**
** Cell content makes use of variable length integers. A variable
** length integer is 1 to 9 bytes where the lower 7 bits of each
** length integer is 1 to 9 bytes where the lower 7 bits of each
** byte are used. The integer consists of all bytes that have bit 8 set and
** the first byte with bit 8 clear. The most significant byte of the integer
** appears first. A variable-length integer may not be more than 9 bytes long.
@ -213,8 +213,9 @@
** 4 Number of leaf pointers on this page
** * zero or more pages numbers of leaves
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/* The following value is the maximum cell size assuming a maximum page
** size give above.

View file

@ -22,7 +22,9 @@
** COMMIT
** ROLLBACK
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_SHARED_CACHE
/*

View file

@ -1,5 +1,5 @@
/*
** 2005 May 23
** 2005 May 23
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
@ -13,8 +13,9 @@
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
*/
#include "third_party/sqlite3/sqliteInt.h"
#include "sqliteInt.h"
/* clang-format off */
/*
** Invoke the 'collation needed' callback to request a collation sequence

View file

@ -16,7 +16,10 @@
** separating it out, the code will be automatically omitted from
** static links that do not use it.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_COMPLETE
/*

View file

@ -13,6 +13,7 @@
** This file implements routines used to report what compile-time options
** SQLite was built with.
*/
/* clang-format off */
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */
@ -21,7 +22,7 @@
** autoconf-based build
*/
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
#include "config.h"
#include "third_party/sqlite3/config.h"
#define SQLITECONFIG_H 1
#endif

View file

@ -10,7 +10,7 @@
**
*************************************************************************
** This file contains the C functions that implement date and time
** functions for SQLite.
** functions for SQLite.
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
@ -19,7 +19,7 @@
** SQLite processes all times and dates as julian day numbers. The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system.
** calendar system.
**
** 1970-01-01 00:00:00 is JD 2440587.5
** 2000-01-01 00:00:00 is JD 2451544.5
@ -43,10 +43,14 @@
** Willmann-Bell, Inc
** Richmond, Virginia (USA)
*/
#include "sqliteInt.h"
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include "libc/assert.h"
#include "libc/calls/weirdtypes.h"
#include "libc/mem/mem.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_DATETIME_FUNCS

View file

@ -13,7 +13,7 @@
** This file contains an implementation of the "sqlite_dbpage" virtual table.
**
** The sqlite_dbpage virtual table is used to read or write whole raw
** pages of the database file. The pager interface is used so that
** pages of the database file. The pager interface is used so that
** uncommitted changes and changes recorded in the WAL file are correctly
** retrieved.
**
@ -30,10 +30,12 @@
** value must be a BLOB which is the correct page size, otherwise the
** update fails. Rows may not be deleted or inserted.
*/
#include "third_party/sqlite3/sqliteInt.h" /* Requires access to internal data structures */
#include "sqliteInt.h" /* Requires access to internal data structures */
#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
&& !defined(SQLITE_OMIT_VIRTUALTABLE)
/* clang-format off */
#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) && \
!defined(SQLITE_OMIT_VIRTUALTABLE)
typedef struct DbpageTable DbpageTable;
typedef struct DbpageCursor DbpageCursor;

View file

@ -20,10 +20,12 @@
** Additional information is available on the "dbstat.html" page of the
** official SQLite documentation.
*/
#include "third_party/sqlite3/sqliteInt.h" /* Requires access to internal data structures */
#include "sqliteInt.h" /* Requires access to internal data structures */
#if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) \
&& !defined(SQLITE_OMIT_VIRTUALTABLE)
/* clang-format off */
#if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) && \
!defined(SQLITE_OMIT_VIRTUALTABLE)
/*
** Page paths:

View file

@ -12,7 +12,9 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** While a SrcList can in general represent multiple tables and subqueries

View file

@ -12,7 +12,9 @@
** 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/sqliteInt.h"
/* clang-format off */
/* Forward declarations */
static void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int);

View file

@ -10,21 +10,22 @@
**
*************************************************************************
**
** This file contains code to support the concept of "benign"
** This file contains code to support the concept of "benign"
** malloc failures (when the xMalloc() or xRealloc() method of the
** sqlite3_mem_methods structure fails to allocate a block of memory
** and returns 0).
** and returns 0).
**
** Most malloc failures are non-benign. After they occur, SQLite
** abandons the current operation and returns an error code (usually
** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily
** fatal. For example, if a malloc fails while resizing a hash table, this
** is completely recoverable simply by not carrying out the resize. The
** hash table will continue to function normally. So a malloc failure
** fatal. For example, if a malloc fails while resizing a hash table, this
** is completely recoverable simply by not carrying out the resize. The
** hash table will continue to function normally. So a malloc failure
** during a hash table resize is a benign fault.
*/
#include "third_party/sqlite3/sqliteInt.h"
#include "sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_UNTESTABLE

View file

@ -11,7 +11,9 @@
** This file contains code used by the compiler to add foreign key
** support to compiled SQL statements.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_OMIT_FOREIGN_KEY
#ifndef SQLITE_OMIT_TRIGGER

View file

@ -3,6 +3,9 @@
** fts3 (or higher). If you believe that your use of fts1 is safe,
** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS.
*/
/* clang-format off */
#if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)) \
&& !defined(SQLITE_ENABLE_BROKEN_FTS1)
#error fts1 has a design flaw and has been deprecated.

View file

@ -13,9 +13,8 @@
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
/* clang-format off */
/*
** The code in this file is only compiled if:
@ -29,7 +28,7 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)
#include "fts1_hash.h"
#include "third_party/sqlite3/fts1_hash.h"
static void *malloc_and_zero(int n){
void *p = malloc(n);

View file

@ -17,6 +17,8 @@
#ifndef _FTS1_HASH_H_
#define _FTS1_HASH_H_
/* clang-format off */
/* Forward declarations of structures. */
typedef struct fts1Hash fts1Hash;
typedef struct fts1HashElem fts1HashElem;

View file

@ -12,7 +12,6 @@
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/
/*
** The code in this file is only compiled if:
**
@ -24,6 +23,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)
/* clang-format off */
#include <assert.h>
#include <stdlib.h>

View file

@ -20,6 +20,8 @@
#ifndef _FTS1_TOKENIZER_H_
#define _FTS1_TOKENIZER_H_
/* clang-format off */
/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.

View file

@ -4,7 +4,6 @@
*************************************************************************
** Implementation of the "simple" full-text-search tokenizer.
*/
/*
** The code in this file is only compiled if:
**
@ -16,6 +15,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)
/* clang-format off */
#include <assert.h>
#include <stdlib.h>

View file

@ -3,6 +3,7 @@
** fts3 (or higher). If you believe that your use of fts2 is safe,
** add -DSQLITE_ENABLE_BROKEN_FTS2=1 to your CFLAGS.
*/
/* clang-format off */
#if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)) \
&& !defined(SQLITE_ENABLE_BROKEN_FTS2)
#error fts2 has a design flaw and has been deprecated.

View file

@ -13,7 +13,6 @@
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/
/*
** The code in this file is only compiled if:
**
@ -23,6 +22,7 @@
** * The FTS2 module is being built into the core of
** SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/
/* clang-format off */
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
#include <assert.h>

View file

@ -17,6 +17,8 @@
#ifndef _FTS2_HASH_H_
#define _FTS2_HASH_H_
/* clang-format off */
/* Forward declarations of structures. */
typedef struct fts2Hash fts2Hash;
typedef struct fts2HashElem fts2HashElem;

View file

@ -10,13 +10,14 @@
**
*************************************************************************
** This file implements a tokenizer for fts2 based on the ICU library.
**
**
** $Id: fts2_icu.c,v 1.3 2008/12/18 05:30:26 danielk1977 Exp $
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
#ifdef SQLITE_ENABLE_ICU
/* clang-format off */
#include <assert.h>
#include <string.h>
#include "fts2_tokenizer.h"

View file

@ -12,7 +12,6 @@
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/
/*
** The code in this file is only compiled if:
**
@ -24,6 +23,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
/* clang-format off */
#include <assert.h>
#include <stdlib.h>

View file

@ -13,7 +13,6 @@
** This is part of an SQLite module implementing full-text search.
** This particular file implements the generic tokenizer interface.
*/
/*
** The code in this file is only compiled if:
**
@ -25,6 +24,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
/* clang-format off */
#include "sqlite3.h"
#include "sqlite3ext.h"

View file

@ -20,6 +20,8 @@
#ifndef _FTS2_TOKENIZER_H_
#define _FTS2_TOKENIZER_H_
/* clang-format off */
/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.

View file

@ -12,7 +12,6 @@
**
** Implementation of the "simple" full-text-search tokenizer.
*/
/*
** The code in this file is only compiled if:
**
@ -24,6 +23,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
/* clang-format off */
#include <assert.h>
#include <stdlib.h>

View file

@ -61,7 +61,7 @@
** A doclist (document list) holds a docid-sorted list of hits for a
** given term. Doclists hold docids and associated token positions.
** A docid is the unique integer identifier for a single document.
** A position is the index of a word within the document. The first
** A position is the index of a word within the document. The first
** word of the document has a position of 0.
**
** FTS3 used to optionally store character offsets using a compile-time
@ -86,7 +86,7 @@
**
** Here, array { X } means zero or more occurrences of X, adjacent in
** memory. A "position" is an index of a token in the token stream
** generated by the tokenizer. Note that POS_END and POS_COLUMN occur
** generated by the tokenizer. Note that POS_END and POS_COLUMN occur
** in the same logical place as the position element, and act as sentinals
** ending a position list array. POS_END is 0. POS_COLUMN is 1.
** The positions numbers are not stored literally but rather as two more
@ -110,7 +110,7 @@
** a document record consists of a docid followed by a position-list and
** a doclist consists of one or more document records.
**
** A bare doclist omits the position information, becoming an
** A bare doclist omits the position information, becoming an
** array of varint-encoded docids.
**
**** Segment leaf nodes ****
@ -287,25 +287,23 @@
** query logic likewise merges doclists so that newer data knocks out
** older data.
*/
/* clang-format off */
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
# define SQLITE_CORE 1
#endif
#include <assert.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "fts3.h"
#ifndef SQLITE_CORE
# include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3.h"
#ifndef SQLITE_CORE
#include "third_party/sqlite3/sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#endif
static int fts3EvalNext(Fts3Cursor *pCsr);

View file

@ -13,7 +13,7 @@
** 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/sqlite3.h"
#ifdef __cplusplus
extern "C" {

View file

@ -13,6 +13,7 @@
*/
#ifndef _FTSINT_H
#define _FTSINT_H
/* clang-format off */
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
# define NDEBUG 1
@ -37,13 +38,13 @@
/* If not building as part of the core, include sqlite3ext.h. */
#ifndef SQLITE_CORE
# include "sqlite3ext.h"
#include "third_party/sqlite3/sqlite3ext.h"
SQLITE_EXTENSION_INIT3
#endif
#include "sqlite3.h"
#include "fts3_tokenizer.h"
#include "fts3_hash.h"
#include "third_party/sqlite3/fts3_hash.h"
#include "third_party/sqlite3/fts3_tokenizer.h"
#include "third_party/sqlite3/sqlite3.h"
/*
** This constant determines the maximum depth of an FTS expression tree

View file

@ -11,11 +11,12 @@
******************************************************************************
**
*/
#include "fts3Int.h"
/* clang-format off */
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <string.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/str/str.h"
typedef struct Fts3auxTable Fts3auxTable;
typedef struct Fts3auxCursor Fts3auxCursor;

View file

@ -11,12 +11,13 @@
******************************************************************************
**
** This module contains code that implements a parser for fts3 query strings
** (the right-hand argument to the MATCH operator). Because the supported
** (the right-hand argument to the MATCH operator). Because the supported
** syntax is relatively simple, the whole tokenizer/parser system is
** hand-coded.
** hand-coded.
*/
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
/* clang-format off */
/*
** By default, this module parses the legacy syntax that has been
@ -78,8 +79,8 @@ int sqlite3_fts3_enable_parentheses = 0;
*/
#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10
#include <string.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/*
** isNot:
@ -1107,7 +1108,7 @@ void sqlite3Fts3ExprFree(Fts3Expr *pDel){
#ifdef SQLITE_TEST
#include <stdio.h>
#include "libc/stdio/stdio.h"
/*
** Return a pointer to a buffer containing a text representation of the

View file

@ -13,6 +13,7 @@
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/
/* clang-format off */
/*
** The code in this file is only compiled if:
@ -23,14 +24,13 @@
** * 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/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "fts3_hash.h"
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3_hash.h"
/*
** Malloc and Free functions

View file

@ -16,6 +16,7 @@
*/
#ifndef _FTS3_HASH_H_
#define _FTS3_HASH_H_
/* clang-format off */
/* Forward declarations of structures. */
typedef struct Fts3Hash Fts3Hash;

View file

@ -11,18 +11,15 @@
*************************************************************************
** This file implements a tokenizer for fts3 based on the ICU library.
*/
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#ifdef SQLITE_ENABLE_ICU
/* clang-format off */
#include <assert.h>
#include <string.h>
#include "fts3_tokenizer.h"
#include <unicode/ubrk.h>
#include <unicode/ucol.h>
#include <unicode/ustring.h>
#include <unicode/utf16.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#include "libc/unicode/unicode.h"
#include "third_party/sqlite3/fts3_tokenizer.h"
typedef struct IcuTokenizer IcuTokenizer;
typedef struct IcuCursor IcuCursor;

View file

@ -12,6 +12,7 @@
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/
/* clang-format off */
/*
** The code in this file is only compiled if:
@ -22,15 +23,14 @@
** * 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/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fts3_tokenizer.h"
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3_tokenizer.h"
/*
** Class derived from sqlite3_tokenizer

View file

@ -10,12 +10,13 @@
**
******************************************************************************
*/
/* clang-format off */
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <string.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/*
** Characters that may appear in the second argument to matchinfo().

View file

@ -25,8 +25,8 @@
**
** input = <string>
**
** The virtual table module tokenizes this <string>, using the FTS3
** tokenizer specified by the arguments to the CREATE VIRTUAL TABLE
** The virtual table module tokenizes this <string>, using the FTS3
** tokenizer specified by the arguments to the CREATE VIRTUAL TABLE
** statement and returns one row for each token in the result. With
** fields set as follows:
**
@ -38,11 +38,12 @@
** pos: Token offset of token within input.
**
*/
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
/* clang-format off */
#include <string.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/str/str.h"
typedef struct Fts3tokTable Fts3tokTable;
typedef struct Fts3tokCursor Fts3tokCursor;

View file

@ -13,6 +13,7 @@
** This is part of an SQLite module implementing full-text search.
** This particular file implements the generic tokenizer interface.
*/
/* clang-format off */
/*
** The code in this file is only compiled if:
@ -23,11 +24,11 @@
** * 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/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <assert.h>
#include <string.h>
#include "libc/assert.h"
#include "libc/str/str.h"
/*
** Return true if the two-argument version of fts3_tokenizer()
@ -227,11 +228,11 @@ int sqlite3Fts3InitTokenizer(
#ifdef SQLITE_TEST
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#include "third_party/sqlite3/sqlite_tcl.h"
#else
# include "tcl.h"
#include "third_party/sqlite3/tcl.h"
#endif
#include <string.h>
#include "libc/str/str.h"
/*
** Implementation of a special SQL scalar function for testing tokenizers

View file

@ -19,12 +19,13 @@
*/
#ifndef _FTS3_TOKENIZER_H_
#define _FTS3_TOKENIZER_H_
/* clang-format off */
/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** 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/sqlite3.h"
/*
** Structures used by the tokenizer interface. When a new tokenizer

View file

@ -12,6 +12,7 @@
**
** Implementation of the "simple" full-text-search tokenizer.
*/
/* clang-format off */
/*
** The code in this file is only compiled if:
@ -22,15 +23,14 @@
** * 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/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fts3_tokenizer.h"
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3_tokenizer.h"
typedef struct simple_tokenizer {
sqlite3_tokenizer base;

View file

@ -12,18 +12,18 @@
**
** Implementation of the "unicode" full-text-search tokenizer.
*/
/* clang-format off */
#ifndef SQLITE_DISABLE_FTS3_UNICODE
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fts3_tokenizer.h"
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3_tokenizer.h"
/*
** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied

View file

@ -10,6 +10,7 @@
**
******************************************************************************
*/
/* clang-format off */
/*
** DO NOT EDIT THIS MACHINE GENERATED FILE.
@ -18,7 +19,7 @@
#ifndef SQLITE_DISABLE_FTS3_UNICODE
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
#include <assert.h>
#include "libc/assert.h"
/*
** Return true if the argument corresponds to a unicode codepoint

View file

@ -13,17 +13,19 @@
** This file is part of the SQLite FTS3 extension module. Specifically,
** this file contains code to insert, update and delete rows from FTS3
** tables. It also contains code to merge FTS3 b-tree segments. Some
** of the sub-routines used to merge segments are also used by the query
** of the sub-routines used to merge segments are also used by the query
** code in fts3.c.
*/
/* clang-format off */
#include "fts3Int.h"
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "libc/alg/alg.h"
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#define FTS_MAX_APPENDABLE_HEIGHT 16

View file

@ -1,4 +1,5 @@
/* clang-format off */
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5)
@ -33,7 +34,7 @@
#ifndef _FTS5_H
#define _FTS5_H
#include "sqlite3.h"
#include "third_party/sqlite3/sqlite3.h"
#ifdef __cplusplus
extern "C" {
@ -603,12 +604,12 @@ struct fts5_api {
#ifndef _FTS5INT_H
#define _FTS5INT_H
/* #include "fts5.h" */
#include "sqlite3ext.h"
/* #include "third_party/sqlite3/fts5.h" */
#include "third_party/sqlite3/sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <string.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/str/str.h"
#ifndef SQLITE_AMALGAMATION
@ -1477,8 +1478,8 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*);
/************ Begin %include sections from the grammar ************************/
#line 47 "fts5parse.y"
/* #include "fts5Int.h" */
/* #include "fts5parse.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/* #include "third_party/sqlite3/fts5parse.h" */
/*
** Disable all error recovery processing in the parser push-down
@ -1806,8 +1807,8 @@ struct fts5yyParser {
typedef struct fts5yyParser fts5yyParser;
#ifndef NDEBUG
#include <stdio.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
static FILE *fts5yyTraceFILE = 0;
static char *fts5yyTracePrompt = 0;
#endif /* NDEBUG */
@ -3012,9 +3013,8 @@ static int sqlite3Fts5ParserFallback(int iToken){
******************************************************************************
*/
/* #include "fts5Int.h" */
#include <math.h> /* amalgamator: keep */
/* #include "third_party/sqlite3/fts5Int.h" */
#include "libc/math.h" /* amalgamator: keep */
/*
** Object used to iterate through all "coalesced phrase instances" in
@ -3728,9 +3728,7 @@ static int sqlite3Fts5AuxInit(fts5_api *pApi){
******************************************************************************
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){
if( (u32)pBuf->nSpace<nByte ){
@ -4135,8 +4133,7 @@ static void sqlite3Fts5TermsetFree(Fts5Termset *p){
** This is an SQLite module implementing full-text search.
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
#define FTS5_DEFAULT_PAGE_SIZE 4050
#define FTS5_DEFAULT_AUTOMERGE 4
@ -5096,10 +5093,8 @@ static int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){
**
*/
/* #include "fts5Int.h" */
/* #include "fts5parse.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/* #include "third_party/sqlite3/fts5parse.h" */
/*
** All token types in the generated fts5parse.h file are greater than 0.
@ -5113,14 +5108,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 <stdio.h>
static void sqlite3Fts5ParserTrace(FILE*, char*);
#include "libc/stdio/stdio.h"
static void sqlite3Fts5ParserTrace(FILE *, char *);
#endif
static int sqlite3Fts5ParserFallback(int);
// static int sqlite3Fts5ParserFallback(int);
struct Fts5Expr {
@ -8152,9 +8147,7 @@ static int sqlite3Fts5ExprPhraseCollist(
**
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
typedef struct Fts5HashEntry Fts5HashEntry;
@ -8718,8 +8711,7 @@ static void sqlite3Fts5HashScanEntry(
** the interface defined in fts5Int.h.
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/*
** Overview:
@ -15426,8 +15418,7 @@ static int sqlite3Fts5IndexReset(Fts5Index *p){
** This is an SQLite module implementing full-text search.
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/*
** This variable is set to false when running tests for which the on disk
@ -18348,9 +18339,7 @@ int sqlite3Fts5Init(sqlite3 *db){
**
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
struct Fts5Storage {
Fts5Config *pConfig;
@ -19510,8 +19499,7 @@ static int sqlite3Fts5StorageConfigValue(
******************************************************************************
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/**************************************************************************
** Start of ascii tokenizer implementation.
@ -20931,8 +20919,7 @@ static int sqlite3Fts5TokenizerInit(fts5_api *pApi){
** DO NOT EDIT THIS MACHINE GENERATED FILE.
*/
#include <assert.h>
#include "libc/assert.h"
@ -21709,8 +21696,7 @@ static void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){
** Routines for varint serialization and deserialization.
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
/*
** This is a copy of the sqlite3GetVarint32() routine from the SQLite core.
@ -22078,8 +22064,7 @@ static int sqlite3Fts5GetVarintLen(u32 iVal){
** One row for each term instance in the database.
*/
/* #include "fts5Int.h" */
/* #include "third_party/sqlite3/fts5Int.h" */
typedef struct Fts5VocabTable Fts5VocabTable;

View file

@ -10,18 +10,19 @@
**
******************************************************************************
**
** Interfaces to extend FTS5. Using the interfaces defined in this file,
** Interfaces to extend FTS5. Using the interfaces defined in this file,
** FTS5 may be extended with:
**
** * custom tokenizers, and
** * custom auxiliary functions.
*/
/* clang-format off */
#ifndef _FTS5_H
#define _FTS5_H
#include "sqlite3.h"
#include "third_party/sqlite3/sqlite3.h"
#ifdef __cplusplus
extern "C" {

View file

@ -13,13 +13,14 @@
** functions of SQLite. (Some function, and in particular the date and
** time functions, are implemented separately.)
*/
#include "sqliteInt.h"
#include <stdlib.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "third_party/sqlite3/sqliteInt.h"
#ifndef SQLITE_OMIT_FLOATING_POINT
#include <math.h>
#include "libc/math.h"
#endif
#include "vdbeInt.h"
#include "third_party/sqlite3/vdbeInt.h"
/* clang-format off */
/*
** Return the collating function associated with a function.

View file

@ -16,7 +16,12 @@
** This file is #include-ed onto the end of "rtree.c" so that it has
** access to all of the R-Tree internals.
*/
#include <stdlib.h>
#include "libc/fmt/conv.h"
#include "libc/mem/mem.h"
#include "third_party/gdtoa/gdtoa.h"
#include "third_party/sqlite3/rtree.h"
#include "third_party/sqlite3/sqlite3.h"
/* clang-format off */
/* Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities */
#ifdef GEOPOLY_ENABLE_DEBUG
@ -38,11 +43,11 @@
# define safe_isalnum(x) sqlite3Isalnum(x)
# define safe_isxdigit(x) sqlite3Isxdigit(x)
#else
/* Use the standard library for separate compilation */
#include <ctype.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))
/* Use the standard library for separate compilation */
#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))
#endif
/*

View file

@ -12,7 +12,8 @@
**
** This file contains definitions of global variables and constants.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/* An array to map all upper-case characters into their corresponding
** lower-case character.
@ -306,7 +307,7 @@ int sqlite3PendingByte = 0x40000000;
u32 sqlite3SelectTrace = 0;
u32 sqlite3WhereTrace = 0;
#include "opcodes.h"
#include "third_party/sqlite3/opcodes.h"
/*
** Properties of opcodes. The OPFLG_INITIALIZER macro is
** created by mkopcodeh.awk during compilation. Data is obtained

View file

@ -12,8 +12,9 @@
** This is the implementation of generic hash-tables
** used in SQLite.
*/
#include "sqliteInt.h"
#include <assert.h>
#include "libc/assert.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.

View file

@ -14,6 +14,7 @@
*/
#ifndef SQLITE_HASH_H
#define SQLITE_HASH_H
/* clang-format off */
/* Forward declarations of structures. */
typedef struct Hash Hash;

View file

@ -15,6 +15,7 @@
*/
#ifndef SQLITE_HWTIME_H
#define SQLITE_HWTIME_H
/* clang-format off */
/*
** The following routine only works on pentium-class (or newer) processors.

View file

@ -11,9 +11,9 @@
*************************************************************************
** $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $
**
** This file implements an integration between the ICU library
** ("International Components for Unicode", an open-source library
** for handling unicode data) and SQLite. The integration uses
** This file implements an integration between the ICU library
** ("International Components for Unicode", an open-source library
** for handling unicode data) and SQLite. The integration uses
** ICU to provide the following to SQLite:
**
** * An implementation of the SQL regexp() function (and hence REGEXP
@ -24,27 +24,23 @@
**
** * Integration of ICU and SQLite collation sequences.
**
** * An implementation of the LIKE operator that uses ICU to
** * An implementation of the LIKE operator that uses ICU to
** provide case-independent matching.
*/
/* clang-format off */
#if !defined(SQLITE_CORE) \
|| defined(SQLITE_ENABLE_ICU) \
|| defined(SQLITE_ENABLE_ICU_COLLATIONS)
#if 0 && !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) || \
defined(SQLITE_ENABLE_ICU_COLLATIONS)
/* Include ICU headers */
#include <unicode/utypes.h>
#include <unicode/uregex.h>
#include <unicode/ustring.h>
#include <unicode/ucol.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/unicode/unicode.h"
#ifndef SQLITE_CORE
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include "third_party/sqlite3/sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#else
#include "sqlite3.h"
#include "third_party/sqlite3/sqlite3.h"
#endif
/*

View file

@ -12,7 +12,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** Generate code that will

View file

@ -23,13 +23,14 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1)
#if !defined(SQLITEINT_H)
#include "sqlite3ext.h"
#include "third_party/sqlite3/sqlite3ext.h"
#endif
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "libc/assert.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "third_party/gdtoa/gdtoa.h"
/* clang-format off */
/* Mark a function parameter as unused, to suppress nuisance compiler
** warnings. */
@ -57,11 +58,11 @@ SQLITE_EXTENSION_INIT1
# define safe_isalnum(x) sqlite3Isalnum(x)
# define safe_isxdigit(x) sqlite3Isxdigit(x)
#else
/* Use the standard library for separate compilation */
#include <ctype.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))
/* Use the standard library for separate compilation */
#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))
#endif
/*
@ -717,9 +718,9 @@ static int jsonParseAddNode(JsonParse*,u32,u32,const char*);
** inlined.
*/
#if defined(__GNUC__)
# define JSON_NOINLINE __attribute__((noinline))
#elif defined(_MSC_VER) && _MSC_VER>=1310
# define JSON_NOINLINE __declspec(noinline)
#define JSON_NOINLINE __attribute__((__noinline__))
#elif defined(_MSC_VER) && _MSC_VER >= 1310
#define JSON_NOINLINE __declspec(noinline)
#else
# define JSON_NOINLINE
#endif

View file

@ -14,8 +14,9 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
*/
/* clang-format off */
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/*
** Execute SQL code. Return one of the SQLITE_ success/failure

View file

@ -12,12 +12,13 @@
** This file contains code used to dynamically load extensions into
** the SQLite library.
*/
/* clang-format off */
#ifndef SQLITE_CORE
#define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
#endif
#include "sqlite3ext.h"
#include "sqliteInt.h"
#include "third_party/sqlite3/sqlite3ext.h"
#include "third_party/sqlite3/sqliteInt.h"
#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*

View file

@ -14,16 +14,17 @@
** 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/sqliteInt.h"
/* clang-format off */
#ifdef SQLITE_ENABLE_FTS3
# include "fts3.h"
#include "third_party/sqlite3/fts3.h"
#endif
#ifdef SQLITE_ENABLE_RTREE
# include "rtree.h"
#include "third_party/sqlite3/rtree.h"
#endif
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
# include "sqliteicu.h"
#include "third_party/sqlite3/sqliteicu.h"
#endif
/*

View file

@ -12,8 +12,9 @@
**
** Memory allocation functions used throughout sqlite.
*/
#include "sqliteInt.h"
#include <stdarg.h>
/* clang-format off */
#include "third_party/sqlite3/sqliteInt.h"
/*
** Attempt to release up to n bytes of non-essential memory currently

View file

@ -16,7 +16,8 @@
** are merely placeholders. Real drivers must be substituted using
** sqlite3_config() before SQLite will operate.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** This version of the memory allocator is the default. It is

View file

@ -41,7 +41,8 @@
** be necessary when compiling for Delphi,
** for example.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** This version of the memory allocator is the default. It is
@ -103,16 +104,16 @@ static malloc_zone_t* _sqliteZone_;
** the macro SQLITE_MALLOCSIZE to the desired function name.
*/
#if defined(SQLITE_USE_MALLOC_H)
# include <malloc.h>
# if defined(SQLITE_USE_MALLOC_USABLE_SIZE)
# if !defined(SQLITE_MALLOCSIZE)
# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
# endif
# elif defined(SQLITE_USE_MSIZE)
# if !defined(SQLITE_MALLOCSIZE)
# define SQLITE_MALLOCSIZE _msize
# endif
# endif
#include "libc/mem/mem.h"
#if defined(SQLITE_USE_MALLOC_USABLE_SIZE)
#if !defined(SQLITE_MALLOCSIZE)
#define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
#endif
#elif defined(SQLITE_USE_MSIZE)
#if !defined(SQLITE_MALLOCSIZE)
#define SQLITE_MALLOCSIZE _msize
#endif
#endif
#endif /* defined(SQLITE_USE_MALLOC_H) */
#endif /* __APPLE__ or not __APPLE__ */

View file

@ -19,7 +19,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** This version of the memory allocator is used only if the
@ -37,7 +38,7 @@
# define backtrace(A,B) 1
# define backtrace_symbols_fd(A,B,C)
#endif
#include <stdio.h>
#include "libc/stdio/stdio.h"
/*
** Each memory allocation looks like this:

View file

@ -10,12 +10,12 @@
**
*************************************************************************
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite.
** allocation subsystem for use by SQLite.
**
** This version of the memory allocation subsystem omits all
** use of malloc(). The SQLite user supplies a block of memory
** before calling sqlite3_initialize() from which allocations
** are made and returned by the xMalloc() and xRealloc()
** are made and returned by the xMalloc() and xRealloc()
** implementations. Once sqlite3_initialize() has been called,
** the amount of memory available to SQLite is fixed and cannot
** be changed.
@ -23,7 +23,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** This version of the memory allocator is only built into the library

View file

@ -10,12 +10,12 @@
**
*************************************************************************
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite.
** allocation subsystem for use by SQLite.
**
** This version of the memory allocation subsystem omits all
** use of malloc(). The application gives SQLite a block of memory
** before calling sqlite3_initialize() from which allocations
** are made and returned by the xMalloc() and xRealloc()
** are made and returned by the xMalloc() and xRealloc()
** implementations. Once sqlite3_initialize() has been called,
** the amount of memory available to SQLite is fixed and cannot
** be changed.
@ -35,12 +35,12 @@
** This algorithm is described in: J. M. Robson. "Bounds for Some Functions
** Concerning Dynamic Storage Allocation". Journal of the Association for
** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499.
**
**
** Let n be the size of the largest allocation divided by the minimum
** allocation size (after rounding all sizes up to a power of 2.) Let M
** be the maximum amount of memory ever outstanding at one time. Let
** N be the total amount of memory available for allocation. Robson
** proved that this memory allocator will never breakdown due to
** proved that this memory allocator will never breakdown due to
** fragmentation as long as the following constraint holds:
**
** N >= M*(1 + log2(n)/2) - n + 1
@ -48,7 +48,8 @@
** 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/sqliteInt.h"
/* clang-format off */
/*
** This version of the memory allocator is used only when

View file

@ -16,8 +16,9 @@
** This file also implements interface sqlite3_serialize() and
** sqlite3_deserialize().
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
#ifdef SQLITE_ENABLE_DESERIALIZE
/* clang-format off */
/*
** Forward declaration of objects used by this utility

View file

@ -23,7 +23,8 @@
** in the common case, they are usually small and no file I/O needs to
** occur.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/* Forward references to internal structures */
typedef struct MemJournal MemJournal;

View file

@ -14,6 +14,7 @@
*/
#ifndef SQLITE_MSVC_H
#define SQLITE_MSVC_H
/* clang-format off */
#if defined(_MSC_VER)
#pragma warning(disable : 4054)

View file

@ -13,7 +13,8 @@
**
** This file contains code that is common across all mutex implementations.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT)
/*

View file

@ -19,6 +19,7 @@
** Source files should #include the sqliteInt.h file and let that file
** include this one indirectly.
*/
/* clang-format off */
/*

View file

@ -25,7 +25,8 @@
** that does error checking on mutexes to make sure they are being
** called correctly.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#ifndef SQLITE_MUTEX_OMIT

View file

@ -11,7 +11,8 @@
*************************************************************************
** This file contains the C functions that implement mutexes for pthreads
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** The code in this file is only used if we are compiling threadsafe

View file

@ -11,18 +11,19 @@
*************************************************************************
** This file contains the C functions that implement mutexes for Win32.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#if SQLITE_OS_WIN
/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"
#include "third_party/sqlite3/os_common.h"
/*
** Include the header file for the Windows VFS.
*/
#include "os_win.h"
#include "third_party/sqlite3/os_win.h"
#endif
/*

View file

@ -13,8 +13,9 @@
** This file contains the implementation of the sqlite3_unlock_notify()
** API method and its associated functionality.
*/
#include "sqliteInt.h"
#include "btreeInt.h"
#include "third_party/sqlite3/btreeInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY

View file

@ -1,3 +1,4 @@
/* clang-format off */
/* Automatically generated. Do not edit */
/* See the tool/mkopcodec.tcl script for details. */
#if !defined(SQLITE_OMIT_EXPLAIN) \

View file

@ -1,111 +1,116 @@
/* Automatically generated. Do not edit */
/* See the tool/mkopcodeh.tcl script for details */
#define OP_Savepoint 0
#define OP_AutoCommit 1
#define OP_Transaction 2
#define OP_SorterNext 3 /* jump */
#define OP_Prev 4 /* jump */
#define OP_Next 5 /* jump */
#define OP_Checkpoint 6
#define OP_JournalMode 7
#define OP_Vacuum 8
#define OP_VFilter 9 /* jump, synopsis: iplan=r[P3] zplan='P4' */
#define OP_VUpdate 10 /* synopsis: data=r[P3@P2] */
#define OP_Goto 11 /* jump */
#define OP_Gosub 12 /* jump */
#define OP_InitCoroutine 13 /* jump */
#define OP_Yield 14 /* jump */
#define OP_MustBeInt 15 /* jump */
#define OP_Jump 16 /* jump */
#define OP_Once 17 /* jump */
#define OP_If 18 /* jump */
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
#define OP_IfNot 20 /* jump */
#define OP_IfNullRow 21 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
#define OP_SeekLT 22 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekLE 23 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekGE 24 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekGT 25 /* jump, synopsis: key=r[P3@P4] */
#define OP_IfNotOpen 26 /* jump, synopsis: if( !csr[P1] ) goto P2 */
#define OP_IfNoHope 27 /* jump, synopsis: key=r[P3@P4] */
#define OP_NoConflict 28 /* jump, synopsis: key=r[P3@P4] */
#define OP_NotFound 29 /* jump, synopsis: key=r[P3@P4] */
#define OP_Found 30 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekRowid 31 /* jump, synopsis: intkey=r[P3] */
#define OP_NotExists 32 /* jump, synopsis: intkey=r[P3] */
#define OP_Last 33 /* jump */
#define OP_IfSmaller 34 /* jump */
#define OP_SorterSort 35 /* jump */
#define OP_Sort 36 /* jump */
#define OP_Rewind 37 /* jump */
#define OP_IdxLE 38 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxGT 39 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxLT 40 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxGE 41 /* jump, synopsis: key=r[P3@P4] */
#define OP_RowSetRead 42 /* jump, synopsis: r[P3]=rowset(P1) */
#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
#define OP_RowSetTest 45 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
#define OP_Program 46 /* jump */
#define OP_FkIfZero 47 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
#define OP_IfPos 48 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
#define OP_IfNotZero 49 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
#define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
#define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
#define OP_Ne 52 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
#define OP_Eq 53 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
#define OP_Gt 54 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
#define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
#define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
#define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
#define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
#define OP_DecrJumpZero 59 /* jump, synopsis: if (--r[P1])==0 goto P2 */
#define OP_IncrVacuum 60 /* jump */
#define OP_VNext 61 /* jump */
#define OP_Init 62 /* jump, synopsis: Start at P2 */
#define OP_PureFunc 63 /* synopsis: r[P3]=func(r[P2@NP]) */
#define OP_Function 64 /* synopsis: r[P3]=func(r[P2@NP]) */
#define OP_Return 65
#define OP_EndCoroutine 66
#define OP_HaltIfNull 67 /* synopsis: if r[P3]=null halt */
#define OP_Halt 68
#define OP_Integer 69 /* synopsis: r[P2]=P1 */
#define OP_Int64 70 /* synopsis: r[P2]=P4 */
#define OP_String 71 /* synopsis: r[P2]='P4' (len=P1) */
#define OP_Null 72 /* synopsis: r[P2..P3]=NULL */
#define OP_SoftNull 73 /* synopsis: r[P1]=NULL */
#define OP_Blob 74 /* synopsis: r[P2]=P4 (len=P1) */
#define OP_Variable 75 /* synopsis: r[P2]=parameter(P1,P4) */
#define OP_Move 76 /* synopsis: r[P2@P3]=r[P1@P3] */
#define OP_Copy 77 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
#define OP_SCopy 78 /* synopsis: r[P2]=r[P1] */
#define OP_IntCopy 79 /* synopsis: r[P2]=r[P1] */
#define OP_ChngCntRow 80 /* synopsis: output=r[P1] */
#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */
#define OP_CollSeq 82
#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */
#define OP_RealAffinity 84
#define OP_Cast 85 /* synopsis: affinity(r[P1]) */
#define OP_Permutation 86
#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */
#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
#define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */
#define OP_Column 90 /* synopsis: r[P3]=PX */
#define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */
#define OP_MakeRecord 92 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
#define OP_Count 93 /* synopsis: r[P2]=count() */
#define OP_ReadCookie 94
#define OP_SetCookie 95
#define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenDup 99
#define OP_Savepoint 0
#define OP_AutoCommit 1
#define OP_Transaction 2
#define OP_SorterNext 3 /* jump */
#define OP_Prev 4 /* jump */
#define OP_Next 5 /* jump */
#define OP_Checkpoint 6
#define OP_JournalMode 7
#define OP_Vacuum 8
#define OP_VFilter 9 /* jump, synopsis: iplan=r[P3] zplan='P4' */
#define OP_VUpdate 10 /* synopsis: data=r[P3@P2] */
#define OP_Goto 11 /* jump */
#define OP_Gosub 12 /* jump */
#define OP_InitCoroutine 13 /* jump */
#define OP_Yield 14 /* jump */
#define OP_MustBeInt 15 /* jump */
#define OP_Jump 16 /* jump */
#define OP_Once 17 /* jump */
#define OP_If 18 /* jump */
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
#define OP_IfNot 20 /* jump */
#define OP_IfNullRow \
21 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
#define OP_SeekLT 22 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekLE 23 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekGE 24 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekGT 25 /* jump, synopsis: key=r[P3@P4] */
#define OP_IfNotOpen 26 /* jump, synopsis: if( !csr[P1] ) goto P2 */
#define OP_IfNoHope 27 /* jump, synopsis: key=r[P3@P4] */
#define OP_NoConflict 28 /* jump, synopsis: key=r[P3@P4] */
#define OP_NotFound 29 /* jump, synopsis: key=r[P3@P4] */
#define OP_Found 30 /* jump, synopsis: key=r[P3@P4] */
#define OP_SeekRowid 31 /* jump, synopsis: intkey=r[P3] */
#define OP_NotExists 32 /* jump, synopsis: intkey=r[P3] */
#define OP_Last 33 /* jump */
#define OP_IfSmaller 34 /* jump */
#define OP_SorterSort 35 /* jump */
#define OP_Sort 36 /* jump */
#define OP_Rewind 37 /* jump */
#define OP_IdxLE 38 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxGT 39 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxLT 40 /* jump, synopsis: key=r[P3@P4] */
#define OP_IdxGE 41 /* jump, synopsis: key=r[P3@P4] */
#define OP_RowSetRead 42 /* jump, synopsis: r[P3]=rowset(P1) */
#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
#define OP_RowSetTest 45 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
#define OP_Program 46 /* jump */
#define OP_FkIfZero 47 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
#define OP_IfPos 48 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
#define OP_IfNotZero 49 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 \
*/
#define OP_IsNull \
50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
#define OP_NotNull \
51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
#define OP_Ne 52 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
#define OP_Eq 53 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
#define OP_Gt 54 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
#define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
#define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
#define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
#define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
#define OP_DecrJumpZero 59 /* jump, synopsis: if (--r[P1])==0 goto P2 */
#define OP_IncrVacuum 60 /* jump */
#define OP_VNext 61 /* jump */
#define OP_Init 62 /* jump, synopsis: Start at P2 */
#define OP_PureFunc 63 /* synopsis: r[P3]=func(r[P2@NP]) */
#define OP_Function 64 /* synopsis: r[P3]=func(r[P2@NP]) */
#define OP_Return 65
#define OP_EndCoroutine 66
#define OP_HaltIfNull 67 /* synopsis: if r[P3]=null halt */
#define OP_Halt 68
#define OP_Integer 69 /* synopsis: r[P2]=P1 */
#define OP_Int64 70 /* synopsis: r[P2]=P4 */
#define OP_String 71 /* synopsis: r[P2]='P4' (len=P1) */
#define OP_Null 72 /* synopsis: r[P2..P3]=NULL */
#define OP_SoftNull 73 /* synopsis: r[P1]=NULL */
#define OP_Blob 74 /* synopsis: r[P2]=P4 (len=P1) */
#define OP_Variable 75 /* synopsis: r[P2]=parameter(P1,P4) */
#define OP_Move 76 /* synopsis: r[P2@P3]=r[P1@P3] */
#define OP_Copy 77 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
#define OP_SCopy 78 /* synopsis: r[P2]=r[P1] */
#define OP_IntCopy 79 /* synopsis: r[P2]=r[P1] */
#define OP_ChngCntRow 80 /* synopsis: output=r[P1] */
#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */
#define OP_CollSeq 82
#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */
#define OP_RealAffinity 84
#define OP_Cast 85 /* synopsis: affinity(r[P1]) */
#define OP_Permutation 86
#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */
#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
#define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */
#define OP_Column 90 /* synopsis: r[P3]=PX */
#define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */
#define OP_MakeRecord 92 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
#define OP_Count 93 /* synopsis: r[P2]=count() */
#define OP_ReadCookie 94
#define OP_SetCookie 95
#define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
#define OP_OpenDup 99
#define OP_OpenAutoindex 100 /* synopsis: nColumn=P2 */
#define OP_OpenEphemeral 101 /* synopsis: nColumn=P2 */
#define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
#define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
#define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
#define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
#define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] \
*/
#define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
#define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
#define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
@ -127,58 +132,61 @@
#define OP_RowCell 124
#define OP_Delete 125
#define OP_ResetCount 126
#define OP_SorterCompare 127 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
#define OP_SorterData 128 /* synopsis: r[P2]=data */
#define OP_RowData 129 /* synopsis: r[P2]=data */
#define OP_Rowid 130 /* synopsis: r[P2]=rowid */
#define OP_NullRow 131
#define OP_SeekEnd 132
#define OP_IdxInsert 133 /* synopsis: key=r[P2] */
#define OP_SorterInsert 134 /* synopsis: key=r[P2] */
#define OP_IdxDelete 135 /* synopsis: key=r[P2@P3] */
#define OP_DeferredSeek 136 /* synopsis: Move P3 to P1.rowid if needed */
#define OP_IdxRowid 137 /* synopsis: r[P2]=rowid */
#define OP_FinishSeek 138
#define OP_Destroy 139
#define OP_Clear 140
#define OP_ResetSorter 141
#define OP_CreateBtree 142 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
#define OP_SqlExec 143
#define OP_ParseSchema 144
#define OP_LoadAnalysis 145
#define OP_DropTable 146
#define OP_DropIndex 147
#define OP_DropTrigger 148
#define OP_IntegrityCk 149
#define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
#define OP_Param 151
#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
#define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
#define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
#define OP_OffsetLimit 155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
#define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
#define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
#define OP_AggStep1 158 /* synopsis: accum=r[P3] step(r[P2@P5]) */
#define OP_AggValue 159 /* synopsis: r[P3]=value N=P2 */
#define OP_AggFinal 160 /* synopsis: accum=r[P1] N=P2 */
#define OP_Expire 161
#define OP_CursorLock 162
#define OP_CursorUnlock 163
#define OP_TableLock 164 /* synopsis: iDb=P1 root=P2 write=P3 */
#define OP_VBegin 165
#define OP_VCreate 166
#define OP_VDestroy 167
#define OP_VOpen 168
#define OP_VColumn 169 /* synopsis: r[P3]=vcolumn(P2) */
#define OP_VRename 170
#define OP_Pagecount 171
#define OP_MaxPgcnt 172
#define OP_Trace 173
#define OP_CursorHint 174
#define OP_ReleaseReg 175 /* synopsis: release r[P1@P2] mask P3 */
#define OP_Noop 176
#define OP_Explain 177
#define OP_Abortable 178
#define OP_SorterCompare 127 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 \
*/
#define OP_SorterData 128 /* synopsis: r[P2]=data */
#define OP_RowData 129 /* synopsis: r[P2]=data */
#define OP_Rowid 130 /* synopsis: r[P2]=rowid */
#define OP_NullRow 131
#define OP_SeekEnd 132
#define OP_IdxInsert 133 /* synopsis: key=r[P2] */
#define OP_SorterInsert 134 /* synopsis: key=r[P2] */
#define OP_IdxDelete 135 /* synopsis: key=r[P2@P3] */
#define OP_DeferredSeek 136 /* synopsis: Move P3 to P1.rowid if needed */
#define OP_IdxRowid 137 /* synopsis: r[P2]=rowid */
#define OP_FinishSeek 138
#define OP_Destroy 139
#define OP_Clear 140
#define OP_ResetSorter 141
#define OP_CreateBtree 142 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
#define OP_SqlExec 143
#define OP_ParseSchema 144
#define OP_LoadAnalysis 145
#define OP_DropTable 146
#define OP_DropIndex 147
#define OP_DropTrigger 148
#define OP_IntegrityCk 149
#define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
#define OP_Param 151
#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
#define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
#define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
#define OP_OffsetLimit \
155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
#define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
#define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
#define OP_AggStep1 158 /* synopsis: accum=r[P3] step(r[P2@P5]) */
#define OP_AggValue 159 /* synopsis: r[P3]=value N=P2 */
#define OP_AggFinal 160 /* synopsis: accum=r[P1] N=P2 */
#define OP_Expire 161
#define OP_CursorLock 162
#define OP_CursorUnlock 163
#define OP_TableLock 164 /* synopsis: iDb=P1 root=P2 write=P3 */
#define OP_VBegin 165
#define OP_VCreate 166
#define OP_VDestroy 167
#define OP_VOpen 168
#define OP_VColumn 169 /* synopsis: r[P3]=vcolumn(P2) */
#define OP_VRename 170
#define OP_Pagecount 171
#define OP_MaxPgcnt 172
#define OP_Trace 173
#define OP_CursorHint 174
#define OP_ReleaseReg 175 /* synopsis: release r[P1@P2] mask P3 */
#define OP_Noop 176
#define OP_Explain 177
#define OP_Abortable 178
/* clang-format off */
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c

View file

@ -13,7 +13,8 @@
** This file contains OS interface code that is common to all
** architectures.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** If we compile with the SQLITE_TEST macro set, then the following block

View file

@ -19,12 +19,13 @@
*/
#ifndef _SQLITE_OS_H_
#define _SQLITE_OS_H_
/* clang-format off */
/*
** Attempt to automatically detect the operating system and setup the
** necessary pre-processor macros for it.
*/
#include "os_setup.h"
#include "third_party/sqlite3/os_setup.h"
/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op

View file

@ -19,6 +19,7 @@
*/
#ifndef _OS_COMMON_H_
#define _OS_COMMON_H_
/* clang-format off */
/*
** At least two bugs have slipped in because we changed the MEMORY_DEBUG
@ -39,7 +40,7 @@
** hwtime.h contains inline assembler code for implementing
** high-performance timing routines.
*/
#include "hwtime.h"
#include "third_party/sqlite3/hwtime.h"
static sqlite_uint64 g_start;
static sqlite_uint64 g_elapsed;

View file

@ -15,6 +15,7 @@
*/
#ifndef SQLITE_OS_SETUP_H
#define SQLITE_OS_SETUP_H
/* clang-format off */
/*
** Figure out if we are dealing with Unix, Windows, or some other operating

View file

@ -43,8 +43,9 @@
** * Definitions of sqlite3_vfs objects for all locking methods
** plus implementations of sqlite3_os_init() and sqlite3_os_end().
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
#include "third_party/sqlite3/sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
/* clang-format off */
/*
** There are various methods for file locking used for concurrency
@ -87,16 +88,22 @@
/*
** standard include files.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
# include <sys/mman.h>
#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/struct/tm.h"
#include "libc/time/time.h"
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE > 0
#include "libc/mem/mem.h"
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
@ -134,9 +141,10 @@
#if OS_VXWORKS
# include <sys/ioctl.h>
# include <semaphore.h>
# include <limits.h>
#include <semaphore.h>
#include <sys/ioctl.h>
#include "libc/limits.h"
#endif /* OS_VXWORKS */
#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
@ -144,7 +152,7 @@
#endif
#ifdef HAVE_UTIME
# include <utime.h>
#include "libc/time/time.h"
#endif
/*
@ -297,7 +305,7 @@ static pid_t randomnessPid = 0;
/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"
#include "third_party/sqlite3/os_common.h"
/*
** Define various macros that are missing from some systems.
@ -861,27 +869,22 @@ static int robust_ftruncate(int h, sqlite3_int64 sz){
** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately.
*/
static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
assert( (sqliteIOErr == SQLITE_IOERR_LOCK) ||
(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
assert((sqliteIOErr == SQLITE_IOERR_LOCK) ||
(sqliteIOErr == SQLITE_IOERR_UNLOCK) ||
(sqliteIOErr == SQLITE_IOERR_RDLOCK) ||
(sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK));
// 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:
else if (posixError == EPERM)
return SQLITE_PERM;
default:
else
return sqliteIOErr;
}
}
@ -3382,17 +3385,17 @@ static int unixRead(
** 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 */

View file

@ -12,18 +12,19 @@
**
** This file contains code that is specific to Windows.
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN /* This file is used for Windows only */
#include "third_party/sqlite3/sqliteInt.h"
#if SQLITE_OS_WIN /* This file is used for Windows only */
/* clang-format off */
/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"
#include "third_party/sqlite3/os_common.h"
/*
** Include the header file for the Windows VFS.
*/
#include "os_win.h"
#include "third_party/sqlite3/os_win.h"
/*
** Compiling and using WAL mode requires several APIs that are only
@ -2193,9 +2194,8 @@ static void winLogIoerr(int nRetry, int lineno){
** The MSVC CRT on Windows CE may not have a localtime() function.
** So define a substitute.
*/
# include <time.h>
struct tm *__cdecl localtime(const time_t *t)
{
#include "libc/time/time.h"
struct tm *__cdecl localtime(const time_t *t) {
static struct tm y;
FILETIME uTm, lTm;
SYSTEMTIME pTm;

View file

@ -14,15 +14,17 @@
*/
#ifndef SQLITE_OS_WIN_H
#define SQLITE_OS_WIN_H
/* clang-format off */
/*
** Include the primary Windows SDK header file.
*/
#include "windows.h"
#include "third_party/sqlite3/windows.h"
#ifdef __CYGWIN__
# include <sys/cygwin.h>
# include <errno.h> /* amalgamator: dontcache */
#include <sys/cygwin.h>
#include "libc/errno.h" /* amalgamator: dontcache */
#endif
/*

View file

@ -10,7 +10,7 @@
**
*************************************************************************
** This is the implementation of the page cache subsystem or "pager".
**
**
** The pager is used to access a database disk file. It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file. The pager also implements file
@ -19,8 +19,9 @@
** another is writing.
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include "wal.h"
#include "third_party/sqlite3/sqliteInt.h"
#include "third_party/sqlite3/wal.h"
/* clang-format off */
/******************* NOTES ON THE DESIGN OF THE PAGER ************************

View file

@ -13,6 +13,7 @@
** subsystem. The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
*/
/* clang-format off */
#ifndef SQLITE_PAGER_H
#define SQLITE_PAGER_H

View file

@ -13,16 +13,17 @@
*************************************************************************
** This file contains SQLite's SQL parser.
**
** The canonical source code to this file ("parse.y") is a Lemon grammar
** The canonical source code to this file ("parse.y") is a Lemon grammar
** file that specifies the input grammar and actions to take while parsing.
** That input file is processed by Lemon to generate a C-language
** That input file is processed by Lemon to generate a C-language
** implementation of a parser for the given grammer. You might be reading
** this comment as part of the translated C-code. Edits should be made
** to the original parse.y sources.
*/
#line 58 "parse.y"
/* clang-format off */
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/*
** Disable all error recovery processing in the parser push-down
@ -1441,8 +1442,8 @@ struct yyParser {
typedef struct yyParser yyParser;
#ifndef NDEBUG
#include <stdio.h>
#include <assert.h>
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */

View file

@ -11,7 +11,8 @@
*************************************************************************
** This file implements that page cache.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** A complete page cache is an instance of this structure. Every

View file

@ -10,8 +10,9 @@
**
*************************************************************************
** This header file defines the interface that the sqlite page cache
** subsystem.
** subsystem.
*/
/* clang-format off */
#ifndef _PCACHE_H_

View file

@ -63,7 +63,7 @@
**
** The third case is a chunk of heap memory (defaulting to 100 pages worth)
** that is allocated when the page cache is created. The size of the local
** bulk allocation can be adjusted using
** bulk allocation can be adjusted using
**
** sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N).
**
@ -80,7 +80,8 @@
** show that method (3) with N==100 provides about a 5% performance boost for
** common workloads.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
typedef struct PCache1 PCache1;
typedef struct PgHdr1 PgHdr1;

View file

@ -11,7 +11,8 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
# if defined(__APPLE__)
@ -28,7 +29,7 @@
** lexicographical order to facility a binary search of the pragma name.
** Do not edit pragma.h directly. Edit and rerun the script in at
** ../tool/mkpragmatab.tcl. */
#include "pragma.h"
#include "third_party/sqlite3/pragma.h"
/*
** Interpret the given string as a safety level. Return 0 for OFF,

View file

@ -3,6 +3,7 @@
** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
** that script and rerun it.
*/
/* clang-format off */
/* The various pragma types */
#define PragTyp_ACTIVATE_EXTENSIONS 0

View file

@ -13,7 +13,8 @@
** interface, and routines that contribute to loading the database schema
** from disk.
*/
#include "sqliteInt.h"
#include "third_party/sqlite3/sqliteInt.h"
/* clang-format off */
/*
** Fill the InitData structure with an error message that indicates

Some files were not shown because too many files have changed in this diff Show more