diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2006-12-12 11:15:28 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2006-12-12 11:15:28 +0000 |
commit | 483bba4eecd0fdabb387e21666162d49c2bca6b6 (patch) | |
tree | d9598e030c0d0106429a0df3e4c6526e0769aa05 | |
parent | a89ad4d196ec87c58ea83703fc465853438eaab3 (diff) |
added "dump" and "clear" messages
svn path=/trunk/externals/zexy/; revision=6816
-rw-r--r-- | src/fifop.c | 48 | ||||
-rw-r--r-- | src/lifop.c | 37 |
2 files changed, 77 insertions, 8 deletions
diff --git a/src/fifop.c b/src/fifop.c index fdbe57d..9ac07a4 100644 --- a/src/fifop.c +++ b/src/fifop.c @@ -205,13 +205,7 @@ static void fifop_query(t_fifop*x) outlet_float(x->x_infout, (t_float)x->counter); } -static void fifop_help(t_fifop*x) -{ - post("\n%c fifop\t\t:: a First-In-First-Out queue with priorities", HEARTSYMBOL); -} - - -static void fifop_free(t_fifop *x) +static void fifop_clear(t_fifop*x) { t_fifop_prioritylist *fifo_list=x->fifo_list; while(fifo_list){ @@ -237,6 +231,42 @@ static void fifop_free(t_fifop *x) freebytes(fifo_list2, sizeof( t_fifop_prioritylist)); } x->fifo_list=0; + x->counter=0; +} +/* this is NOT re-entrant! */ +static void fifop_dump(t_fifop*x) +{ + t_fifop_prioritylist*pfifo=getFifo(x->fifo_list); + + if(!pfifo||!pfifo->fifo_start) { + outlet_bang(x->x_infout); + return; + } + + while(pfifo) { + t_fifop_list*fifo=pfifo->fifo_start; + while(fifo) { + t_atom*argv=fifo->argv; + int argc=fifo->argc; + + /* output the list */ + outlet_list(x->x_out, &s_list, argc, argv); + + fifo=fifo->next; + } + pfifo=pfifo->next; + } +} + +static void fifop_help(t_fifop*x) +{ + post("\n%c fifop\t\t:: a First-In-First-Out queue with priorities", HEARTSYMBOL); +} + + +static void fifop_free(t_fifop *x) +{ + fifop_clear(x); outlet_free(x->x_out); outlet_free(x->x_infout); @@ -263,6 +293,10 @@ void fifop_setup(void) class_addbang (fifop_class, fifop_bang); class_addlist (fifop_class, fifop_list); + + class_addmethod (fifop_class, (t_method)fifop_clear, gensym("clear"), A_NULL); + class_addmethod (fifop_class, (t_method)fifop_dump, gensym("dump"), A_NULL); + class_addmethod (fifop_class, (t_method)fifop_query, gensym("info"), A_NULL); class_addmethod (fifop_class, (t_method)fifop_help, gensym("help"), A_NULL); diff --git a/src/lifop.c b/src/lifop.c index ef57d6a..46eb165 100644 --- a/src/lifop.c +++ b/src/lifop.c @@ -187,7 +187,7 @@ static void lifop_query(t_lifop*x) outlet_float(x->x_infout, (t_float)x->counter); } -static void lifop_free(t_lifop *x) +static void lifop_clear(t_lifop *x) { t_lifop_prioritylist *lifo_list=x->lifo_list; while(lifo_list){ @@ -212,6 +212,37 @@ static void lifop_free(t_lifop *x) freebytes(lifo_list2, sizeof( t_lifop_prioritylist)); } x->lifo_list=0; + x->counter=0; +} + +/* this is NOT re-entrant! */ +static void lifop_dump(t_lifop*x) +{ + t_lifop_prioritylist*plifo=getLifo(x->lifo_list); + + if(!plifo||!plifo->lifo_start) { + outlet_bang(x->x_infout); + return; + } + + while(plifo) { + t_lifop_list*lifo=plifo->lifo_start; + while(lifo) { + t_atom*argv=lifo->argv; + int argc=lifo->argc; + + /* output the list */ + outlet_list(x->x_out, &s_list, argc, argv); + + lifo=lifo->next; + } + plifo=plifo->next; + } +} + +static void lifop_free(t_lifop *x) +{ + lifop_clear(x); outlet_free(x->x_out); outlet_free(x->x_infout); @@ -242,6 +273,10 @@ void lifop_setup(void) class_addbang (lifop_class, lifop_bang); class_addlist (lifop_class, lifop_list); + + class_addmethod (lifop_class, (t_method)lifop_clear, gensym("clear"), A_NULL); + class_addmethod (lifop_class, (t_method)lifop_dump, gensym("dump"), A_NULL); + class_addmethod (lifop_class, (t_method)lifop_query, gensym("info"), A_NULL); class_addmethod (lifop_class, (t_method)lifop_help, gensym("help"), A_NULL); |