|
|
|
@ -193,43 +193,6 @@ set ::punk::bannerTemplate {
|
|
|
|
|
########################################################## |
|
|
|
|
#CANDY-CODE |
|
|
|
|
# |
|
|
|
|
#!todo - unset etc. |
|
|
|
|
if {[info proc ::punk::_unknown] eq ""} {rename unknown ::punk::_unknown} |
|
|
|
|
|
|
|
|
|
proc ::punk::var {varname {= {}} args} { |
|
|
|
|
if {${=} == "="} { |
|
|
|
|
if {[llength $args] > 1} { |
|
|
|
|
uplevel 1 [list set $varname [uplevel 1 $args]] |
|
|
|
|
} else { |
|
|
|
|
uplevel 1 [list set $varname [lindex $args 0]] |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
uplevel 1 [list set $varname] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
proc unknown {args} { |
|
|
|
|
if {[lindex $args 1] eq "="} { |
|
|
|
|
set n [lindex $args 0] |
|
|
|
|
set v [lindex $args 2] |
|
|
|
|
#uplevel 1 [string map [list @n@ $n @v@ $v] {proc @n@ {= val} {uplevel 1 set @n@ $val}}] |
|
|
|
|
uplevel 1 [list interp alias {} $n {} ::punk::var $n] |
|
|
|
|
|
|
|
|
|
#uplevel 1 [list trace add variable $n unset [string map [list @n@ $n] {uplevel 1 [list interp alias {} @n@ {}]}]] |
|
|
|
|
uplevel 1 [list trace add variable $n unset [list interp alias {} $n {}]] |
|
|
|
|
|
|
|
|
|
if {[llength $args] > 3} { |
|
|
|
|
#RHS consists of multiple args; evaluate |
|
|
|
|
return [uplevel 1 [list set $n [uplevel 1 [lrange $args 2 end]]]] |
|
|
|
|
} else { |
|
|
|
|
#RHS is single arg; treat as value |
|
|
|
|
return [uplevel 1 [list set $n $v]] |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
#delegate to original 'unknown' command |
|
|
|
|
uplevel 1 ::punk::_unknown $args |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Cute names for file I/O |
|
|
|
|
proc <- filename { |
|
|
|
|