diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3bddc23d3b..b0043a14ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,14 @@ All notable changes to this project will be documented in this file.
## [Unreleased][unreleased]
-## [3.4.0] - 2016-02-??
+## [3.4.1] - 2016-12-28
+### Added
+- Added support for OpenSSL 1.1.0
+
+### Changed
+- Merged upstream SQLite 3.15.2
+
+## [3.4.0] - 2016-04-05
### Added
- Added `PRAGMA cipher_provider_version`
@@ -66,7 +73,8 @@ All notable changes to this project will be documented in this file.
### Security
- Change KDF iteration length from 4,000 to 64,000
-[unreleased]: https://github.com/sqlcipher/sqlcipher/compare/v3.4.0...prerelease
+[unreleased]: https://github.com/sqlcipher/sqlcipher/compare/v3.4.1...prerelease
+[3.4.1]: https://github.com/sqlcipher/sqlcipher/compare/v3.4.0...v3.4.1
[3.4.0]: https://github.com/sqlcipher/sqlcipher/compare/v3.3.1...v3.4.0
[3.3.1]: https://github.com/sqlcipher/sqlcipher/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/sqlcipher/sqlcipher/compare/v3.2.0...v3.3.0
diff --git a/Makefile.in b/Makefile.in
index 31f039f475..f1a2578129 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -31,7 +31,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
@@ -192,13 +193,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 \
@@ -244,7 +246,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 \
@@ -362,14 +363,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 += \
@@ -396,9 +398,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 \
@@ -425,14 +429,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 \
@@ -494,7 +501,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.
#
@@ -553,7 +561,8 @@ TESTPROGS = \
testfixture$(TEXE) \
sqlite3$(TEXE) \
sqlite3_analyzer$(TEXE) \
- sqldiff$(TEXE)
+ sqldiff$(TEXE) \
+ dbhash$(TEXE)
# Databases containing fuzzer test cases
#
@@ -570,7 +579,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
@@ -586,11 +597,11 @@ sqlcipher.pc: $(TOP)/sqlcipher.pc.in
./config.status
libsqlcipher.la: $(LIBOBJ)
- $(LTLINK) -o $@ $(LIBOBJ) $(TLIBS) \
+ $(LTLINK) -no-undefined -o $@ $(LIBOBJ) $(TLIBS) \
${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8"
libtclsqlite3.la: tclsqlite.lo libsqlcipher.la
- $(LTLINK) -o $@ tclsqlite.lo \
+ $(LTLINK) -no-undefined -o $@ tclsqlite.lo \
libsqlcipher.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
-rpath "$(TCLLIBDIR)" \
-version-info "8:6:8" \
@@ -601,8 +612,15 @@ sqlcipher$(TEXE): $(TOP)/src/shell.c libsqlcipher.la sqlite3.h
-o $@ $(TOP)/src/shell.c libsqlcipher.la \
$(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
@@ -617,8 +635,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
@@ -654,6 +672,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 .
@@ -771,9 +790,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
@@ -1033,6 +1049,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
@@ -1058,7 +1077,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
@@ -1083,6 +1102,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) libsqlcipher.la
TESTFIXTURE_SRC1 = sqlite3.c
@@ -1163,14 +1184,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)
@@ -1185,8 +1209,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
@@ -1249,13 +1274,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 tclsqlcipher$(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
@@ -1268,6 +1292,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 796aec4b06..0f3e74c8e7 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 \
@@ -1037,7 +1153,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 \
@@ -1167,6 +1282,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
@@ -1189,7 +1305,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
#
@@ -1205,6 +1322,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)
@@ -1224,9 +1351,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 \
@@ -1254,13 +1383,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 \
@@ -1277,6 +1409,7 @@ TESTEXT = \
$(TOP)\ext\misc\wholenumber.c
# Source code to the library files needed by the test fixture
+# (non-amalgamation)
#
TESTSRC2 = \
$(SRC00) \
@@ -1306,7 +1439,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 \
@@ -1335,6 +1468,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
#
@@ -1342,7 +1477,8 @@ TESTPROGS = \
testfixture.exe \
$(SQLITE3EXE) \
sqlite3_analyzer.exe \
- sqldiff.exe
+ sqldiff.exe \
+ dbhash.exe
# Databases containing fuzzer test cases
#
@@ -1387,30 +1523,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) \
@@ -1420,6 +1556,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
@@ -1455,7 +1597,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
@@ -1470,6 +1612,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
@@ -1477,9 +1620,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
@@ -1597,9 +1741,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
@@ -1753,10 +1894,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)
@@ -1782,10 +1923,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) \
@@ -1861,6 +2008,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 = \
@@ -1885,9 +2035,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 .
@@ -1913,6 +2063,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)
@@ -1922,13 +2075,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)
@@ -1971,7 +2144,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 $@
@@ -1987,7 +2160,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)
@@ -2006,6 +2179,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)
@@ -2025,38 +2202,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/README.md b/README.md
index a3abad40f4..67cc7a7d48 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,14 @@
## SQLCipher
-SQLCipher is an SQLite extension that provides transparent 256-bit AES encryption of
-database files. Pages are encrypted before being written to disk and are decrypted
-when read back. Due to the small footprint and great performance it’s ideal for
-protecting embedded application databases and is well suited for mobile development.
+SQLCipher extends the [SQLite](https://www.sqlite.org) database library to add security enhancements that make it more suitable for encrypted local data storage such as on-the-fly encryption, tamper evidence, and key derivation. Based on SQLite, SQLCipher closely tracks SQLite and periodically integrates stable SQLite release features.
-The official SQLCipher software site is http://sqlcipher.net
-
-SQLCipher was initially developed by Stephen Lombardo at Zetetic LLC
-(sjlombardo@zetetic.net) as the encrypted database layer for Strip,
-an iPhone data vault and password manager (http://getstrip.com).
+SQLCipher is maintained by Zetetic, LLC, the official site can be found [here](https://www.zetetic.net/sqlcipher/).
## Features
- Fast performance with as little as 5-15% overhead for encryption on many operations
- 100% of data in the database file is encrypted
-- Good security practices (CBC mode, key derivation)
+- Good security practices (CBC mode, HMAC, key derivation)
- Zero-configuration and application level cryptography
- Algorithms provided by the peer reviewed OpenSSL crypto library.
- Configurable crypto providers
@@ -24,20 +17,16 @@ an iPhone data vault and password manager (http://getstrip.com).
We welcome contributions, to contribute to SQLCipher, a [contributor agreement](https://www.zetetic.net/contributions/) needs to be submitted. All submissions should be based on the `prerelease` branch.
-If you are reading this on a Git mirror someplace, you are doing it wrong.
-The [official repository](https://www.sqlite.org/src/) is better. Go there
-now.
-
## Compiling
Building SQLCipher is almost the same as compiling a regular version of
SQLite with two small exceptions:
- 1. You *must* define SQLITE_HAS_CODEC and SQLITE_TEMP_STORE=2 when building sqlcipher.
- 2. You need to link against a OpenSSL's libcrypto
+ 1. You *must* define `SQLITE_HAS_CODEC` and `SQLITE_TEMP_STORE=2` when building sqlcipher.
+ 2. If compiling against the default OpenSSL crypto provider, you will need to link libcrypto
Example Static linking (replace /opt/local/lib with the path to libcrypto.a). Note in this
-example, --enable-tempstore=yes is setting SQLITE_TEMP_STORE=2 for the build.
+example, `--enable-tempstore=yes` is setting `SQLITE_TEMP_STORE=2` for the build.
$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
LDFLAGS="/opt/local/lib/libcrypto.a"
@@ -64,13 +53,13 @@ key data without key derivation.
PRAGMA key = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
-To encrypt a database programatically you can use the sqlite3_key function.
-The data provided in pKey is converted to an encryption key according to the
-same rules as PRAGMA key.
+To encrypt a database programatically you can use the `sqlite3_key` function.
+The data provided in `pKey` is converted to an encryption key according to the
+same rules as `PRAGMA key`.
int sqlite3_key(sqlite3 *db, const void *pKey, int nKey);
-PRAGMA key or sqlite3_key should be called as the first operation when a database is open.
+`PRAGMA key` or `sqlite3_key` should be called as the first operation when a database is open.
## Changing a database key
@@ -80,7 +69,7 @@ after you've supplied the correct database password;
PRAGMA key = 'passphrase'; -- start with the existing database passphrase
PRAGMA rekey = 'new-passphrase'; -- rekey will reencrypt with the new passphrase
-The hexrekey pragma may be used to rekey to a specific binary value
+The hex rekey pragma may be used to rekey to a specific binary value
PRAGMA rekey = "x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
@@ -90,9 +79,9 @@ This can be accomplished programtically by using sqlite3_rekey;
## Support
-The primary avenue for support and discussions is the SQLCipher users mailing list:
+The primary avenue for support and discussions is the SQLCipher discuss site:
-http://groups.google.com/group/sqlcipher
+https://discuss.zetetic.net/c/sqlcipher
Issues or support questions on using SQLCipher should be entered into the
GitHub Issue tracker:
@@ -107,7 +96,7 @@ support@zetetic.net!
## License
-Copyright (c) 2008, ZETETIC LLC
+Copyright (c) 2016, ZETETIC LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -131,231 +120,3 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-## End SQLCipher
-
-This directory contains source code to
-
- SQLite: An Embeddable SQL Database Engine
-
-To compile the project, first create a directory in which to place
-the build products. It is recommended, but not required, that the
-build directory be separate from the source directory. Cd into the
-build directory and then from the build directory run the configure
-script found at the root of the source tree. Then run "make".
-
-For example:
-
- tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
- mkdir bld ;# Build will occur in a sibling directory
- cd bld ;# Change to the build directory
- ../sqlite/configure ;# Run the configure script
- make ;# Run the makefile.
- make install ;# (Optional) Install the build products
-
-The configure script uses autoconf 2.61 and libtool. If the configure
-script does not work out for you, there is a generic makefile named
-"Makefile.linux-gcc" in the top directory of the source tree that you
-can copy and edit to suit your needs. Comments on the generic makefile
-show what changes are needed.
-
-The linux binaries on the website are created using the generic makefile,
-not the configure script. The windows binaries on the website are created
-using MinGW32 configured as a cross-compiler running under Linux. For
-details, see the ./publish.sh script at the top-level of the source tree.
-The developers do not use teh configure script.
-
-SQLite does not require TCL to run, but a TCL installation is required
-by the makefiles. SQLite contains a lot of generated code and TCL is
-used to do much of that code generation. The makefile also requires
-AWK.
-
-Contacts:
-
- http://www.sqlite.org/
-=======
- mkdir bld
- cd bld
- nmake /f Makefile.msc TOP=..\sqlite
- nmake /f Makefile.msc sqlite3.c TOP=..\sqlite
- nmake /f Makefile.msc sqlite3.dll TOP=..\sqlite
- nmake /f Makefile.msc sqlite3.exe TOP=..\sqlite
- nmake /f Makefile.msc test TOP=..\sqlite
-
-There are several build options that can be set via the NMAKE command
-line. For example, to build for WinRT, simply add "FOR_WINRT=1" argument
-to the "sqlite3.dll" command line above. When debugging into the SQLite
-code, adding the "DEBUG=1" argument to one of the above command lines is
-recommended.
-
-SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation
-is required by the makefiles (including those for MSVC). SQLite contains
-a lot of generated code and Tcl is used to do much of that code generation.
-The makefiles also require AWK.
-
-## Source Code Tour
-
-Most of the core source files are in the **src/** subdirectory. But
-src/ also contains files used to build the "testfixture" test harness;
-those file all begin with "test". And src/ contains the "shell.c" file
-which is the main program for the "sqlite3.exe" command-line shell and
-the "tclsqlite.c" file which implements the bindings to SQLite from the
-Tcl programming language. (Historical note: SQLite began as a Tcl
-extension and only later escaped to the wild as an independent library.)
-
-Test scripts and programs are found in the **test/** subdirectory.
-There are other test suites for SQLite (see
-[How SQLite Is Tested](http://www.sqlite.org/testing.html))
-but those other test suites are
-in separate source repositories.
-
-The **ext/** subdirectory contains code for extensions. The
-Full-text search engine is in **ext/fts3**. The R-Tree engine is in
-**ext/rtree**. The **ext/misc** subdirectory contains a number of
-smaller, single-file extensions, such as a REGEXP operator.
-
-The **tool/** subdirectory contains various scripts and programs used
-for building generated source code files or for testing or for generating
-accessory programs such as "sqlite3_analyzer(.exe)".
-
-### Generated Source Code Files
-
-Several of the C-language source files used by SQLite are generated from
-other sources rather than being typed in manually by a programmer. This
-section will summarize those automatically-generated files. To create all
-of the automatically-generated files, simply run "make target_source".
-The "target_source" make target will create a subdirectory "tsrc/" and
-fill it with all the source files needed to build SQLite, both
-manually-edited files and automatically-generated files.
-
-The SQLite interface is defined by the **sqlite3.h** header file, which is
-generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION. The
-[Tcl script](http://www.tcl.tk) at tool/mksqlite3h.tcl does the conversion.
-The manifest.uuid file contains the SHA1 hash of the particular check-in
-and is used to generate the SQLITE\_SOURCE\_ID macro. The VERSION file
-contains the current SQLite version number. The sqlite3.h header is really
-just a copy of src/sqlite.h.in with the source-id and version number inserted
-at just the right spots. Note that comment text in the sqlite3.h file is
-used to generate much of the SQLite API documentation. The Tcl scripts
-used to generate that documentation are in a separate source repository.
-
-The SQL language parser is **parse.c** which is generate from a grammar in
-the src/parse.y file. The conversion of "parse.y" into "parse.c" is done
-by the [lemon](./doc/lemon.html) LALR(1) parser generator. The source code
-for lemon is at tool/lemon.c. Lemon uses a
-template for generating its parser. A generic template is in tool/lempar.c,
-but SQLite uses a slightly modified template found in src/lempar.c.
-
-Lemon also generates the **parse.h** header file, at the same time it
-generates parse.c. But the parse.h header file is
-modified further (to add additional symbols) using the ./addopcodes.awk
-AWK script.
-
-The **opcodes.h** header file contains macros that define the numbers
-corresponding to opcodes in the "VDBE" virtual machine. The opcodes.h
-file is generated by the scanning the src/vdbe.c source file. The
-AWK script at ./mkopcodeh.awk does this scan and generates opcodes.h.
-A second AWK script, ./mkopcodec.awk, then scans opcodes.h to generate
-the **opcodes.c** source file, which contains a reverse mapping from
-opcode-number to opcode-name that is used for EXPLAIN output.
-
-The **keywordhash.h** header file contains the definition of a hash table
-that maps SQL language keywords (ex: "CREATE", "SELECT", "INDEX", etc.) into
-the numeric codes used by the parse.c parser. The keywordhash.h file is
-generated by a C-language program at tool mkkeywordhash.c.
-
-### The Amalgamation
-
-All of the individual C source code and header files (both manually-edited
-and automatically-generated) can be combined into a single big source file
-**sqlite3.c** called "the amalgamation". The amalgamation is the recommended
-way of using SQLite in a larger application. Combining all individual
-source code files into a single big source code file allows the C compiler
-to perform more cross-procedure analysis and generate better code. SQLite
-runs about 5% faster when compiled from the amalgamation versus when compiled
-from individual source files.
-
-The amalgamation is generated from the tool/mksqlite3c.tcl Tcl script.
-First, all of the individual source files must be gathered into the tsrc/
-subdirectory (using the equivalent of "make target_source") then the
-tool/mksqlite3c.tcl script is run to copy them all together in just the
-right order while resolving internal "#include" references.
-
-The amalgamation source file is more than 100K lines long. Some symbolic
-debuggers (most notably MSVC) are unable to deal with files longer than 64K
-lines. To work around this, a separate Tcl script, tool/split-sqlite3c.tcl,
-can be run on the amalgamation to break it up into a single small C file
-called **sqlite3-all.c** that does #include on about five other files
-named **sqlite3-1.c**, **sqlite3-2.c**, ..., **sqlite3-5.c**. In this way,
-all of the source code is contained within a single translation unit so
-that the compiler can do extra cross-procedure optimization, but no
-individual source file exceeds 32K lines in length.
-
-## How It All Fits Together
-
-SQLite is modular in design.
-See the [architectural description](http://www.sqlite.org/arch.html)
-for details. Other documents that are useful in
-(helping to understand how SQLite works include the
-[file format](http://www.sqlite.org/fileformat2.html) description,
-the [virtual machine](http://www.sqlite.org/vdbe.html) that runs
-prepared statements, the description of
-[how transactions work](http://www.sqlite.org/atomiccommit.html), and
-the [overview of the query planner](http://www.sqlite.org/optoverview.html).
-
-Unfortunately, years of effort have gone into optimizating SQLite, both
-for small size and high performance. And optimizations tend to result in
-complex code. So there is a lot of complexity in the SQLite implementation.
-
-Key files:
-
- * **sqlite.h.in** - This file defines the public interface to the SQLite
- library. Readers will need to be familiar with this interface before
- trying to understand how the library works internally.
-
- * **sqliteInt.h** - this header file defines many of the data objects
- used internally by SQLite.
-
- * **parse.y** - This file describes the LALR(1) grammer that SQLite uses
- to parse SQL statements, and the actions that are taken at each step
- in the parsing process.
-
- * **vdbe.c** - This file implements the virtual machine that runs
- prepared statements. There are various helper files whose names
- begin with "vdbe". The VDBE has access to the vdbeInt.h header file
- which defines internal data objects. The rest of SQLite interacts
- with the VDBE through an interface defined by vdbe.h.
-
- * **where.c** - This file analyzes the WHERE clause and generates
- virtual machine code to run queries efficiently. This file is
- sometimes called the "query optimizer". It has its own private
- header file, whereInt.h, that defines data objects used internally.
-
- * **btree.c** - This file contains the implementation of the B-Tree
- storage engine used by SQLite.
-
- * **pager.c** - This file contains the "pager" implementation, the
- module that implements transactions.
-
- * **os_unix.c** and **os_win.c** - These two files implement the interface
- between SQLite and the underlying operating system using the run-time
- pluggable VFS interface.
-
- * **shell.c** - This file is not part of the core SQLite library. This
- is the file that, when linked against sqlite3.a, generates the
- "sqlite3.exe" command-line shell.
-
- * **tclsqlite.c** - This file implements the Tcl bindings for SQLite. It
- is not part of the core SQLite library. But as most of the tests in this
- repository are written in Tcl, the Tcl language bindings are important.
-
-There are many other source files. Each has a suscinct header comment that
-describes its purpose and role within the larger system.
-
-
-## Contacts
-
-The main SQLite webpage is [http://www.sqlite.org/](http://www.sqlite.org/)
-with geographically distributed backup servers at
-[http://www2.sqlite.org/](http://www2.sqlite.org) and
-[http://www3.sqlite.org/](http://www3.sqlite.org).
diff --git a/VERSION b/VERSION
index afad818663..861845e450 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.11.0
+3.15.2
diff --git a/autoconf/Makefile.am b/autoconf/Makefile.am
index 0e09cfcd95..e8211596d9 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 0be42b4e5f..b53e2370eb 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)
+shell: $(SQLITE3EXE)
-libsqlite3.lib: $(LIBOBJ)
- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(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)
+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 2d6db4f07f..6e62a4e138 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 9492530680..b9a11aac8f 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 8df0af6195..7fca05b2e7 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 803c5ea81d..90011bb15f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -51,6 +51,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 ec79279fdf..b130e22aee 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 sqlcipher 3.11.0.
+# Generated by GNU Autoconf 2.69 for sqlcipher 3.15.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlcipher'
PACKAGE_TARNAME='sqlcipher'
-PACKAGE_VERSION='3.11.0'
-PACKAGE_STRING='sqlcipher 3.11.0'
+PACKAGE_VERSION='3.15.2'
+PACKAGE_STRING='sqlcipher 3.15.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -773,11 +773,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
@@ -1331,7 +1334,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 sqlcipher 3.11.0 to adapt to many kinds of systems.
+\`configure' configures sqlcipher 3.15.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1396,7 +1399,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sqlcipher 3.11.0:";;
+ short | recursive ) echo "Configuration of sqlcipher 3.15.2:";;
esac
cat <<\_ACEOF
@@ -1424,11 +1427,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:
@@ -1527,7 +1533,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sqlcipher configure 3.11.0
+sqlcipher configure 3.15.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1946,7 +1952,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 sqlcipher $as_me 3.11.0, which was
+It was created by sqlcipher $as_me 3.15.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -11642,7 +11648,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"
@@ -12277,6 +12283,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 \
@@ -12845,6 +12865,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.
@@ -13016,6 +13074,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
@@ -13601,7 +13673,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 sqlcipher $as_me 3.11.0, which was
+This file was extended by sqlcipher $as_me 3.15.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -13667,7 +13739,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="\\
-sqlcipher config.status 3.11.0
+sqlcipher 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 9a1fe1a415..1452aaa4da 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...)
@@ -381,6 +381,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 \
@@ -621,6 +635,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],
@@ -662,6 +700,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 b16e35960e..114526f372 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 @@ Theory of Operation
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 @@ Command Line Options
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 @@ The Parser Interface
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 @@
The Parser Interface
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 @@
The Parser Interface
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 @@ Differences With YACC and BISON
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 @@
Input File Syntax
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 @@
Grammar Rules
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 @@
Grammar Rules
-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 @@
Grammar Rules
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 @@
Grammar Rules
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 @@
Grammar Rules
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 @@
Precedence Rules
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 @@ Special Directives
%default_destructor
%default_type
%destructor
+%endif
%extra_argument
+%fallback
+%ifdef
+%ifndef
%include
%left
%name
@@ -530,49 +544,57 @@ Special Directives
%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 @@
The %destructor directive
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 @@ The %extra_argument directive
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 @@
The %include directive
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 @@ The %left directive
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
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 @@ The %parse_accept directive
}
-
+
The %parse_failure directive
The %parse_failure directive specifies a block of C code that
@@ -737,12 +813,15 @@
The %parse_failure directive
}
+
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 @@
The %stack_overflow directive
list ::= .
+
The %stack_size directive
If stack overflow is a problem and you can't resolve the trouble
@@ -783,6 +863,7 @@
The %stack_size directive
%stack_size 2000
+
The %start_symbol directive
By default, the start-symbol for the grammar that Lemon generates
@@ -793,6 +874,7 @@
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_destructor directive
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 @@
The %token_prefix directive
#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 @@
The %token_type and %type directives
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 @@
The %token_type and %type directives
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 @@
Error Processing
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 @@ Error Processing
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.