From 34b1f2b2b815a1e16f6fa1f644bc3eb7a1196abc Mon Sep 17 00:00:00 2001 From: larrybr Date: Thu, 2 Sep 2021 16:29:53 +0000 Subject: [PATCH] Get shell.c maker acceptable to TCL v8.4 and minor tweaks FossilOrigin-Name: c60f4f90c954eee6a2b644c50aca9a4ed7616d89177fd1c6acb997a362d9abff --- manifest | 14 ++++---- manifest.uuid | 2 +- src/shell.c.in | 3 -- tool/mkshellc.tcl | 82 ++++++++++++++++++++++------------------------- 4 files changed, 47 insertions(+), 54 deletions(-) diff --git a/manifest b/manifest index c527c93e5e..8e9aaf466e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Meld\s-safe\soption\sinto\sCLI -D 2021-09-02T01:21:14.704 +C Get\sshell.c\smaker\sacceptable\sto\sTCL\sv8.4\sand\sminor\stweaks +D 2021-09-02T16:29:53.220 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -545,7 +545,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c F src/resolve.c 42b94d37a54200707a95566eff4f7e8a380e32d080016b699f23bd79a73a5028 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/select.c 63077c0243ded1432d97c90c1a4c3419b3a574b36634c674599a68bfe4c3bdc2 -F src/shell.c.in 16e84ce4dc4c538fe9b2759b1c1ea7e5923e5f297691a4b97bf1ef9528541b31 +F src/shell.c.in 729b233614ebf5e3a7f7ca1fcbefd0043439192962ae200e41822b2de88dcada F src/sqlite.h.in 43fcf0fe2af04081f420a906fc020bde1243851ba44b0aa567a27f94bf8c3145 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510 @@ -1854,7 +1854,7 @@ F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61 F tool/mkopcodeh.tcl 130b88697da6ec5b89b41844d955d08fb62c2552e889dec8c7bcecb28d8f50bd F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa F tool/mkpragmatab.tcl 7f6db47d1995bc08247255622524567b2ab8962d98063f8aef97e35c3c54e3b8 -F tool/mkshellc.tcl 16236d081adb274a95ed424fde56cd0d535fb2c659128ecc5b70becd4a9b63b8 +F tool/mkshellc.tcl 03939222e3291b96cf1fffe989ce2425c0964e49ea5975c7dc7d3f8b6deadf6d F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f @@ -1920,7 +1920,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dd356ace4ffa57518c16fa7fd9b6bc7bef0bb0ddcbc9bdf60ab0a17c25f8e5c0 -R bde6c7d36d347a265cfb3284dd778d5f +P c7c84998dbec5dfd71d62e12cfa741edba4b6439cc384ab46b21199f290feedd +R 6e2e47da720de4d046b66bea83d7e73e U larrybr -Z ac16bca9a518d5a67bb303386dbab385 +Z fb4c46974e0f94bf6d79643019372d05 diff --git a/manifest.uuid b/manifest.uuid index 440abb6081..9b150efcd7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c7c84998dbec5dfd71d62e12cfa741edba4b6439cc384ab46b21199f290feedd \ No newline at end of file +c60f4f90c954eee6a2b644c50aca9a4ed7616d89177fd1c6acb997a362d9abff \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 7ba35838f8..5e8e25eedc 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -10780,9 +10780,6 @@ static int do_meta_command(char *zLine, ShellState *p){ } }else #endif - - if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){ - }else /* The meta-command is not among the specially handled ones. Dispatch it. */ { int dispatchResult = dispatchCommand(azArg, nArg, p); diff --git a/tool/mkshellc.tcl b/tool/mkshellc.tcl index 0a5c0ad739..d8abac6c2f 100644 --- a/tool/mkshellc.tcl +++ b/tool/mkshellc.tcl @@ -72,12 +72,12 @@ if {[llength $infiles] == 0} { } fconfigure $in -translation binary -set ::cmd_help [dict create] -set ::cmd_dispatch [dict create] -set ::cmd_condition [dict create] -set ::inc_type_files [dict create] +array set ::cmd_help {} +array set ::cmd_dispatch {} +array set ::cmd_condition {} +array set ::inc_type_files {} set ::iShuffleErrors 0 -regexp {(\{)(\})} "{}" ma ::lb ::rb ; # Ease use of { and }. +regexp {(\{)(\})} "{}" ma ::lb ::rb ; # Ease use of { and } in literals. # Setup dispatching function signature and table entry struct . # The effect of these key/value pairs is as this --parameters output says: @@ -102,7 +102,7 @@ set ::parametersHelp { of $cmd and $arg# variables is done by Tcl evaluation (via subst), allowing a wide range of logic to be employed in the derivation of effective values. } -set ::dispCfg [dict create \ +array set ::dispCfg [list \ RETURN_TYPE int \ STORAGE_CLASS static \ ARGS_SIGNATURE "char *\$arg4\\\[\\\], int \$arg5, ShellState *\$arg6" \ @@ -117,12 +117,6 @@ set ::dispCfg [dict create \ # Variables $cmd and $arg# (where # = 0 .. DC_ARG_COUNT-1) have values # when ARGS_SIGNATURE, DISPATCH_ENTRY, and DISPATCHEE_NAME are evaluated. -# proc dump_cfg {} { -# foreach k [dict keys $::dispCfg] { -# puts stderr "$k=[dict get $::dispCfg $k]" -# } -# } - proc condition_command {cmd pp_expr} { if {[regexp {^(!)?defined\(\s*(\w+)\s*\)} $pp_expr ma bang pp_var]} { if {$bang eq "!"} { @@ -133,13 +127,13 @@ proc condition_command {cmd pp_expr} { } else { set pp_expr "#if [string trim $pp_expr]" } - dict set ::cmd_condition $cmd $pp_expr + set ::cmd_condition($cmd) $pp_expr } proc emit_conditionally {cmd lines ostrm {indent ""}} { - set wrapped [dict exists $::cmd_condition $cmd] + set wrapped [info exists ::cmd_condition($cmd)] if {$wrapped} { - puts $ostrm [dict get $::cmd_condition $cmd] + puts $ostrm $::cmd_condition($cmd) } if {[regexp {^\s*(\d+)\s*$} $indent ma inum]} { set lead [string repeat " " $inum] @@ -154,7 +148,7 @@ proc emit_conditionally {cmd lines ostrm {indent ""}} { } } -# Convert list of help text lines into a dict. +# Convert list of help text lines into a key-value list. # Keys are the command names. Values are the help for the # commands as a list of lines, with .* logically first. # Any #if... #endif structures are maintained and do not @@ -163,14 +157,14 @@ proc emit_conditionally {cmd lines ostrm {indent ""}} { # (The effect of this is to defeat sorting by command if # help for multiple commands' is within one conditional.) proc chunkify_help {htin} { - set rv [dict create] + array set rv [list] set if_depth 0 set cmd_seen "" set chunk {} foreach htx $htin { if {[regexp {^\s*\"\.\w} $htx] && $cmd_seen ne "" && $if_depth == 0} { # Flush accumulated chunk. - dict set rv $cmd_seen $chunk + set rv($cmd_seen) $chunk set cmd_seen "" set chunk {} } @@ -193,13 +187,13 @@ proc chunkify_help {htin} { } else { if {$cmd_seen ne "" && [llength $chunk] > 0} { # Flush accumulated chunk. - dict set rv $cmd_seen $chunk + set rv($cmd_seen) $chunk } elseif {$cmd_seen ne "" || [llength $chunk] > 0} { puts stderr "Orphaned help: '$cmd_seen' [join $chunk \n]" incr ::iShuffleErrors } } - return $rv + return [array get rv] } array set ::macroTailREs [list \ @@ -236,7 +230,7 @@ proc COLLECT_DISPATCH {hFile tailCapture ostrm} { set lx [gets $hFile] while {![eof $hFile] && ![regexp {^\s*\];} $lx]} { lappend disp_frag $lx - set grabCmd [dict get $::dispCfg CMD_CAPTURE_RE] + set grabCmd $::dispCfg(CMD_CAPTURE_RE) if {![regexp $grabCmd $lx ma dcmd]} { puts stderr "malformed dispatch element:\n $lx" incr ::iShuffleErrors @@ -244,7 +238,7 @@ proc COLLECT_DISPATCH {hFile tailCapture ostrm} { puts stderr "misdeclared dispatch element:\n $lx" incr ::iShuffleErrors } else { - dict set ::cmd_dispatch $dcmd [list $lx] + set ::cmd_dispatch($dcmd) [list $lx] } set lx [gets $hFile] incr iAte @@ -286,7 +280,7 @@ proc COLLECT_HELP_TEXT {hFile tailCaptureEmpty ostrm} { incr iAte } incr iAte - set ::cmd_help [dict merge $::cmd_help [chunkify_help $help_frag]] + array set ::cmd_help [chunkify_help $help_frag] return $iAte } @@ -310,7 +304,7 @@ proc DISPATCH_CONFIG {hFile tailCaptureEmpty ostrm} { incr iAte foreach line $def_disp { if {[regexp {^\s*(\w+)=(.+)$} $line ma k v]} { - dict set ::dispCfg $k $v + set ::dispCfg($k) $v } } return $iAte @@ -331,17 +325,18 @@ proc DISPATCHABLE_COMMAND {hFile tailCapture ostrm} { incr iAte set na [llength $args] set cmd [lindex $args 0] - set naPass [dict get $::dispCfg DC_ARG_COUNT] + set naPass $::dispCfg(DC_ARG_COUNT) if {$na > $naPass} { puts stderr "Bad args: $lx" } else { while {$na < $naPass} { - if {![dict exists $::dispCfg "DC_ARG${na}_DEFAULT"]} { + set nad "DC_ARG${na}_DEFAULT" + if {![info exists ::dispCfg($nad)]} { puts stderr "Too few args: $lx (need $naPass)" incr ::iShuffleErrors break } else { - lappend args [subst [dict get $::dispCfg "DC_ARG${na}_DEFAULT"]] + lappend args [subst $::dispCfg($nad)] } incr na } @@ -356,19 +351,20 @@ proc DISPATCHABLE_COMMAND {hFile tailCapture ostrm} { set av [lindex $args $aix] if {$av eq "?"} { set ai [expr {$aix + 1}] - set av [subst [dict get $::dispCfg "DC_ARG${ai}_DEFAULT"]] + set aid "DC_ARG${ai}_DEFAULT" + set av [subst $::dispCfg($aid)] } set "arg$aix" $av } if {$cmd ne "?"} { - set rsct [dict get $::dispCfg STORAGE_CLASS] - set rsct "$rsct [dict get $::dispCfg RETURN_TYPE]" - set argexp [subst [dict get $::dispCfg ARGS_SIGNATURE]] - set fname [subst [dict get $::dispCfg DISPATCHEE_NAME]] + set rsct $::dispCfg(STORAGE_CLASS) + set rsct "$rsct $::dispCfg(RETURN_TYPE)" + set argexp [subst $::dispCfg(ARGS_SIGNATURE)] + set fname [subst $::dispCfg(DISPATCHEE_NAME)] set funcOpen "$rsct $fname\($argexp\)$::lb" - set dispEntry [subst [dict get $::dispCfg DISPATCH_ENTRY]] + set dispEntry [subst $::dispCfg(DISPATCH_ENTRY)] emit_conditionally $cmd [linsert $body 0 $funcOpen] $ostrm - dict set ::cmd_dispatch $cmd [list $dispEntry] + set ::cmd_dispatch($cmd) [list $dispEntry] } } return $iAte @@ -377,8 +373,8 @@ proc DISPATCHABLE_COMMAND {hFile tailCapture ostrm} { proc EMIT_DISPATCH {hFile tailCap ostrm} { # Emit the collected dispatch table entries, in command order, maybe # wrapped with a conditional construct as set by CONDITION_COMMAND(). - foreach cmd [lsort [dict keys $::cmd_dispatch]] { - emit_conditionally $cmd [dict get $::cmd_dispatch $cmd] $ostrm $tailCap + foreach cmd [lsort [array names ::cmd_dispatch]] { + emit_conditionally $cmd $::cmd_dispatch($cmd) $ostrm $tailCap } return 0 } @@ -386,8 +382,8 @@ proc EMIT_DISPATCH {hFile tailCap ostrm} { proc EMIT_HELP_TEXT {hFile tailCap ostrm} { # Emit the collected help text table entries, in command order, maybe # wrapped with a conditional construct as set by CONDITION_COMMAND(). - foreach htc [lsort [dict keys $::cmd_help]] { - emit_conditionally $htc [dict get $::cmd_help $htc] $ostrm $tailCap + foreach htc [lsort [array names ::cmd_help]] { + emit_conditionally $htc $::cmd_help($htc) $ostrm $tailCap } return 0 } @@ -438,7 +434,7 @@ proc transform_line {line nesting} { } elseif {$nesting == 0} { return $line } - if {[regexp {^#include "sqlite} $line]} { + if {[regexp {^#include "sqlite.*"} $line]} { return "/* $line */" } if {[regexp {^# *include "test_windirent.h"} $line]} { @@ -469,7 +465,7 @@ if {$customRun == 2} { exit 0 } elseif {$customRun == 3} { set sfd [open $argv0 r] - set macdos [dict create] + array set macdos [list] while {![eof $sfd]} { if {[regexp {^proc ([A-Z_]+\M)} [gets $sfd] ma macro]} { if {[info exists ::macroTailREs($macro)]} { @@ -477,13 +473,13 @@ if {$customRun == 2} { while {[regexp {^\s+#\s*(.+)$} [gets $sfd] ma effect]} { lappend effects " $effect" } - dict set macdos $macro [join $effects "\n"] + set macdos($macro) [join $effects "\n"] } } } close $sfd - foreach m [lsort [dict keys $macdos]] { - puts stderr "\nThe $m macro will:\n [dict get $macdos $m]" + foreach m [lsort [array names macdos]] { + puts stderr "\nThe $m macro will:\n $macdos($m)" } exit 0 } elseif {$customRun == 4} { -- 2.47.3