aboutsummaryrefslogtreecommitdiff
path: root/pdlib.tcl
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2009-09-01 19:53:32 +0000
committermescalinum <mescalinum@users.sourceforge.net>2009-09-01 19:53:32 +0000
commit2f5abe3d9fdc42d3b2f2d50c1d7621487348ac10 (patch)
treeee938cea87d822a48dc5cae896a7f4064be7f2fb /pdlib.tcl
parent893a02e2c234330cd547e2bbbdc779f5c6050bea (diff)
pass inlet number around instead of binding it to the selector
svn path=/trunk/externals/tclpd/; revision=12169
Diffstat (limited to 'pdlib.tcl')
-rw-r--r--pdlib.tcl19
1 files changed, 12 insertions, 7 deletions
diff --git a/pdlib.tcl b/pdlib.tcl
index c349dfd..0a22957 100644
--- a/pdlib.tcl
+++ b/pdlib.tcl
@@ -63,12 +63,17 @@ namespace eval ::pd {
}
# add a class method (that is: a proc named <class>_<sel>)
- proc call_classmethod {classname self sel args} {
+ proc call_classmethod {classname self inlet sel args} {
if $::verbose {post [info level 0]}
- set m "${classname}_${sel}"
- if {[llength [info commands "::$m"]] > 0} {
- return [$m $self {*}$args]
+ set m_sel "::${classname}_${inlet}_${sel}"
+ if {[llength [info commands $m_sel]] > 0} {
+ return [$m_sel $self {*}$args]
}
+ set m_any "::${classname}_${inlet}_anything"
+ if {[llength [info commands $m_any]] > 0} {
+ return [$m_any $self $sel {*}$args]
+ }
+ post "class $classname: inlet $inlet: no such selector: $sel"
}
# this handles the pd::class definition
@@ -105,11 +110,11 @@ namespace eval ::pd {
# class level dispatcher (sort of class constructor)
proc ::$classname {self args} "
if \$::verbose {::pd::post \[info level 0\]}
- ::pd::call_classmethod $classname \$self constructor {*}\$args
+ ::pd::call_classmethod $classname \$self 0 constructor {*}\$args
# object dispatcher
- proc ::\$self {selector args} \"
+ proc ::\$self {inlet selector args} \"
if \\\$::verbose {::pd::post \\\[info level 0\\\]}
- ::pd::call_classmethod $classname \$self \\\$selector {*}\\\$args
+ ::pd::call_classmethod $classname \$self \\\$inlet \\\$selector {*}\\\$args
\"
return \$self
"