From a1bc2ad6ce1cfea9e36855ba4766d1b62f57e2ba Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 25 Oct 2024 03:56:09 +0000 Subject: [PATCH] Docs related to the -array defs-dump option. Rename some internal-use hwaci-common.tcl APIs after discovering that a - as a symbol suffix fails for var derefs (but works for procs calls). FossilOrigin-Name: 0d5da3888e79166fec560554a921e2ef4290558e988144465f1ea7138ca263a3 --- auto.def | 6 ++++-- autosetup/hwaci-common.tcl | 38 +++++++++++++++++++++++++++----------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/auto.def b/auto.def index 84859575fe..c403ee1ad7 100644 --- a/auto.def +++ b/auto.def @@ -989,16 +989,18 @@ if {"" ne $oFF} { } unset oFF +# Demonstrate (mis?)handling of spaces in JSON-export array values: +# define-append OPT_FOO.list {"-DFOO=bar baz" -DBAR="baz barre"} define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS] define OPT_SHELL.list [get-define OPT_SHELL] - hwaci-dump-defs-json config-defs.json \ -bare {SIZEOF_* HAVE_DECL_*} \ -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTOREMAKE TARGET_* USE_GCOV TCL_*} \ -array {*.list} \ -auto {OPT_* PACKAGE_* HAVE_*} \ -none * - +undefine OPT_FEATURE_FLAGS.list +undefine OPT_SHELL.list ######################################################################## # Some build-dev/debug-only output diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index deb94ed986..bab05264f3 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -12,7 +12,7 @@ # Routines for Steve Bennett's autosetup which are common to trees # managed in and around the umbrella of the SQLite project. # -# Routines with a suffix of - are intended for internal use, +# Routines with a suffix of _ are intended for internal use, # within this file, and are not part of the API which auto.def files # should rely on. # @@ -41,7 +41,10 @@ # updating global state via feature tests. ######################################################################## -array set hwaci {} +######################################################################## +# $hwaci is an internal-use-only array for storing whatever generic +# internal stuff we need stored. +array set hwaci_ {} proc hwaci-warn {msg} { puts stderr "WARNING: $msg" @@ -54,13 +57,13 @@ proc hwaci-fatal {msg} { } ######################################################################## -# hwaci-lshift- shifts $count elements from the list named $listVar and +# hwaci-lshift_ shifts $count elements from the list named $listVar and # returns them. # # Modified slightly from: https://wiki.tcl-lang.org/page/lshift # # On an empty list, returns "". -proc hwaci-lshift- {listVar {count 1}} { +proc hwaci-lshift_ {listVar {count 1}} { upvar 1 $listVar l if {![info exists l]} { # make the error message show the real variable name @@ -262,9 +265,9 @@ proc hwaci-opt-define-bool {args} { set invert 1 set args [lrange $args 1 end] } - set optName [hwaci-lshift- args] - set defName [hwaci-lshift- args] - set descr [hwaci-lshift- args] + set optName [hwaci-lshift_ args] + set defName [hwaci-lshift_ args] + set descr [hwaci-lshift_ args] if {"" eq $descr} { set descr $defName } @@ -828,10 +831,11 @@ proc hwaci-defs-format- {type value} { } ######################################################################## -# This function works almost identically to autosetup's make-config-header -# but emits its output in JSON form. It is not a fully-functional JSON -# emitter, and emit broken JSON for complicated outputs, but should be -# sufficient for purposes of emitting most configure vars. +# This function works almost identically to autosetup's +# make-config-header but emits its output in JSON form. It is not a +# fully-functional JSON emitter, and will emit broken JSON for +# complicated outputs, but should be sufficient for purposes of +# emitting most configure vars (numbers and simple strings). # # In addition to the formatting flags supported by make-config-header, # it also supports: @@ -844,6 +848,18 @@ proc hwaci-defs-format- {type value} { # # "ITS_NAME": [ "value1", ...valueN ] # +# Achtung: if a given -array pattern contains values which themselves +# contains spaces... +# +# define-append foo {"-DFOO=bar baz" -DBAR="baz barre"} +# +# will lead to: +# +# ["-DFOO=bar baz", "-DBAR=\"baz", "barre\""] +# +# Neither is especially satisfactory (and the second is useless), and +# handling of such values is subject to change if any such values ever +# _really_ need to be processed by our source trees. proc hwaci-dump-defs-json {file args} { file mkdir [file dirname $file] set lines {} diff --git a/manifest b/manifest index 585a47ebe5..a40fd468aa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Experimentally\sadd\sthe\s-array\sformatting\soption\sto\shwaci-dump-defs-json\sand\semit\sOPT_FEATURE_FLAGS/OPT_SHELL\sin\sboth\sflat\sstring\sand\sarray\sforms. -D 2024-10-25T03:35:01.759 +C Docs\srelated\sto\sthe\s-array\sdefs-dump\soption.\sRename\ssome\sinternal-use\shwaci-common.tcl\sAPIs\safter\sdiscovering\sthat\sa\s-\sas\sa\ssymbol\ssuffix\sfails\sfor\svar\sderefs\s(but\sworks\sfor\sprocs\scalls). +D 2024-10-25T03:56:09.158 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def d84cacf36daca7f56099b5ea525cf0ce20ab2e635d73517fec87cd46340d7a5e +F auto.def 48411cc3e6b140d4af7ab51ce309bf1dc0d4eaace628befb261f6915994bb3c7 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -47,7 +47,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 -F autosetup/hwaci-common.tcl 8575c29133e3bec015915965940812fe07196b67a88a47f3f5473dace4dab43f +F autosetup/hwaci-common.tcl 3f1653580ed9256c186c14264e50f8d7fb03e5a21b1790fccad173515d162b2a F autosetup/jimsh0.c eb49d62a5b28b4d3b2af10cdfa5dc972ed76e8474fd773cdc7266e768c746f6d F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb @@ -2237,8 +2237,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 800b083c3a55a990bd5b7fd587e24144b0084a394f9cf8160c3aa0a6880f8053 -R f436110a36bf2e585da07552c226e8eb +P ce6bc4603c27952ca44ff55c81dd50a04b0f6ef8f198720ee0da3aff4c291449 +R 38a7ffa837a034a8e4135985ac058125 U stephan -Z 22976a2d67fb47f3aec5f8d0ffbf3d71 +Z 7fac80295cd944d4b161bf97831f53d2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 73963d7ab3..f8dd8bc4e7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce6bc4603c27952ca44ff55c81dd50a04b0f6ef8f198720ee0da3aff4c291449 +0d5da3888e79166fec560554a921e2ef4290558e988144465f1ea7138ca263a3 -- 2.47.2