From 51ec837e61bb2ac2b710bc6f617854de1941591b Mon Sep 17 00:00:00 2001
From: Nick Parker
Date: Mon, 5 Dec 2016 14:29:15 -0600
Subject: [PATCH] Snapshot of upstream SQLite 3.15.2
---
Makefile.in | 69 +-
Makefile.msc | 303 +-
VERSION | 2 +-
autoconf/Makefile.am | 9 +-
autoconf/Makefile.msc | 106 +-
autoconf/README.txt | 4 +-
autoconf/configure.ac | 93 +-
autoconf/tea/configure.ac | 1 -
config.h.in | 12 +
configure | 120 +-
configure.ac | 50 +-
doc/lemon.html | 291 +-
ext/fts2/fts2_tokenizer.c | 6 +-
ext/fts3/fts3_test.c | 22 +-
ext/fts3/fts3_tokenizer.c | 77 +-
ext/fts3/fts3_write.c | 10 +-
ext/fts3/tool/fts3view.c | 2 +-
ext/fts5/fts5.h | 15 +-
ext/fts5/fts5Int.h | 15 +-
ext/fts5/fts5_aux.c | 232 +-
ext/fts5/fts5_config.c | 18 +-
ext/fts5/fts5_expr.c | 263 +-
ext/fts5/fts5_hash.c | 4 +-
ext/fts5/fts5_index.c | 363 +-
ext/fts5/fts5_main.c | 57 +-
ext/fts5/fts5_storage.c | 15 +-
ext/fts5/fts5_tcl.c | 33 +-
ext/fts5/fts5_test_mi.c | 39 +-
ext/fts5/fts5_vocab.c | 13 +-
ext/fts5/fts5parse.y | 11 +-
ext/fts5/test/fts5_common.tcl | 19 +-
ext/fts5/test/fts5aa.test | 9 +-
ext/fts5/test/fts5af.test | 91 +-
ext/fts5/test/fts5aux.test | 32 +
ext/fts5/test/fts5bigtok.test | 1 +
ext/fts5/test/fts5colset.test | 59 +
ext/fts5/test/fts5config.test | 16 +
ext/fts5/test/fts5corrupt2.test | 6 +-
ext/fts5/test/fts5corrupt3.test | 4 +
ext/fts5/test/fts5determin.test | 67 +
ext/fts5/test/fts5dlidx.test | 4 +-
ext/fts5/test/fts5eb.test | 29 +-
ext/fts5/test/fts5fault4.test | 2 +-
ext/fts5/test/fts5fault8.test | 25 +
ext/fts5/test/fts5faultB.test | 83 +
ext/fts5/test/fts5fuzz1.test | 93 +
ext/fts5/test/fts5matchinfo.test | 24 +
ext/fts5/test/fts5merge.test | 68 +-
ext/fts5/test/fts5merge2.test | 5 +-
ext/fts5/test/fts5multiclient.test | 48 +
ext/fts5/test/fts5optimize.test | 47 +-
ext/fts5/test/fts5rank.test | 54 +
ext/fts5/test/fts5simple.test | 68 +-
ext/fts5/test/fts5simple3.test | 34 +
ext/fts5/test/fts5unicode2.test | 8 +-
ext/fts5/test/fts5vocab.test | 38 +-
ext/fts5/tool/fts5txt2db.tcl | 5 +-
ext/icu/icu.c | 142 +-
ext/misc/amatch.c | 8 +-
ext/misc/carray.c | 364 ++
ext/misc/csv.c | 869 +++
ext/misc/fuzzer.c | 4 +-
ext/misc/json1.c | 55 +-
ext/misc/memvfs.c | 491 ++
ext/misc/percentile.c | 2 +-
ext/misc/regexp.c | 10 +-
ext/misc/scrub.c | 610 +++
ext/misc/series.c | 16 +-
ext/misc/spellfix.c | 34 +-
ext/misc/vfsstat.c | 816 +++
ext/rbu/rbu.c | 56 +-
ext/rbu/rbu1.test | 46 +-
ext/rbu/rbu5.test | 27 +-
ext/rbu/rbuC.test | 142 +
ext/rbu/rbu_common.tcl | 54 +
ext/rbu/rbudiff.test | 177 +-
ext/rbu/rbudor.test | 59 +
ext/rbu/rbufault3.test | 98 +
ext/rbu/rbuprogress.test | 417 ++
ext/rbu/rbuvacuum.test | 392 ++
ext/rbu/rbuvacuum2.test | 204 +
ext/rbu/sqlite3rbu.c | 1225 ++++-
ext/rbu/sqlite3rbu.h | 120 +-
ext/rbu/test_rbu.c | 101 +-
ext/rtree/rtree.c | 64 +-
ext/rtree/rtree1.test | 20 +-
ext/rtree/rtree3.test | 31 +-
ext/rtree/rtreeC.test | 4 -
ext/rtree/rtreeG.test | 66 +
ext/session/changeset.c | 416 ++
ext/session/session1.test | 585 +++
ext/session/session2.test | 591 +++
ext/session/session3.test | 211 +
ext/session/session4.test | 67 +
ext/session/session5.test | 408 ++
ext/session/session6.test | 90 +
ext/session/session8.test | 91 +
ext/session/session9.test | 287 +
ext/session/sessionA.test | 106 +
ext/session/sessionB.test | 508 ++
ext/session/sessionC.test | 198 +
ext/session/sessionD.test | 225 +
ext/session/sessionE.test | 117 +
ext/session/sessionF.test | 295 ++
ext/session/sessionG.test | 177 +
ext/session/session_common.tcl | 170 +
ext/session/sessionfault.test | 589 +++
ext/session/sessionfault2.test | 107 +
ext/session/sqlite3session.c | 4641 +++++++++++++++++
ext/session/sqlite3session.h | 1281 +++++
ext/session/test_session.c | 1046 ++++
main.mk | 47 +-
manifest | 844 +--
manifest.uuid | 2 +-
src/alter.c | 40 +-
src/analyze.c | 62 +-
src/attach.c | 27 +-
src/auth.c | 7 +-
src/backup.c | 57 +-
src/bitvec.c | 4 +-
src/btree.c | 354 +-
src/btree.h | 52 +-
src/build.c | 415 +-
src/callback.c | 70 +-
src/complete.c | 2 +-
src/ctime.c | 11 +-
src/date.c | 22 +-
src/dbstat.c | 30 +-
src/delete.c | 56 +-
src/expr.c | 1813 +++++--
src/fkey.c | 12 +-
src/func.c | 127 +-
src/global.c | 34 +-
src/hash.c | 10 +-
src/hash.h | 6 +-
src/hwtime.h | 6 +-
src/in-operator.md | 107 +
src/insert.c | 57 +-
src/journal.c | 256 -
src/legacy.c | 2 +-
src/loadext.c | 77 +-
src/main.c | 219 +-
src/malloc.c | 2 +-
src/memjournal.c | 327 +-
src/msvc.h | 6 +-
src/os.c | 27 +-
src/os.h | 5 +-
src/os_setup.h | 6 +-
src/os_unix.c | 166 +-
src/os_win.c | 752 ++-
src/os_win.h | 6 +-
src/pager.c | 315 +-
src/pager.h | 23 +-
src/parse.y | 609 ++-
src/pcache.c | 242 +-
src/pcache.h | 18 +-
src/pcache1.c | 52 +-
src/pragma.c | 76 +-
src/prepare.c | 80 +-
src/printf.c | 36 +-
src/resolve.c | 79 +-
src/rowset.c | 140 +-
src/select.c | 268 +-
src/shell.c | 1332 ++++-
src/sqlite.h.in | 487 +-
src/sqlite3ext.h | 28 +-
src/sqliteInt.h | 674 ++-
src/sqliteLimit.h | 13 +-
src/status.c | 9 +-
src/table.c | 6 +-
src/tclsqlite.c | 669 ++-
src/test1.c | 738 ++-
src/test2.c | 46 +-
src/test3.c | 90 +-
src/test4.c | 36 +-
src/test5.c | 14 +-
src/test6.c | 70 +-
src/test7.c | 32 +-
src/test8.c | 10 +-
src/test9.c | 12 +-
src/test_async.c | 19 +-
src/test_autoext.c | 35 +-
src/test_backup.c | 15 +-
src/test_bestindex.c | 610 +++
src/test_blob.c | 18 +-
src/test_btree.c | 8 +-
src/test_config.c | 43 +-
src/test_delete.c | 138 +
src/test_demovfs.c | 13 +-
src/test_devsym.c | 10 +-
src/test_fs.c | 20 +-
src/test_func.c | 30 +-
src/test_hexio.c | 20 +-
src/test_init.c | 14 +-
src/test_intarray.c | 13 +-
src/test_intarray.h | 6 +-
src/test_journal.c | 30 +-
src/test_malloc.c | 75 +-
src/test_multiplex.c | 29 +-
src/test_multiplex.h | 6 +-
src/test_mutex.c | 28 +-
src/test_onefile.c | 2 +-
src/test_osinst.c | 17 +-
src/test_quota.c | 79 +-
src/test_rtree.c | 16 +-
src/test_schema.c | 12 +-
src/test_superlock.c | 15 +-
src/test_syscall.c | 53 +-
src/test_tclvar.c | 8 +-
src/test_thread.c | 28 +-
src/test_vfs.c | 17 +-
src/test_windirent.c | 30 +-
src/test_windirent.h | 7 +
src/threads.c | 14 +-
src/tokenize.c | 50 +-
src/treeview.c | 44 +-
src/trigger.c | 20 +-
src/update.c | 30 +-
src/utf.c | 4 +-
src/util.c | 245 +-
src/vacuum.c | 196 +-
src/vdbe.c | 1111 ++--
src/vdbe.h | 14 +-
src/vdbeInt.h | 120 +-
src/vdbeapi.c | 262 +-
src/vdbeaux.c | 547 +-
src/vdbeblob.c | 28 +
src/vdbemem.c | 164 +-
src/vdbesort.c | 77 +-
src/vdbetrace.c | 12 +-
src/vtab.c | 96 +-
src/wal.c | 42 +-
src/wal.h | 6 +-
src/walker.c | 20 +-
src/where.c | 950 ++--
src/whereInt.h | 52 +-
src/wherecode.c | 580 +-
src/whereexpr.c | 124 +-
test/alter3.test | 12 +-
test/alter4.test | 19 +
test/analyze9.test | 2 +-
test/analyzeD.test | 5 +-
test/analyzer1.test | 9 +-
test/auth.test | 49 +-
test/auth2.test | 12 -
test/auth3.test | 21 +-
test/autoinc.test | 12 +
test/autoindex2.test | 7 +-
test/autovacuum.test | 17 +-
test/backcompat.test | 13 +-
test/backup.test | 21 +-
test/backup4.test | 5 +
test/backup_malloc.test | 32 +
test/bc_common.tcl | 5 +-
test/bestindex1.test | 275 +
test/bestindex2.test | 141 +
test/bestindex3.test | 175 +
test/capi3.test | 30 +-
test/capi3c.test | 21 +-
test/cffault.test | 2 +-
test/close.test | 4 +
test/collateB.test | 63 +
test/conflict.test | 12 +-
test/conflict2.test | 23 +-
test/corrupt2.test | 44 +-
test/corrupt3.test | 7 +-
test/corrupt4.test | 7 +-
test/corrupt6.test | 7 +-
test/corrupt7.test | 7 +-
test/corruptE.test | 7 +-
test/corruptG.test | 7 +-
test/corruptH.test | 8 +-
test/corruptI.test | 8 +-
test/corruptJ.test | 8 +-
test/coveridxscan.test | 31 +
test/crash8.test | 1 +
test/csv01.test | 112 +
test/ctime.test | 5 +-
test/cursorhint2.test | 182 +
test/dbstatus.test | 48 +-
test/dbstatus2.test | 2 +-
test/delete.test | 14 +
test/delete4.test | 42 +
test/delete_db.test | 217 +
test/e_expr.test | 7 +-
test/e_fkey.test | 8 +-
test/e_uri.test | 2 +-
test/e_vacuum.test | 79 +-
test/e_walauto.test | 5 +
test/e_walhook.test | 6 +-
test/eqp.test | 66 +-
test/exclusive.test | 9 +-
test/exists.test | 1 +
test/expr.test | 27 +
test/filectrl.test | 26 +
test/filefmt.test | 16 +-
test/fkey6.test | 56 +-
test/fts3atoken.test | 83 +-
test/fts3aux1.test | 6 +-
test/fts3conf.test | 38 +
test/fts3expr.test | 4 +
test/fts4growth.test | 40 +-
test/fts4langid.test | 49 +-
test/fts4merge.test | 26 +-
test/fts4merge3.test | 6 +-
test/fts4opt.test | 213 +
test/fuzz-oss1.test | 4 +
test/fuzzcheck.c | 52 +-
test/hook.test | 410 ++
test/icu.test | 9 +
test/in.test | 26 +-
test/in5.test | 54 +
test/incrblob.test | 23 +-
test/incrblob_err.test | 4 +-
test/incrvacuum2.test | 2 +-
test/index6.test | 18 +-
test/index7.test | 17 +-
test/index8.test | 60 +
test/indexexpr1.test | 46 +
test/instrfault.test | 68 +
test/intpkey.test | 39 +-
test/io.test | 2 +-
test/journal2.test | 2 +-
test/json101.test | 332 ++
test/limit2.test | 153 +
test/loadext.test | 14 +-
test/lock.test | 5 +-
test/main.test | 2 +-
test/mallocI.test | 11 +
test/memsubsys1.test | 12 +-
test/minmax.test | 14 +
test/misc1.test | 2 +-
test/misc5.test | 2 +
test/misc8.test | 39 +
test/mmap1.test | 6 +-
test/mmap3.test | 3 +
test/mutex1.test | 2 +-
test/nan.test | 80 +-
test/nolock.test | 35 +
test/pager1.test | 177 +-
test/pagerfault.test | 30 +-
test/pageropt.test | 5 +
test/parser1.test | 23 +
test/permutations.test | 58 +-
test/pragma.test | 145 +-
test/pragma3.test | 3 +-
test/quota.test | 2 +
test/regexp2.test | 125 +
test/releasetest.tcl | 169 +-
test/rowvalue.test | 296 ++
test/rowvalue2.test | 279 +
test/rowvalue3.test | 220 +
test/rowvalue4.test | 313 ++
test/rowvalue5.test | 115 +
test/rowvalue6.test | 36 +
test/rowvalue7.test | 58 +
test/rowvalue8.test | 59 +
test/rowvalue9.test | 302 ++
test/rowvaluefault.test | 72 +
test/savepoint7.test | 34 +
test/select4.test | 73 +-
test/select7.test | 12 +-
test/selectA.test | 9 +
test/session.test | 22 +
test/shell1.test | 104 +-
test/shell2.test | 12 +-
test/shell3.test | 22 +-
test/shell4.test | 31 +-
test/shell5.test | 10 +-
test/skipscan1.test | 31 +-
test/snapshot.test | 99 +
test/snapshot_fault.test | 2 +-
test/sort5.test | 74 +
test/speed3.test | 8 +-
test/speedtest1.c | 98 +-
test/spellfix3.test | 11 +-
test/sqldiff1.test | 12 +-
test/stat.test | 22 +-
test/stmt.test | 10 +-
test/subselect.test | 2 +-
test/superlock.test | 25 +-
test/sync.test | 2 +
test/tabfunc01.test | 73 +
test/tclsqlite.test | 40 +-
test/tempdb.test | 2 +-
test/tempdb2.test | 77 +
test/tempfault.test | 134 +
test/temptable2.test | 357 ++
test/temptable3.test | 41 +
test/tester.tcl | 155 +-
test/time-wordcount.sh | 34 +
test/tkt-2d1a5c67d.test | 3 +-
test/tkt-313723c356.test | 2 +-
test/tkt-5d863f876e.test | 2 +-
test/tkt-9d68c883.test | 2 +
test/tkt4018.test | 1 +
test/trace3.test | 233 +
test/types2.test | 2 +-
test/unixexcl.test | 1 +
test/vacuum5.test | 153 +
test/vacuummem.test | 73 +
test/view.test | 20 +
test/vtab6.test | 4 +-
test/vtabF.test | 4 +-
test/vtabH.test | 28 +-
test/wal.test | 2 +
test/wal2.test | 5 +-
test/wal3.test | 1 +
test/wal5.test | 7 +-
test/wal8.test | 1 +
test/walbak.test | 2 +
test/walcrash4.test | 85 +
test/walprotocol.test | 2 +-
test/walro.test | 2 +-
test/where.test | 11 +-
test/where2.test | 11 +
test/where3.test | 4 +-
test/whereD.test | 77 +
test/win32nolock.test | 126 +
test/wordcount.c | 54 +-
test/zerodamage.test | 3 +-
tool/GetTclKit.bat | 10 +-
tool/Replace.cs | 223 +
tool/addopcodes.tcl | 3 +
tool/build-all-msvc.bat | 133 +-
tool/dbhash.c | 506 ++
tool/fuzzershell.c | 321 ++
tool/lemon.c | 386 +-
tool/lempar.c | 318 +-
tool/libvers.c | 15 +
tool/logest.c | 2 +-
tool/mkautoconfamal.sh | 1 +
tool/mkmsvcmin.tcl | 18 +-
tool/mkopcodeh.tcl | 35 +-
tool/mksqlite3c-noext.tcl | 59 +-
tool/mksqlite3c.tcl | 34 +-
tool/mksqlite3h.tcl | 44 +-
tool/mkvsix.tcl | 4 +-
tool/opcodesum.tcl | 34 +
tool/replace.tcl | 5 +-
tool/run-speed-test.sh | 36 +-
tool/showdb.c | 4 +-
tool/spaceanal.tcl | 78 +-
tool/speed-check.sh | 122 +
tool/sqldiff.c | 193 +-
tool/srcck1.c | 2 +-
tool/symbols.sh | 2 +-
tool/warnings.sh | 23 +-
vsixtest/App.xaml | 8 +
vsixtest/App.xaml.cpp | 120 +
vsixtest/App.xaml.h | 27 +
vsixtest/Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes
vsixtest/Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes
.../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes
vsixtest/Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes
...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes
vsixtest/Assets/StoreLogo.png | Bin 0 -> 1451 bytes
vsixtest/Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes
vsixtest/MainPage.xaml | 13 +
vsixtest/MainPage.xaml.cpp | 53 +
vsixtest/MainPage.xaml.h | 22 +
vsixtest/Package.appxmanifest | 49 +
vsixtest/pch.cpp | 6 +
vsixtest/pch.h | 11 +
vsixtest/vsixtest.sln | 39 +
vsixtest/vsixtest.tcl | 373 ++
vsixtest/vsixtest.vcxproj.data | 198 +
vsixtest/vsixtest.vcxproj.filters | 57 +
vsixtest/vsixtest_TemporaryKey.pfx | Bin 0 -> 2520 bytes
469 files changed, 45135 insertions(+), 8295 deletions(-)
create mode 100644 ext/fts5/test/fts5colset.test
create mode 100644 ext/fts5/test/fts5determin.test
create mode 100644 ext/fts5/test/fts5faultB.test
create mode 100644 ext/fts5/test/fts5fuzz1.test
create mode 100644 ext/fts5/test/fts5multiclient.test
create mode 100644 ext/misc/carray.c
create mode 100644 ext/misc/csv.c
create mode 100644 ext/misc/memvfs.c
create mode 100644 ext/misc/scrub.c
create mode 100644 ext/misc/vfsstat.c
create mode 100644 ext/rbu/rbuC.test
create mode 100644 ext/rbu/rbudor.test
create mode 100644 ext/rbu/rbufault3.test
create mode 100644 ext/rbu/rbuprogress.test
create mode 100644 ext/rbu/rbuvacuum.test
create mode 100644 ext/rbu/rbuvacuum2.test
create mode 100644 ext/rtree/rtreeG.test
create mode 100644 ext/session/changeset.c
create mode 100644 ext/session/session1.test
create mode 100644 ext/session/session2.test
create mode 100644 ext/session/session3.test
create mode 100644 ext/session/session4.test
create mode 100644 ext/session/session5.test
create mode 100644 ext/session/session6.test
create mode 100644 ext/session/session8.test
create mode 100644 ext/session/session9.test
create mode 100644 ext/session/sessionA.test
create mode 100644 ext/session/sessionB.test
create mode 100644 ext/session/sessionC.test
create mode 100644 ext/session/sessionD.test
create mode 100644 ext/session/sessionE.test
create mode 100644 ext/session/sessionF.test
create mode 100644 ext/session/sessionG.test
create mode 100644 ext/session/session_common.tcl
create mode 100644 ext/session/sessionfault.test
create mode 100644 ext/session/sessionfault2.test
create mode 100644 ext/session/sqlite3session.c
create mode 100644 ext/session/sqlite3session.h
create mode 100644 ext/session/test_session.c
create mode 100644 src/in-operator.md
delete mode 100644 src/journal.c
create mode 100644 src/test_bestindex.c
create mode 100644 src/test_delete.c
create mode 100644 test/bestindex1.test
create mode 100644 test/bestindex2.test
create mode 100644 test/bestindex3.test
create mode 100644 test/collateB.test
create mode 100644 test/csv01.test
create mode 100644 test/cursorhint2.test
create mode 100644 test/delete_db.test
create mode 100644 test/fts4opt.test
create mode 100644 test/index8.test
create mode 100644 test/instrfault.test
create mode 100644 test/limit2.test
create mode 100644 test/regexp2.test
mode change 100644 => 100755 test/releasetest.tcl
create mode 100644 test/rowvalue.test
create mode 100644 test/rowvalue2.test
create mode 100644 test/rowvalue3.test
create mode 100644 test/rowvalue4.test
create mode 100644 test/rowvalue5.test
create mode 100644 test/rowvalue6.test
create mode 100644 test/rowvalue7.test
create mode 100644 test/rowvalue8.test
create mode 100644 test/rowvalue9.test
create mode 100644 test/rowvaluefault.test
create mode 100644 test/session.test
create mode 100644 test/tempdb2.test
create mode 100644 test/tempfault.test
create mode 100644 test/temptable2.test
create mode 100644 test/temptable3.test
create mode 100644 test/time-wordcount.sh
create mode 100644 test/trace3.test
create mode 100644 test/vacuum5.test
create mode 100644 test/vacuummem.test
create mode 100644 test/walcrash4.test
create mode 100644 test/win32nolock.test
create mode 100644 tool/Replace.cs
create mode 100644 tool/dbhash.c
create mode 100644 tool/libvers.c
create mode 100644 tool/opcodesum.tcl
create mode 100644 tool/speed-check.sh
create mode 100644 vsixtest/App.xaml
create mode 100644 vsixtest/App.xaml.cpp
create mode 100644 vsixtest/App.xaml.h
create mode 100644 vsixtest/Assets/LockScreenLogo.scale-200.png
create mode 100644 vsixtest/Assets/SplashScreen.scale-200.png
create mode 100644 vsixtest/Assets/Square150x150Logo.scale-200.png
create mode 100644 vsixtest/Assets/Square44x44Logo.scale-200.png
create mode 100644 vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
create mode 100644 vsixtest/Assets/StoreLogo.png
create mode 100644 vsixtest/Assets/Wide310x150Logo.scale-200.png
create mode 100644 vsixtest/MainPage.xaml
create mode 100644 vsixtest/MainPage.xaml.cpp
create mode 100644 vsixtest/MainPage.xaml.h
create mode 100644 vsixtest/Package.appxmanifest
create mode 100644 vsixtest/pch.cpp
create mode 100644 vsixtest/pch.h
create mode 100644 vsixtest/vsixtest.sln
create mode 100644 vsixtest/vsixtest.tcl
create mode 100644 vsixtest/vsixtest.vcxproj.data
create mode 100644 vsixtest/vsixtest.vcxproj.filters
create mode 100644 vsixtest/vsixtest_TemporaryKey.pfx
diff --git a/Makefile.in b/Makefile.in
index 013cf442..bb1f14b6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -30,7 +30,8 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@
#
CC = @CC@
CFLAGS = @CPPFLAGS@ @CFLAGS@
-TCC = $(CC) $(CFLAGS) -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/fts3
+TCC = ${CC} ${CFLAGS} -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/icu
+TCC += -I${TOP}/ext/fts3 -I${TOP}/ext/async -I${TOP}/ext/session
# Define this for the autoconf-based build, so that the code knows it can
# include the generated config.h
@@ -173,13 +174,14 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
fts5.lo \
func.lo global.lo hash.lo \
- icu.lo insert.lo journal.lo json1.lo legacy.lo loadext.lo \
+ icu.lo insert.lo json1.lo legacy.lo loadext.lo \
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
memjournal.lo \
mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
- random.lo resolve.lo rowset.lo rtree.lo select.lo sqlite3rbu.lo status.lo \
+ random.lo resolve.lo rowset.lo rtree.lo \
+ sqlite3session.lo select.lo sqlite3rbu.lo status.lo \
table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
update.lo util.lo vacuum.lo \
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
@@ -224,7 +226,6 @@ SRC = \
$(TOP)/src/hash.h \
$(TOP)/src/hwtime.h \
$(TOP)/src/insert.c \
- $(TOP)/src/journal.c \
$(TOP)/src/legacy.c \
$(TOP)/src/loadext.c \
$(TOP)/src/main.c \
@@ -342,14 +343,15 @@ SRC += \
SRC += \
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/rtree.c
+SRC += \
+ $(TOP)/ext/session/sqlite3session.c \
+ $(TOP)/ext/session/sqlite3session.h
SRC += \
$(TOP)/ext/rbu/sqlite3rbu.h \
$(TOP)/ext/rbu/sqlite3rbu.c
SRC += \
$(TOP)/ext/misc/json1.c
-
-
# Generated source code files
#
SRC += \
@@ -376,9 +378,11 @@ TESTSRC = \
$(TOP)/src/test_autoext.c \
$(TOP)/src/test_async.c \
$(TOP)/src/test_backup.c \
+ $(TOP)/src/test_bestindex.c \
$(TOP)/src/test_blob.c \
$(TOP)/src/test_btree.c \
$(TOP)/src/test_config.c \
+ $(TOP)/src/test_delete.c \
$(TOP)/src/test_demovfs.c \
$(TOP)/src/test_devsym.c \
$(TOP)/src/test_fs.c \
@@ -405,14 +409,17 @@ TESTSRC = \
$(TOP)/src/test_windirent.c \
$(TOP)/src/test_wsd.c \
$(TOP)/ext/fts3/fts3_term.c \
- $(TOP)/ext/fts3/fts3_test.c \
+ $(TOP)/ext/fts3/fts3_test.c \
+ $(TOP)/ext/session/test_session.c \
$(TOP)/ext/rbu/test_rbu.c
# Statically linked extensions
#
TESTSRC += \
$(TOP)/ext/misc/amatch.c \
+ $(TOP)/ext/misc/carray.c \
$(TOP)/ext/misc/closure.c \
+ $(TOP)/ext/misc/csv.c \
$(TOP)/ext/misc/eval.c \
$(TOP)/ext/misc/fileio.c \
$(TOP)/ext/misc/fuzzer.c \
@@ -474,7 +481,8 @@ TESTSRC2 = \
$(TOP)/ext/fts3/fts3_term.c \
$(TOP)/ext/fts3/fts3_tokenizer.c \
$(TOP)/ext/fts3/fts3_write.c \
- $(TOP)/ext/async/sqlite3async.c
+ $(TOP)/ext/async/sqlite3async.c \
+ $(TOP)/ext/session/sqlite3session.c
# Header files used by all library source files.
#
@@ -533,7 +541,8 @@ TESTPROGS = \
testfixture$(TEXE) \
sqlite3$(TEXE) \
sqlite3_analyzer$(TEXE) \
- sqldiff$(TEXE)
+ sqldiff$(TEXE) \
+ dbhash$(TEXE)
# Databases containing fuzzer test cases
#
@@ -550,7 +559,9 @@ TESTOPTS = --verbose=file --output=test-out.txt
# Extra compiler options for various shell tools
#
SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4
+# SHELL_OPT += -DSQLITE_ENABLE_FTS5
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
+SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5
@@ -581,8 +592,15 @@ sqlite3$(TEXE): $(TOP)/src/shell.c sqlite3.c
$(TOP)/src/shell.c sqlite3.c \
$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
-sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS)
+sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
+ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
+
+dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h
+ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS)
+
+scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo
+ $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \
+ $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS)
srcck1$(BEXE): $(TOP)/tool/srcck1.c
$(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c
@@ -597,8 +615,8 @@ fuzzershell$(TEXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
fuzzcheck$(TEXE): $(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS)
-mptester$(TEXE): sqlite3.c $(TOP)/mptest/mptest.c
- $(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
+mptester$(TEXE): sqlite3.lo $(TOP)/mptest/mptest.c
+ $(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.lo \
$(TLIBS) -rpath "$(libdir)"
MPTEST1=./mptester$(TEXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
@@ -634,6 +652,7 @@ mptest: mptester$(TEXE)
sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl
cp tsrc/shell.c tsrc/sqlite3ext.h .
+ cp $(TOP)/ext/session/sqlite3session.h .
sqlite3ext.h: .target_source
cp tsrc/sqlite3ext.h .
@@ -738,9 +757,6 @@ hash.lo: $(TOP)/src/hash.c $(HDR)
insert.lo: $(TOP)/src/insert.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c
-journal.lo: $(TOP)/src/journal.c $(HDR)
- $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/journal.c
-
legacy.lo: $(TOP)/src/legacy.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c
@@ -1000,6 +1016,9 @@ fts3_write.lo: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
rtree.lo: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
+sqlite3session.lo: $(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
+ $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
+
json1.lo: $(TOP)/ext/misc/json1.c
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
@@ -1025,7 +1044,7 @@ FTS5_SRC = \
fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon
cp $(TOP)/ext/fts5/fts5parse.y .
rm -f fts5parse.h
- ./lemon $(OPTS) fts5parse.y
+ ./lemon$(BEXE) $(OPTS) fts5parse.y
fts5parse.h: fts5parse.c
@@ -1050,6 +1069,8 @@ sqlite3rbu.lo: $(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR)
TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
TESTFIXTURE_FLAGS += -DBUILD_sqlite
+TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
+TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
TESTFIXTURE_SRC1 = sqlite3.c
@@ -1130,14 +1151,17 @@ showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo
showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo
$(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS)
+changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo
+ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS)
+
rollback-test$(TEXE): $(TOP)/tool/rollback-test.c sqlite3.lo
$(LTLINK) -o $@ $(TOP)/tool/rollback-test.c sqlite3.lo $(TLIBS)
LogEst$(TEXE): $(TOP)/tool/logest.c sqlite3.h
$(LTLINK) -I. -o $@ $(TOP)/tool/logest.c
-wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.c
- $(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.c $(TLIBS)
+wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo
+ $(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.lo $(TLIBS)
speedtest1$(TEXE): $(TOP)/test/speedtest1.c sqlite3.lo
$(LTLINK) -o $@ $(TOP)/test/speedtest1.c sqlite3.lo $(TLIBS)
@@ -1152,8 +1176,9 @@ loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
# symbols that do not begin with "sqlite3_". It is run as part of the
# releasetest.tcl script.
#
+VALIDIDS=' sqlite3(changeset|changegroup|session)?_'
checksymbols: sqlite3.lo
- nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
+ nm -g --defined-only sqlite3.lo | egrep -v $(VALIDIDS); test $$? -ne 0
echo '0 errors out of 1 tests'
# Build the amalgamation-autoconf package. The amalamgation-tarball target builds
@@ -1216,13 +1241,12 @@ clean:
rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
rm -f mkkeywordhash$(BEXE) keywordhash.h
rm -f *.da *.bb *.bbg gmon.out
- rm -rf quota2a quota2b quota2c
rm -rf tsrc .target_source
rm -f tclsqlite3$(TEXE)
rm -f testfixture$(TEXE) test.db
rm -f LogEst$(TEXE) fts3view$(TEXE) rollback-test$(TEXE) showdb$(TEXE)
rm -f showjournal$(TEXE) showstat4$(TEXE) showwal$(TEXE) speedtest1$(TEXE)
- rm -f wordcount$(TEXE)
+ rm -f wordcount$(TEXE) changeset$(TEXE)
rm -f sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
rm -f sqlite3.c
rm -f sqlite3rc.h
@@ -1235,6 +1259,7 @@ clean:
rm -f fuzzershell fuzzershell.exe
rm -f fuzzcheck fuzzcheck.exe
rm -f sqldiff sqldiff.exe
+ rm -f dbhash dbhash.exe
rm -f fts5.* fts5parse.*
distclean: clean
diff --git a/Makefile.msc b/Makefile.msc
index 843f9a25..0d42d41a 100644
--- a/Makefile.msc
+++ b/Makefile.msc
@@ -24,6 +24,20 @@ USE_AMALGAMATION = 1
USE_FULLWARN = 0
!ENDIF
+# Set this non-0 to enable full runtime error checks (-RTC1, etc). This
+# has no effect if (any) optimizations are enabled.
+#
+!IFNDEF USE_RUNTIME_CHECKS
+USE_RUNTIME_CHECKS = 0
+!ENDIF
+
+# Set this non-0 to create a SQLite amalgamation file that excludes the
+# various built-in extensions.
+#
+!IFNDEF MINIMAL_AMALGAMATION
+MINIMAL_AMALGAMATION = 0
+!ENDIF
+
# Set this non-0 to use "stdcall" calling convention for the core library
# and shell executable.
#
@@ -198,6 +212,12 @@ DEBUG = 0
OPTIMIZATIONS = 2
!ENDIF
+# Set this to non-0 to enable support for the session extension.
+#
+!IFNDEF SESSION
+SESSION = 0
+!ENDIF
+
# Set the source code file to be used by executables and libraries when
# they need the amalgamation.
#
@@ -219,37 +239,88 @@ SQLITE3H = sqlite3.h
# This is the name to use for the SQLite dynamic link library (DLL).
#
!IFNDEF SQLITE3DLL
+!IF $(FOR_WIN10)!=0
+SQLITE3DLL = winsqlite3.dll
+!ELSE
SQLITE3DLL = sqlite3.dll
!ENDIF
+!ENDIF
# This is the name to use for the SQLite import library (LIB).
#
!IFNDEF SQLITE3LIB
+!IF $(FOR_WIN10)!=0
+SQLITE3LIB = winsqlite3.lib
+!ELSE
SQLITE3LIB = sqlite3.lib
!ENDIF
+!ENDIF
# This is the name to use for the SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXE
+!IF $(FOR_WIN10)!=0
+SQLITE3EXE = winsqlite3shell.exe
+!ELSE
SQLITE3EXE = sqlite3.exe
!ENDIF
+!ENDIF
# This is the argument used to set the program database (PDB) file for the
# SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXEPDB
+!IF $(FOR_WIN10)!=0
+SQLITE3EXEPDB =
+!ELSE
SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
!ENDIF
+!ENDIF
+
+# <>
+# These are the names of the customized Tcl header files used by various parts
+# of this makefile when the stdcall calling convention is in use. It is not
+# used for any other purpose.
+#
+!IFNDEF SQLITETCLH
+SQLITETCLH = sqlite_tcl.h
+!ENDIF
+
+!IFNDEF SQLITETCLDECLSH
+SQLITETCLDECLSH = sqlite_tclDecls.h
+!ENDIF
+
+# These are the additional targets that the targets that integrate with the
+# Tcl library should depend on when compiling, etc.
+#
+!IFNDEF SQLITE_TCL_DEP
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+SQLITE_TCL_DEP = $(SQLITETCLDECLSH) $(SQLITETCLH)
+!ELSE
+SQLITE_TCL_DEP =
+!ENDIF
+!ENDIF
+# <>
# These are the "standard" SQLite compilation options used when compiling for
# the Windows platform.
#
!IFNDEF OPT_FEATURE_FLAGS
+!IF $(MINIMAL_AMALGAMATION)==0
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
+!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
!ENDIF
+# Should the session extension be enabled? If so, add compilation options
+# to enable it.
+#
+!IF $(SESSION)!=0
+OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
+OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
+!ENDIF
+
# These are the "extended" SQLite compilation options used when compiling for
# the Windows 10 platform.
#
@@ -290,6 +361,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
CC = cl.exe
!ENDIF
+# Check for the predefined command macro CSC. This should point to a working
+# C Sharp compiler binary. If it is not defined, simply define it to the
+# legacy default value 'csc.exe'.
+#
+!IFNDEF CSC
+CSC = csc.exe
+!ENDIF
+
# Check for the command macro LD. This should point to the linker binary for
# the target platform. If it is not defined, simply define it to the legacy
# default value 'link.exe'.
@@ -417,15 +496,6 @@ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
-# Adjust the names of the primary targets for use with Windows 10.
-#
-!IF $(FOR_WIN10)!=0
-SQLITE3DLL = winsqlite3.dll
-SQLITE3LIB = winsqlite3.lib
-SQLITE3EXE = winsqlite3shell.exe
-SQLITE3EXEPDB =
-!ENDIF
-
# Check if we want to use the "stdcall" calling convention when compiling.
# This is not supported by the compilers for non-x86 platforms. It should
# also be noted here that building any target with these "stdcall" options
@@ -435,20 +505,32 @@ SQLITE3EXEPDB =
#
!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
!IF "$(PLATFORM)"=="x86"
-CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
-SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
+CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+# <>
+TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
+# <>
!ELSE
!IFNDEF PLATFORM
-CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
-SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
+CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+# <>
+TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
+# <>
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
+# <>
+TEST_CCONV_OPTS =
+# <>
!ENDIF
!ENDIF
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
+# <>
+TEST_CCONV_OPTS =
+# <>
!ENDIF
# These are additional compiler options used for the core library.
@@ -465,20 +547,24 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
# when linking.
#
!IFNDEF CORE_LINK_DEP
-!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
+!IF $(DYNAMIC_SHELL)!=0
CORE_LINK_DEP =
-!ELSE
+!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
CORE_LINK_DEP = sqlite3.def
+!ELSE
+CORE_LINK_DEP =
!ENDIF
!ENDIF
# These are additional linker options used for the core library.
#
!IFNDEF CORE_LINK_OPTS
-!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
+!IF $(DYNAMIC_SHELL)!=0
CORE_LINK_OPTS =
-!ELSE
+!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
CORE_LINK_OPTS = /DEF:sqlite3.def
+!ELSE
+CORE_LINK_OPTS =
!ENDIF
!ENDIF
@@ -588,6 +674,8 @@ TCC = $(TCC) -I$(TOP)\ext\fts3
RCC = $(RCC) -I$(TOP)\ext\fts3
TCC = $(TCC) -I$(TOP)\ext\rtree
RCC = $(RCC) -I$(TOP)\ext\rtree
+TCC = $(TCC) -I$(TOP)\ext\session
+RCC = $(RCC) -I$(TOP)\ext\session
!ENDIF
# The mksqlite3c.tcl script accepts some options on the command
@@ -595,12 +683,35 @@ RCC = $(RCC) -I$(TOP)\ext\rtree
# options are necessary in order to allow debugging symbols to
# work correctly with Visual Studio when using the amalgamation.
#
+!IFNDEF MKSQLITE3C_TOOL
+!IF $(MINIMAL_AMALGAMATION)!=0
+MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c-noext.tcl
+!ELSE
+MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c.tcl
+!ENDIF
+!ENDIF
+
!IFNDEF MKSQLITE3C_ARGS
!IF $(DEBUG)>1
MKSQLITE3C_ARGS = --linemacros
!ELSE
MKSQLITE3C_ARGS =
!ENDIF
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+MKSQLITE3C_ARGS = $(MKSQLITE3C_ARGS) --useapicall
+!ENDIF
+!ENDIF
+
+# The mksqlite3h.tcl script accepts some options on the command line.
+# When compiling with stdcall support, some of these options are
+# necessary.
+#
+!IFNDEF MKSQLITE3H_ARGS
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+MKSQLITE3H_ARGS = --useapicall
+!ELSE
+MKSQLITE3H_ARGS =
+!ENDIF
!ENDIF
# <>
@@ -683,11 +794,11 @@ TCLLIBDIR = c:\tcl\lib
!ENDIF
!IFNDEF LIBTCL
-LIBTCL = tcl85.lib
+LIBTCL = tcl86.lib
!ENDIF
!IFNDEF LIBTCLSTUB
-LIBTCLSTUB = tclstub85.lib
+LIBTCLSTUB = tclstub86.lib
!ENDIF
!IFNDEF LIBTCLPATH
@@ -717,7 +828,7 @@ LIBICU = icuuc.lib icuin.lib
# specific Tcl shell to use.
#
!IFNDEF TCLSH_CMD
-TCLSH_CMD = tclsh85
+TCLSH_CMD = tclsh
!ENDIF
# <>
@@ -800,6 +911,10 @@ RCC = $(RCC) -D_DEBUG
!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
TCC = $(TCC) -Od
BCC = $(BCC) -Od
+!IF $(USE_RUNTIME_CHECKS)!=0
+TCC = $(TCC) -RTC1
+BCC = $(BCC) -RTC1
+!ENDIF
!ELSEIF $(OPTIMIZATIONS)>=3
TCC = $(TCC) -Ox
BCC = $(BCC) -Ox
@@ -966,13 +1081,14 @@ LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
fts3_tokenize_vtab.lo fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
fts5.lo \
func.lo global.lo hash.lo \
- icu.lo insert.lo journal.lo legacy.lo loadext.lo \
+ icu.lo insert.lo legacy.lo loadext.lo \
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
memjournal.lo \
mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
pager.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
- random.lo resolve.lo rowset.lo rtree.lo select.lo sqlite3rbu.lo status.lo \
+ random.lo resolve.lo rowset.lo rtree.lo \
+ sqlite3session.lo select.lo sqlite3rbu.lo status.lo \
table.lo threads.lo tokenize.lo treeview.lo trigger.lo \
update.lo util.lo vacuum.lo \
vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbesort.lo \
@@ -1030,7 +1146,6 @@ SRC00 = \
$(TOP)\src\global.c \
$(TOP)\src\hash.c \
$(TOP)\src\insert.c \
- $(TOP)\src\journal.c \
$(TOP)\src\legacy.c \
$(TOP)\src\loadext.c \
$(TOP)\src\main.c \
@@ -1160,6 +1275,7 @@ SRC07 = \
$(TOP)\ext\fts3\fts3_write.c \
$(TOP)\ext\icu\icu.c \
$(TOP)\ext\rtree\rtree.c \
+ $(TOP)\ext\session\sqlite3session.c \
$(TOP)\ext\rbu\sqlite3rbu.c \
$(TOP)\ext\misc\json1.c
@@ -1182,7 +1298,8 @@ SRC09 = \
$(TOP)\ext\fts3\fts3_tokenizer.h \
$(TOP)\ext\icu\sqliteicu.h \
$(TOP)\ext\rtree\rtree.h \
- $(TOP)\ext\rbu\sqlite3rbu.h
+ $(TOP)\ext\rbu\sqlite3rbu.h \
+ $(TOP)\ext\session\sqlite3session.h
# Generated source code files
#
@@ -1198,6 +1315,16 @@ SRC11 = \
parse.h \
$(SQLITE3H)
+# Generated Tcl header files
+#
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+SRC12 = \
+ $(SQLITETCLH) \
+ $(SQLITETCLDECLSH)
+!ELSE
+SRC12 =
+!ENDIF
+
# All source code files.
#
SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11)
@@ -1217,9 +1344,11 @@ TESTSRC = \
$(TOP)\src\test_autoext.c \
$(TOP)\src\test_async.c \
$(TOP)\src\test_backup.c \
+ $(TOP)\src\test_bestindex.c \
$(TOP)\src\test_blob.c \
$(TOP)\src\test_btree.c \
$(TOP)\src\test_config.c \
+ $(TOP)\src\test_delete.c \
$(TOP)\src\test_demovfs.c \
$(TOP)\src\test_devsym.c \
$(TOP)\src\test_fs.c \
@@ -1247,13 +1376,16 @@ TESTSRC = \
$(TOP)\src\test_wsd.c \
$(TOP)\ext\fts3\fts3_term.c \
$(TOP)\ext\fts3\fts3_test.c \
- $(TOP)\ext\rbu\test_rbu.c
+ $(TOP)\ext\rbu\test_rbu.c \
+ $(TOP)\ext\session\test_session.c
# Statically linked extensions.
#
TESTEXT = \
$(TOP)\ext\misc\amatch.c \
+ $(TOP)\ext\misc\carray.c \
$(TOP)\ext\misc\closure.c \
+ $(TOP)\ext\misc\csv.c \
$(TOP)\ext\misc\eval.c \
$(TOP)\ext\misc\fileio.c \
$(TOP)\ext\misc\fuzzer.c \
@@ -1270,6 +1402,7 @@ TESTEXT = \
$(TOP)\ext\misc\wholenumber.c
# Source code to the library files needed by the test fixture
+# (non-amalgamation)
#
TESTSRC2 = \
$(SRC00) \
@@ -1299,7 +1432,7 @@ HDR = \
parse.h \
$(TOP)\src\pragma.h \
$(SQLITE3H) \
- $(TOP)\src\sqlite3ext.h \
+ sqlite3ext.h \
$(TOP)\src\sqliteInt.h \
$(TOP)\src\sqliteLimit.h \
$(TOP)\src\vdbe.h \
@@ -1328,6 +1461,8 @@ EXTHDR = $(EXTHDR) \
$(TOP)\ext\icu\sqliteicu.h
EXTHDR = $(EXTHDR) \
$(TOP)\ext\rtree\sqlite3rtree.h
+EXTHDR = $(EXTHDR) \
+ $(TOP)\ext\session\sqlite3session.h
# executables needed for testing
#
@@ -1335,7 +1470,8 @@ TESTPROGS = \
testfixture.exe \
$(SQLITE3EXE) \
sqlite3_analyzer.exe \
- sqldiff.exe
+ sqldiff.exe \
+ dbhash.exe
# Databases containing fuzzer test cases
#
@@ -1380,30 +1516,30 @@ all: dll libsqlite3.lib shell $(ALL_TCL_TARGETS)
# Dynamic link library section.
#
-dll: $(SQLITE3DLL)
+dll: $(SQLITE3DLL)
# Shell executable.
#
-shell: $(SQLITE3EXE)
+shell: $(SQLITE3EXE)
+# <>
libsqlite3.lib: $(LIBOBJ)
$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
-# <>
libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
# <>
-$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
+$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
-# <>
-sqlite3.def: libsqlite3.lib
+# <>
+sqlite3.def: libsqlite3.lib
echo EXPORTS > sqlite3.def
dumpbin /all libsqlite3.lib \
- | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" \1 \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \
| sort >> sqlite3.def
-# <>
+# <>
$(SQLITE3EXE): $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(SHELL_CORE_SRC) \
@@ -1413,6 +1549,12 @@ $(SQLITE3EXE): $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_S
sqldiff.exe: $(TOP)\tool\sqldiff.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+dbhash.exe: $(TOP)\tool\dbhash.c $(SQLITE3C) $(SQLITE3H)
+ $(LTLINK) $(NO_WARN) $(TOP)\tool\dbhash.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+
+scrub.exe: $(TOP)\ext\misc\scrub.c $(SQLITE3C) $(SQLITE3H)
+ $(LTLINK) $(NO_WARN) $(TOP)\ext\misc\scrub.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+
srcck1.exe: $(TOP)\tool\srcck1.c
$(BCC) $(NO_WARN) -Fe$@ $(TOP)\tool\srcck1.c
@@ -1448,7 +1590,7 @@ mptest: mptester.exe
# files are automatically generated. This target takes care of
# all that automatic generation.
#
-.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c
+.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c $(SQLITE_TCL_DEP)
-rmdir /Q/S tsrc 2>NUL
-mkdir tsrc
for %i in ($(SRC00)) do copy /Y %i tsrc
@@ -1463,6 +1605,7 @@ mptest: mptester.exe
for %i in ($(SRC09)) do copy /Y %i tsrc
for %i in ($(SRC10)) do copy /Y %i tsrc
for %i in ($(SRC11)) do copy /Y %i tsrc
+ for %i in ($(SRC12)) do copy /Y %i tsrc
copy /Y fts5.c tsrc
copy /Y fts5.h tsrc
del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
@@ -1470,9 +1613,10 @@ mptest: mptester.exe
move vdbe.new tsrc\vdbe.c
echo > .target_source
-sqlite3.c: .target_source sqlite3ext.h $(TOP)\tool\mksqlite3c.tcl
- $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS)
+sqlite3.c: .target_source sqlite3ext.h $(MKSQLITE3C_TOOL)
+ $(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS)
copy tsrc\shell.c .
+ copy $(TOP)\ext\session\sqlite3session.h .
sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl
$(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl
@@ -1590,9 +1734,6 @@ hash.lo: $(TOP)\src\hash.c $(HDR)
insert.lo: $(TOP)\src\insert.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
-journal.lo: $(TOP)\src\journal.c $(HDR)
- $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\journal.c
-
legacy.lo: $(TOP)\src\legacy.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
@@ -1746,10 +1887,10 @@ wherecode.lo: $(TOP)\src\wherecode.c $(HDR)
whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c
-tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
+tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
-tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR)
+tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
@@ -1775,10 +1916,16 @@ parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl
$(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h
$(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
- $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H)
+ $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) $(MKSQLITE3H_ARGS)
-sqlite3ext.h: .target_source
- copy tsrc\sqlite3ext.h .
+sqlite3ext.h: .target_source
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+ type tsrc\sqlite3ext.h | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*\)" "(SQLITE_CALLBACK *)" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_APICALL *" > sqlite3ext.h
+ copy /Y sqlite3ext.h tsrc\sqlite3ext.h
+!ELSE
+ copy /Y tsrc\sqlite3ext.h sqlite3ext.h
+!ENDIF
mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c
$(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) \
@@ -1854,6 +2001,9 @@ fts3_write.lo: $(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
rtree.lo: $(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
+sqlite3session.lo: $(TOP)\ext\session\sqlite3session.c $(HDR) $(EXTHDR)
+ $(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\session\sqlite3session.c
+
# FTS5 things
#
FTS5_SRC = \
@@ -1878,9 +2028,9 @@ fts5parse.c: $(TOP)\ext\fts5\fts5parse.y lemon.exe
del /Q fts5parse.h 2>NUL
.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) fts5parse.y
-fts5parse.h: fts5parse.c
+fts5parse.h: fts5parse.c
-fts5.c: $(FTS5_SRC)
+fts5.c: $(FTS5_SRC)
$(TCLSH_CMD) $(TOP)\ext\fts5\tool\mkfts5c.tcl
copy $(TOP)\ext\fts5\fts5.h .
@@ -1906,6 +2056,9 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR)
TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
+TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
+TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
+TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
@@ -1915,13 +2068,33 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
!ENDIF
-testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR)
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+sqlite_tclDecls.h:
+ echo #ifndef SQLITE_TCLAPI > $(SQLITETCLDECLSH)
+ echo # define SQLITE_TCLAPI >> $(SQLITETCLDECLSH)
+ echo #endif >> $(SQLITETCLDECLSH)
+ type "$(TCLINCDIR)\tclDecls.h" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN(?: CONST\d+?)?\s+?[^\(]*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tcl_" "(SQLITE_TCLAPI *tcl_" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tclFreeObj" "(SQLITE_TCLAPI *tclFreeObj" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> $(SQLITETCLDECLSH)
+
+sqlite_tcl.h:
+ type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "typedef (.*?)\(Tcl_" "typedef \1 (SQLITE_TCLAPI Tcl_" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "void (*freeProc)" "void (SQLITE_TCLAPI *freeProc)" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*findProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *findProc)" \
+ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> $(SQLITETCLH)
+!ENDIF
+
+testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(SQLITE_TCL_DEP)
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
-DBUILD_sqlite -I$(TCLINCDIR) \
$(TESTFIXTURE_SRC) \
/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
-extensiontest: testfixture.exe testloadext.dll
+extensiontest: testfixture.exe testloadext.dll
@set PATH=$(LIBTCLPATH);$(PATH)
.\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS)
@@ -1964,7 +2137,7 @@ smoketest: $(TESTPROGS)
@set PATH=$(LIBTCLPATH);$(PATH)
.\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)
-sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
+sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl $(SQLITE_TCL_DEP)
echo #define TCLSH 2 > $@
echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
@@ -1980,7 +2153,7 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
testloadext.lo: $(TOP)\src\test_loadext.c
$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
-testloadext.dll: testloadext.lo
+testloadext.dll: testloadext.lo
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(SQLITE3H)
@@ -1999,6 +2172,10 @@ showwal.exe: $(TOP)\tool\showwal.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\showwal.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+changeset.exe: $(TOP)\ext\session\changeset.c $(SQLITE3C)
+ $(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
+ $(TOP)\ext\session\changeset.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+
fts3view.exe: $(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
@@ -2018,38 +2195,40 @@ speedtest1.exe: $(TOP)\test\speedtest1.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\test\speedtest1.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
-rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H)
+rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) -DSQLITE_ENABLE_RBU -Fe$@ \
$(TOP)\ext\rbu\rbu.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+
+moreclean: clean
+ del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
# <>
clean:
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
- del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
+ del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
+ del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
# <>
- del /Q $(SQLITE3C) $(SQLITE3H) opcodes.c opcodes.h 2>NUL
+ del /Q sqlite3.c sqlite3.h 2>NUL
+ del /Q opcodes.c opcodes.h 2>NUL
del /Q lemon.* lempar.c parse.* 2>NUL
del /Q mkkeywordhash.* keywordhash.h 2>NUL
del /Q notasharedlib.* 2>NUL
-rmdir /Q/S .deps 2>NUL
-rmdir /Q/S .libs 2>NUL
- -rmdir /Q/S quota2a 2>NUL
- -rmdir /Q/S quota2b 2>NUL
- -rmdir /Q/S quota2c 2>NUL
-rmdir /Q/S tsrc 2>NUL
del /Q .target_source 2>NUL
- del /Q tclsqlite3.exe 2>NUL
+ del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL
del /Q testloadext.dll 2>NUL
del /Q testfixture.exe test.db 2>NUL
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
+ del /Q changeset.exe 2>NUL
del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL
- del /Q $(SQLITE3EXE) $(SQLITE3DLL) sqlite3.def 2>NUL
del /Q sqlite3.c sqlite3-*.c 2>NUL
del /Q sqlite3rc.h 2>NUL
- del /Q shell.c sqlite3ext.h 2>NUL
+ del /Q shell.c sqlite3ext.h sqlite3session.h 2>NUL
del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
del /Q sqlite-*-output.vsix 2>NUL
- del /Q fuzzershell.exe fuzzcheck.exe sqldiff.exe 2>NUL
+ del /Q fuzzershell.exe fuzzcheck.exe sqldiff.exe dbhash.exe 2>NUL
del /Q fts5.* fts5parse.* 2>NUL
# <>
diff --git a/VERSION b/VERSION
index afad8186..861845e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.11.0
+3.15.2
diff --git a/autoconf/Makefile.am b/autoconf/Makefile.am
index 0e09cfcd..e8211596 100644
--- a/autoconf/Makefile.am
+++ b/autoconf/Makefile.am
@@ -1,19 +1,20 @@
-AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ @FTS5_FLAGS@ @JSON1_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE
+AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ @FTS5_FLAGS@ @JSON1_FLAGS@ @SESSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE
lib_LTLIBRARIES = libsqlite3.la
libsqlite3_la_SOURCES = sqlite3.c
libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8
bin_PROGRAMS = sqlite3
-sqlite3_SOURCES = shell.c sqlite3.c sqlite3.h
-sqlite3_LDADD = @READLINE_LIBS@
+sqlite3_SOURCES = shell.c sqlite3.h
+EXTRA_sqlite3_SOURCES = sqlite3.c
+sqlite3_LDADD = @EXTRA_SHELL_OBJ@ @READLINE_LIBS@
sqlite3_DEPENDENCIES = @EXTRA_SHELL_OBJ@
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS
include_HEADERS = sqlite3.h sqlite3ext.h
-EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt
+EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt Replace.cs
pkgconfigdir = ${libdir}/pkgconfig
pkgconfig_DATA = sqlite3.pc
diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc
index 0be42b4e..b53e2370 100644
--- a/autoconf/Makefile.msc
+++ b/autoconf/Makefile.msc
@@ -24,6 +24,20 @@ TOP = .
USE_FULLWARN = 0
!ENDIF
+# Set this non-0 to enable full runtime error checks (-RTC1, etc). This
+# has no effect if (any) optimizations are enabled.
+#
+!IFNDEF USE_RUNTIME_CHECKS
+USE_RUNTIME_CHECKS = 0
+!ENDIF
+
+# Set this non-0 to create a SQLite amalgamation file that excludes the
+# various built-in extensions.
+#
+!IFNDEF MINIMAL_AMALGAMATION
+MINIMAL_AMALGAMATION = 0
+!ENDIF
+
# Set this non-0 to use "stdcall" calling convention for the core library
# and shell executable.
#
@@ -183,6 +197,12 @@ DEBUG = 0
OPTIMIZATIONS = 2
!ENDIF
+# Set this to non-0 to enable support for the session extension.
+#
+!IFNDEF SESSION
+SESSION = 0
+!ENDIF
+
# Set the source code file to be used by executables and libraries when
# they need the amalgamation.
#
@@ -204,37 +224,64 @@ SQLITE3H = sqlite3.h
# This is the name to use for the SQLite dynamic link library (DLL).
#
!IFNDEF SQLITE3DLL
+!IF $(FOR_WIN10)!=0
+SQLITE3DLL = winsqlite3.dll
+!ELSE
SQLITE3DLL = sqlite3.dll
!ENDIF
+!ENDIF
# This is the name to use for the SQLite import library (LIB).
#
!IFNDEF SQLITE3LIB
+!IF $(FOR_WIN10)!=0
+SQLITE3LIB = winsqlite3.lib
+!ELSE
SQLITE3LIB = sqlite3.lib
!ENDIF
+!ENDIF
# This is the name to use for the SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXE
+!IF $(FOR_WIN10)!=0
+SQLITE3EXE = winsqlite3shell.exe
+!ELSE
SQLITE3EXE = sqlite3.exe
!ENDIF
+!ENDIF
# This is the argument used to set the program database (PDB) file for the
# SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXEPDB
+!IF $(FOR_WIN10)!=0
+SQLITE3EXEPDB =
+!ELSE
SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
!ENDIF
+!ENDIF
+
# These are the "standard" SQLite compilation options used when compiling for
# the Windows platform.
#
!IFNDEF OPT_FEATURE_FLAGS
+!IF $(MINIMAL_AMALGAMATION)==0
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
+!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
!ENDIF
+# Should the session extension be enabled? If so, add compilation options
+# to enable it.
+#
+!IF $(SESSION)!=0
+OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
+OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
+!ENDIF
+
# These are the "extended" SQLite compilation options used when compiling for
# the Windows 10 platform.
#
@@ -275,6 +322,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
CC = cl.exe
!ENDIF
+# Check for the predefined command macro CSC. This should point to a working
+# C Sharp compiler binary. If it is not defined, simply define it to the
+# legacy default value 'csc.exe'.
+#
+!IFNDEF CSC
+CSC = csc.exe
+!ENDIF
+
# Check for the command macro LD. This should point to the linker binary for
# the target platform. If it is not defined, simply define it to the legacy
# default value 'link.exe'.
@@ -402,15 +457,6 @@ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
-# Adjust the names of the primary targets for use with Windows 10.
-#
-!IF $(FOR_WIN10)!=0
-SQLITE3DLL = winsqlite3.dll
-SQLITE3LIB = winsqlite3.lib
-SQLITE3EXE = winsqlite3shell.exe
-SQLITE3EXEPDB =
-!ENDIF
-
# Check if we want to use the "stdcall" calling convention when compiling.
# This is not supported by the compilers for non-x86 platforms. It should
# also be noted here that building any target with these "stdcall" options
@@ -420,12 +466,12 @@ SQLITE3EXEPDB =
#
!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
!IF "$(PLATFORM)"=="x86"
-CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
-SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
+CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
!ELSE
!IFNDEF PLATFORM
-CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
-SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
+CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
+SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
@@ -450,8 +496,10 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
# when linking.
#
!IFNDEF CORE_LINK_DEP
-!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
+!IF $(DYNAMIC_SHELL)!=0
CORE_LINK_DEP =
+!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
+CORE_LINK_DEP = sqlite3.def
!ELSE
CORE_LINK_DEP =
!ENDIF
@@ -460,8 +508,10 @@ CORE_LINK_DEP =
# These are additional linker options used for the core library.
#
!IFNDEF CORE_LINK_OPTS
-!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
+!IF $(DYNAMIC_SHELL)!=0
CORE_LINK_OPTS =
+!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
+CORE_LINK_OPTS = /DEF:sqlite3.def
!ELSE
CORE_LINK_OPTS =
!ENDIF
@@ -707,6 +757,10 @@ RCC = $(RCC) -D_DEBUG
!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
TCC = $(TCC) -Od
BCC = $(BCC) -Od
+!IF $(USE_RUNTIME_CHECKS)!=0
+TCC = $(TCC) -RTC1
+BCC = $(BCC) -RTC1
+!ENDIF
!ELSEIF $(OPTIMIZATIONS)>=3
TCC = $(TCC) -Ox
BCC = $(BCC) -Ox
@@ -863,23 +917,28 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
-all: dll libsqlite3.lib shell
+all: dll shell
# Dynamic link library section.
#
-dll: $(SQLITE3DLL)
+dll: $(SQLITE3DLL)
# Shell executable.
#
-shell: $(SQLITE3EXE)
-
-libsqlite3.lib: $(LIBOBJ)
- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
+shell: $(SQLITE3EXE)
-$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
+$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
+Replace.exe:
+ $(CSC) /target:exe $(TOP)\Replace.cs
+
+sqlite3.def: Replace.exe $(LIBOBJ)
+ echo EXPORTS > sqlite3.def
+ dumpbin /all $(LIBOBJ) \
+ | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
+ | sort >> sqlite3.def
$(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \
@@ -918,4 +977,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
clean:
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
- del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
+ del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
+ del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
diff --git a/autoconf/README.txt b/autoconf/README.txt
index 2d6db4f0..6e62a4e1 100644
--- a/autoconf/README.txt
+++ b/autoconf/README.txt
@@ -6,8 +6,8 @@ This package contains:
* the shell.c file used to build the sqlite3 command-line shell program
* autoconf/automake installation infrastucture for building on POSIX
compliant systems
- * a Makefile.msc and sqlite3.rc for building with Microsoft Visual C++ on
- Windows
+ * a Makefile.msc, sqlite3.rc, and Replace.cs for building with Microsoft
+ Visual C++ on Windows
SUMMARY OF HOW TO BUILD
=======================
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 94925306..b9a11aac 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -30,39 +30,52 @@ AC_FUNC_STRERROR_R
AC_CONFIG_FILES([Makefile sqlite3.pc])
AC_SUBST(BUILD_CFLAGS)
-#-----------------------------------------------------------------------
+#-------------------------------------------------------------------------
+# Two options to enable readline compatible libraries:
+#
# --enable-editline
# --enable-readline
#
-AC_ARG_ENABLE(editline, [AS_HELP_STRING(
- [--enable-editline],
- [use BSD libedit])],
- [], [enable_editline=yes])
-AC_ARG_ENABLE(readline, [AS_HELP_STRING(
- [--enable-readline],
- [use readline])],
- [], [enable_readline=no])
-if test x"$enable_editline" != xno ; then
- sLIBS=$LIBS
- LIBS=""
- AC_SEARCH_LIBS([readline],[edit],[enable_readline=no],[enable_editline=no])
- READLINE_LIBS=$LIBS
- if test x"$LIBS" != "x"; then
- AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
- else
- unset ac_cv_search_readline
- fi
- LIBS=$sLIBS
-fi
-if test x"$enable_readline" != xno ; then
- sLIBS=$LIBS
- LIBS=""
- AC_SEARCH_LIBS(tgetent, curses ncurses ncursesw, [], [])
- AC_SEARCH_LIBS(readline, readline, [], [enable_readline=no])
- AC_CHECK_FUNCS(readline, [], [])
- READLINE_LIBS=$LIBS
- LIBS=$sLIBS
-fi
+# Both are enabled by default. If, after command line processing both are
+# still enabled, the script searches for editline first and automatically
+# disables readline if it is found. So, to use readline explicitly, the
+# user must pass "--disable-editline". To disable command line editing
+# support altogether, "--disable-editline --disable-readline".
+#
+# When searching for either library, check for headers before libraries
+# as some distros supply packages that contain libraries but not header
+# files, which come as a separate development package.
+#
+AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
+AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
+
+AS_IF([ test x"$enable_editline" != xno ],[
+ AC_CHECK_HEADERS([editline/readline.h],[
+ sLIBS=$LIBS
+ LIBS=""
+ AC_SEARCH_LIBS([readline],[edit],[
+ AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
+ READLINE_LIBS=$LIBS
+ enable_readline=no
+ ])
+ AS_UNSET(ac_cv_search_readline)
+ LIBS=$sLIBS
+ ])
+])
+
+AS_IF([ test x"$enable_readline" != xno ],[
+ AC_CHECK_HEADERS([readline/readline.h],[
+ sLIBS=$LIBS
+ LIBS=""
+ AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
+ AC_SEARCH_LIBS(readline,[readline edit], [
+ AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
+ READLINE_LIBS=$LIBS
+ ])
+ LIBS=$sLIBS
+ ])
+])
+
AC_SUBST(READLINE_LIBS)
#-----------------------------------------------------------------------
@@ -103,7 +116,7 @@ AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
[--enable-fts5], [include fts5 support [default=no]])],
[], [enable_fts5=no])
-if test x"$enable_fts5" == "xyes"; then
+if test x"$enable_fts5" = "xyes"; then
AC_SEARCH_LIBS(log, m)
FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
fi
@@ -116,12 +129,24 @@ AC_SUBST(FTS5_FLAGS)
AC_ARG_ENABLE(json1, [AS_HELP_STRING(
[--enable-json1], [include json1 support [default=no]])],
[], [enable_json1=no])
-if test x"$enable_json1" == "xyes"; then
+if test x"$enable_json1" = "xyes"; then
JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
fi
AC_SUBST(JSON1_FLAGS)
#-----------------------------------------------------------------------
+#-----------------------------------------------------------------------
+# --enable-session
+#
+AC_ARG_ENABLE(session, [AS_HELP_STRING(
+ [--enable-session], [enable the session extension [default=no]])],
+ [], [enable_session=no])
+if test x"$enable_session" = "xyes"; then
+ SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
+fi
+AC_SUBST(SESSION_FLAGS)
+#-----------------------------------------------------------------------
+
#-----------------------------------------------------------------------
# --enable-static-shell
#
@@ -129,8 +154,8 @@ AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
[--enable-static-shell],
[statically link libsqlite3 into shell tool [default=yes]])],
[], [enable_static_shell=yes])
-if test x"$enable_static_shell" == "xyes"; then
- EXTRA_SHELL_OBJ=sqlite3.$OBJEXT
+if test x"$enable_static_shell" = "xyes"; then
+ EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
else
EXTRA_SHELL_OBJ=libsqlite3.la
fi
diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac
index 8df0af61..7fca05b2 100644
--- a/autoconf/tea/configure.ac
+++ b/autoconf/tea/configure.ac
@@ -78,7 +78,6 @@ TEA_ADD_LIBS([])
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1])
TEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1])
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1])
-TEA_ADD_CFLAGS([-DSQLITE_OMIT_DEPRECATED=1])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([])
diff --git a/config.h.in b/config.h.in
index 36fd6078..f2ba7d4f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -45,6 +45,18 @@
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the pread() function. */
+#undef HAVE_PREAD
+
+/* Define to 1 if you have the pread64() function. */
+#undef HAVE_PREAD64
+
+/* Define to 1 if you have the pwrite() function. */
+#undef HAVE_PWRITE
+
+/* Define to 1 if you have the pwrite64() function. */
+#undef HAVE_PWRITE64
+
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
diff --git a/configure b/configure
index b2cb4d13..e22c4dc8 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.11.0.
+# Generated by GNU Autoconf 2.69 for sqlite 3.15.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.11.0'
-PACKAGE_STRING='sqlite 3.11.0'
+PACKAGE_VERSION='3.15.2'
+PACKAGE_STRING='sqlite 3.15.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -903,11 +903,14 @@ with_readline_inc
enable_debug
enable_amalgamation
enable_load_extension
+enable_memsys5
+enable_memsys3
enable_fts3
enable_fts4
enable_fts5
enable_json1
enable_rtree
+enable_session
enable_gcov
'
ac_precious_vars='build_alias
@@ -1460,7 +1463,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sqlite 3.11.0 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.15.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1525,7 +1528,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.11.0:";;
+ short | recursive ) echo "Configuration of sqlite 3.15.2:";;
esac
cat <<\_ACEOF
@@ -1551,11 +1554,14 @@ Optional Features:
separately
--disable-load-extension
Disable loading of external extensions
+ --enable-memsys5 Enable MEMSYS5
+ --enable-memsys3 Enable MEMSYS3
--enable-fts3 Enable the FTS3 extension
--enable-fts4 Enable the FTS4 extension
--enable-fts5 Enable the FTS5 extension
--enable-json1 Enable the JSON1 extension
--enable-rtree Enable the RTREE extension
+ --enable-session Enable the SESSION extension
--enable-gcov Enable coverage testing using gcov
Optional Packages:
@@ -1646,7 +1652,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sqlite configure 3.11.0
+sqlite configure 3.15.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2065,7 +2071,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sqlite $as_me 3.11.0, which was
+It was created by sqlite $as_me 3.15.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3923,13 +3929,13 @@ if ${lt_cv_nm_interface+:} false; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:3926: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:3932: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:3929: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:3935: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:3932: output\"" >&5)
+ (eval echo "\"\$as_me:3938: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -5135,7 +5141,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5138 "configure"' > conftest.$ac_ext
+ echo '#line 5144 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6660,11 +6666,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6663: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6669: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6667: \$? = $ac_status" >&5
+ echo "$as_me:6673: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -6999,11 +7005,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7002: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7008: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7006: \$? = $ac_status" >&5
+ echo "$as_me:7012: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7104,11 +7110,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7107: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7113: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7111: \$? = $ac_status" >&5
+ echo "$as_me:7117: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -7159,11 +7165,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7162: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7168: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7166: \$? = $ac_status" >&5
+ echo "$as_me:7172: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9539,7 +9545,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 9542 "configure"
+#line 9548 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9635,7 +9641,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 9638 "configure"
+#line 9644 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10273,7 +10279,7 @@ done
#########
# Figure out whether or not we have these functions
#
-for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime
+for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -10755,6 +10761,20 @@ else
fi
fi
+ # Recent versions of Xcode on Macs hid the tclConfig.sh file
+ # in a strange place.
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ if test x"$cross_compiling" = xno; then
+ for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
+ do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig="$i"
+ break
+ fi
+ done
+ fi
+ fi
+
# then check for a private Tcl installation
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
@@ -11323,6 +11343,44 @@ else
OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
fi
+##########
+# Do we want to support memsys3 and/or memsys5
+#
+# Check whether --enable-memsys5 was given.
+if test "${enable_memsys5+set}" = set; then :
+ enableval=$enable_memsys5; enable_memsys5=yes
+else
+ enable_memsys5=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support MEMSYS5" >&5
+$as_echo_n "checking whether to support MEMSYS5... " >&6; }
+if test "${enable_memsys5}" = "yes"; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS5"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+# Check whether --enable-memsys3 was given.
+if test "${enable_memsys3+set}" = set; then :
+ enableval=$enable_memsys3; enable_memsys3=yes
+else
+ enable_memsys3=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support MEMSYS3" >&5
+$as_echo_n "checking whether to support MEMSYS3... " >&6; }
+if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS3"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
#########
# See whether we should enable Full Text Search extensions
# Check whether --enable-fts3 was given.
@@ -11494,6 +11552,20 @@ if test "${enable_rtree}" = "yes" ; then
OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
fi
+#########
+# See whether we should enable the SESSION extension
+# Check whether --enable-session was given.
+if test "${enable_session+set}" = set; then :
+ enableval=$enable_session; enable_session=yes
+else
+ enable_session=no
+fi
+
+if test "${enable_session}" = "yes" ; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_SESSION"
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_PREUPDATE_HOOK"
+fi
+
#########
# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
for option in $CFLAGS $CPPFLAGS
@@ -12079,7 +12151,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sqlite $as_me 3.11.0, which was
+This file was extended by sqlite $as_me 3.15.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12145,7 +12217,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sqlite config.status 3.11.0
+sqlite config.status 3.15.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 19f85dc8..c9e3af92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,7 +108,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
#########
# Figure out whether or not we have these functions
#
-AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
+AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
#########
# By default, we use the amalgamation (this may be changed below...)
@@ -334,6 +334,20 @@ if test "${use_tcl}" = "yes" ; then
fi
fi
+ # Recent versions of Xcode on Macs hid the tclConfig.sh file
+ # in a strange place.
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ if test x"$cross_compiling" = xno; then
+ for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
+ do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig="$i"
+ break
+ fi
+ done
+ fi
+ fi
+
# then check for a private Tcl installation
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
@@ -574,6 +588,30 @@ else
OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
fi
+##########
+# Do we want to support memsys3 and/or memsys5
+#
+AC_ARG_ENABLE(memsys5,
+ AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]),
+ [enable_memsys5=yes],[enable_memsys5=no])
+AC_MSG_CHECKING([whether to support MEMSYS5])
+if test "${enable_memsys5}" = "yes"; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS5"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+AC_ARG_ENABLE(memsys3,
+ AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]),
+ [enable_memsys3=yes],[enable_memsys3=no])
+AC_MSG_CHECKING([whether to support MEMSYS3])
+if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS3"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
#########
# See whether we should enable Full Text Search extensions
AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
@@ -615,6 +653,16 @@ if test "${enable_rtree}" = "yes" ; then
OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
fi
+#########
+# See whether we should enable the SESSION extension
+AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
+ [Enable the SESSION extension]),
+ [enable_session=yes],[enable_session=no])
+if test "${enable_session}" = "yes" ; then
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_SESSION"
+ OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_PREUPDATE_HOOK"
+fi
+
#########
# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
for option in $CFLAGS $CPPFLAGS
diff --git a/doc/lemon.html b/doc/lemon.html
index b16e3596..114526f3 100644
--- a/doc/lemon.html
+++ b/doc/lemon.html
@@ -5,14 +5,17 @@
The Lemon Parser Generator
-Lemon is an LALR(1) parser generator for C or C++.
-It does the same job as ``bison'' and ``yacc''.
-But lemon is not another bison or yacc clone. It
+
Lemon is an LALR(1) parser generator for C.
+It does the same job as "bison" and "yacc".
+But lemon is not a bison or yacc clone. Lemon
uses a different grammar syntax which is designed to
-reduce the number of coding errors. Lemon also uses a more
-sophisticated parsing engine that is faster than yacc and
-bison and which is both reentrant and thread-safe.
-Furthermore, Lemon implements features that can be used
+reduce the number of coding errors. Lemon also uses a
+parsing engine that is faster than yacc and
+bison and which is both reentrant and threadsafe.
+(Update: Since the previous sentence was written, bison
+has also been updated so that it too can generate a
+reentrant and threadsafe parser.)
+Lemon also implements features that can be used
to eliminate resource leaks, making is suitable for use
in long-running programs such as graphical user interfaces
or embedded controllers.
@@ -44,18 +47,18 @@ one and three files of outputs.
automaton.
By default, all three of these output files are generated.
-The header file is suppressed if the ``-m'' command-line option is
-used and the report file is omitted when ``-q'' is selected.
+The header file is suppressed if the "-m" command-line option is
+used and the report file is omitted when "-q" is selected.
-The grammar specification file uses a ``.y'' suffix, by convention.
+
The grammar specification file uses a ".y" suffix, by convention.
In the examples used in this document, we'll assume the name of the
-grammar file is ``gram.y''. A typical use of Lemon would be the
+grammar file is "gram.y". A typical use of Lemon would be the
following command:
lemon gram.y
-This command will generate three output files named ``gram.c'',
-``gram.h'' and ``gram.out''.
+This command will generate three output files named "gram.c",
+"gram.h" and "gram.out".
The first is C code to implement the parser. The second
is the header file that defines numerical values for all
terminal symbols, and the last is the report that explains
@@ -71,39 +74,35 @@ with a brief explanation of what each does by typing
As of this writing, the following command-line options are supported:
-- -b
-
- -c
-
- -g
-
- -m
-
- -q
-
- -s
-
- -x
+
- -b
+Show only the basis for each parser state in the report file.
+
- -c
+Do not compress the generated action tables.
+
- -Dname
+Define C preprocessor macro name. This macro is useable by
+"%ifdef" lines in the grammar file.
+
- -g
+Do not generate a parser. Instead write the input grammar to standard
+output with all comments, actions, and other extraneous text removed.
+
- -l
+Omit "#line" directives in the generated parser C code.
+
- -m
+Cause the output C source code to be compatible with the "makeheaders"
+program.
+
- -p
+Display all conflicts that are resolved by
+precedence rules.
+
- -q
+Suppress generation of the report file.
+
- -r
+Do not sort or renumber the parser states as part of optimization.
+
- -s
+Show parser statistics before existing.
+
- -Tfile
+Use file as the template for the generated C-code parser implementation.
+
- -x
+Print the Lemon version number.
-The ``-b'' option reduces the amount of text in the report file by
-printing only the basis of each parser state, rather than the full
-configuration.
-The ``-c'' option suppresses action table compression. Using -c
-will make the parser a little larger and slower but it will detect
-syntax errors sooner.
-The ``-g'' option causes no output files to be generated at all.
-Instead, the input grammar file is printed on standard output but
-with all comments, actions and other extraneous text deleted. This
-is a useful way to get a quick summary of a grammar.
-The ``-m'' option causes the output C source file to be compatible
-with the ``makeheaders'' program.
-Makeheaders is a program that automatically generates header files
-from C source code. When the ``-m'' option is used, the header
-file is not output since the makeheaders program will take care
-of generated all header files automatically.
-The ``-q'' option suppresses the report file.
-Using ``-s'' causes a brief summary of parser statistics to be
-printed. Like this:
-
- Parser statistics: 74 terminals, 70 nonterminals, 179 rules
- 340 states, 2026 parser table entries, 0 conflicts
-
-Finally, the ``-x'' option causes Lemon to print its version number
-and then stops without attempting to read the grammar or generate a parser.
The Parser Interface
@@ -121,12 +120,12 @@ A new parser is created as follows:
The ParseAlloc() routine allocates and initializes a new parser and
returns a pointer to it.
-The actual data structure used to represent a parser is opaque --
+The actual data structure used to represent a parser is opaque —
its internal structure is not visible or usable by the calling routine.
For this reason, the ParseAlloc() routine returns a pointer to void
rather than a pointer to some particular structure.
The sole argument to the ParseAlloc() routine is a pointer to the
-subroutine used to allocate memory. Typically this means ``malloc()''.
+subroutine used to allocate memory. Typically this means malloc().
After a program is finished using a parser, it can reclaim all
memory allocated by that parser by calling
@@ -151,18 +150,19 @@ type of the next token in the data stream.
There is one token type for each terminal symbol in the grammar.
The gram.h file generated by Lemon contains #define statements that
map symbolic terminal symbol names into appropriate integer values.
-(A value of 0 for the second argument is a special flag to the
-parser to indicate that the end of input has been reached.)
+A value of 0 for the second argument is a special flag to the
+parser to indicate that the end of input has been reached.
The third argument is the value of the given token. By default,
the type of the third argument is integer, but the grammar will
usually redefine this type to be some kind of structure.
Typically the second argument will be a broad category of tokens
-such as ``identifier'' or ``number'' and the third argument will
+such as "identifier" or "number" and the third argument will
be the name of the identifier or the value of the number.
The Parse() function may have either three or four arguments,
-depending on the grammar. If the grammar specification file request
-it, the Parse() function will have a fourth parameter that can be
+depending on the grammar. If the grammar specification file requests
+it (via the extra_argument directive),
+the Parse() function will have a fourth parameter that can be
of any type chosen by the programmer. The parser doesn't do anything
with this argument except to pass it through to action routines.
This is a convenient mechanism for passing state information down
@@ -192,7 +192,7 @@ following:
This example shows a user-written routine that parses a file of
text and returns a pointer to the parse tree.
-(We've omitted all error-handling from this example to keep it
+(All error-handling code is omitted from this example to keep it
simple.)
We assume the existence of some kind of tokenizer which is created
using TokenizerCreate() on line 8 and deleted by TokenizerFree()
@@ -263,6 +263,12 @@ with prior yacc and bison experience.
But after years of experience using Lemon, I firmly
believe that the Lemon way of doing things is better.
+Updated as of 2016-02-16:
+The text above was written in the 1990s.
+We are told that Bison has lately been enhanced to support the
+tokenizer-calls-parser paradigm used by Lemon, and to obviate the
+need for global variables.
+
Input File Syntax
The main purpose of the grammar specification file for Lemon is
@@ -280,7 +286,7 @@ tokens) and it honors the same commenting conventions as C and C++.
Terminals and Nonterminals
A terminal symbol (token) is any string of alphanumeric
-and underscore characters
+and/or underscore characters
that begins with an upper case letter.
A terminal can contain lowercase letters after the first character,
but the usual convention is to make terminals all upper case.
@@ -307,7 +313,7 @@ must have alphanumeric names.
The main component of a Lemon grammar file is a sequence of grammar
rules.
Each grammar rule consists of a nonterminal symbol followed by
-the special symbol ``::='' and then a list of terminals and/or nonterminals.
+the special symbol "::=" and then a list of terminals and/or nonterminals.
The rule is terminated by a period.
The list of terminals and nonterminals on the right-hand side of the
rule can be empty.
@@ -323,9 +329,9 @@ A typical sequence of grammar rules might look something like this:
-There is one non-terminal in this example, ``expr'', and five
-terminal symbols or tokens: ``PLUS'', ``TIMES'', ``LPAREN'',
-``RPAREN'' and ``VALUE''.
+There is one non-terminal in this example, "expr", and five
+terminal symbols or tokens: "PLUS", "TIMES", "LPAREN",
+"RPAREN" and "VALUE".
Like yacc and bison, Lemon allows the grammar to specify a block
of C code that will be executed whenever a grammar rule is reduced
@@ -341,15 +347,15 @@ For example:
In order to be useful, grammar actions must normally be linked to
their associated grammar rules.
-In yacc and bison, this is accomplished by embedding a ``$$'' in the
+In yacc and bison, this is accomplished by embedding a "$$" in the
action to stand for the value of the left-hand side of the rule and
-symbols ``$1'', ``$2'', and so forth to stand for the value of
+symbols "$1", "$2", and so forth to stand for the value of
the terminal or nonterminal at position 1, 2 and so forth on the
right-hand side of the rule.
This idea is very powerful, but it is also very error-prone. The
single most common source of errors in a yacc or bison grammar is
to miscount the number of symbols on the right-hand side of a grammar
-rule and say ``$7'' when you really mean ``$8''.
+rule and say "$7" when you really mean "$8".
Lemon avoids the need to count grammar symbols by assigning symbolic
names to each symbol in a grammar rule and then using those symbolic
@@ -379,7 +385,7 @@ For example, the rule
expr(A) ::= expr(B) PLUS expr(C). { A = B; }
-will generate an error because the linking symbol ``C'' is used
+will generate an error because the linking symbol "C" is used
in the grammar rule but not in the reduce action.
The Lemon notation for linking grammar rules to reduce actions
@@ -387,6 +393,7 @@ also facilitates the use of destructors for reclaiming memory
allocated by the values of terminals and nonterminals on the
right-hand side of a rule.
+
Precedence Rules
Lemon resolves parsing ambiguities in exactly the same way as
@@ -398,7 +405,10 @@ whichever rule comes first in the grammar file.
yacc and bison, Lemon allows a measure of control
over the resolution of paring conflicts using precedence rules.
A precedence value can be assigned to any terminal symbol
-using the %left, %right or %nonassoc directives. Terminal symbols
+using the
+%left,
+%right or
+%nonassoc directives. Terminal symbols
mentioned in earlier directives have a lower precedence that
terminal symbols mentioned in later directives. For example:
@@ -518,7 +528,11 @@ other than that, the order of directives in Lemon is arbitrary.
%default_destructor
%default_type
%destructor
+%endif
%extra_argument
+%fallback
+%ifdef
+%ifndef
%include
%left
%name
@@ -530,49 +544,57 @@ other than that, the order of directives in Lemon is arbitrary.
%stack_size
%start_symbol
%syntax_error
+%token_class
%token_destructor
%token_prefix
%token_type
%type
+%wildcard
Each of these directives will be described separately in the
following sections:
+
The %code directive
-The %code directive is used to specify addition C/C++ code that
+
The %code directive is used to specify addition C code that
is added to the end of the main output file. This is similar to
-the %include directive except that %include is inserted at the
-beginning of the main output file.
+the %include directive except that %include
+is inserted at the beginning of the main output file.
%code is typically used to include some action routines or perhaps
-a tokenizer as part of the output file.
+a tokenizer or even the "main()" function
+as part of the output file.
+
The %default_destructor directive
The %default_destructor directive specifies a destructor to
use for non-terminals that do not have their own destructor
specified by a separate %destructor directive. See the documentation
-on the %destructor directive below for additional information.
+on the %destructor directive below for
+additional information.
In some grammers, many different non-terminal symbols have the
same datatype and hence the same destructor. This directive is
a convenience way to specify the same destructor for all those
non-terminals using a single statement.
+
The %default_type directive
The %default_type directive specifies the datatype of non-terminal
symbols that do no have their own datatype defined using a separate
-%type directive. See the documentation on %type below for addition
-information.
+%type directive.
+
+
The %destructor directive
The %destructor directive is used to specify a destructor for
a non-terminal symbol.
-(See also the %token_destructor directive which is used to
-specify a destructor for terminal symbols.)
+(See also the %token_destructor
+directive which is used to specify a destructor for terminal symbols.)
A non-terminal's destructor is called to dispose of the
non-terminal's value whenever the non-terminal is popped from
@@ -595,28 +617,28 @@ or other resources held by that non-terminal.
This example is a bit contrived but it serves to illustrate how
destructors work. The example shows a non-terminal named
-``nt'' that holds values of type ``void*''. When the rule for
-an ``nt'' reduces, it sets the value of the non-terminal to
+"nt" that holds values of type "void*". When the rule for
+an "nt" reduces, it sets the value of the non-terminal to
space obtained from malloc(). Later, when the nt non-terminal
is popped from the stack, the destructor will fire and call
free() on this malloced space, thus avoiding a memory leak.
-(Note that the symbol ``$$'' in the destructor code is replaced
+(Note that the symbol "$$" in the destructor code is replaced
by the value of the non-terminal.)
It is important to note that the value of a non-terminal is passed
to the destructor whenever the non-terminal is removed from the
stack, unless the non-terminal is used in a C-code action. If
the non-terminal is used by C-code, then it is assumed that the
-C-code will take care of destroying it if it should really
-be destroyed. More commonly, the value is used to build some
+C-code will take care of destroying it.
+More commonly, the value is used to build some
larger structure and we don't want to destroy it, which is why
the destructor is not called in this circumstance.
-By appropriate use of destructors, it is possible to
-build a parser using Lemon that can be used within a long-running
-program, such as a GUI, that will not leak memory or other resources.
+
Destructors help avoid memory leaks by automatically freeing
+allocated objects when they go out of scope.
To do the same using yacc or bison is much more difficult.
+
The %extra_argument directive
The %extra_argument directive instructs Lemon to add a 4th parameter
@@ -630,17 +652,66 @@ and so forth. For example, if the grammar file contains:
Then the Parse() function generated will have an 4th parameter
-of type ``MyStruct*'' and all action routines will have access to
-a variable named ``pAbc'' that is the value of the 4th parameter
+of type "MyStruct*" and all action routines will have access to
+a variable named "pAbc" that is the value of the 4th parameter
in the most recent call to Parse().
+
+The %fallback directive
+
+The %fallback directive specifies an alternative meaning for one
+or more tokens. The alternative meaning is tried if the original token
+would have generated a syntax error.
+
+
The %fallback directive was added to support robust parsing of SQL
+syntax in SQLite.
+The SQL language contains a large assortment of keywords, each of which
+appears as a different token to the language parser. SQL contains so
+many keywords, that it can be difficult for programmers to keep up with
+them all. Programmers will, therefore, sometimes mistakenly use an
+obscure language keyword for an identifier. The %fallback directive
+provides a mechanism to tell the parser: "If you are unable to parse
+this keyword, try treating it as an identifier instead."
+
+
The syntax of %fallback is as follows:
+
+
+%fallback ID TOKEN... .
+
+
+In words, the %fallback directive is followed by a list of token names
+terminated by a period. The first token name is the fallback token - the
+token to which all the other tokens fall back to. The second and subsequent
+arguments are tokens which fall back to the token identified by the first
+argument.
+
+
+
The %ifdef, %ifndef, and %endif directives.
+
+The %ifdef, %ifndef, and %endif directives are similar to
+#ifdef, #ifndef, and #endif in the C-preprocessor, just not as general.
+Each of these directives must begin at the left margin. No whitespace
+is allowed between the "%" and the directive name.
+
+
Grammar text in between "%ifdef MACRO" and the next nested "%endif" is
+ignored unless the "-DMACRO" command-line option is used. Grammar text
+betwen "%ifndef MACRO" and the next nested "%endif" is included except when
+the "-DMACRO" command-line option is used.
+
+
Note that the argument to %ifdef and %ifndef must be a single
+preprocessor symbol name, not a general expression. There is no "%else"
+directive.
+
+
+
The %include directive
The %include directive specifies C code that is included at the
top of the generated parser. You can include any text you want --
the Lemon parser generator copies it blindly. If you have multiple
-%include directives in your grammar file the value of the last
-%include directive overwrites all the others.
The %include directive is very handy for getting some extra #include
preprocessor statements at the beginning of the generated parser.
@@ -653,12 +724,13 @@ For example:
This might be needed, for example, if some of the C actions in the
grammar call functions that are prototyed in unistd.h.
+
The %left directive
-The %left directive is used (along with the %right and
-%nonassoc directives) to declare precedences of terminal
-symbols. Every terminal symbol whose name appears after
-a %left directive but before the next period (``.'') is
+The %left directive is used (along with the %right and
+%nonassoc directives) to declare precedences of
+terminal symbols. Every terminal symbol whose name appears after
+a %left directive but before the next period (".") is
given the same left-associative precedence value. Subsequent
%left directives have higher precedence. For example:
@@ -679,10 +751,11 @@ a large amount of stack space if you make heavy use or right-associative
operators. For this reason, it is recommended that you use %left
rather than %right whenever possible.
+
The %name directive
By default, the functions generated by Lemon all begin with the
-five-character string ``Parse''. You can change this string to something
+five-character string "Parse". You can change this string to something
different using the %name directive. For instance:
@@ -701,16 +774,19 @@ The %name directive allows you to generator two or more different
parsers and link them all into the same executable.
+
The %nonassoc directive
This directive is used to assign non-associative precedence to
-one or more terminal symbols. See the section on precedence rules
-or on the %left directive for additional information.
+one or more terminal symbols. See the section on
+precedence rules
+or on the %left directive for additional information.
+
The %parse_accept directive
The %parse_accept directive specifies a block of C code that is
-executed whenever the parser accepts its input string. To ``accept''
+executed whenever the parser accepts its input string. To "accept"
an input string means that the parser was able to process all tokens
without error.
@@ -722,7 +798,7 @@ without error.
}
-
+
The %parse_failure directive
The %parse_failure directive specifies a block of C code that
@@ -737,12 +813,15 @@ only invoked when parsing is unable to continue.
}
+
The %right directive
This directive is used to assign right-associative precedence to
-one or more terminal symbols. See the section on precedence rules
-or on the %left directive for additional information.
+one or more terminal symbols. See the section on
+precedence rules
+or on the %left directive for additional information.
+
The %stack_overflow directive
The %stack_overflow directive specifies a block of C code that
@@ -771,6 +850,7 @@ Not like this:
list ::= .
+
The %stack_size directive
If stack overflow is a problem and you can't resolve the trouble
@@ -783,6 +863,7 @@ with a stack of the requested size. The default value is 100.
%stack_size 2000
+
The %start_symbol directive
By default, the start-symbol for the grammar that Lemon generates
@@ -793,6 +874,7 @@ can choose a different start-symbol using the %start_symbol directive.
%start_symbol prog
+
The %token_destructor directive
The %destructor directive assigns a destructor to a non-terminal
@@ -805,6 +887,7 @@ the %token_type directive) and so they use a common destructor. Other
than that, the token destructor works just like the non-terminal
destructors.
+
The %token_prefix directive
Lemon generates #defines that assign small integer constants
@@ -830,6 +913,7 @@ to cause Lemon to produce these symbols instead:
#define TOKEN_PLUS 4
+
The %token_type and %type directives
These directives are used to specify the data types for values
@@ -845,7 +929,7 @@ token structure. Like this:
If the data type of terminals is not specified, the default value
-is ``int''.
+is "void*".
Non-terminal symbols can each have their own data types. Typically
the data type of a non-terminal is a pointer to the root of a parse-tree
@@ -866,6 +950,17 @@ non-terminal whose data type requires 1K of storage, then your 100
entry parser stack will require 100K of heap space. If you are willing
and able to pay that price, fine. You just need to know.
+
+The %wildcard directive
+
+The %wildcard directive is followed by a single token name and a
+period. This directive specifies that the identified token should
+match any input token.
+
+
When the generated parser has the choice of matching an input against
+the wildcard token and some other token, the other token is always used.
+The wildcard token is only matched if there are no other alternatives.
+
Error Processing
After extensive experimentation over several years, it has been
@@ -877,7 +972,7 @@ first invokes the code specified by the %syntax_error directive, if
any. It then enters its error recovery strategy. The error recovery
strategy is to begin popping the parsers stack until it enters a
state where it is permitted to shift a special non-terminal symbol
-named ``error''. It then shifts this non-terminal and continues
+named "error". It then shifts this non-terminal and continues
parsing. But the %syntax_error routine will not be called again
until at least three new tokens have been successfully shifted.
@@ -886,7 +981,7 @@ is unable to shift the error symbol, then the %parse_failed routine
is invoked and the parser resets itself to its start state, ready
to begin parsing a new file. This is what will happen at the very
first syntax error, of course, if there are no instances of the
-``error'' non-terminal in your grammar.
+"error" non-terminal in your grammar.