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/tabdump.c | 60 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'src/tabdump.c') diff --git a/src/tabdump.c b/src/tabdump.c index ad1b86f..3129d6e 100644 --- a/src/tabdump.c +++ b/src/tabdump.c @@ -1,4 +1,4 @@ -/* +/* * tabdump: get the content of a table as a list of floats * * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem) @@ -7,12 +7,12 @@ * 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 . */ @@ -23,8 +23,7 @@ static t_class *tabdump_class; -typedef struct _tabdump -{ +typedef struct _tabdump { t_object x_obj; t_symbol *x_arrayname; t_int startindex, stopindex; @@ -36,32 +35,38 @@ static void tabdump_bang(t_tabdump *x) int npoints; zarray_t *vec; - if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) + if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { error("%s: no such array", x->x_arrayname->s_name); - else if (!zarray_getarray(A, &npoints, &vec)) + } else if (!zarray_getarray(A, &npoints, &vec)) { error("%s: bad template for tabdump", x->x_arrayname->s_name); - else - { - int n; - t_atom *atombuf; - - int start=x->startindex; - int stop =x->stopindex; - if(start<0||start>stop)start=0; - if(stopnpoints)stop=npoints; - npoints=stop-start; - - atombuf = (t_atom *)getbytes(sizeof(t_atom)*npoints); - for (n = 0; n < npoints; n++) SETFLOAT(&atombuf[n], zarray_getfloat(vec, start+n)); - outlet_list(x->x_obj.ob_outlet, gensym("list"), npoints, atombuf); - freebytes(atombuf,sizeof(t_atom)*npoints); + } else { + int n; + t_atom *atombuf; + + int start=x->startindex; + int stop =x->stopindex; + if(start<0||start>stop) { + start=0; + } + if(stopnpoints) { + stop=npoints; } + npoints=stop-start; + + atombuf = (t_atom *)getbytes(sizeof(t_atom)*npoints); + for (n = 0; n < npoints; n++) { + SETFLOAT(&atombuf[n], zarray_getfloat(vec, start+n)); + } + outlet_list(x->x_obj.ob_outlet, gensym("list"), npoints, atombuf); + freebytes(atombuf,sizeof(t_atom)*npoints); + } } -static void tabdump_list(t_tabdump *x, t_symbol* UNUSED(s),int argc, t_atom*argv) +static void tabdump_list(t_tabdump *x, t_symbol* UNUSED(s),int argc, + t_atom*argv) { int a,b; - switch(argc){ + switch(argc) { case 2: a=atom_getint(argv); b=atom_getint(argv+1); @@ -103,13 +108,14 @@ static void tabdump_helper(void) void tabdump_setup(void) { tabdump_class = class_new(gensym("tabdump"), (t_newmethod)tabdump_new, - 0, sizeof(t_tabdump), 0, A_DEFSYM, 0); + 0, sizeof(t_tabdump), 0, A_DEFSYM, 0); class_addbang(tabdump_class, (t_method)tabdump_bang); class_addlist(tabdump_class, (t_method)tabdump_list); class_addmethod(tabdump_class, (t_method)tabdump_set, gensym("set"), - A_SYMBOL, 0); + A_SYMBOL, 0); - class_addmethod(tabdump_class, (t_method)tabdump_helper, gensym("help"), 0); + class_addmethod(tabdump_class, (t_method)tabdump_helper, gensym("help"), + 0); zexy_register("tabdump"); } -- cgit v1.2.1