cmdr
Check-in [f74095b252]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cmdr::config - Fix long-standing bug in forced parameter value calculation (method 'Force'). Any error in the calculations left the flag 'myinforce' set, causing a future invokation to believe to be in a recursive call and do nothing. While this had no effect on regular operation, i.e. where the using application exits after the command, in interactive mode this disabled checks and validations for the command in question, and also retained old parameter values. Fixed by putting a try/finally around the section, resetting the flag even in the presence of errors thrown by it. cmdr::config version bumped to 1.1.1.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f74095b252d4c9dfed505229e55986ea8bd05b2f
User & Date: andreask 2014-06-17 18:27:28
Context
2014-08-15
17:52
Extended color definition code with recognition of symbolic escape code sequences. check-in: 4d0064e1b1 user: aku tags: trunk
2014-06-17
18:27
cmdr::config - Fix long-standing bug in forced parameter value calculation (method 'Force'). Any error in the calculations left the flag 'myinforce' set, causing a future invokation to believe to be in a recursive call and do nothing. While this had no effect on regular operation, i.e. where the using application exits after the command, in interactive mode this disabled checks and validations for the command in question, and also retained old parameter values. Fixed by putting a try/finally around the section, resetting the flag even in the presence of errors thrown by it. cmdr::config version bumped to 1.1.1. check-in: f74095b252 user: andreask tags: trunk
2014-06-03
20:40
cmdr::help, cmdr::pager - Moved the paging support into a separate package, for use outside of the help code. Functiomnality tweak: Linenoise not supporting querying the height does not disable paging, just goes with a default height. check-in: ff5bdec2ca user: andreask tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to config.tcl.

   262    262   	# Done in order of declaration.
   263    263   	# Any dependencies between parameter can be handled by proper
   264    264   	# declaration order.
   265    265   
   266    266   	if {$myinforce} return
   267    267   	set myinforce yes
   268    268   
   269         -	foreach name $mynames {
   270         -	    set para [dict get $mymap $name]
   271         -
   272         -	    # Ignore parameters which defer value generation until
   273         -	    # actual use, except if we are forced to compute them.
   274         -	    if {!$forcedefered && [$para defered]} continue
   275         -
   276         -	    if {!$allowinteract} {
   277         -		$para dontinteract
   278         -	    }
   279         -	    try {
   280         -		$para value
   281         -	    } trap {CMDR PARAMETER UNDEFINED} {e o} {
   282         -		# Ignore when a parameter was not defined.
   283         -		# Note that this is transparent to validation
   284         -		# errors.
   285         -	    }
   286         -	}
   287         -
   288         -	set myinforce no
          269  +	try {
          270  +	    foreach name $mynames {
          271  +		set para [dict get $mymap $name]
          272  +
          273  +		# Ignore parameters which defer value generation until
          274  +		# actual use, except if we are forced to compute them.
          275  +		if {!$forcedefered && [$para defered]} continue
          276  +
          277  +		if {!$allowinteract} {
          278  +		    $para dontinteract
          279  +		}
          280  +		try {
          281  +		    $para value
          282  +		} trap {CMDR PARAMETER UNDEFINED} {e o} {
          283  +		    # Ignore when a parameter was not defined.
          284  +		    # Note that this is transparent to validation
          285  +		    # errors.
          286  +		}
          287  +	    }
          288  +	} finally {
          289  +	    # Do not leave the flag behind in case of error.
          290  +	    # Would influence following uses.
          291  +	    set myinforce no
          292  +	}
   289    293   	return
   290    294       }
   291    295   
   292    296       method reset {} {
   293    297   	debug.cmdr/config {}
   294    298   	dict for {name para} $mymap {
   295    299   	    $para reset
................................................................................
  1361   1365       }
  1362   1366   
  1363   1367       # # ## ### ##### ######## #############
  1364   1368   }
  1365   1369   
  1366   1370   # # ## ### ##### ######## ############# #####################
  1367   1371   ## Ready
  1368         -package provide cmdr::config 1.1
         1372  +package provide cmdr::config 1.1.1