From 4f8c7c28f8ece71d15ed28ae30f253725f1efa39 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 20 Oct 2012 18:32:25 +0000 Subject: update code format to pd-style: astyle --style=ansi --align-pointer=name *.c svn path=/trunk/externals/moonlib/; revision=16427 --- tabsort.c | 70 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'tabsort.c') diff --git a/tabsort.c b/tabsort.c index 53956a1..1658426 100644 --- a/tabsort.c +++ b/tabsort.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2002 Antoine Rousseau +Copyright (C) 2002 Antoine Rousseau This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -13,7 +13,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA typedef struct tabsort { - /*env part*/ + /*env part*/ t_object x_obj; /* header */ t_symbol *x_arrayname1; t_symbol *x_arrayname2; @@ -41,67 +41,67 @@ static void *tabsort_new(t_symbol *tab1,t_symbol *tab2) x->x_arrayname1 = tab1; x->x_arrayname2 = tab2; - outlet_new((t_object*)x, &s_bang); + outlet_new((t_object *)x, &s_bang); return (x); } static void tabsort_set1(t_tabsort *x, t_symbol *s) { - x->x_arrayname1 = s; + x->x_arrayname1 = s; } static void tabsort_set2(t_tabsort *x, t_symbol *s) { - x->x_arrayname2 = s; + x->x_arrayname2 = s; } static void tabsort_float(t_tabsort *x, t_floatarg n) { - t_garray *a; - int n1,n2,i,j; - t_float *vec1,*vec2,tmp; + t_garray *a; + int n1,n2,i,j; + t_float *vec1,*vec2,tmp; if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname1, garray_class))) { - if (*x->x_arrayname1->s_name) pd_error(x, "tabsort: %s: no such array", - x->x_arrayname1->s_name); - return; + if (*x->x_arrayname1->s_name) pd_error(x, "tabsort: %s: no such array", + x->x_arrayname1->s_name); + return; } else if (!garray_getfloatarray(a, &n1, &vec1)) { - error("%s: bad template for tabsort", x->x_arrayname1->s_name); - return; + error("%s: bad template for tabsort", x->x_arrayname1->s_name); + return; } if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname2, garray_class))) { - if (*x->x_arrayname2->s_name) pd_error(x, "tabsort: %s: no such array", - x->x_arrayname2->s_name); - return; + if (*x->x_arrayname2->s_name) pd_error(x, "tabsort: %s: no such array", + x->x_arrayname2->s_name); + return; } else if (!garray_getfloatarray(a, &n2, &vec2)) { - error("%s: bad template for tabsort", x->x_arrayname2->s_name); - return; + error("%s: bad template for tabsort", x->x_arrayname2->s_name); + return; } - if(n>n1) n=n1; - if(n>n2) n=n2; + if(n>n1) n=n1; + if(n>n2) n=n2; - for(i=0;ii;j--) - if(vec1[(int)vec2[j-1]]i; j--) + if(vec1[(int)vec2[j-1]]ob_outlet); + garray_redraw(a); + outlet_bang(((t_object *)x)->ob_outlet); } @@ -113,11 +113,11 @@ static void tabsort_ff(t_tabsort *x) /* cleanup on free */ void tabsort_setup(void ) { tabsort_class = class_new(gensym("tabsort"), (t_newmethod)tabsort_new, - (t_method)tabsort_ff, sizeof(t_tabsort), 0, A_DEFSYM, A_DEFSYM, 0); + (t_method)tabsort_ff, sizeof(t_tabsort), 0, A_DEFSYM, A_DEFSYM, 0); class_addmethod(tabsort_class, (t_method)tabsort_set1, - gensym("set1"), A_DEFSYM, 0); + gensym("set1"), A_DEFSYM, 0); class_addmethod(tabsort_class, (t_method)tabsort_set2, - gensym("set2"), A_DEFSYM, 0); + gensym("set2"), A_DEFSYM, 0); class_addfloat(tabsort_class, tabsort_float); } -- cgit v1.2.1