1 # vim: foldmarker=<<<,>>>
5 # inherit tlc::Handlers
7 constructor
{accessvar args
} {}
15 method attach_output
{handler
}
16 method detach_output
{handler
}
17 method attach_input
{dom_obj
}
18 method detach_input
{dom_obj
}
20 method force_if_pending
{}
26 method debug
{level msg
}
36 method scopevar_unset
{args
}
41 configbody tlc
::Domino::name { #<<<1
42 set baselog_instancename
$name
46 body tlc
::Domino::constructor {accessvar args
} { #<<<1
55 upvar $accessvar scopevar
57 trace variable scopevar u
[code
$this scopevar_unset
]
61 body tlc
::Domino::destructor {} { #<<<1
62 after cancel
$after_id
63 foreach dom_obj
[array names inputs
] {
69 body tlc
::Domino::tip {args
} { #<<<1
72 if {$after_id != ""} return
73 debug debug
"tlc::Domino::tip: ($this) ($name)"
74 set after_id
[after idle
[code
$this tip_outputs
]]
78 body tlc
::Domino::tip_now {args
} { #<<<1
83 body tlc
::Domino::attach_output {handler
} { #<<<1
84 set idx
[lsearch $outputs $handler]
86 lappend outputs
$handler
94 body tlc
::Domino::detach_output {handler
} { #<<<1
95 set idx
[lsearch $outputs $handler]
96 set outputs
[lreplace $outputs $idx $idx]
100 body tlc
::Domino::tip_outputs {} { #<<<1
101 after cancel
$after_id
103 foreach output
$outputs {
107 log
error "\nerror updating output ($output):\n\t$errmsg\n$::errorInfo"
113 body tlc
::Domino::attach_input {dom_obj
} { #<<<1
114 if {![$dom_obj isa tlc
::Domino]} {
115 error "$dom_obj isn't a Domino"
118 set inputs
($dom_obj) 1
120 return [$dom_obj attach_output
[code
$this tip
]]
124 body tlc
::Domino::detach_input {dom_obj
} { #<<<1
125 if {![$dom_obj isa tlc
::Domino]} {
126 error "$dom_obj isn't a Domino"
129 catch {unset inputs
($dom_obj)}
131 return [$dom_obj detach_output
[code
$this tip
]]
135 body tlc
::Domino::debug {level msg
} { #<<<1
136 # invoke_handlers debug $level $msg
140 body tlc
::Domino::pending {} { #<<<1
141 return [expr {$after_id != ""}]
145 body tlc
::Domino::force_if_pending {} { #<<<1
146 if {$after_id != ""} tip_now
150 body tlc
::Domino::lock {} { #<<<1
155 body tlc
::Domino::unlock {} { #<<<1
158 puts stderr
"$this lock went below zero!: $lock\n[tlc::stackdump]"
163 body tlc
::Domino::scopevar_unset {args
} { #<<<1