From 739a8290a8b05645a2d055aed8e5eb76ba2e24e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Fri, 28 Aug 2015 17:55:26 +0000 Subject: one-true indentation svn path=/trunk/externals/zexy/; revision=17537 --- src/relay.c | 69 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'src/relay.c') diff --git a/src/relay.c b/src/relay.c index 8fcd34e..e1ea476 100644 --- a/src/relay.c +++ b/src/relay.c @@ -1,4 +1,4 @@ -/* +/* * relay: route without stripping selector * * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem) @@ -7,17 +7,17 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ -/* +/* (c) 2106:forum::für::umläute:2005 "relay" is like "route" but doesn't change the incoming list @@ -26,7 +26,7 @@ [foo bar( --> [route foo] --> [bar( [foo bar( --> [relay foo] --> [foor bar( - namings: + namings: direct, channel, relay, steer, guide, ?? in the meantime i choose [relay] (as in mail-relay) @@ -40,14 +40,12 @@ static t_class *relay_class; -typedef struct _relayelement -{ +typedef struct _relayelement { t_word e_w; t_outlet *e_outlet; } t_relayelement; -typedef struct _relay -{ +typedef struct _relay { t_object x_obj; t_atomtype x_type; t_int x_nelement; @@ -55,15 +53,16 @@ typedef struct _relay t_outlet *x_rejectout; } t_relay; -static void relay_anything(t_relay *x, t_symbol *sel, int argc, t_atom *argv) +static void relay_anything(t_relay *x, t_symbol *sel, int argc, + t_atom *argv) { t_relayelement *e; int nelement; if (x->x_type == A_SYMBOL) { for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { if (e->e_w.w_symbol == sel) { - outlet_anything(e->e_outlet, sel, argc, argv); - return; + outlet_anything(e->e_outlet, sel, argc, argv); + return; } } } @@ -83,38 +82,38 @@ static void relay_list(t_relay *x, t_symbol *sel, int argc, t_atom *argv) f = atom_getfloat(argv); for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { if (e->e_w.w_float == f) { - outlet_anything(e->e_outlet, sel, argc, argv); - return; + outlet_anything(e->e_outlet, sel, argc, argv); + return; } } } else { /* symbol arguments */ if (argc == 0) { /* no args: treat as "bang" */ for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { - if (e->e_w.w_symbol == gensym("bang")) { - outlet_bang(e->e_outlet); - return; - } + if (e->e_w.w_symbol == gensym("bang")) { + outlet_bang(e->e_outlet); + return; + } } } else if (argc>1) { - for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { - if (e->e_w.w_symbol == gensym("list")) { - outlet_anything(e->e_outlet, sel, argc, argv); - return; - } + for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { + if (e->e_w.w_symbol == gensym("list")) { + outlet_anything(e->e_outlet, sel, argc, argv); + return; + } } } else if (argv[0].a_type == A_FLOAT) { /* one float arg */ for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { - if (e->e_w.w_symbol == gensym("float")) { - outlet_float(e->e_outlet, argv[0].a_w.w_float); - return; - } + if (e->e_w.w_symbol == gensym("float")) { + outlet_float(e->e_outlet, argv[0].a_w.w_float); + return; + } } } else { for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) { - if (e->e_w.w_symbol == gensym("symbol")) { - outlet_symbol(e->e_outlet, argv[0].a_w.w_symbol); - return; - } + if (e->e_w.w_symbol == gensym("symbol")) { + outlet_symbol(e->e_outlet, argv[0].a_w.w_symbol); + return; + } } } } @@ -143,9 +142,11 @@ static void *relay_new(t_symbol* UNUSED(s), int argc, t_atom *argv) x->x_vec = (t_relayelement *)getbytes(argc * sizeof(*x->x_vec)); for (n = 0, e = x->x_vec; n < argc; n++, e++) { e->e_outlet = outlet_new(&x->x_obj, gensym("list")); - if (x->x_type == A_FLOAT) + if (x->x_type == A_FLOAT) { e->e_w.w_float = atom_getfloatarg(n, argc, argv); - else e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv); + } else { + e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv); + } } x->x_rejectout = outlet_new(&x->x_obj, gensym("list")); return (x); @@ -154,7 +155,7 @@ static void *relay_new(t_symbol* UNUSED(s), int argc, t_atom *argv) void relay_setup(void) { relay_class = class_new(gensym("relay"), (t_newmethod)relay_new, - (t_method)relay_free, sizeof(t_relay), 0, A_GIMME, 0); + (t_method)relay_free, sizeof(t_relay), 0, A_GIMME, 0); class_addlist(relay_class, relay_list); class_addanything(relay_class, relay_anything); zexy_register("relay"); -- cgit v1.2.1