cmdr
Check-in [7ab77ead21]
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 [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:cmdr::actor - New feature "common -extend", enabling extension of a block instead of overwriting it.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ab77ead21640a4cbd9456355fcb98608bf073ae
User & Date: aku 2014-05-16 00:29:39
Original Comment: cmdr::actor - New feature "common -extend", enabling extension of a block instead of ovrwriting it.
References
2014-05-28
23:33
cmdr::actor, cmdr::officer - Fix bug introduced with revision [7ab77ead21]. The option handling added to "actor::set" in that revision means that the command "my set *command* ..." storing the actual command line (i.e. user information) can break, trying to interpret application specific option information as something for the internal command. Fixed by adding "--" to "actor::set"s option handling, and using it for the breakable command to force interpretation of the user data as such. check-in: cd7539eb28 user: andreask tags: trunk
Context
2014-05-16
00:44
Fix inadvertent split of trunk check-in: 8ff369076f user: andreask tags: trunk
00:29
cmdr::actor - New feature "common -extend", enabling extension of a block instead of overwriting it. check-in: 7ab77ead21 user: aku tags: trunk
2014-04-23
05:39
Move the p-name helper command of validate::common into the parameter class, as a convenience method. check-in: 288c34780b user: aku tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to actor.tcl.

   163    163   	    return [$mysuper get $key]
   164    164   	}
   165    165   	# ... and fail if we are at the top.
   166    166   	return -code error -errorcode {CMDR STORE UNKNOWN} \
   167    167   	    "Expected known key for get, got \"$key\""
   168    168       }
   169    169   
   170         -    method set {key data} {
          170  +    method set {key args} {
   171    171   	debug.cmdr/actor {}
          172  +	set extend 0
          173  +	while {[string match -* [lindex $args 0]]} {
          174  +	    set args [lassign $args o]
          175  +	    switch -exact -- $o {
          176  +		-extend {set extend 1}
          177  +		default {
          178  +		    return -code error -errorcode {CMDR SET UNKNOWN OPTION} \
          179  +			"Unknown option \"$o\", expcted -extend"
          180  +		}
          181  +	    }
          182  +	}
          183  +	if {[llength $args] != 1} {
          184  +	    return -code error -errorcode {CMDR SET WRONG-ARGS} \
          185  +		"Expected one argument."
          186  +	}
          187  +	set data [lindex $args 0]
          188  +	if {$extend} {
          189  +	    set data [my get $key]$data
          190  +	}
   172    191   	dict set mystore $key $data
   173    192   	return
   174    193       }
   175    194   
   176    195       method lappend {key data} {
   177    196   	debug.cmdr/actor {}
   178    197   	catch { set value [my get $key] }
................................................................................
   341    360   
   342    361       ##
   343    362       # # ## ### ##### ######## #############
   344    363   }
   345    364   
   346    365   # # ## ### ##### ######## ############# #####################
   347    366   ## Ready
   348         -package provide cmdr::actor 1.2
          367  +package provide cmdr::actor 1.3