1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Merge all recent enhancements from trunk.

FossilOrigin-Name: f3f9200115caf4b356f90ec97c351d1afbcb9bf6
This commit is contained in:
drh
2016-02-02 02:22:30 +00:00
79 changed files with 3330 additions and 1132 deletions

View File

@ -729,8 +729,10 @@ GOTO no_errors
GOTO :EOF
:fn_UnsetVariable
IF NOT "%1" == "" (
SET %1=
SET VALUE=%1
IF DEFINED VALUE (
SET %VALUE%=
SET VALUE=
CALL :fn_ResetErrorLevel
)
GOTO :EOF

View File

@ -34,14 +34,14 @@ set -e
ARTIFACT=`printf "3%.2d%.2d%.2d" $xx $yy $zz`
rm -rf $TMPSPACE
cp -R $TOP/autoconf $TMPSPACE
cp sqlite3.c $TMPSPACE
cp sqlite3.h $TMPSPACE
cp sqlite3ext.h $TMPSPACE
cp $TOP/sqlite3.1 $TMPSPACE
cp $TOP/sqlite3.pc.in $TMPSPACE
cp $TOP/src/shell.c $TMPSPACE
cp -R $TOP/autoconf $TMPSPACE
cp sqlite3.c $TMPSPACE
cp sqlite3.h $TMPSPACE
cp sqlite3ext.h $TMPSPACE
cp $TOP/sqlite3.1 $TMPSPACE
cp $TOP/sqlite3.pc.in $TMPSPACE
cp $TOP/src/shell.c $TMPSPACE
cp $TOP/src/sqlite3.rc $TMPSPACE
cat $TMPSPACE/configure.ac |
sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp

98
tool/mkmsvcmin.tcl Normal file
View File

@ -0,0 +1,98 @@
#!/usr/bin/tcl
#
# This script reads the regular MSVC makefile (../Makefile.msc) and outputs
# a revised version of that Makefile that is "minimal" in the sense that
# it uses the sqlite3.c amalgamation as input and does not require tclsh.
# The resulting "../Makefile.min.msc" is suitable for use in the amalgamation
# tarballs.
#
if {$argc==0} {
set basedir [file dir [file dir [file normalize $argv0]]]
set fromFileName [file join $basedir Makefile.msc]
set toFileName [file join $basedir autoconf Makefile.msc]
} else {
set fromFileName [lindex $argv 0]
if {![file exists $fromFileName]} {
error "input file \"$fromFileName\" does not exist"
}
set toFileName [lindex $argv 1]
if {[file exists $toFileName]} {
error "output file \"$toFileName\" already exists"
}
}
proc readFile { fileName } {
set file_id [open $fileName RDONLY]
fconfigure $file_id -encoding binary -translation binary
set result [read $file_id]
close $file_id
return $result
}
proc writeFile { fileName data } {
set file_id [open $fileName {WRONLY CREAT TRUNC}]
fconfigure $file_id -encoding binary -translation binary
puts -nonewline $file_id $data
close $file_id
return ""
}
proc escapeSubSpec { data } {
regsub -all -- {&} $data {\\\&} data
regsub -all -- {\\(\d+)} $data {\\\\\1} data
return $data
}
proc substVars { data } {
return [uplevel 1 [list subst -nocommands -nobackslashes $data]]
}
#
# NOTE: This block is used to replace the section marked <<block1>> in
# the Makefile, if it exists.
#
set blocks(1) [string trimleft [string map [list \\\\ \\] {
_HASHCHAR=^#
!IF ![echo !IFNDEF VERSION > rcver.vc] && \\
![for /F "delims=" %V in ('type "$(SQLITE3H)" ^| find "$(_HASHCHAR)define SQLITE_VERSION "') do (echo VERSION = ^^%V >> rcver.vc)] && \\
![echo !ENDIF >> rcver.vc]
!INCLUDE rcver.vc
!ENDIF
RESOURCE_VERSION = $(VERSION:^#=)
RESOURCE_VERSION = $(RESOURCE_VERSION:define=)
RESOURCE_VERSION = $(RESOURCE_VERSION:SQLITE_VERSION=)
RESOURCE_VERSION = $(RESOURCE_VERSION:"=)
RESOURCE_VERSION = $(RESOURCE_VERSION:.=,)
$(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
echo #endif >> sqlite3rc.h
$(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
}]]
set data "#### DO NOT EDIT ####\n"
append data "# This makefile is automatically "
append data "generated from the [file tail $fromFileName] at\n"
append data "# the root of the canonical SQLite source tree (not the\n"
append data "# amalgamation tarball) using the tool/[file tail $argv0]\n"
append data "# script.\n#\n\n"
append data [readFile $fromFileName]
regsub -all -- {# <<mark>>\n.*?# <</mark>>\n} \
$data "" data
foreach i [lsort -integer [array names blocks]] {
regsub -all -- [substVars \
{# <<block${i}>>\n.*?# <</block${i}>>\n}] \
$data [escapeSubSpec $blocks($i)] data
}
set data [string map [list " -I\$(TOP)\\src" ""] $data]
set data [string map [list " /DEF:sqlite3.def" ""] $data]
set data [string map [list " sqlite3.def" ""] $data]
set data [string map [list " \$(ALL_TCL_TARGETS)" ""] $data]
set data [string map [list "\$(TOP)\\src\\" "\$(TOP)\\"] $data]
writeFile $toFileName $data

View File

@ -19,7 +19,7 @@ puts "#else"
puts "# define OpHelp(X)"
puts "#endif"
puts "const char *sqlite3OpcodeName(int i)\173"
puts " static const char *const azName\[\] = \173 \"?\","
puts " static const char *const azName\[\] = \173"
set mx 0
set in [open [lindex $argv 0] rb]
@ -40,7 +40,7 @@ while {![eof $in]} {
}
close $in
for {set i 1} {$i<=$mx} {incr i} {
for {set i 0} {$i<=$mx} {incr i} {
puts [format " /* %3d */ %-18s OpHelp(\"%s\")," \
$i \"$label($i)\" $synopsis($i)]
}

View File

@ -81,8 +81,8 @@ while {![eof $in]} {
set in1($name) 0
set in2($name) 0
set in3($name) 0
set out1($name) 0
set out2($name) 0
set out3($name) 0
for {set i 3} {$i<[llength $line]-1} {incr i} {
switch [string trim [lindex $line $i] ,] {
same {
@ -112,16 +112,19 @@ while {![eof $in]} {
# Assign numbers to all opcodes and output the result.
#
set cnt 0
set max 0
puts "/* Automatically generated. Do not edit */"
puts "/* See the tool/mkopcodeh.tcl script for details */"
set op(OP_Noop) -1
set order($nOp) OP_Noop
incr nOp
set op(OP_Explain) -1
set order($nOp) OP_Explain
incr nOp
foreach name {OP_Noop OP_Explain} {
set jump($name) 0
set in1($name) 0
set in2($name) 0
set in3($name) 0
set out2($name) 0
set out3($name) 0
set op($name) -1
set order($nOp) $name
incr nOp
}
# The following are the opcodes that are processed by resolveP2Values()
#
@ -144,7 +147,7 @@ set rp2v_ops {
# Assign small values to opcodes that are processed by resolveP2Values()
# to make code generation for the switch() statement smaller and faster.
#
set cnt 0
set cnt -1
for {set i 0} {$i<$nOp} {incr i} {
set name $order($i)
if {[lsearch $rp2v_ops $name]>=0} {
@ -169,7 +172,7 @@ for {set i 0} {$i<$nOp} {incr i} {
}
}
set max $cnt
for {set i 1} {$i<=$nOp} {incr i} {
for {set i 0} {$i<$nOp} {incr i} {
if {![info exists used($i)]} {
set def($i) "OP_NotUsed_$i"
}
@ -196,27 +199,28 @@ for {set i 1} {$i<=$nOp} {incr i} {
# Generate the bitvectors:
#
set bv(0) 0
for {set i 1} {$i<=$max} {incr i} {
for {set i 0} {$i<=$max} {incr i} {
set name $def($i)
if {[info exists jump($name)] && $jump($name)} {set a0 1} {set a0 0}
if {[info exists in1($name)] && $in1($name)} {set a1 2} {set a1 0}
if {[info exists in2($name)] && $in2($name)} {set a2 4} {set a2 0}
if {[info exists in3($name)] && $in3($name)} {set a3 8} {set a3 0}
if {[info exists out2($name)] && $out2($name)} {set a4 16} {set a4 0}
if {[info exists out3($name)] && $out3($name)} {set a5 32} {set a5 0}
set bv($i) [expr {$a0+$a1+$a2+$a3+$a4+$a5}]
set x 0
if {$jump($name)} {incr x 1}
if {$in1($name)} {incr x 2}
if {$in2($name)} {incr x 4}
if {$in3($name)} {incr x 8}
if {$out2($name)} {incr x 16}
if {$out3($name)} {incr x 32}
set bv($i) $x
}
puts ""
puts "/* Properties such as \"out2\" or \"jump\" that are specified in"
puts "** comments following the \"case\" for each opcode in the vdbe.c"
puts "** are encoded into bitvectors as follows:"
puts "*/"
puts "#define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */"
puts "#define OPFLG_IN1 0x0002 /* in1: P1 is an input */"
puts "#define OPFLG_IN2 0x0004 /* in2: P2 is an input */"
puts "#define OPFLG_IN3 0x0008 /* in3: P3 is an input */"
puts "#define OPFLG_OUT2 0x0010 /* out2: P2 is an output */"
puts "#define OPFLG_OUT3 0x0020 /* out3: P3 is an output */"
puts "#define OPFLG_JUMP 0x01 /* jump: P2 holds jmp target */"
puts "#define OPFLG_IN1 0x02 /* in1: P1 is an input */"
puts "#define OPFLG_IN2 0x04 /* in2: P2 is an input */"
puts "#define OPFLG_IN3 0x08 /* in3: P3 is an input */"
puts "#define OPFLG_OUT2 0x10 /* out2: P2 is an output */"
puts "#define OPFLG_OUT3 0x20 /* out3: P3 is an output */"
puts "#define OPFLG_INITIALIZER \173\\"
for {set i 0} {$i<=$max} {incr i} {
if {$i%8==0} {