From 95bf21f70657b8acada4120e51207d64c97445cd Mon Sep 17 00:00:00 2001 From: Bryan Jurish Date: Mon, 23 Feb 2004 00:32:33 +0000 Subject: sprinkler v0.05 + added pass-through outlet for unbound destination symbols + added hack to prevent 'bang's being sprinkled as 'normal' symbols svn path=/trunk/; revision=1345 --- externals/sprinkler/Changes | 10 +++++--- externals/sprinkler/README.pod | 2 -- externals/sprinkler/configure.in | 10 ++++---- externals/sprinkler/sprinkler-help.pd.in | 39 ++++++++++++++++++-------------- externals/sprinkler/sprinkler.c | 37 ++++++++++++++++++++++++------ 5 files changed, 64 insertions(+), 34 deletions(-) diff --git a/externals/sprinkler/Changes b/externals/sprinkler/Changes index 00793604..c500a87f 100644 --- a/externals/sprinkler/Changes +++ b/externals/sprinkler/Changes @@ -1,8 +1,12 @@ Change log for PD external 'sprinkler' (formerly 'forward') -v0.04 Sun, 17 Aug 2003 13:23:54 +0200 - + removed stale "VERSION" file - + tested with gcc-2.95.4 and pd-0.37-test8 +v0.05 Mon, 23 Feb 2004 01:14:08 +0100 + + added pass-through outlet for unbound destination symbols + + added hack to prevent 'bang's being sprinkled as 'normal' symbols + +v0.04 Thu, 29 Jan 2004 16:26:00 +0100 + + added error() call for missing destinations + + todo: add pass-through outlet for missing destinations v0.03 Sun Sep 8 00:56:33 CEST 2002 + renamed to 'sprinkler' diff --git a/externals/sprinkler/README.pod b/externals/sprinkler/README.pod index 24560b10..172458e9 100644 --- a/externals/sprinkler/README.pod +++ b/externals/sprinkler/README.pod @@ -2,8 +2,6 @@ README for pd external 'sprinkler' (formerly 'forward') -Last updated for sprinkler v0.04 - =head1 DESCRIPTION 'sprinkler' objects do dynamic control-message dissemination. diff --git a/externals/sprinkler/configure.in b/externals/sprinkler/configure.in index 320c7f3e..94cfb6f1 100644 --- a/externals/sprinkler/configure.in +++ b/externals/sprinkler/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl -- adapted from 'configure.in' in ggee distribution by Guenter Geiger AC_PREREQ(2.5) -AC_INIT(sprinkler, [0.04], [moocow@ling.uni-potsdam.de]) +AC_INIT(sprinkler, [0.05], [moocow@ling.uni-potsdam.de]) dnl dnl Programs, prefix @@ -89,14 +89,14 @@ if test "$enable_forward" == "yes" ; then NON_MAX_FORWARD="yes" DFLAGS="$DFLAGS -DNON_MAX_FORWARD" SPRINKLER_COMPAT_TEXT=["(with MAX-incompatible [forward] alias)"] - SPRINKLER_ALIAS_1="#X obj 102 327 forward;" - SPRINKLER_ALIAS_2="#X obj 102 352 fw;" + SPRINKLER_ALIAS_1="#X obj 102 407 forward;" + SPRINKLER_ALIAS_2="#X obj 102 432 fw;" else AC_MSG_RESULT(no) NON_MAX_FORWARD="no" SPRINKLER_COMPAT_TEXT=["(formerly MAX-incompatible \[forward\])"] - SPRINKLER_ALIAS_1="#X text 102 327 none;" - SPRINKLER_ALIAS_2="#X text 102 352 (disabled);" + SPRINKLER_ALIAS_1="#X text 102 407 none;" + SPRINKLER_ALIAS_2="#X text 102 432 (disabled);" fi AC_SUBST(NON_MAX_FORWARD) AC_SUBST(SPRINKLER_COMPAT_TEXT) diff --git a/externals/sprinkler/sprinkler-help.pd.in b/externals/sprinkler/sprinkler-help.pd.in index 6f5b3c44..73e93ace 100644 --- a/externals/sprinkler/sprinkler-help.pd.in +++ b/externals/sprinkler/sprinkler-help.pd.in @@ -1,22 +1,22 @@ -#N canvas 186 52 500 508 10; -#X floatatom 26 36 5 0 0; -#X symbolatom 36 100 10 0 0; -#X text 25 309 ARGUMENTS: none; -#X text 183 307 INLETS:; -#X text 183 343 OUTLETS: none; +#N canvas 193 23 510 596 10; +#X floatatom 26 36 5 0 0 0 - - -; +#X symbolatom 36 100 10 0 0 0 - - -; +#X text 25 389 ARGUMENTS: none; +#X text 183 387 INLETS:; +#X text 183 423 OUTLETS: none; #X text 217 161 forward lists; #X text 161 45 forward single floats; #X text 169 107 forward single symbols; -#X text 41 379 NOTES:; -#X text 185 321 1 - list or message of the form DST MSG; -#X text 165 477 Bryan Jurish ; -#X floatatom 118 254 5 0 0; -#X obj 54 254 pack s 0; -#X text 175 219 dynamic destination; +#X text 41 469 NOTES:; +#X text 185 401 1 - list or message of the form DST MSG; +#X text 165 567 Bryan Jurish ; +#X floatatom 117 257 5 0 0 0 - - -; +#X obj 53 257 pack s 0; +#X text 178 224 dynamic destination; #X msg 45 153 420; -#X obj 26 284 sprinkler; +#X obj 25 326 sprinkler; #X text 53 3 sprinkler : dynamic control-message dissemination; -#X text 41 393 When a [sprinkler] object gets an input message of the +#X text 41 483 When a [sprinkler] object gets an input message of the form "DST MSG" at its inlet \, the message MSG is sent to the [receive] object(s) named by DST. 'sprinkler' is really only useful if you don't know (or don't want to know) the length and/or type(s) of your messages @@ -24,13 +24,16 @@ beforehand.; #X msg 25 59 sprinkler-help1 \$1; #X msg 35 121 sprinkler-help2 \$1; #X msg 45 177 sprinkler-help1 \$1 24 7; -#X msg 55 209 sprinkler-help1; -#X msg 61 231 sprinkler-help2; +#X msg 54 212 sprinkler-help1; +#X msg 60 234 sprinkler-help2; #X obj 340 42 r sprinkler-help1; #X obj 340 64 print sprinkler-help1; #X obj 340 110 r sprinkler-help2; #X obj 340 132 print sprinkler-help2; -#X text 39 327 ALIASES:; +#X obj 25 350 print sprinkler-thru; +#X text 257 298 this gets passed through; +#X msg 53 297 illusory-receive-name uh oh; +#X text 39 407 ALIASES:; @SPRINKLER_ALIAS_1@ @SPRINKLER_ALIAS_2@ #X text 135 18 @SPRINKLER_COMPAT_TEXT@; @@ -39,6 +42,7 @@ beforehand.; #X connect 11 0 12 1; #X connect 12 0 15 0; #X connect 14 0 20 0; +#X connect 15 0 27 0; #X connect 18 0 15 0; #X connect 19 0 15 0; #X connect 20 0 15 0; @@ -46,3 +50,4 @@ beforehand.; #X connect 22 0 12 0; #X connect 23 0 24 0; #X connect 25 0 26 0; +#X connect 29 0 15 0; diff --git a/externals/sprinkler/sprinkler.c b/externals/sprinkler/sprinkler.c index 56ab209d..44e6bde9 100644 --- a/externals/sprinkler/sprinkler.c +++ b/externals/sprinkler/sprinkler.c @@ -58,13 +58,14 @@ static char sprinkler_errbuf[EBUFSIZE]; * Structures and Types *=====================================================================*/ -static char *sprinkler_version = "\nsprinkler version 0.03 by Bryan Jurish : dynamic message dissemination"; +static char *sprinkler_banner = "\nsprinkler version %s by Bryan Jurish : dynamic message dissemination"; static t_class *sprinkler_class; typedef struct _sprinkler { - t_object x_obj; + t_object x_obj; + t_outlet *x_thru; //-- pass-through outlet } t_sprinkler; @@ -98,7 +99,12 @@ static void sprinkler_anything(t_sprinkler *x, t_symbol *dst, int argc, t_atom * pd_typedmess(dst->s_thing,&s_float,argc,argv); return; case A_SYMBOL: - pd_typedmess(dst->s_thing,&s_symbol,argc,argv); + //-- special handling for 'bang' + if (argv->a_w.w_symbol == &s_bang) { + pd_typedmess(dst->s_thing,&s_bang,0,0); + } else { + pd_typedmess(dst->s_thing,&s_symbol,argc,argv); + } return; case A_POINTER: pd_typedmess(dst->s_thing,&s_pointer,argc,argv); @@ -114,13 +120,17 @@ static void sprinkler_anything(t_sprinkler *x, t_symbol *dst, int argc, t_atom * case A_GIMME: case A_CANT: default: - // just fall though - ; // empty statement to keep VC++ happy + // just fall though } } // default -- sprinkler anything else with 'pd_forwardmess' pd_forwardmess(dst->s_thing,argc,argv); + return; } + + //post("sprinkler: no destination for `%s'", dst ? dst->s_name : "(null)"); + //-- pass through + outlet_anything(x->x_thru, dst, argc, argv); } static void sprinkler_list(t_sprinkler *x, t_symbol *s, int argc, t_atom *argv) @@ -131,19 +141,32 @@ static void sprinkler_list(t_sprinkler *x, t_symbol *s, int argc, t_atom *argv) sprinkler_anything(x,atom_getsymbol(argv),--argc,++argv); } + +/*-------------------------------------------------------------------- + * newmethod, freemethod + */ void *sprinkler_new(t_symbol *s) { t_sprinkler *x = (t_sprinkler *)pd_new(sprinkler_class); + x->x_thru = outlet_new(&x->x_obj, &s_anything); return (x); } +void sprinkler_free(t_sprinkler *x) { + outlet_free(x->x_thru); +} + /*-------------------------------------------------------------------- * setup *--------------------------------------------------------------------*/ void sprinkler_setup(void) { - post(sprinkler_version); - sprinkler_class = class_new(gensym("sprinkler"), (t_newmethod)sprinkler_new, 0, sizeof(t_sprinkler), 0, 0); + post(sprinkler_banner, PACKAGE_VERSION); + sprinkler_class = class_new(gensym("sprinkler"), + (t_newmethod)sprinkler_new, + (t_method)sprinkler_free, + sizeof(t_sprinkler), + 0, 0); #ifdef NON_MAX_FORWARD // add aliases [forward] and [fw] -- cgit v1.2.1