-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-02-26 02:17, Jonathan Wilkes wrote:
> Seems like for any object that doesn't have a bang method nor list
> method, an empty list silently gets discarded.
[...]
> 
> Is there a way to fix this?
> 

sure :-)

the default list method will try to do something clever with the empty
list:
- - if there is a non-default bangmethod, it will call that (which is
not the case for [sin])
- - elif there is a non-default catchall method, it will call that
(which is not the case for [sin])
- - elif the object has inlets (which is the case for [sin]), it will
distribute the atoms over the inlets. since there are 0 atoms, no
inlet will receive any data.
- - else call the default catchall method.

so i think there are two things to fix:
1. Pd shouldn't try to fill an empty list to the objects inlets.
2. [t a] should not output an empty list if it receives a [bang(

attached are fixes for both problems (actually the 2nd patch makes [t
a] output the message as it came in, rather than converting it to a
list - so it also fixes the problem for numbers and symbols, not only
for bangs)
i rely on the community to test them thorougly :-)

there are still some weirdos though:

[float 42, list 666, list, foo(
|
[t s]
|
[print]

i wonder what the correct behaviour should actually be.
intuitively i would say that for non-symbols, [t s] should output the
selector as a symbol (if we don't want to introduce "%d" semantics
which i would rather not for performance reasons).
this would also make sense for anythings, where we currently get that
weird "only convert 's' to 'b' or 'a'" (it's weird insofar as it takes
some time to see what the 's' is referring to)

fgm,asdr
IOhannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEvIWQACgkQkX2Xpv6ydvROxQCcCySUREYwDdUEAQwkHpq/oSVX
TJUAoMxAjB4wZwUGy+QiOAoSwY2o7xLF
=56Tj
-----END PGP SIGNATURE-----
>From 049904da3f4019593e6565bb7b2723b5154f5e87 Mon Sep 17 00:00:00 2001
From: IOhannes m zmoelnig <[email protected]>
Date: Thu, 28 Feb 2013 10:05:45 +0100
Subject: [PATCH 1/3] don't unpack empty lists to object's inlets

since the list is empty, this will effectively be a no-op
(and thus an empty list is silently discarded).
better call the pd_defaultanything() method.
---
 src/m_class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/m_class.c b/src/m_class.c
index bbc2fe7..3fb6d5c 100644
--- a/src/m_class.c
+++ b/src/m_class.c
@@ -132,7 +132,7 @@ static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv)
 
         /* if the object is patchable (i.e., can have proper inlets)
             send it on to obj_list which will unpack the list into the inlets */
-    else if ((*x)->c_patchable)
+    else if (argc>0 && (*x)->c_patchable)
         obj_list((t_object *)x, s, argc, argv);
             /* otherwise gove up and complain. */
     else pd_defaultanything(x, &s_list, argc, argv);
-- 
1.7.10.4

>From 7bfdcc792d20cf173ab58e69260b148144dbd903 Mon Sep 17 00:00:00 2001
From: IOhannes m zmoelnig <[email protected]>
Date: Thu, 28 Feb 2013 10:09:05 +0100
Subject: [PATCH 2/3] fixing trigger's "a" outlet

so it re-sends the actual message, rather than converting it to list.
---
 src/x_connective.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/x_connective.c b/src/x_connective.c
index abd0931..0ac8cc6 100644
--- a/src/x_connective.c
+++ b/src/x_connective.c
@@ -991,6 +991,8 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
         else if (u->u_type == TR_SYMBOL)
             outlet_symbol(u->u_outlet,
                 (argc ? atom_getsymbol(argv) : &s_symbol));
+        else if (u->u_type == TR_ANYTHING)
+            outlet_anything(u->u_outlet, s, argc, argv);
         else if (u->u_type == TR_POINTER)
         {
             if (!argc || argv->a_type != TR_POINTER)
@@ -1017,28 +1019,28 @@ static void trigger_anything(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
 
 static void trigger_bang(t_trigger *x)
 {
-    trigger_list(x, 0, 0, 0);
+    trigger_list(x, &s_bang, 0, 0);
 }
 
 static void trigger_pointer(t_trigger *x, t_gpointer *gp)
 {
     t_atom at;
     SETPOINTER(&at, gp);
-    trigger_list(x, 0, 1, &at);
+    trigger_list(x, &s_pointer, 1, &at);
 }
 
 static void trigger_float(t_trigger *x, t_float f)
 {
     t_atom at;
     SETFLOAT(&at, f);
-    trigger_list(x, 0, 1, &at);
+    trigger_list(x, &s_float, 1, &at);
 }
 
 static void trigger_symbol(t_trigger *x, t_symbol *s)
 {
     t_atom at;
     SETSYMBOL(&at, s);
-    trigger_list(x, 0, 1, &at);
+    trigger_list(x, &s_symbol, 1, &at);
 }
 
 static void trigger_free(t_trigger *x)
-- 
1.7.10.4

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to