From 53b224a8e82d3bdeddf093316145ad2c2c9ca6a9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 8 Nov 2011 02:58:10 +0000 Subject: first stab at some tclpd objects svn path=/trunk/externals/tclfile/; revision=15713 --- exists.tcl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 exists.tcl (limited to 'exists.tcl') diff --git a/exists.tcl b/exists.tcl new file mode 100644 index 0000000..c927ac6 --- /dev/null +++ b/exists.tcl @@ -0,0 +1,35 @@ +package require Tclpd 0.2.3 +package require TclpdLib 0.19 + +proc+ exists::constructor {self args} { + # add second inlet (first created by default) + pd::add_inlet $self list + + # add outlet + pd::add_outlet $self list +} + +proc+ exists::0_symbol {self args} { + # HOT inlet + set @filename [lindex {*}$args 1] + exists::0_bang $self +} + +proc+ exists::0_anything {self args} { + # HOT inlet + set @filename [lindex {*}$args 1] + pd::post "anything: $@filename" + exists::0_bang $self +} + +proc+ exists::0_bang {self} { + if {$@filename == {}} return + pd::outlet $self 0 [list float [file exists $@filename]] +} + +proc+ exists::1_anything {self args} { + # COLD inlet + set @filename [lindex {*}$args 1] +} + +pd::class exists -- cgit v1.2.1