From abab98e79999d4cb1fc9bad5ce5dff36a5ef9412 Mon Sep 17 00:00:00 2001 From: "Kjetil S. Matheussen" Date: Fri, 16 Jan 2004 15:07:14 +0000 Subject: An inlet can receive anything by using any as type svn path=/trunk/externals/k_guile/; revision=1268 --- local.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'local.scm') diff --git a/local.scm b/local.scm index 500f78b..31e107b 100644 --- a/local.scm +++ b/local.scm @@ -56,6 +56,7 @@ ;; ;; (define pd-inlet-vector (make-vector 1 '())) +(define pd-inlet-anyvector (make-vector 1 '())) (define (pd-set-inlet-func) (pd-c-set-inlet-func pd-instance @@ -64,6 +65,11 @@ (let ((inlet-func (assq symbol (vector-ref pd-inlet-vector inlet-num)))) + (if (not inlet-func) + (begin + (set! inlet-func (assq 'any + (vector-ref pd-inlet-vector inlet-num))) + (set! args (cons symbol args)))) (if inlet-func (apply (cadr inlet-func) args) (pd-display "No function defined for handling \'" symbol " to inlet " inlet-num)))))) @@ -73,7 +79,10 @@ (pd-display "Wrong argument to pd-inlet: " func " is not a procedure") (if (and (pd-check-number inlet-num "pd-inlet") (pd-legalinlet inlet-num)) - (let ((inlet-funcs (vector-ref pd-inlet-vector inlet-num))) + (let ((inlet-funcs (vector-ref (if (eq? symbol 'any) + pd-inlet-anyvector + pd-inlet-vector) + inlet-num))) (vector-set! pd-inlet-vector inlet-num (cons (list symbol func) -- cgit v1.2.1