TABLE OF CONTENTS
::pwtk::treatrun
SYNOPSIS
proc ::pwtk::treatrun {runCmd newCmd} {
EXAMPLE
treatrun runPW rerunPW
DESCRIPTION
This command allows to replace a default implementation of the runCmd command. This is distinct from the Tcl "rename" command. With the above example, runPW will behave as rerunPW (but both commands still exist as such, it is just that the behaviour of runCmd is temporarily modified to behave as newCmd).
A given treatrun can be cleared by assigning it to an empty string, i.e., treatrun runCmd {}
ARGUMENTS
- runCmd -- one of the runXX or rerunXX commands, defined in runXX.tcl source file
- newCmd -- command for the new behavior; must be of the following form: "proc newCmd args script"
EXAMPLE
# Let's say that for each runPW execution, we would like to print # a time. This can be achieved with treatrun as follows: proc my_runPW {args} { puts "Time is: [clock format [clock seconds]]" eval runPW $args } treatrun runPW my_runPW
SOURCE
variable state variable runXX_exportList if { $runCmd ni $runXX_exportList } { ::pwtk::error "unsupported runCmd \"$runCmd\", must be one of: [join $supported {, }]" 1 } ifnotempty newCmd { set state(treatrun,$runCmd) $newCmd } else { unset state(treatrun,$runCmd) } }