cmdr
Check-in [f74095b252]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

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 Unified Diffs Ignore Whitespace Patch

Changes to config.tcl.

262
263
264
265
266
267
268

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287


288

289
290
291
292
293
294
295
	# Done in order of declaration.
	# Any dependencies between parameter can be handled by proper
	# declaration order.

	if {$myinforce} return
	set myinforce yes


	foreach name $mynames {
	    set para [dict get $mymap $name]

	    # Ignore parameters which defer value generation until
	    # actual use, except if we are forced to compute them.
	    if {!$forcedefered && [$para defered]} continue

	    if {!$allowinteract} {
		$para dontinteract
	    }
	    try {
		$para value
	    } trap {CMDR PARAMETER UNDEFINED} {e o} {
		# Ignore when a parameter was not defined.
		# Note that this is transparent to validation
		# errors.
	    }
	}



	set myinforce no

	return
    }

    method reset {} {
	debug.cmdr/config {}
	dict for {name para} $mymap {
	    $para reset







>
|
|

|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
	# Done in order of declaration.
	# Any dependencies between parameter can be handled by proper
	# declaration order.

	if {$myinforce} return
	set myinforce yes

	try {
	    foreach name $mynames {
		set para [dict get $mymap $name]

		# Ignore parameters which defer value generation until
		# actual use, except if we are forced to compute them.
		if {!$forcedefered && [$para defered]} continue

		if {!$allowinteract} {
		    $para dontinteract
		}
		try {
		    $para value
		} trap {CMDR PARAMETER UNDEFINED} {e o} {
		    # Ignore when a parameter was not defined.
		    # Note that this is transparent to validation
		    # errors.
		}
	    }
	} finally {
	    # Do not leave the flag behind in case of error.
	    # Would influence following uses.
	    set myinforce no
	}
	return
    }

    method reset {} {
	debug.cmdr/config {}
	dict for {name para} $mymap {
	    $para reset
1361
1362
1363
1364
1365
1366
1367
1368
    }

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::config 1.1







|
1365
1366
1367
1368
1369
1370
1371
1372
    }

    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::config 1.1.1