aboutsummaryrefslogtreecommitdiff
path: root/src/lister.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lister.c')
-rw-r--r--src/lister.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/lister.c b/src/lister.c
index 14096ab..72d9c46 100644
--- a/src/lister.c
+++ b/src/lister.c
@@ -1,4 +1,4 @@
-/*
+/*
* lister: this is for lists, what "float" is for floats (use [list] instead)
*
* (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 <http://www.gnu.org/licenses/>.
*/
@@ -41,26 +41,30 @@ static t_class *mypdlist_class;
static void atoms_copy(int argc, t_atom *from, t_atom *to)
{
int i;
- for (i = 0; i < argc; i++)
+ for (i = 0; i < argc; i++) {
to[i] = from[i];
+ }
}
static void mypdlist_storelist(t_mypdlist *x, int argc, t_atom *argv)
{
- if(x->x_list)freebytes(x->x_list, x->x_n*sizeof(t_atom));
+ if(x->x_list) {
+ freebytes(x->x_list, x->x_n*sizeof(t_atom));
+ }
x->x_n=argc;
x->x_list=(t_atom*)getbytes(x->x_n*sizeof(t_atom));
atoms_copy(argc, argv, x->x_list);
}
-static void mypdlist_secondlist(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
+static void mypdlist_secondlist(t_mypdlist *x, t_symbol *s, int argc,
+ t_atom *argv)
{
mypdlist_storelist(x, argc, argv);
}
static void mypdlist_bang(t_mypdlist *x)
-{
+{
int outc=x->x_n;
t_atom*outv;
ATOMS_ALLOCA(outv, outc);
@@ -70,7 +74,8 @@ static void mypdlist_bang(t_mypdlist *x)
}
-static void mypdlist_list(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
+static void mypdlist_list(t_mypdlist *x, t_symbol *s, int argc,
+ t_atom *argv)
{
mypdlist_secondlist(x, s, argc, argv);
mypdlist_bang(x);
@@ -78,7 +83,9 @@ static void mypdlist_list(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
static void mypdlist_free(t_mypdlist *x)
-{ freebytes(x->x_list, x->x_n * sizeof(t_atom)); }
+{
+ freebytes(x->x_list, x->x_n * sizeof(t_atom));
+}
static void *mypdlist_new(t_symbol *s, int argc, t_atom *argv)
{
@@ -90,8 +97,9 @@ static void *mypdlist_new(t_symbol *s, int argc, t_atom *argv)
x->x_n = 0;
x->x_list = 0;
- if(argc)
+ if(argc) {
mypdlist_secondlist(x, gensym("list"), argc, argv);
+ }
return (x);
}
@@ -104,7 +112,7 @@ static void mypdlist_help(t_mypdlist*x)
void lister_setup(void)
{
- mypdlist_class = class_new(gensym("lister"), (t_newmethod)mypdlist_new,
+ mypdlist_class = class_new(gensym("lister"), (t_newmethod)mypdlist_new,
(t_method)mypdlist_free, sizeof(t_mypdlist), 0, A_GIMME, 0);
/* i don't know how to get this work with name=="list" !!! */
@@ -112,9 +120,11 @@ void lister_setup(void)
class_addbang (mypdlist_class, mypdlist_bang);
class_addlist (mypdlist_class, mypdlist_list);
- class_addmethod (mypdlist_class, (t_method)mypdlist_secondlist, gensym("lst2"), A_GIMME, 0);
+ class_addmethod (mypdlist_class, (t_method)mypdlist_secondlist,
+ gensym("lst2"), A_GIMME, 0);
- class_addmethod(mypdlist_class, (t_method)mypdlist_help, gensym("help"), A_NULL);
+ class_addmethod(mypdlist_class, (t_method)mypdlist_help, gensym("help"),
+ A_NULL);
zexy_register("lister");
}
void l_setup(void)