diff options
-rw-r--r-- | src/dirac~.c | 23 | ||||
-rw-r--r-- | src/freadln.c | 25 | ||||
-rw-r--r-- | src/fwriteln.c | 1 | ||||
-rw-r--r-- | src/index.c | 57 | ||||
-rw-r--r-- | src/length.c | 1 | ||||
-rw-r--r-- | src/limiter~.c | 70 | ||||
-rw-r--r-- | src/list2lists.c | 4 | ||||
-rw-r--r-- | src/listfind.c | 8 | ||||
-rw-r--r-- | src/lpt.c | 3 | ||||
-rw-r--r-- | src/makesymbol.c | 1 | ||||
-rw-r--r-- | src/matchbox.c | 37 | ||||
-rw-r--r-- | src/multiplex.c | 5 | ||||
-rw-r--r-- | src/regex.c | 2 | ||||
-rw-r--r-- | src/sfrecord.c | 16 | ||||
-rw-r--r-- | src/sgn~.c | 14 | ||||
-rw-r--r-- | src/sort.c | 2 | ||||
-rw-r--r-- | src/tabread4~~.c | 4 | ||||
-rw-r--r-- | src/time.c | 1 | ||||
-rw-r--r-- | src/winNT_portio.c | 21 | ||||
-rw-r--r-- | src/zexy.c | 162 |
20 files changed, 229 insertions, 228 deletions
diff --git a/src/dirac~.c b/src/dirac~.c index 90d9dbb..7aae46d 100644 --- a/src/dirac~.c +++ b/src/dirac~.c @@ -74,15 +74,6 @@ static t_int *dirac_perform(t_int *w) return (w+4); } - -static t_int *dirac_perf8(t_int *w) -{ - t_dirac *x = (t_dirac *)(w[1]); - t_sample *out = (t_sample *)(w[2]); - int n = (int)(w[3]); - - t_int do_it = x->do_it; - #ifndef __WIN32__ /* LATER: investigate the occurence of zero_perf8() */ /* it seems, like pd has the symbol zero_perf8(), @@ -90,11 +81,21 @@ static t_int *dirac_perf8(t_int *w) * so linux can use it, but w32 not * have to tell miller about that */ - zero_perf8(w+1); +t_int *zero_perf8(t_int *w); #else - zero_perform(w+1); +/* on w32 we have no access to this hidden function anyhow... */ +# define zero_perf8 zero_perform #endif +static t_int *dirac_perf8(t_int *w) +{ + t_dirac *x = (t_dirac *)(w[1]); + t_sample *out = (t_sample *)(w[2]); + int n = (int)(w[3]); + + t_int do_it = x->do_it; + zero_perf8(w+1); + if (do_it >= n) x->do_it -= n; else if(do_it >= 0) diff --git a/src/freadln.c b/src/freadln.c index fdad165..16e3aad 100644 --- a/src/freadln.c +++ b/src/freadln.c @@ -23,15 +23,12 @@ #include <stdio.h> #include <string.h> -//#include <stdarg.h> -//#include <fcntl.h> #ifdef __WIN32__ # include <io.h> # include <stdlib.h> -//#else -//# include <sys/types.h> -//# include <unistd.h> +#else +# include <unistd.h> #endif #define MIN_FREADLN_LENGTH 10 @@ -85,17 +82,19 @@ static void freadln_open (t_freadln *x, t_symbol *s, t_symbol*type) freadln_close(x); -/* if(type!=gensym("cr")) { +/* + if(type!=gensym("cr")) { pd_error(x, "currently only 'cr' type files are implemented!"); return; - }*/ + } +*/ if (type==gensym("cr")) strcpy(x->linebreak_chr,"\n"); else strcpy(x->linebreak_chr,";\n"); - // directory, filename, extension, dirresult, nameresult, unsigned int size, int bin + /* directory, filename, extension, dirresult, nameresult, unsigned int size, int bin */ if ((fd=open_via_path(dirname, s->s_name,"", filenamebuf, &filenamebufptr, MAXPDSTRING,0)) < 0 ) { pd_error(x, "%s: failed to open %s", s->s_name, filenamebuf); @@ -164,7 +163,7 @@ static void freadln_readline (t_freadln *x) t_symbol *s; int rewind_after; - if (x->x_file < 0) { + if (!x->x_file) { pd_error(x, "no file opened for reading"); return; } @@ -196,7 +195,6 @@ static void freadln_readline (t_freadln *x) if (linebreak_pos==-1) linebreak_pos=items_read; x->x_textbuf[linebreak_pos-1]='\0'; - //post("analyzing \"%s\"",x->x_textbuf); if (!(bbuf=binbuf_new())) { pd_error(x, "out of memory"); freadln_close(x); @@ -216,9 +214,10 @@ static void freadln_readline (t_freadln *x) else { outlet_list(x->x_message_outlet, atom_getsymbol(abuf), 0, abuf); } - // NOTE: the following line might be a problem in recursions - // and could be performed before to outlet_* as well, - // but(!) atom buffer abuf must be copied if doing so. + /* NOTE: the following line might be a problem in recursions + * and could be performed before to outlet_* as well, + * but(!) atom buffer abuf must be copied if doing so. + */ binbuf_free(bbuf); } diff --git a/src/fwriteln.c b/src/fwriteln.c index 4c1d9fb..a6a9689 100644 --- a/src/fwriteln.c +++ b/src/fwriteln.c @@ -239,7 +239,6 @@ static void *fwriteln_new(t_symbol *s, int argc, t_atom *argv) strncat(x->format_string_afloats,width_str,2); strncat(x->format_string_afloats,precision_str,3); strncat(x->format_string_afloats,float_format,2); - //post("format string: \"%s\"\n",x->format_string_afloats); return (void *)x; } diff --git a/src/index.c b/src/index.c index 402f14f..d1d3045 100644 --- a/src/index.c +++ b/src/index.c @@ -104,9 +104,9 @@ static void index_symbol(t_index *x, t_symbol *s) int element; if ( (element = find_item(s, x->names, x->maxentries)+1) ) outlet_float(x->x_obj.ob_outlet, (t_float)element); - else if (x->auto_mode) // not yet stored: add automatically + else if (x->auto_mode) /* not yet stored: add automatically */ index_add(x, s, 0); - else outlet_float(x->x_obj.ob_outlet, 0.f); // not yet stored but do not add + else outlet_float(x->x_obj.ob_outlet, 0.f); /* not yet stored but do not add */ } /* output the entry at a given index */ @@ -254,7 +254,6 @@ static void index_sort(t_index *x){ while(step>1){ int i = loops; - //step = (step % 2)?(step+1)/2:step/2; step+=step%2; step>>=1; loops+=2; @@ -262,11 +261,11 @@ static void index_sort(t_index *x){ while(i--) { /* there might be some optimization in here */ for (n=0; n<(x->entries-step); n++) { int comp=strcmp(buf[n]->s_name,buf[n+step]->s_name); - if (comp>0) { // compare STRINGS not SYMBOLS - t_symbol*s_tmp = buf[n]; - buf[n] = buf[n+step]; - buf[n+step] = s_tmp; - } + if (comp>0) { /* compare STRINGS not SYMBOLS */ + t_symbol*s_tmp = buf[n]; + buf[n] = buf[n+step]; + buf[n+step] = s_tmp; + } } } } @@ -325,25 +324,27 @@ static void index_free(t_index *x) static void index_helper(t_index *x) { - ZEXY_USEVAR(x); - post("\n%c index :: index symbols to indices", HEARTSYMBOL); - post("<symbol> : look up the <symbol> in the index and return it's index\n" - "\n<int> : look up the element at index <int> in the index" - "\n'add <symbol>' : add a new symbol to the index-map" - "\n'add <symbol> <int>' : add a new symbol at the index <int>" - "\n'delete <symbol>' : delete a symbol from the index-map" - "\n'delete <int>' : delete the entry at index <int> from the index-map" - "\n'reset' : delete the whole index-map" - "\n'bang' : return the number of entries in the index-map" - "\n'dump' : dump each entry in the format \"list <symbol> <index>\"" - "\n'compact' : remove holes in the index-map"); - post("\n'sort' : alphabetically sort the entries" - "\n'auto <1/0> : if auto is 1 and a yet unknown symbol is looked up it is\n\t\t\t automatically added to the index-map" - "\n'resize <1/0> : if resize is 1 (default), the index-map is resized\n\t\t\t automatically if needed" - "\n'help' : view this" - "\noutlet : <n> : index of the <symbol>" - "\n <symbol> : entry at <index>"); - post("\ncreation:\"index [<maxelements> [<auto>]]\": creates a <maxelements> sized index"); + endpost(); + post("%c index :: index symbols to indices", HEARTSYMBOL); + post("<symbol> : look up the <symbol> in the index and return it's index"); + post("<int> : look up the element at index <int> in the index"); + post("'add <symbol>' : add a new symbol to the index-map"); + post("'add <symbol> <int>' : add a new symbol at the index <int>"); + post("'delete <symbol>' : delete a symbol from the index-map"); + post("'delete <int>' : delete the entry at index <int> from the index-map"); + post("'reset' : delete the whole index-map"); + post("'bang' : return the number of entries in the index-map"); + post("'dump' : dump each entry in the format \"list <symbol> <index>\""); + post("'compact' : remove holes in the index-map"); + endpost(); + post("'sort' : alphabetically sort the entries"); + post("'auto <1/0> : if auto is 1 and a yet unknown symbol is looked up it is\n\t\t\t automatically added to the index-map"); + post("'resize <1/0> : if resize is 1 (default), the index-map is resized\n\t\t\t automatically if needed"); + post("'help' : view this"); + post("outlet : <n> : index of the <symbol>"); + post(" <symbol> : entry at <index>"); + endpost(); + post("creation:\"index [<maxelements> [<auto>]]\": creates a <maxelements> sized index"); } void index_setup(void) @@ -356,7 +357,7 @@ void index_setup(void) class_addmethod(index_class, (t_method)index_reset, gensym("reset"), 0); class_addmethod(index_class, (t_method)index_delete, gensym("delete"), A_GIMME, 0); - // class_addmethod(index_class, (t_method)index_add, gensym("add"), A_SYMBOL, 0); + /* class_addmethod(index_class, (t_method)index_add, gensym("add"), A_SYMBOL, 0); */ class_addmethod(index_class, (t_method)index_add, gensym("add"), A_SYMBOL, A_DEFFLOAT, 0); class_addmethod(index_class, (t_method)index_auto, gensym("auto"), A_FLOAT, 0); diff --git a/src/length.c b/src/length.c index f39cbe8..86bf86d 100644 --- a/src/length.c +++ b/src/length.c @@ -51,7 +51,6 @@ void length_setup(void) class_addlist(length_class, (t_method)length_list); class_addanything(length_class, (t_method)length_any); - // class_addbang(length_class, (t_method)length_bang); zexy_register("length"); } diff --git a/src/limiter~.c b/src/limiter~.c index ef2e039..a0040f6 100644 --- a/src/limiter~.c +++ b/src/limiter~.c @@ -56,21 +56,24 @@ #define TABLESIZE 512 /* compressor table */ /* ------------------------------------------------------------------------------------ */ -// first define the structs... +/* first define the structs... */ static t_class *limiter_class; typedef struct _limctl -{ // variables changed by user - t_float limit, hold_samples, change_of_amplification; +{ + /* variables changed by user */ + t_float limit; + t_float hold_samples; + t_float change_of_amplification; } t_limctl; typedef struct _cmpctl { - t_float treshold, ratio; // uclimit is the very same is the limiter1-limit (decalculated relative to our treshold) - t_float uclimit, climit_inverse; // climit == compressed limit (uclimit == uncompressed limit) + t_float treshold, ratio; /* uclimit is the very same is the limiter1-limit (decalculated relative to our treshold) */ + t_float uclimit, climit_inverse; /* climit == compressed limit (uclimit == uncompressed limit) */ - t_float limiter_limit; // start limiting (stop compressing); == tresh/limit; + t_float limiter_limit; /* start limiting (stop compressing); == tresh/limit; */ t_float treshdB, oneminusratio; } t_cmpctl; @@ -87,8 +90,7 @@ typedef struct _limiter int number_of_inlets, s_n; - // variables changed by process - + /* variables changed by process */ t_sample amplification; t_float samples_left, still_left; @@ -97,9 +99,10 @@ typedef struct _limiter t_limctl *val1, *val2; t_cmpctl *cmp; - // note : limit is not the same for val1 & val2 : - // at val1 it is the limit of the INPUT_VALUE - // at val2 it is the limit for the AMPLIFICATION (in fact it is abs_limit1/abs_limit2) + /* note : limit is not the same for val1 & val2 : + * at val1 it is the limit of the INPUT_VALUE + * at val2 it is the limit for the AMPLIFICATION (in fact it is abs_limit1/abs_limit2) + */ t_inbuf* in; int buf_size; @@ -107,13 +110,14 @@ typedef struct _limiter } t_limiter; /* ------------------------------------------------------------------------------------ */ -// then do the message - thing +/* then do the message - thing */ -// do the user settings +/* do the user settings */ -// calcs +/* calcs */ static t_float calc_holdsamples(t_float htime, int buf) -{ // hold_time must be greater than buffer_time to make sure that any peak_sample is amplified with its own factor +{ + /* hold_time must be greater than buffer_time to make sure that any peak_sample is amplified with its own factor */ t_float min_hold = buf / sys_getsr(); return (0.001 * sys_getsr() * ((htime > min_hold)?htime:((min_hold > 50)?min_hold:50))); } @@ -135,7 +139,7 @@ static void set_uclimit(t_limiter *x) c->oneminusratio = 1. - ratio; } -// settings +/* settings */ static void set_treshold(t_limiter *x, t_float treshold) { @@ -174,7 +178,6 @@ static void set_mode(t_limiter *x, t_float mode) x->mode = LIMIT0; break; } - // post("mode set to %d", x->mode); } static void set_LIMIT(t_limiter *x) @@ -193,7 +196,8 @@ static void set_COMPRESS(t_limiter *x) } static void set_bufsize(t_limiter *x, int size) -{ // this is really unneeded...and for historical reasons only +{ + /* this is really unneeded...and for historical reasons only */ if (size < BUFSIZE) size = BUFSIZE; x->buf_size = size + XTRASAMPS; } @@ -218,8 +222,8 @@ static void set_limits(t_limiter *x, t_floatarg limit1, t_floatarg limit2) if (lim2 < lim1) { - lim2 = 2*lim1; // this is to prevent lim2 (which should trigger the FAST regulation) - x->mode = 0; // to underrun the SLOW regulation; this would cause distortion + lim2 = 2*lim1; /* this is to prevent lim2 (which should trigger the FAST regulation) */ + x->mode = 0; /* to underrun the SLOW regulation; this would cause distortion */ } x->val1->limit = lim1; @@ -276,7 +280,7 @@ static void reset(t_limiter *x) x->amplification = 1.; } -// verbose +/* verbose */ static void status(t_limiter *x) { t_limctl *v1 = x->val1; @@ -351,7 +355,7 @@ static void limiter_tilde_helper(t_limiter *x) /* ------------------------------------------------------------------------------------ */ -// now do the dsp - thing // +/* now do the dsp - thing */ /* ------------------------------------------------------------------------------------ */ static t_int *oversampling_maxima(t_int *w) @@ -443,9 +447,9 @@ static t_int *limiter_perform(t_int *w) t_limctl *v2 = (t_limctl *)(x->val2); t_cmpctl *c = (t_cmpctl *)(x->cmp); - // now let's make things a little bit faster + /* now let's make things a little bit faster */ - // these must not be changed by process + /* these MUST NOT be changed by process */ const t_float limit = v1->limit; const t_float holdlong = v1->hold_samples; const t_float coa_long = v1->change_of_amplification; @@ -460,12 +464,12 @@ static t_int *limiter_perform(t_int *w) t_float oneminusratio = c->oneminusratio; - // these will be changed by process + /* these will be changed by process */ t_float amp = x->amplification; t_float samplesleft = x->samples_left; t_float stillleft = x->still_left; - // an intern variable... + /* an intern variable... */ t_float max_val; switch (x->mode) { @@ -474,7 +478,7 @@ static t_int *limiter_perform(t_int *w) { max_val = *in; - // the MAIN routine for the 1-treshold-limiter + /* the MAIN routine for the 1-treshold-limiter */ if ((max_val * amp) > limit) { @@ -499,7 +503,7 @@ static t_int *limiter_perform(t_int *w) while (n--) { max_val = *in; - // the main routine 2 + /* the main routine 2 */ if ((max_val * amp) > limit) { @@ -538,7 +542,7 @@ static t_int *limiter_perform(t_int *w) { max_val = *in; - // the MAIN routine for the compressor (very similar to the 1-treshold-limiter) + /* the MAIN routine for the compressor (very similar to the 1-treshold-limiter) */ if (max_val * amp > tresh) { amp = tresh / max_val; @@ -548,9 +552,9 @@ static t_int *limiter_perform(t_int *w) else if ((amp *= coa_long) > 1) amp = 1; if (amp < 1.) - if (amp > uclimit) // amp is still UnCompressed uclimit==limitIN/tresh; + if (amp > uclimit) /* amp is still UnCompressed uclimit==limitIN/tresh; */ *out++ = pow(amp, oneminusratio); - else *out++ = amp * climit_inv; // amp must fit for limiting : amp(new) = limit/maxval; = amp(old)*limitOUT/tresh; + else *out++ = amp * climit_inv; /* amp must fit for limiting : amp(new) = limit/maxval; = amp(old)*limitOUT/tresh; */ else *out++ = 1.; *in++ = 0.; @@ -561,7 +565,7 @@ static t_int *limiter_perform(t_int *w) break; } - // now return the goodies + /* now return the goodies */ x->amplification = amp; x->samples_left = samplesleft; @@ -592,7 +596,7 @@ static void limiter_dsp(t_limiter *x, t_signal **sp) /* ------------------------------------------------------------------------------------ */ -// finally do the creation - things +/* finally do the creation - things */ static void *limiter_new(t_symbol *s, int argc, t_atom *argv) { diff --git a/src/list2lists.c b/src/list2lists.c index a591172..d181bf8 100644 --- a/src/list2lists.c +++ b/src/list2lists.c @@ -19,7 +19,9 @@ #include "zexy.h" -//#define DEBUG +#if 0 +# define DEBUG +#endif #ifdef DEBUG # define DEBUGFUN(x) x diff --git a/src/listfind.c b/src/listfind.c index 2bc3cf3..e362bc1 100644 --- a/src/listfind.c +++ b/src/listfind.c @@ -19,7 +19,9 @@ #include "zexy.h" -//#define DEBUG +#if 0 +# define DEBUG +#endif #ifdef DEBUG # define DEBUGFUN(x) x @@ -82,7 +84,7 @@ static int list_equals(int count, t_atom*a1, t_atom*a2) { for(i=0; i<count; i++, a1++, a2++) { if(a1->a_type!=a2->a_type) return 0; - if(a1->a_w.w_symbol!=a2->a_w.w_symbol) // is it that simple? + if(a1->a_w.w_symbol!=a2->a_w.w_symbol) /* is it that simple? */ return 0; } return 1; @@ -124,7 +126,7 @@ static void listfind_doit(t_outlet*out, int longcount, t_atom*longlist, int patt count++; DEBUGFUN(post("new offset=%d", offset)); - offset++; // proceed to the next element + offset++; /* proceed to the next element */ } DEBUGFUN(post("got %d results", count)); @@ -107,7 +107,7 @@ typedef struct _lpt unsigned long port; int device; /* file descriptor of device, in case we are using one ...*/ - int mode; // MODE_IOPERM, MODE_IOPL + int mode; /* MODE_IOPERM, MODE_IOPL */ } t_lpt; static void lpt_float(t_lpt *x, t_floatarg f) @@ -237,7 +237,6 @@ static void *lpt_new(t_symbol *s, int argc, t_atom *argv) x->mode=MODE_NONE; } else x->mode=MODE_IOPL; count_iopl++; - // post("iopl.............................%d", count_iopl); } if(x->mode==MODE_NONE){ diff --git a/src/makesymbol.c b/src/makesymbol.c index 98acd61..a3793f6 100644 --- a/src/makesymbol.c +++ b/src/makesymbol.c @@ -69,7 +69,6 @@ typedef char cstring[MAXSTRINGLENG]; static t_symbol* list2symbol(char *masque, int argc, t_atom *argv) { - // cstring buf[MAXSTRINGARGS]; cstring*buf=(cstring*)getbytes(MAXSTRINGARGS*sizeof(cstring)); cstring buffer; int i; diff --git a/src/matchbox.c b/src/matchbox.c index 131fc5c..0ca5dcd 100644 --- a/src/matchbox.c +++ b/src/matchbox.c @@ -14,12 +14,13 @@ * ******************************************************/ -// LATER: add a creation argument to specify the initial search mode - -// LATER: bind a "name" to the [matchbox] so several objects can share the same entries -// if no name is given at creation time, the entries are local only - -// even LATER: dynamically bind to several searchlists (via "set" message) +/* LATER: add a creation argument to specify the initial search mode + * + * LATER: bind a "name" to the [matchbox] so several objects can share the same entries + * if no name is given at creation time, the entries are local only + * + * even LATER: dynamically bind to several searchlists (via "set" message) + */ #include "zexy.h" @@ -131,7 +132,7 @@ static int atommatch_exact(t_atom*pattern, t_atom*atom) { return pattern==atom; } } else { - //post("types don't match!"); + /* post("types don't match!"); */ return FALSE; } @@ -318,8 +319,6 @@ static int atommatch_osc(t_atom*pattern, t_atom*test) { int result = FALSE; - //startpost("atommatch::OSC -> "); - if(pattern->a_type==A_SYMBOL) { s_pattern=pattern->a_w.w_symbol->s_name; } else { @@ -338,8 +337,6 @@ static int atommatch_osc(t_atom*pattern, t_atom*test) { result = OSC_PatternMatch(s_pattern, s_test, s_pattern); - //post("'%s' <-> '%s' = %d", s_pattern, s_test, result); - if(pattern_size>0) { freebytes(s_pattern, pattern_size); s_pattern=0; pattern_size=0; @@ -401,10 +398,10 @@ static t_listlist*matchlistlist_regex(unsigned int*numresults, t_listlist*search regex_t**regexpressions=0; t_listlist*matchinglist=0, *sl; int i=0; - flags|=REG_EXTENDED; - int num=0; + flags|=REG_EXTENDED; + /* 1st compile the patterns */ regexpressions=(regex_t**)getbytes(sizeof(regex_t*)*p_argc); for(i=0; i<p_argc; i++) { @@ -539,32 +536,32 @@ static t_listlist*matchlistlist(unsigned int*numresults, t_listlist*searchlist, static void matchbox_list(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { - int results=0; + unsigned int results=0; int mode=x->x_mode; t_listlist*resultlist=matchlistlist(&results, x->x_lists, argc, argv, mode, FALSE); t_listlist*dummylist; - outlet_float(x->x_outNumResults, results); + outlet_float(x->x_outNumResults, (t_float)results); for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next) outlet_list(x->x_outResult, &s_list, dummylist->argc, dummylist->argv); } static void matchbox_add(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { - // 1st match, whether we already have this entry + /* 1st match, whether we already have this entry */ if(matchlistlist(0, x->x_lists, argc, argv, MATCHBOX_EXACT, FALSE)) { - // already there, skip the rest + /* already there, skip the rest */ z_verbose(1, "this list is already in the buffer!, skipping..."); return; } - // 2nd if this is a new entry, add it + /* 2nd if this is a new entry, add it */ x->x_lists=addlistlist(x->x_lists, argc, argv); x->x_numlists++; } static void matchbox_delete(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { - int results=0; + unsigned int results=0; int mode=x->x_mode; t_listlist*resultlist=matchlistlist(&results, x->x_lists, argc, argv, mode, TRUE); t_listlist*dummylist; @@ -572,7 +569,7 @@ static void matchbox_delete(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { x->x_numlists-=results; - outlet_float(x->x_outNumResults, results); + outlet_float(x->x_outNumResults, (t_float)results); for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next) outlet_anything(x->x_outResult, delsym, dummylist->argc, dummylist->argv); diff --git a/src/multiplex.c b/src/multiplex.c index 05849ea..8fe5b58 100644 --- a/src/multiplex.c +++ b/src/multiplex.c @@ -63,9 +63,6 @@ static void *mux_new(t_symbol *s, int argc, t_atom *argv) { int n = (argc < 2)?2:argc; t_mux *x = (t_mux *)pd_new(mux_class); - // t_muxproxy *y=(t_muxproxy*)pd_new(muxproxy_class); - ZEXY_USEVAR(s); - ZEXY_USEVAR(argv); x->i_selected=0; x->i_count = n; @@ -107,7 +104,7 @@ static void mux_free(t_mux*x){ freebytes(x->x_proxy, x->i_count * sizeof(t_muxproxy*)); } - //pd_free(&y->p_pd) + /* pd_free(&y->p_pd); */ } void multiplex_setup(void) diff --git a/src/regex.c b/src/regex.c index eb0e3b9..264bfeb 100644 --- a/src/regex.c +++ b/src/regex.c @@ -232,7 +232,7 @@ static void regex_symbol(t_regex *x, t_symbol *s, int argc, t_atom*argv) if(match[i].rm_so!=-1){ /* output the matches */ if(i>0 && (match[i].rm_so==match[i-1].rm_so) && (match[i].rm_eo==match[i-1].rm_eo)){ - // duplicate matches + /* duplicate matches */ } else { SETFLOAT(ap2+0, (t_float)i); SETFLOAT(ap2+1, (t_float)match[i].rm_so); diff --git a/src/sfrecord.c b/src/sfrecord.c index 54b1f58..dd3966d 100644 --- a/src/sfrecord.c +++ b/src/sfrecord.c @@ -26,8 +26,7 @@ zmoelnig@iem.kug.ac.at /* TODO: deprecate this in favour of [sfplay~] */ - -/* #define DEBUG_ME // for debugging messages */ +/* #define DEBUG_ME for debugging messages */ #include "zexy.h" @@ -128,15 +127,18 @@ static void sfrecord_open(t_sfrecord *x,t_symbol *filename,t_symbol *endian) return; } -/* test if big endian else asume little endian - should be 'l' but could be anything*/ - + /* test if big endian else asume little endian + * should be 'l' but could be anything + */ if(sfrecord_am_i_big_endian()) x->swap = !(endian->s_name[0] == 'b'); else x->swap = (endian->s_name[0] == 'b'); -// x->skip = 1; /* skip header after open;; sometimes we´ll have to write a header using the x->skip; so don´t delete it completely*/ + /* + * skip header after open;; sometimes we´ll have to write a header using the x->skip; so don´t delete it completely + */ + /* x->skip = 1; */ x->filename = filename; @@ -414,7 +416,7 @@ static t_int *sfrecord_perform(t_int *w) #endif break; }; -#endif //0 +#endif /* 0 */ return (w+c+3); /* writing was fine */ @@ -73,14 +73,14 @@ static t_int *sgnTilde_perform8(t_int *w) } #ifdef __SSE__ -static long l_bitmask[]={0x80000000, 0x80000000, 0x80000000, 0x80000000}; // sign bitmask +static long l_bitmask[]={0x80000000, 0x80000000, 0x80000000, 0x80000000}; /* sign bitmask */ static t_int *sgnTilde_performSSE(t_int *w) { __m128 *in = (__m128 *)(w[1]); __m128 *out = (__m128 *)(w[2]); __m128 val; - int n = (int)(w[3])>>3; // we do 8x loop-unrolling + int n = (int)(w[3])>>3; /* we do 8x loop-unrolling */ const __m128 sgnmask= _mm_loadu_ps((float*)l_bitmask); const __m128 zero = _mm_setzero_ps(); @@ -91,10 +91,10 @@ static t_int *sgnTilde_performSSE(t_int *w) while (n--) { val=in[0]; - xmm0 = _mm_cmpneq_ps(val , zero);// mask for non-zeros - xmm1 = _mm_and_ps (val, sgnmask);// sign (without value) - xmm0 = _mm_and_ps (xmm0, one); // (abs) value: (val==0.f)?0.f:1.f - out[0]= _mm_or_ps (xmm1, xmm0);// merge sign and value + xmm0 = _mm_cmpneq_ps(val , zero);/* mask for non-zeros */ + xmm1 = _mm_and_ps (val, sgnmask);/* sign (without value) */ + xmm0 = _mm_and_ps (xmm0, one); /* (abs) value: (val==0.f)?0.f:1.f */ + out[0]= _mm_or_ps (xmm1, xmm0);/* merge sign and value */ val=in[1]; xmm0 = _mm_cmpneq_ps(val , zero); @@ -117,7 +117,7 @@ static void sgnTilde_dsp(t_sgnTilde *x, t_signal **sp) Z_SIMD_CHKBLOCKSIZE(sp[0]->s_n)&& Z_SIMD_CHKALIGN(sp[0]->s_vec)&& Z_SIMD_CHKALIGN(sp[1]->s_vec)&& - ZEXY_TYPE_EQUAL(t_sample, float) // currently SSE2 code is only for float (not for double) + ZEXY_TYPE_EQUAL(t_sample, float) /* currently SSE2 code is only for float (not for double) */ ) { dsp_add(sgnTilde_performSSE, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); @@ -79,7 +79,6 @@ static void sort_list(t_sort *x, t_symbol *s, int argc, t_atom *argv) t_int *idx; int i, loops = 1; - ZEXY_USEVAR(s); sort_buffer(x, argc, argv); buf = x->buffer; @@ -88,7 +87,6 @@ static void sort_list(t_sort *x, t_symbol *s, int argc, t_atom *argv) while (step > 1) { step = (step % 2)?(step+1)/2:step/2; - // i = loops++; i = loops; loops += 2; diff --git a/src/tabread4~~.c b/src/tabread4~~.c index dbcf4bf..d150afa 100644 --- a/src/tabread4~~.c +++ b/src/tabread4~~.c @@ -72,7 +72,6 @@ static t_int *tabread4_tilde_perform(t_int *w) while (n--) *out++ = 0; return (w+6); } - // post("xxx"); for (i = 0; i < n; i++) { t_sample in0_s=*in++; @@ -87,9 +86,6 @@ static t_int *tabread4_tilde_perform(t_int *w) index = maxindex, frac = 1; else frac = findex - index; - //post("%f + %f = %f", in0_s, in1_s, findex); - // post("%f - %f = %d", findex, frac, index); - wp = buf + index; a = zarray_getfloat(wp,-1); @@ -95,7 +95,6 @@ static void time_bang(t_time *x) resolvetime = (x->GMT)?gmtime(&tv.tv_sec):localtime(&tv.tv_sec); ms = tv.tv_usec*0.001; #endif - // outlet_float(x->x_outlet4, (t_float)(mytime.millitm)); outlet_float(x->x_outlet4, (t_float)(ms)); outlet_float(x->x_outlet3, (t_float)resolvetime->tm_sec); outlet_float(x->x_outlet2, (t_float)resolvetime->tm_min); diff --git a/src/winNT_portio.c b/src/winNT_portio.c index 83fe89e..470df14 100644 --- a/src/winNT_portio.c +++ b/src/winNT_portio.c @@ -19,14 +19,13 @@ static BOOL bPrivException = FALSE; int read_parport(int port) { - // byte = _inp((unsigned short)port); unsigned char value; #ifdef _MSC_VER __asm mov edx,port __asm in al,dx __asm mov value,al #else - // hmm, i should read some documentation about inline assembler + /* hmm, i should read some documentation about inline assembler */ post("lpt: cannot read from parport (recompile!)"); return 0; #endif @@ -35,15 +34,17 @@ int read_parport(int port) void write_parport(int port, int invalue) { - // _outp((unsigned short)port, value); + /* _outp((unsigned short)port, value); */ BYTE value = (BYTE)invalue; #ifdef _MSC_VER __asm mov edx,port __asm mov al,value __asm out dx,al #else - // hmm, i should read some documentation about inline assembler - // and probably about assembler in general... + /* + * hmm, i should read some documentation about inline assembler + * and probably about assembler in general... + */ post("lpt: cannot write to parport (recompile!)"); /* asm( @@ -62,7 +63,7 @@ static LONG WINAPI HandlerExceptionFilter ( EXCEPTION_POINTERS *pExPtrs ) if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) { - pExPtrs->ContextRecord->Eip ++; // Skip the OUT or IN instruction that caused the exception + pExPtrs->ContextRecord->Eip ++; /* Skip the OUT or IN instruction that caused the exception */ bPrivException = TRUE; return EXCEPTION_CONTINUE_EXECUTION; } @@ -75,13 +76,13 @@ static BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParent HANDLE hUserPort; hUserPort = CreateFile("\\\\.\\UserPort", GENERIC_READ, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - CloseHandle(hUserPort); // Activate the driver - Sleep(100); // We must make a process switch + CloseHandle(hUserPort); /* Activate the driver */ + Sleep(100); /* We must make a process switch */ SetUnhandledExceptionFilter(HandlerExceptionFilter); bPrivException = FALSE; - read_parport(PortToAccess); // Try to access the given port address + read_parport(PortToAccess); /* Try to access the given port address */ if (bPrivException) { @@ -124,4 +125,6 @@ int open_port(int port) return(0); } } +#else +static int i=0; #endif /* __WIN32__ & Z_WANT_LPT */ @@ -21,6 +21,8 @@ #include "zexy.h" #include "z_zexy.h" + +#include <stdio.h> #include <stdarg.h> @@ -39,88 +41,90 @@ t_class *zexy_class; static void zexy_help(void) { - post("\n\n...this is the zexy %c external "VERSION"...", HEARTSYMBOL); - post("\n%c handling signals" + endpost(); endpost(); + post("...this is the zexy %c external "VERSION"...", HEARTSYMBOL); + endpost(); + post("%c handling signals", HEARTSYMBOL); #if 0 - "\nstreamout~\t:: stream signals via a LAN : (%c) gige 1999" - "\nstreamin~\t:: catch signals from a LAN : based on gige" + post("streamout~\t:: stream signals via a LAN : (%c) gige 1999"); + post("streamin~\t:: catch signals from a LAN : based on gige"); #endif - "\nsfplay\t\t:: play back a (multichannel) soundfile : (c) ritsch 1999" - "\nsfrecord\t:: record a (multichannel) soundfile : based on ritsch", HEARTSYMBOL); - - post("\n%c generating signals" - "\nnoish~\t\t:: generate bandlimited noise" - "\nnoisi~\t\t:: generate bandlimited noise" - "\ndirac~\t\t:: generate a dirac-pulse" - "\nstep~\t\t:: generate a unity-step" - "\ndfreq~\t\t:: detect frequency by counting zero-crossings : (c) ritsch 1998", HEARTSYMBOL); - - post("\n%c manipulating signals" - "\nlimiter~\t:: limit/compress one or more signals" - "\nnop~\t\t:: pass through a signal (delay 1 block)" - "\nz~\t\t:: samplewise delay" - "\nswap~\t\t:: byte-swap a signal" - "\nquantize~\t:: quantize a signal", HEARTSYMBOL); - - post("\n%c binary operations on signals" - "\nabs~, sgn~, >~, <~, ==~, &&~, ||~", HEARTSYMBOL); - - post("\n%c multary operations on signals" - - "\nmultiline~\t:: multiple line~ multiplication" - "\nmultiplex~\t:: multiplex 1 inlet~ to 1-of-various outlet~s" - "\ndemultiplex~\t:: demultiplex 1-of-various inlet~s to 1 outlet~", HEARTSYMBOL); - - post("\n%c investigating signals in message-domain" - "\npack~\t\t:: convert a signal into a list of floats" - "\nunpack~\t\t:: convert packages of floats into a signal" - - "\nsigzero~\t:: indicates whether a signal is zero throughout the block" - "\navg~\t\t:: outputs average of a signal as float" - "\ntavg~\t\t:: outputs average of a signal between two bangs" - "\nenvrms~\t\t:: an env~-object that ouputs rms instead of db" - "\npdf~\t\t:: power density function", HEARTSYMBOL); + post("sfplay\t\t:: play back a (multichannel) soundfile : (c) ritsch 1999"); + post("sfrecord\t:: record a (multichannel) soundfile : based on ritsch"); + + endpost(); post("%c generating signals", HEARTSYMBOL); + post("noish~\t\t:: generate bandlimited noise"); + post("noisi~\t\t:: generate bandlimited noise"); + post("dirac~\t\t:: generate a dirac-pulse"); + post("step~\t\t:: generate a unity-step"); + post("dfreq~\t\t:: detect frequency by counting zero-crossings : (c) ritsch 1998"); + + endpost(); post("%c manipulating signals", HEARTSYMBOL); + post("limiter~\t:: limit/compress one or more signals"); + post("nop~\t\t:: pass through a signal (delay 1 block)"); + post("z~\t\t:: samplewise delay"); + post("swap~\t\t:: byte-swap a signal"); + post("quantize~\t:: quantize a signal"); + + endpost(); post("%c binary operations on signals", HEARTSYMBOL); + post("abs~, sgn~, >~, <~, ==~, &&~, ||~"); + + endpost(); post("%c multary operations on signals", HEARTSYMBOL); + post("multiline~\t:: multiple line~ multiplication"); + post("multiplex~\t:: multiplex 1 inlet~ to 1-of-various outlet~s"); + post("demultiplex~\t:: demultiplex 1-of-various inlet~s to 1 outlet~"); + + endpost(); post("%c investigating signals in message-domain", HEARTSYMBOL); + post("pack~\t\t:: convert a signal into a list of floats"); + post("unpack~\t\t:: convert packages of floats into a signal"); + + post("sigzero~\t:: indicates whether a signal is zero throughout the block"); + post("avg~\t\t:: outputs average of a signal as float"); + post("tavg~\t\t:: outputs average of a signal between two bangs"); + post("envrms~\t\t:: an env~-object that ouputs rms instead of db"); + post("pdf~\t\t:: power density function"); - post("\n%c basic message objects" - "\nnop\t\t:: a no-operation" - "\nlister\t\t:: stores lists" - "\nany2list\t\t:: converts \"anything\" to lists" - "\nlist2int\t:: cast each float of a list to integer" - "\natoi\t\t:: convert ascii to integer" - "\nlist2symbol\t:: convert a list into a single symbol" - "\nsymbol2list\t:: split a symbol into a list" - "\nstrcmp\t\t:: compare 2 lists as if they where strings" - "\nrepack\t\t:: (re)packs atoms to packages of a given size" - "\npackel\t\t:: element of a package" - "\nlength\t\t:: length of a package" - "\nniagara\t\t:: divide a package into 2 sub-packages" - "\nglue\t\t:: append a list to another" - "\nrepeat\t\t:: repeat a message" - "\nsegregate\t:: sort inputs by type" - "\n.\t\t:: scalar multiplication of vectors (lists of floats)", HEARTSYMBOL); - - post("\n%c advanced message objects" - "\ntabread4\t:: 4-point interpolating table-read object" - "\ntabdump\t\t:: dump the table as a list" - "\ntabset\t\t:: set a table with a list" - "\nmavg\t\t:: a variable moving average filter" - "\nmean\t\t:: get the arithmetic mean of a vector" - "\nminmax\t\t:: get the minimum and the maximum of a vector" - "\nmakesymbol\t:: creates (formatted) symbols" - "\ndate\t\t:: get the current system date" - "\ntime\t\t:: get the current system time" - "\nindex\t\t:: convert symbols to indices" - "\ndrip\t\t:: converts a package to a sequence of atoms" - "\nsort\t\t:: shell-sort a package of floats" - "\ndemux\t\t:: demultiplex the input to a specified output" - "\nmsgfile\t\t:: store and handles lists of lists" - "\nlp\t\t:: write to the (parallel) port" - "\nwrap\t\t:: wrap a floating number between 2 limits" - "\nurn\t\t:: unique random numbers" - "\noperating_system\t:: information on the OS", HEARTSYMBOL); - - post("\n\n(l) forum::für::umläute except where indicated\n" - "this software is under the GnuGPL that is provided with these files"); + endpost(); post("%c basic message objects", HEARTSYMBOL); + post("nop\t\t:: a no-operation"); + post("lister\t\t:: stores lists"); + post("any2list\t\t:: converts \"anything\" to lists"); + post("list2int\t:: cast each float of a list to integer"); + post("atoi\t\t:: convert ascii to integer"); + post("list2symbol\t:: convert a list into a single symbol"); + post("symbol2list\t:: split a symbol into a list"); + post("strcmp\t\t:: compare 2 lists as if they where strings"); + post("repack\t\t:: (re)packs atoms to packages of a given size"); + post("packel\t\t:: element of a package"); + post("length\t\t:: length of a package"); + post("niagara\t\t:: divide a package into 2 sub-packages"); + post("glue\t\t:: append a list to another"); + post("repeat\t\t:: repeat a message"); + post("segregate\t:: sort inputs by type"); + post(".\t\t:: scalar multiplication of vectors (lists of floats)"); + + endpost(); post("%c advanced message objects", HEARTSYMBOL); + post("tabread4\t:: 4-point interpolating table-read object"); + post("tabdump\t\t:: dump the table as a list"); + post("tabset\t\t:: set a table with a list"); + post("mavg\t\t:: a variable moving average filter"); + post("mean\t\t:: get the arithmetic mean of a vector"); + post("minmax\t\t:: get the minimum and the maximum of a vector"); + post("makesymbol\t:: creates (formatted) symbols"); + post("date\t\t:: get the current system date"); + post("time\t\t:: get the current system time"); + post("index\t\t:: convert symbols to indices"); + post("drip\t\t:: converts a package to a sequence of atoms"); + post("sort\t\t:: shell-sort a package of floats"); + post("demux\t\t:: demultiplex the input to a specified output"); + post("msgfile\t\t:: store and handles lists of lists"); + post("lp\t\t:: write to the (parallel) port"); + post("wrap\t\t:: wrap a floating number between 2 limits"); + post("urn\t\t:: unique random numbers"); + post("operating_system\t:: information on the OS"); + + endpost(); post("\n(l) forum::für::umläute except where indicated"); + post("this software is released under the GnuGPL that is provided with these files"); + endpost(); } static void *zexy_new(void) |