From 63853899de48eec84718fac91487c0f0da439f40 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 12 Nov 2011 05:41:02 +0000 Subject: handle any message as a file name svn path=/trunk/externals/tclfile/; revision=15730 --- exists-help.pd | 22 ++++++++++++++++++---- exists.tcl | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/exists-help.pd b/exists-help.pd index 9cde207..9ec95b2 100644 --- a/exists-help.pd +++ b/exists-help.pd @@ -1,20 +1,27 @@ -#N canvas 137 104 448 333 10; +#N canvas 351 42 448 333 10; #X obj 33 166 exists; #X floatatom 36 202 5 0 0 0 - - -; #X obj 37 226 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 65 91 symbol unexistent?; -#X msg 41 60 symbol exists.tcl; +#X msg 34 39 symbol exists.tcl; #X obj 239 183 exists; #X floatatom 242 219 5 0 0 0 - - -; #X obj 243 243 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 247 77 bang; -#X msg 274 136 symbol /tmp/; -#X msg 290 158 /tmp; +#X msg 272 116 symbol /tmp/; +#X msg 288 138 /tmp; #X obj 110 306 pddp/pddplink http://tcl.tk/man/tcl8.5/TclCmd/file.htm#M15 ; #X text 18 294 this is a clone of this command:; +#X msg 48 63 exists.tcl; +#X msg 86 111 this is a test; +#X msg 83 137 list one 2 three 4; +#X msg 106 171 1 2 3 4; +#X msg 86 208 float 1; +#X msg 144 201 1 two; +#X msg 291 163 list this is a test; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 3 0 0 0; @@ -24,3 +31,10 @@ #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 10 0 5 1; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 5 1; diff --git a/exists.tcl b/exists.tcl index fed8da3..53a4918 100644 --- a/exists.tcl +++ b/exists.tcl @@ -1,6 +1,15 @@ package require Tclpd 0.2.3 package require TclpdLib 0.19 +proc exists::make_symbol {argslist} { + set output [pd::strip_selectors $argslist] + set selector [lindex $output 0] + if {$selector eq "list" || $selector eq "float"} { + set output [lrange $output 1 end] + } + return $output +} + proc exists::constructor {self args} { if {![namespace exists $self]} { namespace eval $self {} @@ -22,6 +31,12 @@ proc exists::0_symbol {self args} { exists::0_bang $self } +proc exists::0_anything {self args} { + # HOT inlet + variable ${self}::filename [make_symbol $args] + exists::0_bang $self +} + proc exists::0_bang {self} { variable ${self}::current_canvas variable ${self}::filename @@ -38,4 +53,9 @@ proc exists::1_symbol {self args} { variable ${self}::filename [pd::arg 0 symbol] } +proc exists::1_anything {self args} { + # COLD inlet + variable ${self}::filename [make_symbol $args] +} + pd::class exists -- cgit v1.2.1