diff --git a/manifest b/manifest index e7c415ad2b..efd82a70ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revert\slinking\sthe\sshell\sto\sthe\sdll\sfor\sreasons\sexplained\sin\snew\smakefile\scomments.\sMove\sthe\s--with-debug\sconfigure\sflag\sinto\sthe\sdeveloper\soptions\sset\sand\sadd\scommentary\sabout\swhy\sit\sshould\snever\sbe\sused\sfor\sproduction\sbuilds. -D 2024-11-19T17:41:13.115 +C Merge\strunk\sinto\sthis\sbranch.\sFix\sa\ssmall\sjimtcl/tclsh\sregex\sincompatibility\sin\smkccode.tcl. +D 2024-11-19T19:16:58.734 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -2135,7 +2135,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a -F tool/mkccode.tcl 4cb8ad7e7330aaed052b0657a1bfacbc67103c400e41860aff643a482cfc2d3e x +F tool/mkccode.tcl 0e7488b7218128271b93a4b16e60a169097b6cb555446ce4d6a131be039bb536 x F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a @@ -2178,7 +2178,7 @@ F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60 F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b -F tool/sqlite3_analyzer.c.in 348ba349bbdc93c9866439f9f935d7284866a2a4e6898bc906ae1204ade56918 +F tool/sqlite3_analyzer.c.in 39690af454d2866e87e2b475ec5eabee366f211f2307e90b918345f35bb1a643 F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 -R 0effbfea81177717d860b06a74ce79d8 +P 7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf 7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 +R 0da2647f2e208e5fa5304d40f71239b4 U stephan -Z aa386346708361b0b61a6d6560bd2986 +Z bed720f65fe4f336de4e69b585a4a039 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2cf57950de..d9f567ad70 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf +7fb3ebfec634e0508267049fddb2b513201dbefce4d378ca3ec261c5d8336d7f diff --git a/tool/mkccode.tcl b/tool/mkccode.tcl index e847c8d3b8..b95f0c679d 100755 --- a/tool/mkccode.tcl +++ b/tool/mkccode.tcl @@ -6,7 +6,7 @@ # # Usage example: # -# tclsh mkccode.tcl demoapp.c.in >demoapp.c +# tclsh mkccode.tcl -DENABLE_FEATURE_XYZ demoapp.c.in >demoapp.c # # The demoapp.c.in file contains a mixture of C code, TCL script, and # processing directives used by mktclsqliteprog.tcl to build the final C-code @@ -33,29 +33,63 @@ # then all of the text in the input file is converted into C-language # string literals. # +# IFDEF macro +# IFNDEF macro +# ELSE +# ENDIF +# +# The text from "IFDEF macro" down to the next ELSE or ENDIF is +# included only if -Dmacro appears as a command-line argument. +# The "IFNDEF macro" simply inverts the initial test. +# # None of the control directives described above will nest. Only the # top-level input file ("demoapp.c.in" in the example) is interpreted. # referenced files are copied verbatim. # -if {[llength $argv]!=1} { - puts stderr "Usage: $argv0 TEMPLATE >OUTPUT" +proc usage {} { + puts stderr "Usage: $::argv0 \[OPTIONS\] TEMPLATE >OUTPUT" exit 1 } -set infile [lindex $argv 0] +set infile {} +foreach ax $argv { + if {[string match -D* $ax]} { + if {[string match *=* $ax]} { + regexp -- {-D([^=]+)=(.*)} $ax all name value + set DEF($name) $value + } else { + set DEF([string range $ax 2 end]) 1 + } + continue + } + if {[string match -* $ax]} { + puts stderr "$::argv0: Unknown option \"$ax\"" + usage + } + if {$infile!=""} { + puts stderr "$::argv0: Surplus argument: \"$ax\"" + usage + } + set infile $ax +} set ROOT [file normalize [file dir $argv0]/..] set HOME [file normalize [file dir $infile]] set in [open $infile rb] puts [subst {/* DO NOT EDIT ** -** This file was generated by \"$argv0 $infile\". +** This file was generated by \"$argv0 $argv\". ** To make changes, edit $infile then rerun the generator ** command. */}] set instr 0 +set omit {} +set nomit 0 +set ln 0 while {1} { set line [gets $in] + incr ln if {[eof $in]} break if {[regexp {^INCLUDE (.*)} $line all path]} { + if {$nomit>0 && [string match *1* $omit]} continue if {0} { # https://github.com/msteveb/jimtcl/issues/320 regsub {^\$ROOT\y} $path $ROOT path @@ -91,10 +125,43 @@ while {1} { puts "/* END_STRING */" continue } - if {$instr} { + if {[regexp {^IFNDEF +([A-Za-z_]+)} $line all name]} { + set omit $omit[info exists DEF($name)] + incr nomit + continue + } + if {[regexp {^IFDEF +([A-Za-z_]+)} $line all name]} { + set omit $omit[expr {![info exists DEF($name)]}] + incr nomit + continue + } + if {[regexp {^ELSE} $line]} { + if {!$nomit} { + puts stderr "$infile:$ln: ELSE without a prior IFDEF" + exit 1 + } + set omit [string range $omit 0 end-1][expr {![string index $omit end]}] + continue + } + if {[regexp {^ENDIF} $line]} { + if {!$nomit} { + puts stderr "$infile:$ln: ENDIF without a prior IFDEF" + exit 1 + } + incr nomit -1 + set omit [string range $omit 0 [expr {$nomit-1}]] + continue + } + if {$nomit>0 && [string match *1* $omit]} { + # noop + } elseif {$instr} { set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line] puts "\"$x\\n\"" } else { puts $line } } +if {$nomit} { + puts stderr "$infile:$ln: One or more unterminated IFDEFs" + exit 1 +} diff --git a/tool/sqlite3_analyzer.c.in b/tool/sqlite3_analyzer.c.in index 1c9fc836a1..a934f05700 100644 --- a/tool/sqlite3_analyzer.c.in +++ b/tool/sqlite3_analyzer.c.in @@ -3,6 +3,7 @@ ** text on standard output. */ #define TCLSH_INIT_PROC sqlite3_analyzer_init_proc +IFNDEF SQLITE_ENABLE_DBSTAT_VTAB #define SQLITE_ENABLE_DBSTAT_VTAB 1 #undef SQLITE_THREADSAFE #define SQLITE_THREADSAFE 0 @@ -14,9 +15,10 @@ #define SQLITE_DEFAULT_MEMSTATUS 0 #define SQLITE_MAX_EXPR_DEPTH 0 #define SQLITE_OMIT_LOAD_EXTENSION 1 -#if !defined(SQLITE_AMALGAMATION) && !defined(USE_EXTERNAL_SQLITE) INCLUDE sqlite3.c -#endif +ELSE +#include "sqlite3.h" +ENDIF INCLUDE $ROOT/src/tclsqlite.c #if defined(_WIN32)