From 2f5abe3d9fdc42d3b2f2d50c1d7621487348ac10 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Tue, 1 Sep 2009 19:53:32 +0000 Subject: pass inlet number around instead of binding it to the selector svn path=/trunk/externals/tclpd/; revision=12169 --- pdlib.tcl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'pdlib.tcl') 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 _) - 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 " -- cgit v1.2.1