aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/sprinkler/Changes6
-rw-r--r--externals/sprinkler/README.pod20
-rw-r--r--externals/sprinkler/configure.in22
-rw-r--r--externals/sprinkler/sprinkler.c57
4 files changed, 79 insertions, 26 deletions
diff --git a/externals/sprinkler/Changes b/externals/sprinkler/Changes
index c500a87f..33e41871 100644
--- a/externals/sprinkler/Changes
+++ b/externals/sprinkler/Changes
@@ -1,5 +1,11 @@
Change log for PD external 'sprinkler' (formerly 'forward')
+v0.06 Tue, 14 Sep 2004 18:50:03 +0200
+ + added --enable-all-forwardmess configure option to use pd_forwardmess()
+ for all messages (even those of length 1) : should fix 'bang' problem
+ + fixed gcc-3.3 warning re: (++argv) in sprinkler_list() thanks to
+ Erasmus Zipfel
+
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
diff --git a/externals/sprinkler/README.pod b/externals/sprinkler/README.pod
index 172458e9..301aa498 100644
--- a/externals/sprinkler/README.pod
+++ b/externals/sprinkler/README.pod
@@ -25,17 +25,29 @@ The 'configure' script supports the following options, among others:
=over 4
-=item * --enable-debug , --disable-debug
+=item --enable-debug , --disable-debug
Whether to enable verbose debugging messages.
Default=no.
-=item * --enable-forward , --disable-forward
+=item --enable-forward , --disable-forward
Whether to create [forward] objects as instances
of the [sprinkler] class (MAX-incompatible).
Default=no.
+=item --enable-all-forwardmess , --disable-all-forwardmess
+
+Whether to use pd_forwardmess() for all messages. If this
+option is disabled (the default), messages of length 1 will
+be handled specially; thus a symbol 'foo' will be passed as
+'symbol foo', rather than just 'foo'.
+
+Default=no.
+
+Future versions of 'sprinkler' may use pd_forwardmess() for
+all messages by default -- go on, try it!
+
=back
=head1 ACKNOWLEDGEMENTS
@@ -48,6 +60,8 @@ from code by Guenter Geiger, Larry Troxler, and iohannes m zmoeling.
Thanks to Krzysztof Czaja for pointing out to me the existence of MAX "forward",
and to Miller Puckette for the name "sprinkler".
+Thanks to Erasmus Zipfel for a bugreport and useful ideas.
+
=head1 KNOWN BUGS
One of the acknowledgements used to be in this section.
@@ -55,6 +69,8 @@ Sorry, folks.
Backwards-compatible version is incompatible with MAX.
+Semantic strangeness with singleton messages is somewhat cryptic.
+
=head1 AUTHOR
Bryan Jurish E<lt>moocow@ling.uni-potsdam.deE<gt>
diff --git a/externals/sprinkler/configure.in b/externals/sprinkler/configure.in
index 94cfb6f1..3c853da1 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.05], [moocow@ling.uni-potsdam.de])
+AC_INIT(sprinkler, [0.06], [moocow@ling.uni-potsdam.de])
dnl
dnl Programs, prefix
@@ -69,7 +69,7 @@ AC_ARG_ENABLE([debug],
if test "$enable_debug" == "yes" ; then
AC_MSG_RESULT(yes)
DEBUG="yes"
- DFLAGS="$DFLAGS -DSPRINKLER_DEBUG"
+ AC_DEFINE(SPRINKLER_DEBUG, 1, [Define this to use pd_forwardmess() for all messages])
else
AC_MSG_RESULT(no)
DEBUG="no"
@@ -82,7 +82,9 @@ dnl build backwards-compatible non-max 'forward'?
dnl
AC_MSG_CHECKING([whether to allow non-MAX "forward" alias])
AC_ARG_ENABLE([forward],
- AC_HELP_STRING([--enable-forward],[allow backwards-compatible non-MAX "forward" alias (default=no)]))
+ AC_HELP_STRING(
+ [--enable-forward],
+ [allow backwards-compatible non-MAX "forward" alias (default=no)]))
if test "$enable_forward" == "yes" ; then
AC_MSG_RESULT(yes)
@@ -103,7 +105,21 @@ AC_SUBST(SPRINKLER_COMPAT_TEXT)
AC_SUBST(SPRINKLER_ALIAS_1)
AC_SUBST(SPRINKLER_ALIAS_2)
+dnl
+dnl use pd_forwardmess() for everything?
+dnl
+AC_MSG_CHECKING([whether to use pd_forwardmess() for all messages])
+AC_ARG_ENABLE([all-forwardmess],
+ AC_HELP_STRING(
+ [--enable-all-forwardmess],
+ [use pd_forwardmess() for all messages (default=no)]))
+if test "$enable_all_forwardmess" = "yes" ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(ALL_FORWARDMESS, 1, [Define this to use pd_forwardmess() for all messages])
+else
+ AC_MSG_RESULT(no)
+fi
dnl
dnl machine-dependent variables
diff --git a/externals/sprinkler/sprinkler.c b/externals/sprinkler/sprinkler.c
index fcaca4d4..a6fd4582 100644
--- a/externals/sprinkler/sprinkler.c
+++ b/externals/sprinkler/sprinkler.c
@@ -1,14 +1,17 @@
-/* -*- Mode: C -*- */
-/*=============================================================================*\
- * File: sprinkler.c
+/* File: sprinkler.c
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
- * Description: message-forwarding : workaround for missing dynamic 'send'
+ * Contributors:
+ * Krzysztof Czaja pointed out the MAX-incompatibility of the name 'forward'
+ * Miller Puckette suggested the name 'sprinkler'
+ * Erasmus Zipfel diagnosed a bug in sprinkler_list()
+ *
+ * Description: dynamic message-forwarding object
*
* + code adapted from 'send_class' in $PD_ROOT/src/x_connective.c
* + formerly 'forward.c'
-
*
- * Copyright (c) 2002 Bryan Jurish.
+ *
+ * Copyright (c) 2002,2004 Bryan Jurish.
*
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
@@ -31,7 +34,6 @@
*=============================================================================*/
#include <m_pd.h>
-//#include "sprinkler.h"
/* black magic */
#ifdef NT
@@ -58,7 +60,8 @@ static char sprinkler_errbuf[EBUFSIZE];
* Structures and Types
*=====================================================================*/
-static char *sprinkler_banner = "\nsprinkler version %s by Bryan Jurish : dynamic message dissemination";
+static char *sprinkler_banner =
+"\nsprinkler version %s by Bryan Jurish : dynamic message dissemination";
static t_class *sprinkler_class;
@@ -73,26 +76,30 @@ typedef struct _sprinkler
* the guts:
* + send (the tail of) a list or message to the control-bus
* named by its initial element
- * + HACK for single-element arglists *ONLY*:
+ * + [DEPRECATED] : HACK for single-element arglists *ONLY*
* - sprinkler float- and pointer-initial arglists with 'pd_sprinklermess',
- * everything else with 'pd_typedmess' as a *LIST*
+ * everything else with 'pd_forwardmess'
*--------------------------------------------------------------------*/
static void sprinkler_anything(t_sprinkler *x, t_symbol *dst, int argc, t_atom *argv)
{
#ifdef SPRINKLER_DEBUG
atom_string(argv, sprinkler_errbuf, EBUFSIZE);
- post("sprinkler_debug : sprinkler_anything : dst=%s, argc=%d, arg1=%s", dst->s_name, argc, argc ? sprinkler_errbuf : "NULL");
+ post("sprinkler_debug : sprinkler_anything : dst=%s, argc=%d, arg1=%s",
+ dst->s_name, argc, argc ? sprinkler_errbuf : "NULL");
#endif
- /*-----------------------------------------------------------------------
- * HACK:
- * + single-element arglists *ONLY*
- * + sprinkler float- and pointer-initial arglists with 'pd_sprinklermess',
- * everything else with 'pd_typedmess' as a *LIST*
- *------------------------------------------------------------------------
- */
if (dst->s_thing) {
+
+#if !defined(ALL_FORWARDMESS)
+
+ /*-----------------------------------------------------------------------
+ * HACK (obsolete):
+ * + single-element arglists *ONLY*
+ * + sprinkler float- and pointer-initial arglists with 'pd_sprinklermess',
+ * everything else with 'pd_forwardmess'
+ *------------------------------------------------------------------------
+ */
if (argc == 1) {
switch (argv->a_type) {
case A_FLOAT:
@@ -124,6 +131,9 @@ static void sprinkler_anything(t_sprinkler *x, t_symbol *dst, int argc, t_atom *
// just fall though
}
}
+
+#endif /* !defined(ALL_FORWARDMESS) */
+
// default -- sprinkler anything else with 'pd_forwardmess'
pd_forwardmess(dst->s_thing,argc,argv);
return;
@@ -139,7 +149,7 @@ static void sprinkler_list(t_sprinkler *x, t_symbol *s, int argc, t_atom *argv)
#ifdef SPRINKLER_DEBUG
post("sprinkler_debug : sprinkler_list : argc=%d", argc);
#endif
- sprinkler_anything(x,atom_getsymbol(argv),--argc,++argv);
+ sprinkler_anything(x,atom_getsymbol(argv), argc-1, argv+1);
}
@@ -170,17 +180,22 @@ void sprinkler_setup(void)
0, 0);
#ifdef NON_MAX_FORWARD
- // add aliases [forward] and [fw]
+ //-- add aliases [forward] and [fw]
post("sprinkler : non-MAX [forward] alias enabled");
class_addcreator((t_newmethod)sprinkler_new, gensym("forward"), A_DEFSYM, 0);
class_addcreator((t_newmethod)sprinkler_new, gensym("fw"), A_DEFSYM, 0);
#endif
+#ifdef ALL_FORWARDMESS
+ //-- report new semantics
+ post("sprinkler : will use pd_forwardmess() for all messages");
+#endif
+
#ifdef SPRINKLER_DEBUG
post("sprinkler : debugging enabled");
#endif
- // methods
+ //-- methods
class_addlist(sprinkler_class, sprinkler_list);
class_addanything(sprinkler_class, sprinkler_anything);