diff --git a/src/d_delay.c b/src/d_delay.c index 3571e89a6e79994e402bfdc89d07c4a7519e3f9a..05511c158e39b8c6670d50eab5b257b39ea9c922 100644 --- a/src/d_delay.c +++ b/src/d_delay.c @@ -5,6 +5,7 @@ /* send~, delread~, throw~, catch~ */ #include "m_pd.h" +#include <string.h> extern int ugen_getsortno(void); #define DEFDELVS 64 /* LATER get this from canvas at DSP time */ @@ -121,6 +122,11 @@ static void sigdelwrite_free(t_sigdelwrite *x) (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample)); } +static void sigdelwrite_clear(t_sigdelwrite *x) { + int n = XTRASAMPS + x->x_cspace.c_n; + memset(x->x_cspace.c_vec, 0, n * sizeof(t_sample)); +} + static void sigdelwrite_setup(void) { sigdelwrite_class = class_new(gensym("delwrite~"), @@ -129,6 +135,8 @@ static void sigdelwrite_setup(void) CLASS_MAINSIGNALIN(sigdelwrite_class, t_sigdelwrite, x_f); class_addmethod(sigdelwrite_class, (t_method)sigdelwrite_dsp, gensym("dsp"), 0); + class_addmethod(sigdelwrite_class, (t_method)sigdelwrite_clear, + gensym("clear"), 0); } /* ----------------------------- delread~ ----------------------------- */ diff --git a/src/m_atom.c b/src/m_atom.c index d84161c07e6b69cddcce94b65aeaa7aab4e67ab0..e3e1976b304e82dd48dc1a1786b3aad12ea34fd7 100644 --- a/src/m_atom.c +++ b/src/m_atom.c @@ -94,10 +94,13 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) char *sp; unsigned int len; int quote; - for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++) - if (*sp == ';' || *sp == ',' || *sp == '\\' || - (*sp == '$' && sp[1] >= '0' && sp[1] <= '9')) - quote = 1; + if(!strcmp(a->a_w.w_symbol->s_name, "$@")) /* JMZ: #@ quoting */ + quote=1; + else + for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++) + if (*sp == ';' || *sp == ',' || *sp == '\\' || + (*sp == '$' && sp[1] >= '0' && sp[1] <= '9')) + quote = 1; if (quote) { char *bp = buf, *ep = buf + (bufsize-2); @@ -105,7 +108,7 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) while (bp < ep && *sp) { if (*sp == ';' || *sp == ',' || *sp == '\\' || - (*sp == '$' && sp[1] >= '0' && sp[1] <= '9')) + (*sp == '$' && ((sp[1] >= '0' && sp[1] <= '9')||sp[1]=='@'))) *bp++ = '\\'; *bp++ = *sp++; } @@ -125,7 +128,11 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) } break; case A_DOLLAR: - sprintf(buf, "$%d", a->a_w.w_index); + if(a->a_w.w_symbol==gensym("@")) { /* JMZ: $@ expansion */ + sprintf(buf, "$@"); + } else { + sprintf(buf, "$%d", a->a_w.w_index); + } break; case A_DOLLSYM: strncpy(buf, a->a_w.w_symbol->s_name, bufsize); diff --git a/src/m_binbuf.c b/src/m_binbuf.c index 13b0293ea8a14d9633c9cce6fafceb26d7ecd1b7..9176804260014e0c4c1b13822e491a37ab51fb74 100644 --- a/src/m_binbuf.c +++ b/src/m_binbuf.c @@ -146,7 +146,8 @@ void binbuf_text(t_binbuf *x, char *text, size_t size) } } if (!lastslash && c == '$' && (textp != etext && - textp[0] >= '0' && textp[0] <= '9')) + ((textp[0] >= '0' && textp[0] <= '9')|| + textp[0]=='@'))) /* JMZ: $@ and $# expansion */ dollar = 1; if (!slash) bufp++; } @@ -155,7 +156,7 @@ void binbuf_text(t_binbuf *x, char *text, size_t size) && *textp != '\t' &&*textp != ',' && *textp != ';'))); *bufp = 0; #if 0 - post("binbuf_text: buf %s", buf); + post("binbuf_text: buf %s, dollar=%d", buf, dollar); #endif if (floatstate == 2 || floatstate == 4 || floatstate == 5 || floatstate == 8) @@ -166,14 +167,27 @@ void binbuf_text(t_binbuf *x, char *text, size_t size) was. */ else if (dollar) { - if (buf[0] != '$') - dollar = 0; - for (bufp = buf+1; *bufp; bufp++) - if (*bufp < '0' || *bufp > '9') - dollar = 0; - if (dollar) - SETDOLLAR(ap, atoi(buf+1)); - else SETDOLLSYM(ap, gensym(buf)); + if(buf[1]=='@') /* JMZ: $@ expansion */ + { + if(buf[2]==0) /* only expand A_DOLLAR $@ */ + { + ap->a_type = A_DOLLAR; + ap->a_w.w_symbol = gensym("@"); + } + else /* there is no A_DOLLSYM $@ */ + { + SETSYMBOL(ap, gensym(buf)); + } + } else { + if (buf[0] != '$') + dollar = 0; + for (bufp = buf+1; *bufp; bufp++) + if (*bufp < '0' || *bufp > '9') + dollar = 0; + if (dollar) + SETDOLLAR(ap, atoi(buf+1)); + else SETDOLLSYM(ap, gensym(buf)); + } } else SETSYMBOL(ap, gensym(buf)); } @@ -337,8 +351,12 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y) break; case A_DOLLAR: //fprintf(stderr,"addbinbuf: dollar\n"); - sprintf(tbuf, "$%d", ap->a_w.w_index); - SETSYMBOL(ap, gensym(tbuf)); + if(ap->a_w.w_symbol==gensym("@")){ /* JMZ: $@ expansion */ + SETSYMBOL(ap, gensym("$@")); + } else { + sprintf(tbuf, "$%d", ap->a_w.w_index); + SETSYMBOL(ap, gensym(tbuf)); + } break; case A_DOLLSYM: //fprintf(stderr,"addbinbuf: dollsym\n"); @@ -392,6 +410,11 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) char *str = argv->a_w.w_symbol->s_name, *str2; if (!strcmp(str, ";")) SETSEMI(ap); else if (!strcmp(str, ",")) SETCOMMA(ap); + else if (!strcmp(str, "$@")) /* JMZ: $@ expansion */ + { + ap->a_type = A_DOLLAR; + ap->a_w.w_symbol = gensym("@"); + } else if ((str2 = strchr(str, '$')) && str2[1] >= '0' && str2[1] <= '9') { @@ -585,7 +608,9 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) t_atom *at = x->b_vec; int ac = x->b_n; int nargs, maxnargs = 0; - if (ac <= SMALLMSG) + //if (ac <= SMALLMSG) + //IB added ac > argc check to allow for proper $@ arg (list) allocation + if (ac <= SMALLMSG && ac > argc) mstack = smallstack; else { @@ -597,12 +622,16 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) that the pd_objectmaker target can't come up via a named destination in the message, only because the original "target" points there. */ - if (target == &pd_objectmaker) - maxnargs = ac; + if (target == &pd_objectmaker) { + //IB added ac > argc check to allow for proper $@ arg (list) allocation + maxnargs = (ac > argc ? ac : argc+1); + //if (at && x->b_n) + // fprintf(stderr,"pd_objectmaker %s %d\n", at[0].a_w.w_symbol->s_name, maxnargs); + } else { int i, j = (target ? 0 : -1); - for (i = 0; i < ac; i++) + for (i = 0; i < (ac > argc ? ac : argc); i++) { if (at[i].a_type == A_SEMI) j = -1; @@ -626,6 +655,8 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) } msp = mstack; + //fprintf(stderr,"maxnargs=%d argc=%d\n", maxnargs, argc); + //static t_atom *ems = mstack+MSTACKSIZE; while (1) { t_pd *nexttarget; @@ -712,10 +743,27 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) *msp = *at; break; case A_DOLLAR: - if (at->a_w.w_index > 0 && at->a_w.w_index <= argc) - *msp = argv[at->a_w.w_index-1]; - else if (at->a_w.w_index == 0) - SETFLOAT(msp, canvas_getdollarzero()); + if (at->a_w.w_symbol==gensym("@")) + { /* JMZ: $@ expansion */ + int i; + //if(msp+argc >= ems) + //{ + // error("message stack overflow"); + // goto broken; + //} + for (i=0; i<argc; i++) + { + *msp++=argv[i]; + nargs++; + } + msp--; + nargs--; + //fprintf(stderr,"x->b_n=%d ac=%d maxnargs=%d nargs=%d argc=%d\n", x->b_n, ac, maxnargs, nargs, argc); + } + else if (at->a_w.w_index > 0 && at->a_w.w_index <= argc) + *msp = argv[at->a_w.w_index-1]; + else if (at->a_w.w_index == 0) + SETFLOAT(msp, canvas_getdollarzero()); else { if (target == &pd_objectmaker) diff --git a/src/m_pd.h b/src/m_pd.h index 56bbfe9cfd9db09a54cb60859da04023edc99829..ad6b976be0fecd943bfbfc2b1db968d93870181e 100644 --- a/src/m_pd.h +++ b/src/m_pd.h @@ -11,7 +11,7 @@ extern "C" { #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 42 #define PD_BUGFIX_VERSION 5 -#define PD_TEST_VERSION "extended-l2ork-20110305" +#define PD_TEST_VERSION "extended-l2ork-20110310" /* old name for "MSW" flag -- we have to take it for the sake of many old "nmakefiles" for externs, which will define NT and not MSW */ diff --git a/src/makefile.dependencies b/src/makefile.dependencies index a1a6e9ae75d766cae01b2026ff99d2e0f169185a..9cad237e06e36fe530e4bfaadd4fe5ca2c1f97c4 100644 --- a/src/makefile.dependencies +++ b/src/makefile.dependencies @@ -19,12 +19,13 @@ d_array.o: d_array.c m_pd.h \ /usr/include/bits/sigset.h /usr/include/bits/time.h \ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h d_delay.o: d_delay.c m_pd.h \ - /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h /usr/include/stdio.h \ + /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h /usr/include/string.h \ /usr/include/features.h /usr/include/bits/predefs.h \ /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/xlocale.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h d_filter.o: d_filter.c m_pd.h \ diff --git a/src/pd.tk b/src/pd.tk index decd43e2366b7409248adf40e74566baaeb97047..a1b43e55cf3d45251a0a3e37b16847fbfba67746 100644 --- a/src/pd.tk +++ b/src/pd.tk @@ -652,7 +652,7 @@ pack .controls.dio -side right -padx 20 toplevel .printout wm title .printout "Console" # initial location of the console window (+x+y) -wm geometry .printout +10+160 +wm geometry .printout +10+170 wm protocol .printout WM_DELETE_WINDOW { .controls.switches.console invoke } match_linux_wm [list frame .printout.frame] text .printout.frame.text -relief sunken -bd 1 -font console_font \ diff --git a/src/x_connective.c b/src/x_connective.c index c5063c194cd128861f9a4ff3ac53cbd39bee978e..844687780607a4231ab5da701d8383988bdc1b56 100644 --- a/src/x_connective.c +++ b/src/x_connective.c @@ -1051,6 +1051,14 @@ static void trigger_anything(t_trigger *x, t_symbol *s, int argc, t_atom *argv) outlet_bang(u->u_outlet); else if (u->u_type == TR_ANYTHING) outlet_anything(u->u_outlet, s, argc, argv); + else if (u->u_type == TR_STATIC_FLOAT) + { + outlet_float(u->u_outlet, u->u_float); + } + else if (u->u_type == TR_STATIC_SYMBOL) + { + outlet_symbol(u->u_outlet, &u->u_sym); + } else pd_error(x, "trigger: can only convert 's' to 'b' or 'a'"); } }