Index: third_party/sqlite/src/tool/vdbe-compress.tcl |
diff --git a/third_party/sqlite/src/tool/vdbe-compress.tcl b/third_party/sqlite/src/tool/vdbe-compress.tcl |
index 3bcff9e5f0b3da01bdb873714f2d9e51602d6761..9477f4afe62a4aaaec5265faf6f3a96d0af66741 100644 |
--- a/third_party/sqlite/src/tool/vdbe-compress.tcl |
+++ b/third_party/sqlite/src/tool/vdbe-compress.tcl |
@@ -13,7 +13,7 @@ |
# Script usage: |
# |
# mv vdbe.c vdbe.c.template |
-# tclsh vdbe-compress.tcl <vdbe.c.template >vdbe.c |
+# tclsh vdbe-compress.tcl $CFLAGS <vdbe.c.template >vdbe.c |
# |
# Modifications made: |
# |
@@ -42,6 +42,16 @@ set unionDef {} ;# C code of the union |
set afterUnion {} ;# C code after the union |
set sCtr 0 ;# Context counter |
+# If the SQLITE_SMALL_STACK compile-time option is missing, then |
+# this transformation becomes a no-op. |
+# |
+if {![regexp {SQLITE_SMALL_STACK} $argv]} { |
+ while {![eof stdin]} { |
+ puts [gets stdin] |
+ } |
+ exit |
+} |
+ |
# Read program text up to the spot where the union should be |
# inserted. |
# |
@@ -79,6 +89,9 @@ while {![eof stdin]} { |
append unionDef " $line\n" |
append afterUnion $line\n |
lappend vlist $vname |
+ } elseif {[regexp {^#(if|endif)} $line] && [llength $vlist]>0} { |
+ append unionDef "$line\n" |
+ append afterUnion $line\n |
} else { |
break |
} |
@@ -97,6 +110,11 @@ while {![eof stdin]} { |
foreach v $vlist { |
regsub -all "(\[^a-zA-Z0-9>.\])${v}(\\W)" $line "\\1u.$sname.$v\\2" line |
regsub -all "(\[^a-zA-Z0-9>.\])${v}(\\W)" $line "\\1u.$sname.$v\\2" line |
+ |
+ # The expressions above fail to catch instance of variable "abc" in |
+ # expressions like (32>abc). The following expression makes those |
+ # substitutions. |
+ regsub -all "(\[^-\])>${v}(\\W)" $line "\\1>u.$sname.$v\\2" line |
} |
append afterUnion [string trimright $line]\n |
} elseif {$line=="" && [eof stdin]} { |