Update of /cvsroot/pure-data/externals/zexy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21949
Modified Files: dirac~.c freadln.c fwriteln.c index.c length.c limiter~.c list2lists.c listfind.c lpt.c makesymbol.c matchbox.c multiplex.c regex.c sfrecord.c sgn~.c sort.c tabread4~~.c time.c winNT_portio.c zexy.c Log Message: run with "-pedantic" and "-std=c99": removed warnings
Index: time.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/time.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** time.c 14 Mar 2007 09:08:56 -0000 1.6 --- time.c 3 Jan 2008 12:11:24 -0000 1.7 *************** *** 96,100 **** 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); --- 96,99 ----
Index: dirac~.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/dirac~.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dirac~.c 30 Oct 2007 09:21:51 -0000 1.7 --- dirac~.c 3 Jan 2008 12:11:24 -0000 1.8 *************** *** 75,87 **** }
- - 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() */ --- 75,78 ---- *************** *** 91,99 **** * have to tell miller about that */ ! zero_perf8(w+1); #else ! zero_perform(w+1); #endif
if (do_it >= n) x->do_it -= n; --- 82,100 ---- * have to tell miller about that */ ! t_int *zero_perf8(t_int *w); #else ! /* 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;
Index: index.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/index.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** index.c 14 Mar 2007 09:08:56 -0000 1.17 --- index.c 3 Jan 2008 12:11:24 -0000 1.18 *************** *** 105,111 **** 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 index_add(x, s, 0); ! else outlet_float(x->x_obj.ob_outlet, 0.f); // not yet stored but do not add }
--- 105,111 ---- 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 */ index_add(x, s, 0); ! else outlet_float(x->x_obj.ob_outlet, 0.f); /* not yet stored but do not add */ }
*************** *** 255,259 **** while(step>1){ int i = loops; - //step = (step % 2)?(step+1)/2:step/2; step+=step%2; step>>=1; --- 255,258 ---- *************** *** 263,271 **** 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; ! } } } --- 262,270 ---- 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; ! } } } *************** *** 326,348 **** 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"); }
--- 325,349 ---- static void index_helper(t_index *x) { ! 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"); }
*************** *** 357,361 **** 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, A_DEFFLOAT, 0);
--- 358,362 ---- 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, A_DEFFLOAT, 0);
Index: sort.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/sort.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sort.c 30 Oct 2007 09:26:46 -0000 1.9 --- sort.c 3 Jan 2008 12:11:24 -0000 1.10 *************** *** 80,84 ****
int i, loops = 1; - ZEXY_USEVAR(s);
sort_buffer(x, argc, argv); --- 80,83 ---- *************** *** 89,93 **** step = (step % 2)?(step+1)/2:step/2;
- // i = loops++; i = loops; loops += 2; --- 88,91 ----
Index: lpt.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/lpt.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** lpt.c 3 Jan 2008 11:15:25 -0000 1.16 --- lpt.c 3 Jan 2008 12:11:24 -0000 1.17 *************** *** 108,112 **** int device; /* file descriptor of device, in case we are using one ...*/
! int mode; // MODE_IOPERM, MODE_IOPL } t_lpt;
--- 108,112 ---- int device; /* file descriptor of device, in case we are using one ...*/
! int mode; /* MODE_IOPERM, MODE_IOPL */ } t_lpt;
*************** *** 238,242 **** } else x->mode=MODE_IOPL; count_iopl++; - // post("iopl.............................%d", count_iopl); }
--- 238,241 ----
Index: limiter~.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/limiter~.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** limiter~.c 30 Oct 2007 09:21:52 -0000 1.9 --- limiter~.c 3 Jan 2008 12:11:24 -0000 1.10 *************** *** 57,75 ****
/* ------------------------------------------------------------------------------------ */ ! // first define the structs...
static t_class *limiter_class;
typedef struct _limctl ! { // variables changed by user ! t_float limit, hold_samples, 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 limiter_limit; // start limiting (stop compressing); == tresh/limit;
t_float treshdB, oneminusratio; --- 57,78 ----
/* ------------------------------------------------------------------------------------ */ ! /* first define the structs... */
static t_class *limiter_class;
typedef struct _limctl ! { ! /* 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 limiter_limit; /* start limiting (stop compressing); == tresh/limit; */
t_float treshdB, oneminusratio; *************** *** 88,93 **** int number_of_inlets, s_n;
! // variables changed by process ! t_sample amplification; t_float samples_left, still_left; --- 91,95 ---- int number_of_inlets, s_n;
! /* variables changed by process */ t_sample amplification; t_float samples_left, still_left; *************** *** 98,104 **** 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)
t_inbuf* in; --- 100,107 ---- 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) ! */
t_inbuf* in; *************** *** 108,118 ****
/* ------------------------------------------------------------------------------------ */ ! // then do the message - thing
! // do the user settings
! // 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 t_float min_hold = buf / sys_getsr(); return (0.001 * sys_getsr() * ((htime > min_hold)?htime:((min_hold > 50)?min_hold:50))); --- 111,122 ----
/* ------------------------------------------------------------------------------------ */ ! /* then do the message - thing */
! /* do the user settings */
! /* 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 */ t_float min_hold = buf / sys_getsr(); return (0.001 * sys_getsr() * ((htime > min_hold)?htime:((min_hold > 50)?min_hold:50))); *************** *** 136,140 **** }
! // settings
static void set_treshold(t_limiter *x, t_float treshold) --- 140,144 ---- }
! /* settings */
static void set_treshold(t_limiter *x, t_float treshold) *************** *** 175,179 **** break; } - // post("mode set to %d", x->mode); }
--- 179,182 ---- *************** *** 194,198 ****
static void set_bufsize(t_limiter *x, int size) ! { // this is really unneeded...and for historical reasons only if (size < BUFSIZE) size = BUFSIZE; x->buf_size = size + XTRASAMPS; --- 197,202 ----
static void set_bufsize(t_limiter *x, int size) ! { ! /* this is really unneeded...and for historical reasons only */ if (size < BUFSIZE) size = BUFSIZE; x->buf_size = size + XTRASAMPS; *************** *** 219,224 **** 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 }
--- 223,228 ---- 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 */ }
*************** *** 277,281 **** }
! // verbose static void status(t_limiter *x) { --- 281,285 ---- }
! /* verbose */ static void status(t_limiter *x) { *************** *** 352,356 ****
/* ------------------------------------------------------------------------------------ */ ! // now do the dsp - thing // /* ------------------------------------------------------------------------------------ */
--- 356,360 ----
/* ------------------------------------------------------------------------------------ */ ! /* now do the dsp - thing */ /* ------------------------------------------------------------------------------------ */
*************** *** 444,450 **** t_cmpctl *c = (t_cmpctl *)(x->cmp);
! // now let's make things a little bit faster
! // these must not be changed by process const t_float limit = v1->limit; const t_float holdlong = v1->hold_samples; --- 448,454 ---- t_cmpctl *c = (t_cmpctl *)(x->cmp);
! /* now let's make things a little bit faster */
! /* these MUST NOT be changed by process */ const t_float limit = v1->limit; const t_float holdlong = v1->hold_samples; *************** *** 461,470 **** t_float oneminusratio = c->oneminusratio;
! // 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... t_float max_val; --- 465,474 ---- t_float oneminusratio = c->oneminusratio;
! /* 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... */ t_float max_val; *************** *** 475,479 **** max_val = *in;
! // the MAIN routine for the 1-treshold-limiter
if ((max_val * amp) > limit) --- 479,483 ---- max_val = *in;
! /* the MAIN routine for the 1-treshold-limiter */
if ((max_val * amp) > limit) *************** *** 500,504 **** { max_val = *in; ! // the main routine 2
if ((max_val * amp) > limit) --- 504,508 ---- { max_val = *in; ! /* the main routine 2 */
if ((max_val * amp) > limit) *************** *** 539,543 **** max_val = *in;
! // the MAIN routine for the compressor (very similar to the 1-treshold-limiter)
if (max_val * amp > tresh) { --- 543,547 ---- max_val = *in;
! /* the MAIN routine for the compressor (very similar to the 1-treshold-limiter) */
if (max_val * amp > tresh) { *************** *** 549,555 ****
if (amp < 1.) ! 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++ = 1.;
--- 553,559 ----
if (amp < 1.) ! 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++ = 1.;
*************** *** 562,566 **** }
! // now return the goodies x->amplification = amp; x->samples_left = samplesleft; --- 566,570 ---- }
! /* now return the goodies */ x->amplification = amp; x->samples_left = samplesleft; *************** *** 593,597 ****
/* ------------------------------------------------------------------------------------ */ ! // finally do the creation - things
static void *limiter_new(t_symbol *s, int argc, t_atom *argv) --- 597,601 ----
/* ------------------------------------------------------------------------------------ */ ! /* finally do the creation - things */
static void *limiter_new(t_symbol *s, int argc, t_atom *argv)
Index: multiplex.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/multiplex.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** multiplex.c 31 Oct 2007 10:26:11 -0000 1.10 --- multiplex.c 3 Jan 2008 12:11:24 -0000 1.11 *************** *** 64,70 **** 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; --- 64,67 ---- *************** *** 108,112 **** }
! //pd_free(&y->p_pd) }
--- 105,109 ---- }
! /* pd_free(&y->p_pd); */ }
Index: sfrecord.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/sfrecord.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sfrecord.c 14 Mar 2007 09:08:56 -0000 1.8 --- sfrecord.c 3 Jan 2008 12:11:24 -0000 1.9 *************** *** 27,32 **** /* TODO: deprecate this in favour of [sfplay~] */
! ! /* #define DEBUG_ME // for debugging messages */
#include "zexy.h" --- 27,31 ---- /* TODO: deprecate this in favour of [sfplay~] */
! /* #define DEBUG_ME for debugging messages */
#include "zexy.h" *************** *** 129,135 **** }
! /* 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'); --- 128,134 ---- }
! /* 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'); *************** *** 137,141 **** 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*/
x->filename = filename; --- 136,143 ---- x->swap = (endian->s_name[0] == 'b');
! /* ! * 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; *************** *** 415,419 **** break; }; ! #endif //0 return (w+c+3); /* writing was fine */
--- 417,421 ---- break; }; ! #endif /* 0 */ return (w+c+3); /* writing was fine */
Index: winNT_portio.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/winNT_portio.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** winNT_portio.c 10 Nov 2007 17:45:38 -0000 1.6 --- winNT_portio.c 3 Jan 2008 12:11:24 -0000 1.7 *************** *** 20,24 **** int read_parport(int port) { - // byte = _inp((unsigned short)port); unsigned char value; #ifdef _MSC_VER --- 20,23 ---- *************** *** 27,31 **** __asm mov value,al #else ! // hmm, i should read some documentation about inline assembler post("lpt: cannot read from parport (recompile!)"); return 0; --- 26,30 ---- __asm mov value,al #else ! /* hmm, i should read some documentation about inline assembler */ post("lpt: cannot read from parport (recompile!)"); return 0; *************** *** 36,40 **** void write_parport(int port, int invalue) { ! // _outp((unsigned short)port, value); BYTE value = (BYTE)invalue; #ifdef _MSC_VER --- 35,39 ---- void write_parport(int port, int invalue) { ! /* _outp((unsigned short)port, value); */ BYTE value = (BYTE)invalue; #ifdef _MSC_VER *************** *** 43,48 **** __asm out dx,al #else ! // hmm, i should read some documentation about inline assembler ! // and probably about assembler in general... post("lpt: cannot write to parport (recompile!)"); /* --- 42,49 ---- __asm out dx,al #else ! /* ! * hmm, i should read some documentation about inline assembler ! * and probably about assembler in general... ! */ post("lpt: cannot write to parport (recompile!)"); /* *************** *** 63,67 **** if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) { ! pExPtrs->ContextRecord->Eip ++; // Skip the OUT or IN instruction that caused the exception bPrivException = TRUE; return EXCEPTION_CONTINUE_EXECUTION; --- 64,68 ---- if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) { ! pExPtrs->ContextRecord->Eip ++; /* Skip the OUT or IN instruction that caused the exception */ bPrivException = TRUE; return EXCEPTION_CONTINUE_EXECUTION; *************** *** 76,86 ****
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
SetUnhandledExceptionFilter(HandlerExceptionFilter); bPrivException = FALSE; ! read_parport(PortToAccess); // Try to access the given port address
if (bPrivException) --- 77,87 ----
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 */
SetUnhandledExceptionFilter(HandlerExceptionFilter); bPrivException = FALSE; ! read_parport(PortToAccess); /* Try to access the given port address */
if (bPrivException) *************** *** 125,127 **** --- 126,130 ---- } } + #else + static int i=0; #endif /* __WIN32__ & Z_WANT_LPT */
Index: regex.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/regex.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** regex.c 30 Oct 2007 09:26:46 -0000 1.10 --- regex.c 3 Jan 2008 12:11:24 -0000 1.11 *************** *** 233,237 **** /* 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 } else { SETFLOAT(ap2+0, (t_float)i); --- 233,237 ---- /* 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 */ } else { SETFLOAT(ap2+0, (t_float)i);
Index: zexy.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/zexy.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** zexy.c 3 Jan 2008 11:15:25 -0000 1.21 --- zexy.c 3 Jan 2008 12:11:24 -0000 1.22 *************** *** 22,25 **** --- 22,27 ---- #include "zexy.h" #include "z_zexy.h" + + #include <stdio.h> #include <stdarg.h>
*************** *** 40,125 **** static void zexy_help(void) { ! post("\n\n...this is the zexy %c external "VERSION"...", HEARTSYMBOL); ! post("\n%c handling signals" #if 0 ! "\nstreamout~\t:: stream signals via a LAN : (%c) gige 1999" ! "\nstreamin~\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("\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"); }
--- 42,129 ---- static void zexy_help(void) { ! endpost(); endpost(); ! post("...this is the zexy %c external "VERSION"...", HEARTSYMBOL); ! endpost(); ! post("%c handling signals", HEARTSYMBOL); #if 0 ! post("streamout~\t:: stream signals via a LAN : (%c) gige 1999"); ! post("streamin~\t:: catch signals from a LAN : based on gige"); #endif ! 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");
! 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(); }
Index: listfind.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/listfind.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** listfind.c 3 Jan 2008 11:27:37 -0000 1.2 --- listfind.c 3 Jan 2008 12:11:24 -0000 1.3 *************** *** 20,24 **** #include "zexy.h"
! //#define DEBUG
#ifdef DEBUG --- 20,26 ---- #include "zexy.h"
! #if 0 ! # define DEBUG ! #endif
#ifdef DEBUG *************** *** 83,87 **** if(a1->a_type!=a2->a_type) return 0; ! if(a1->a_w.w_symbol!=a2->a_w.w_symbol) // is it that simple? return 0; } --- 85,89 ---- if(a1->a_type!=a2->a_type) return 0; ! if(a1->a_w.w_symbol!=a2->a_w.w_symbol) /* is it that simple? */ return 0; } *************** *** 125,129 ****
DEBUGFUN(post("new offset=%d", offset)); ! offset++; // proceed to the next element }
--- 127,131 ----
DEBUGFUN(post("new offset=%d", offset)); ! offset++; /* proceed to the next element */ }
Index: length.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/length.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** length.c 30 Oct 2007 09:26:46 -0000 1.9 --- length.c 3 Jan 2008 12:11:24 -0000 1.10 *************** *** 52,56 **** 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"); --- 52,55 ----
Index: list2lists.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/list2lists.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** list2lists.c 3 Jan 2008 11:27:37 -0000 1.2 --- list2lists.c 3 Jan 2008 12:11:24 -0000 1.3 *************** *** 20,24 **** #include "zexy.h"
! //#define DEBUG
#ifdef DEBUG --- 20,26 ---- #include "zexy.h"
! #if 0 ! # define DEBUG ! #endif
#ifdef DEBUG
Index: fwriteln.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/fwriteln.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fwriteln.c 31 Oct 2007 10:46:46 -0000 1.10 --- fwriteln.c 3 Jan 2008 12:11:24 -0000 1.11 *************** *** 240,244 **** 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; } --- 240,243 ----
Index: makesymbol.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/makesymbol.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** makesymbol.c 14 Mar 2007 09:08:56 -0000 1.10 --- makesymbol.c 3 Jan 2008 12:11:24 -0000 1.11 *************** *** 70,74 **** static t_symbol* list2symbol(char *masque, int argc, t_atom *argv) { - // cstring buf[MAXSTRINGARGS]; cstring*buf=(cstring*)getbytes(MAXSTRINGARGS*sizeof(cstring)); cstring buffer; --- 70,73 ----
Index: tabread4~~.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/tabread4~~.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tabread4~~.c 31 Oct 2007 10:26:11 -0000 1.1 --- tabread4~~.c 3 Jan 2008 12:11:24 -0000 1.2 *************** *** 73,77 **** return (w+6); } - // post("xxx"); for (i = 0; i < n; i++) { --- 73,76 ---- *************** *** 88,94 **** else frac = findex - index;
- //post("%f + %f = %f", in0_s, in1_s, findex); - // post("%f - %f = %d", findex, frac, index); - wp = buf + index;
--- 87,90 ----
Index: matchbox.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/matchbox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** matchbox.c 31 Oct 2007 10:46:46 -0000 1.8 --- matchbox.c 3 Jan 2008 12:11:24 -0000 1.9 *************** *** 15,24 **** ******************************************************/
! // 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)
--- 15,25 ---- ******************************************************/
! /* 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) ! */
*************** *** 132,136 **** } } else { ! //post("types don't match!"); return FALSE; } --- 133,137 ---- } } else { ! /* post("types don't match!"); */ return FALSE; } *************** *** 319,324 **** int result = FALSE;
- //startpost("atommatch::OSC -> "); - if(pattern->a_type==A_SYMBOL) { s_pattern=pattern->a_w.w_symbol->s_name; --- 320,323 ---- *************** *** 339,344 **** 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); --- 338,341 ---- *************** *** 402,409 **** t_listlist*matchinglist=0, *sl; int i=0; - flags|=REG_EXTENDED; - int num=0;
/* 1st compile the patterns */ regexpressions=(regex_t**)getbytes(sizeof(regex_t*)*p_argc); --- 399,406 ---- t_listlist*matchinglist=0, *sl; int i=0; int num=0;
+ flags|=REG_EXTENDED; + /* 1st compile the patterns */ regexpressions=(regex_t**)getbytes(sizeof(regex_t*)*p_argc); *************** *** 540,549 ****
static void matchbox_list(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! 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);
for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next) --- 537,546 ----
static void matchbox_list(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! 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, (t_float)results);
for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next) *************** *** 552,563 ****
static void matchbox_add(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! // 1st match, whether we already have this entry if(matchlistlist(0, x->x_lists, argc, argv, MATCHBOX_EXACT, FALSE)) { ! // 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 x->x_lists=addlistlist(x->x_lists, argc, argv); x->x_numlists++; --- 549,560 ----
static void matchbox_add(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! /* 1st match, whether we already have this entry */ if(matchlistlist(0, x->x_lists, argc, argv, MATCHBOX_EXACT, FALSE)) { ! /* 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 */ x->x_lists=addlistlist(x->x_lists, argc, argv); x->x_numlists++; *************** *** 565,569 ****
static void matchbox_delete(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! int results=0; int mode=x->x_mode; t_listlist*resultlist=matchlistlist(&results, x->x_lists, argc, argv, mode, TRUE); --- 562,566 ----
static void matchbox_delete(t_matchbox*x, t_symbol*s, int argc, t_atom*argv) { ! unsigned int results=0; int mode=x->x_mode; t_listlist*resultlist=matchlistlist(&results, x->x_lists, argc, argv, mode, TRUE); *************** *** 573,577 **** x->x_numlists-=results;
! outlet_float(x->x_outNumResults, results);
for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next) --- 570,574 ---- x->x_numlists-=results;
! outlet_float(x->x_outNumResults, (t_float)results);
for(dummylist=resultlist; 0!=dummylist; dummylist=dummylist->next)
Index: freadln.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/freadln.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** freadln.c 31 Oct 2007 10:46:46 -0000 1.5 --- freadln.c 3 Jan 2008 12:11:24 -0000 1.6 *************** *** 24,36 **** #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> #endif
--- 24,33 ---- #include <stdio.h> #include <string.h>
#ifdef __WIN32__ # include <io.h> # include <stdlib.h> ! #else ! # include <unistd.h> #endif
*************** *** 86,93 **** freadln_close(x);
! /* if(type!=gensym("cr")) { pd_error(x, "currently only 'cr' type files are implemented!"); return; ! }*/ if (type==gensym("cr")) strcpy(x->linebreak_chr,"\n"); --- 83,92 ---- freadln_close(x);
! /* ! if(type!=gensym("cr")) { pd_error(x, "currently only 'cr' type files are implemented!"); return; ! } ! */ if (type==gensym("cr")) strcpy(x->linebreak_chr,"\n"); *************** *** 96,100 ****
! // directory, filename, extension, dirresult, nameresult, unsigned int size, int bin if ((fd=open_via_path(dirname, s->s_name,"", filenamebuf, &filenamebufptr, MAXPDSTRING,0)) < 0 ) { --- 95,99 ----
! /* directory, filename, extension, dirresult, nameresult, unsigned int size, int bin */ if ((fd=open_via_path(dirname, s->s_name,"", filenamebuf, &filenamebufptr, MAXPDSTRING,0)) < 0 ) { *************** *** 165,169 **** int rewind_after;
! if (x->x_file < 0) { pd_error(x, "no file opened for reading"); return; --- 164,168 ---- int rewind_after;
! if (!x->x_file) { pd_error(x, "no file opened for reading"); return; *************** *** 197,201 **** 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"); --- 196,199 ---- *************** *** 217,223 **** 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. binbuf_free(bbuf);
--- 215,222 ---- 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. ! */ binbuf_free(bbuf);
Index: sgn~.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/sgn~.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sgn~.c 3 Jan 2008 11:15:25 -0000 1.9 --- sgn~.c 3 Jan 2008 12:11:24 -0000 1.10 *************** *** 74,78 ****
#ifdef __SSE__ ! static long l_bitmask[]={0x80000000, 0x80000000, 0x80000000, 0x80000000}; // sign bitmask static t_int *sgnTilde_performSSE(t_int *w) { --- 74,78 ----
#ifdef __SSE__ ! static long l_bitmask[]={0x80000000, 0x80000000, 0x80000000, 0x80000000}; /* sign bitmask */ static t_int *sgnTilde_performSSE(t_int *w) { *************** *** 81,85 ****
__m128 val; ! int n = (int)(w[3])>>3; // we do 8x loop-unrolling
const __m128 sgnmask= _mm_loadu_ps((float*)l_bitmask); --- 81,85 ----
__m128 val; ! int n = (int)(w[3])>>3; /* we do 8x loop-unrolling */
const __m128 sgnmask= _mm_loadu_ps((float*)l_bitmask); *************** *** 92,99 ****
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
val=in[1]; --- 92,99 ----
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 */
val=in[1]; *************** *** 118,122 **** 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) ) { --- 118,122 ---- 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) */ ) {