diff options
author | stephan <stephan@noemail.net> | 2025-04-07 02:16:26 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-04-07 02:16:26 +0000 |
commit | d2b9cc099d66fe220eb1c4883f865ec94cb37f52 (patch) | |
tree | e58b05a865f5d557bb764ce6c4a70928dfb14f39 /autosetup | |
parent | 7d83ed04b11e7b7353f161f2ab706b4b88ec3c92 (diff) | |
download | sqlite-d2b9cc099d66fe220eb1c4883f865ec94cb37f52.tar.gz sqlite-d2b9cc099d66fe220eb1c4883f865ec94cb37f52.zip |
Rename proj-current-proc-name to proj-current-scope and have it distinguish between global scope and an invalid scope level.
FossilOrigin-Name: 1c7e5b6cab0f8c8d8ae4a1503ea04f2c65943b0788f3996c015fc163ae979a66
Diffstat (limited to 'autosetup')
-rw-r--r-- | autosetup/proj.tcl | 21 | ||||
-rw-r--r-- | autosetup/sqlite-config.tcl | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index f17ee37e8..bfe21e5f6 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -85,7 +85,7 @@ proc proj-warn {args} { # Emits an error message to stderr and exits with non-0. proc proj-fatal {args} { show-notices - puts stderr "ERROR: \[[proj-current-proc-name 1]]: $args" + puts stderr "ERROR: \[[proj-current-scope 1]]: $args" exit 1 } @@ -1413,20 +1413,23 @@ proc proj-get-env {var {dflt ""}} { } ######################################################################## -# @proj-current-proc-name +# @proj-current-scope ?lvl? # # Returns the name of the _calling_ proc from ($lvl + 1) levels up the # call stack (where the caller's level will be 1 up from _this_ -# call). If $lvl would resolve to global scope (or lower) then "global -# scope" is returned. -proc proj-current-proc-name {{lvl 0}} { +# call). If $lvl would resolve to global scope "global scope" is +# returned and if it would be negative then a string indicating such +# is returned (as opposed to throwing an error). +proc proj-current-scope {{lvl 0}} { #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} set ilvl [info level] - set offset [expr {-$lvl - 1}] - if {[expr {$ilvl + $offset}] <= 0} { + set offset [expr {$ilvl - $lvl - 1}] + if { $offset < 0} { + return "invalid scope ($offset)" + } elseif { $offset == 0} { return "global scope" } else { - return lindex [info level $offset] 0 + return [lindex [info level $offset] 0] } } @@ -1549,7 +1552,7 @@ proc proj-dot-ins-append {fileIn args} { proj-fatal "Too many arguments: $fileIn $args" } } - #puts "******* [proj-current-proc-name]: adding $fileIn" + #puts "******* [proj-current-scope]: adding $fileIn" lappend ::proj_(dot-in-files) $fileIn } diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 442039a78..2ab8508a8 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -544,7 +544,7 @@ proc msg-debug {msg} { # the debug message. It is not legal to call this from the global # scope. proc proc-debug {msg} { - msg-debug "\[[proj-current-proc-name 1]\]: $msg" + msg-debug "\[[proj-current-scope 1]\]: $msg" } define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags. |