diff options
Diffstat (limited to 'examples/dynreceive.tcl')
-rw-r--r-- | examples/dynreceive.tcl | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/examples/dynreceive.tcl b/examples/dynreceive.tcl index 8a269f7..6903da9 100644 --- a/examples/dynreceive.tcl +++ b/examples/dynreceive.tcl @@ -1,53 +1,53 @@ -package require Tclpd 0.2.1 -package require TclpdLib 0.17 +package require Tclpd 0.2.3 +package require TclpdLib 0.19 -pd::class dynreceive { - constructor { - set @sym {} - if {[pd::args] > 0} { - set @sym [pd::arg 0 symbol] - pd_bind [tclpd_get_instance_pd $self] [gensym $@sym] - } - pd::add_outlet $self +proc+ dynreceive::constructor {self args} { + set @sym {} + if {[pd::args] > 0} { + set @sym [pd::arg 0 symbol] + pd_bind [tclpd_get_instance_pd $self] [gensym $@sym] } + pd::add_outlet $self +} - destructor { - # don't forget to call pd_unbind, or sending things to a symbol - # bound to dead object will crash pd! - if {$@sym != {}} { - pd_unbind [tclpd_get_instance_pd $self] [gensym $@sym] - } +proc+ dynreceive::destructor {self} { + # don't forget to call pd_unbind, or sending things to a symbol + # bound to dead object will crash pd! + if {$@sym != {}} { + pd_unbind [tclpd_get_instance_pd $self] [gensym $@sym] } +} - 0_set { - # send [set empty( to clear the receive symbol - set s [pd::arg 0 symbol] - if {$@sym != {}} { - pd_unbind [tclpd_get_instance_pd $self] [gensym $@sym] - } - if {$s == {empty}} { - set @sym {} - } else { - set @sym $s - pd_bind [tclpd_get_instance_pd $self] [gensym $@sym] - } +proc+ dynreceive::0_set {self args} { + # send [set empty( to clear the receive symbol + set s [pd::arg 0 symbol] + if {$@sym != {}} { + pd_unbind [tclpd_get_instance_pd $self] [gensym $@sym] } - - 0_bang { - pd::outlet $self 0 bang + if {$s == {empty}} { + set @sym {} + } else { + set @sym $s + pd_bind [tclpd_get_instance_pd $self] [gensym $@sym] } +} - 0_float { - pd::outlet $self 0 float [pd::arg 0 float] - } +proc+ dynreceive::0_bang {self} { + pd::outlet $self 0 bang +} - 0_symbol { - pd::outlet $self 0 symbol [gensym [pd::arg 0 symbol]] - } +proc+ dynreceive::0_float {self args} { + pd::outlet $self 0 float [pd::arg 0 float] +} - 0_anything { - set sel [pd::arg 0 symbol] - set argz [lrange $args 1 end] - pd::outlet $self 0 $sel $argz - } +proc+ dynreceive::0_symbol {self args} { + pd::outlet $self 0 symbol [gensym [pd::arg 0 symbol]] } + +proc+ dynreceive::0_anything {self args} { + set sel [pd::arg 0 symbol] + set argz [lrange $args 1 end] + pd::outlet $self 0 $sel $argz +} + +pd::class dynreceive |