Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27344
Modified Files:
Tag: desiredata
m_binbuf.c
Log Message:
reformatting.
Index: m_binbuf.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_binbuf.c,v
retrieving revision 1.4.4.1.2.8.2.7
retrieving revision 1.4.4.1.2.8.2.8
diff -C2 -d -r1.4.4.1.2.8.2.7 -r1.4.4.1.2.8.2.8
*** m_binbuf.c 20 Dec 2006 08:27:17 -0000 1.4.4.1.2.8.2.7
--- m_binbuf.c 20 Dec 2006 08:42:28 -0000 1.4.4.1.2.8.2.8
***************
*** 31,55 ****
};
! t_binbuf *binbuf_new(void)
! {
t_binbuf *x = (t_binbuf *)t_getbytes(sizeof(*x));
x->b_n = 0;
x->b_vec = (t_atom *)t_getbytes(0);
! return (x);
}
! void binbuf_free(t_binbuf *x)
! {
t_freebytes(x->b_vec, x->b_n * sizeof(*x->b_vec));
t_freebytes(x, sizeof(*x));
}
! t_binbuf *binbuf_duplicate(t_binbuf *y)
! {
t_binbuf *x = (t_binbuf *)t_getbytes(sizeof(*x));
x->b_n = y->b_n;
x->b_vec = (t_atom *)t_getbytes(x->b_n * sizeof(*x->b_vec));
memcpy(x->b_vec, y->b_vec, x->b_n * sizeof(*x->b_vec));
! return (x);
}
--- 31,52 ----
};
! t_binbuf *binbuf_new(void) {
t_binbuf *x = (t_binbuf *)t_getbytes(sizeof(*x));
x->b_n = 0;
x->b_vec = (t_atom *)t_getbytes(0);
! return x;
}
! void binbuf_free(t_binbuf *x) {
t_freebytes(x->b_vec, x->b_n * sizeof(*x->b_vec));
t_freebytes(x, sizeof(*x));
}
! t_binbuf *binbuf_duplicate(t_binbuf *y) {
t_binbuf *x = (t_binbuf *)t_getbytes(sizeof(*x));
x->b_n = y->b_n;
x->b_vec = (t_atom *)t_getbytes(x->b_n * sizeof(*x->b_vec));
memcpy(x->b_vec, y->b_vec, x->b_n * sizeof(*x->b_vec));
! return x;
}
***************
*** 192,204 ****
writing to file doesn't buffer everything together. */
! void binbuf_add(t_binbuf *x, int argc, t_atom *argv)
! {
int newsize = x->b_n + argc, i;
t_atom *ap;
! if (ap = (t_atom *)t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
! newsize * sizeof(*x->b_vec)))
x->b_vec = ap;
! else
! {
error("binbuf_addmessage: out of space");
return;
--- 189,198 ----
writing to file doesn't buffer everything together. */
! void binbuf_add(t_binbuf *x, int argc, t_atom *argv) {
int newsize = x->b_n + argc, i;
t_atom *ap;
! if (ap = (t_atom *)t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), newsize * sizeof(*x->b_vec))) {
x->b_vec = ap;
! } else {
error("binbuf_addmessage: out of space");
return;
***************
*** 288,331 ****
int newsize = x->b_n + argc, i;
t_atom *ap;
! if (ap = (t_atom *)t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec),
! newsize * sizeof(*x->b_vec)))
x->b_vec = ap;
! else
! {
error("binbuf_addmessage: out of space");
return;
}
!
! for (ap = x->b_vec + x->b_n, i = argc; i--; ap++)
! {
! if (argv->a_type == A_SYMBOL)
! {
char *str = argv->a_w.w_symbol->s_name, *str2;
if (!strcmp(str, ";")) SETSEMI(ap);
else if (!strcmp(str, ",")) SETCOMMA(ap);
! else if ((str2 = strchr(str, '$')) && str2[1] >= '0' && str2[1] <= '9')
! {
int dollsym = 0;
! if (*str != '$')
! dollsym = 1;
! else for (str2 = str + 1; *str2; str2++)
! if (*str2 < '0' || *str2 > '9')
! {
dollsym = 1;
break;
}
! if (dollsym)
! SETDOLLSYM(ap, gensym(str));
! else
! {
int dollar = 0;
sscanf(argv->a_w.w_symbol->s_name + 1, "%d", &dollar);
SETDOLLAR(ap, dollar);
}
! }
! else *ap = *argv;
argv++;
! }
! else *ap = *(argv++);
}
x->b_n = newsize;
--- 282,312 ----
int newsize = x->b_n + argc, i;
t_atom *ap;
! if (ap = (t_atom *)t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), newsize * sizeof(*x->b_vec))) {
x->b_vec = ap;
! } else {
error("binbuf_addmessage: out of space");
return;
}
! for (ap = x->b_vec + x->b_n, i = argc; i--; ap++) {
! if (argv->a_type == A_SYMBOL) {
char *str = argv->a_w.w_symbol->s_name, *str2;
if (!strcmp(str, ";")) SETSEMI(ap);
else if (!strcmp(str, ",")) SETCOMMA(ap);
! else if ((str2 = strchr(str, '$')) && str2[1] >= '0' && str2[1] <= '9') {
int dollsym = 0;
! if (*str != '$') dollsym = 1;
! else for (str2 = str + 1; *str2; str2++) if (*str2 < '0' || *str2 > '9') {
dollsym = 1;
break;
}
! if (dollsym) SETDOLLSYM(ap, gensym(str));
! else {
int dollar = 0;
sscanf(argv->a_w.w_symbol->s_name + 1, "%d", &dollar);
SETDOLLAR(ap, dollar);
}
! } else *ap = *argv;
argv++;
! } else *ap = *(argv++);
}
x->b_n = newsize;
***************
*** 335,345 ****
#define MSTACKSIZE 2048
! void binbuf_print(t_binbuf *x)
! {
int i, startedpost = 0, newline = 1;
! for (i = 0; i < x->b_n; i++)
! {
! if (newline)
! {
if (startedpost) endpost();
startpost("");
--- 316,323 ----
#define MSTACKSIZE 2048
! void binbuf_print(t_binbuf *x) {
int i, startedpost = 0, newline = 1;
! for (i = 0; i < x->b_n; i++) {
! if (newline) {
if (startedpost) endpost();
startpost("");
***************
*** 347,353 ****
}
postatom(1, x->b_vec + i);
! if (x->b_vec[i].a_type == A_SEMI)
! newline = 1;
! else newline = 0;
}
if (startedpost) endpost();
--- 325,329 ----
}
postatom(1, x->b_vec + i);
! newline = !! x->b_vec[i].a_type == A_SEMI;
}
if (startedpost) endpost();
***************
*** 375,380 ****
* return value = 1; (s+1=="-bla")
*/
! int binbuf_expanddollsym(char*s, char*buf,t_atom dollar0, int ac, t_atom *av, int tonew)
! {
int argno=atol(s);
int arglen=0;
--- 351,355 ----
* return value = 1; (s+1=="-bla")
*/
! int binbuf_expanddollsym(char*s, char*buf,t_atom dollar0, int ac, t_atom *av, int tonew) {
int argno=atol(s);
int arglen=0;
***************
*** 382,407 ****
char c=*cs;
*buf=0;
!
! while(c&&(c>='0')&&(c<='9')){
c=*cs++;
arglen++;
}
-
if (cs==s) { /* invalid $-expansion (like "$bla") */
sprintf(buf, "$");
return 0;
! }
! else if (argno < 0 || argno > ac) /* undefined argument */
! {
if(!tonew)return 0;
sprintf(buf, "$%d", argno);
! }
! else if (argno == 0){ /* $0 */
atom_string(&dollar0, buf, MAXPDSTRING/2-1);
! }
! else{ /* fine! */
atom_string(av+(argno-1), buf, MAXPDSTRING/2-1);
}
! return (arglen-1);
}
--- 357,376 ----
char c=*cs;
*buf=0;
! while(c&&(c>='0')&&(c<='9')) {
c=*cs++;
arglen++;
}
if (cs==s) { /* invalid $-expansion (like "$bla") */
sprintf(buf, "$");
return 0;
! } else if (argno < 0 || argno > ac) { /* undefined argument */
if(!tonew)return 0;
sprintf(buf, "$%d", argno);
! } else if (argno == 0){ /* $0 */
atom_string(&dollar0, buf, MAXPDSTRING/2-1);
! } else { /* fine! */
atom_string(av+(argno-1), buf, MAXPDSTRING/2-1);
}
! return arglen-1;
}
***************
*** 457,461 ****
}
}
! return (gensym(buf2));
}
--- 426,430 ----
}
}
! return gensym(buf2);
}
***************
*** 593,597 ****
#endif
sys_bashfilename(s, namebuf);
! return (open(namebuf, mode));
}
--- 562,566 ----
#endif
sys_bashfilename(s, namebuf);
! return open(namebuf, mode);
}
***************
*** 600,604 ****
char namebuf[MAXPDSTRING];
sys_bashfilename(s, namebuf);
! return (fopen(namebuf, mode));
}
--- 569,573 ----
char namebuf[MAXPDSTRING];
sys_bashfilename(s, namebuf);
! return fopen(namebuf, mode);
}
***************
*** 643,679 ****
/* read a binbuf from a file, via the search patch of a canvas */
! int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas,
! int crflag)
! {
int filedesc;
char buf[MAXPDSTRING], *bufptr;
! if ((filedesc = canvas_open(canvas, filename, "",
! buf, &bufptr, MAXPDSTRING, 0)) < 0)
! {
error("%s: can't open", filename);
! return (1);
! }
! else close (filedesc);
! if (binbuf_read(b, bufptr, buf, crflag))
! return (1);
! else return (0);
}
/* old version */
! int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname,
! int crflag)
! {
int filedesc;
char buf[MAXPDSTRING], *bufptr;
! if ((filedesc = open_via_path(
! dirname, filename, "", buf, &bufptr, MAXPDSTRING, 0)) < 0)
! {
error("%s: can't open", filename);
! return (1);
}
else close (filedesc);
! if (binbuf_read(b, bufptr, buf, crflag))
! return (1);
! else return (0);
}
--- 612,635 ----
/* read a binbuf from a file, via the search patch of a canvas */
! int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas, int crflag) {
int filedesc;
char buf[MAXPDSTRING], *bufptr;
! if ((filedesc = canvas_open(canvas, filename, "", buf, &bufptr, MAXPDSTRING, 0)) < 0) {
error("%s: can't open", filename);
! return 1;
! } else close(filedesc);
! return !!binbuf_read(b, bufptr, buf, crflag);
}
/* old version */
! int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, int crflag) {
int filedesc;
char buf[MAXPDSTRING], *bufptr;
! if ((filedesc = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 0)) < 0) {
error("%s: can't open", filename);
! return 1;
}
else close (filedesc);
! return !!binbuf_read(b, bufptr, buf, crflag);
}
***************
*** 681,688 ****
static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd);
! /* write a binbuf to a text file. If "crflag" is set we suppress
! semicolons. */
! int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag)
! {
FILE *f = 0;
char sbuf[WBUFSIZE], fbuf[MAXPDSTRING], *bp = sbuf, *ep = sbuf + WBUFSIZE;
--- 637,642 ----
static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd);
! /* write a binbuf to a text file. If "crflag" is set we suppress semicolons. */
! int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) {
FILE *f = 0;
char sbuf[WBUFSIZE], fbuf[MAXPDSTRING], *bp = sbuf, *ep = sbuf + WBUFSIZE;
***************
*** 695,712 ****
strcat(fbuf, dir), strcat(fbuf, "/");
strcat(fbuf, filename);
! if (!strcmp(filename + strlen(filename) - 4, ".pat"))
! {
x = binbuf_convert(x, 0);
deleteit = 1;
}
!
! if (!(f = binbuf_dofopen(fbuf, "w")))
! {
fprintf(stderr, "open: ");
sys_unixerror(fbuf);
goto fail;
}
! for (ap = x->b_vec, indx = x->b_n; indx--; ap++)
! {
int length;
/* estimate how many characters will be needed. Printing out
--- 649,662 ----
strcat(fbuf, dir), strcat(fbuf, "/");
strcat(fbuf, filename);
! if (!strcmp(filename + strlen(filename) - 4, ".pat")) {
x = binbuf_convert(x, 0);
deleteit = 1;
}
! if (!(f = binbuf_dofopen(fbuf, "w"))) {
fprintf(stderr, "open: ");
sys_unixerror(fbuf);
goto fail;
}
! for (ap = x->b_vec, indx = x->b_n; indx--; ap++) {
int length;
/* estimate how many characters will be needed. Printing out
***************
*** 715,722 ****
length = 80 + strlen(ap->a_w.w_symbol->s_name);
else length = 40;
! if (ep - bp < length)
! {
! if (fwrite(sbuf, bp-sbuf, 1, f) < 1)
! {
sys_unixerror(fbuf);
goto fail;
--- 665,670 ----
length = 80 + strlen(ap->a_w.w_symbol->s_name);
else length = 40;
! if (ep - bp < length) {
! if (fwrite(sbuf, bp-sbuf, 1, f) < 1) {
sys_unixerror(fbuf);
goto fail;
***************
*** 724,731 ****
bp = sbuf;
}
! if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) &&
! bp > sbuf && bp[-1] == ' ') bp--;
! if (!crflag || ap->a_type != A_SEMI)
! {
atom_string(ap, bp, (ep-bp)-2);
length = strlen(bp);
--- 672,677 ----
bp = sbuf;
}
! if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && bp > sbuf && bp[-1] == ' ') bp--;
! if (!crflag || ap->a_type != A_SEMI) {
atom_string(ap, bp, (ep-bp)-2);
length = strlen(bp);
***************
*** 733,762 ****
ncolumn += length;
}
! if (ap->a_type == A_SEMI || (!crflag && ncolumn > 65))
! {
*bp++ = '\n';
ncolumn = 0;
! }
! else
! {
*bp++ = ' ';
ncolumn++;
}
}
! if (fwrite(sbuf, bp-sbuf, 1, f) < 1)
! {
sys_unixerror(fbuf);
goto fail;
}
! if (deleteit)
! binbuf_free(x);
fclose(f);
! return (0);
fail:
! if (deleteit)
! binbuf_free(x);
! if (f)
! fclose(f);
! return (1);
}
--- 679,701 ----
ncolumn += length;
}
! if (ap->a_type == A_SEMI || (!crflag && ncolumn > 65)) {
*bp++ = '\n';
ncolumn = 0;
! } else {
*bp++ = ' ';
ncolumn++;
}
}
! if (fwrite(sbuf, bp-sbuf, 1, f) < 1) {
sys_unixerror(fbuf);
goto fail;
}
! if (deleteit) binbuf_free(x);
fclose(f);
! return 0;
fail:
! if (deleteit) binbuf_free(x);
! if (f) fclose(f);
! return 1;
}
***************
*** 805,818 ****
/* dollar signs in file translate to symbols */
! for (i = 0; i < natom; i++)
! {
! if (nextmess[i].a_type == A_DOLLAR)
! {
char buf[100];
sprintf(buf, "$%d", nextmess[i].a_w.w_index);
SETSYMBOL(nextmess+i, gensym(buf));
! }
! else if (nextmess[i].a_type == A_DOLLSYM)
! {
char buf[100];
sprintf(buf, "%s", nextmess[i].a_w.w_symbol->s_name);
--- 744,753 ----
/* dollar signs in file translate to symbols */
! for (i = 0; i < natom; i++) {
! if (nextmess[i].a_type == A_DOLLAR) {
char buf[100];
sprintf(buf, "$%d", nextmess[i].a_w.w_index);
SETSYMBOL(nextmess+i, gensym(buf));
! } else if (nextmess[i].a_type == A_DOLLSYM) {
char buf[100];
sprintf(buf, "%s", nextmess[i].a_w.w_symbol->s_name);
***************
*** 820,831 ****
}
}
! if (!strcmp(first, "#N"))
! {
! if (!strcmp(second, "vpatcher"))
! {
! if (stackdepth >= MAXSTACK)
! {
post("too many embedded patches");
! return (newb);
}
stack[stackdepth] = nobj;
--- 755,763 ----
}
}
! if (!strcmp(first, "#N")) {
! if (!strcmp(second, "vpatcher")) {
! if (stackdepth >= MAXSTACK) {
post("too many embedded patches");
! return newb;
}
stack[stackdepth] = nobj;
***************
*** 988,1002 ****
}
}
! }
! else /* Pd to Max */
! {
! if (!strcmp(first, "#N"))
! {
! if (!strcmp(second, "canvas"))
! {
! if (stackdepth >= MAXSTACK)
! {
post("too many embedded patches");
! return (newb);
}
stack[stackdepth] = nobj;
--- 920,929 ----
}
}
! } else { /* Pd to Max */
! if (!strcmp(first, "#N")) {
! if (!strcmp(second, "canvas")) {
! if (stackdepth >= MAXSTACK) {
post("too many embedded patches");
! return newb;
}
stack[stackdepth] = nobj;
***************
*** 1011,1019 ****
}
}
! if (!strcmp(first, "#X"))
! {
! if (natom >= 5 && !strcmp(second, "restore")
! && (ISSYMBOL (&nextmess[4], "pd")))
! {
binbuf_addv(newb, "ss;", gensym("#P"), gensym("pop"));
binbuf_addv(newb, "ssffffss;",
--- 938,943 ----
}
}
! if (!strcmp(first, "#X")) {
! if (natom >= 5 && !strcmp(second, "restore") && (ISSYMBOL (&nextmess[4], "pd"))) {
binbuf_addv(newb, "ss;", gensym("#P"), gensym("pop"));
binbuf_addv(newb, "ssffffss;",
***************
*** 1026,1073 ****
nobj = stack[stackdepth];
nobj++;
! }
! else if (!strcmp(second, "obj"))
! {
! t_symbol *classname =
! atom_getsymbolarg(4, natom, nextmess);
if (classname == gensym("inlet"))
! binbuf_addv(newb, "ssfff;", gensym("#P"),
! gensym("inlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15.);
else if (classname == gensym("inlet~"))
! binbuf_addv(newb, "ssffff;", gensym("#P"),
! gensym("inlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15., 1.);
else if (classname == gensym("outlet"))
! binbuf_addv(newb, "ssfff;", gensym("#P"),
! gensym("outlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15.);
else if (classname == gensym("outlet~"))
! binbuf_addv(newb, "ssffff;", gensym("#P"),
! gensym("outlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15., 1.);
else if (classname == gensym("bng"))
! binbuf_addv(newb, "ssffff;", gensym("#P"),
! gensym("button"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
atom_getfloatarg(5, natom, nextmess), 0.);
else if (classname == gensym("tgl"))
! binbuf_addv(newb, "ssffff;", gensym("#P"),
! gensym("toggle"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
atom_getfloatarg(5, natom, nextmess), 0.);
else if (classname == gensym("vsl"))
! binbuf_addv(newb, "ssffffff;", gensym("#P"),
! gensym("slider"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
--- 950,987 ----
nobj = stack[stackdepth];
nobj++;
! } else if (!strcmp(second, "obj")) {
! t_symbol *classname = atom_getsymbolarg(4, natom, nextmess);
if (classname == gensym("inlet"))
! binbuf_addv(newb, "ssfff;", gensym("#P"), gensym("inlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15.);
else if (classname == gensym("inlet~"))
! binbuf_addv(newb, "ssffff;", gensym("#P"), gensym("inlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15., 1.);
else if (classname == gensym("outlet"))
! binbuf_addv(newb, "ssfff;", gensym("#P"), gensym("outlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15.);
else if (classname == gensym("outlet~"))
! binbuf_addv(newb, "ssffff;", gensym("#P"), gensym("outlet"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
15., 1.);
else if (classname == gensym("bng"))
! binbuf_addv(newb, "ssffff;", gensym("#P"), gensym("button"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
atom_getfloatarg(5, natom, nextmess), 0.);
else if (classname == gensym("tgl"))
! binbuf_addv(newb, "ssffff;", gensym("#P"), gensym("toggle"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
atom_getfloatarg(5, natom, nextmess), 0.);
else if (classname == gensym("vsl"))
! binbuf_addv(newb, "ssffffff;", gensym("#P"), gensym("slider"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess),
***************
*** 1079,1084 ****
atom_getfloatarg(6, natom, nextmess) - 1),
atom_getfloatarg(7, natom, nextmess));
! else
! {
SETSYMBOL(outmess, gensym("#P"));
SETSYMBOL(outmess + 1, gensym("newex"));
--- 993,997 ----
atom_getfloatarg(6, natom, nextmess) - 1),
atom_getfloatarg(7, natom, nextmess));
! else {
SETSYMBOL(outmess, gensym("#P"));
SETSYMBOL(outmess + 1, gensym("newex"));
***************
*** 1087,1104 ****
SETFLOAT(outmess + 4, 50);
SETFLOAT(outmess + 5, 1);
! for (i = 4; i < natom; i++)
! outmess[i+2] = nextmess[i];
SETSEMI(outmess + natom + 2);
binbuf_add(newb, natom + 3, outmess);
}
nobj++;
!
! }
! else if (!strcmp(second, "msg") ||
! !strcmp(second, "text"))
! {
SETSYMBOL(outmess, gensym("#P"));
! SETSYMBOL(outmess + 1, gensym((char *)
! (strcmp(second, "msg") ? "comment" : "message")));
outmess[2] = nextmess[2];
outmess[3] = nextmess[3];
--- 1000,1011 ----
SETFLOAT(outmess + 4, 50);
SETFLOAT(outmess + 5, 1);
! for (i = 4; i < natom; i++) outmess[i+2] = nextmess[i];
SETSEMI(outmess + natom + 2);
binbuf_add(newb, natom + 3, outmess);
}
nobj++;
! } else if (!strcmp(second, "msg") || !strcmp(second, "text")) {
SETSYMBOL(outmess, gensym("#P"));
! SETSYMBOL(outmess + 1, gensym((char *)(strcmp(second, "msg") ? "comment" : "message")));
outmess[2] = nextmess[2];
outmess[3] = nextmess[3];
***************
*** 1110,1130 ****
binbuf_add(newb, natom + 3, outmess);
nobj++;
! }
! else if (!strcmp(second, "floatatom"))
! {
! binbuf_addv(newb, "ssfff;",
! gensym("#P"), gensym("flonum"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess), 35);
nobj++;
! }
! else if (!strcmp(second, "connect"))
! {
! binbuf_addv(newb, "ssffff;",
! gensym("#P"), gensym("connect"),
! nobj - atom_getfloatarg(2, natom, nextmess) - 1,
! atom_getfloatarg(3, natom, nextmess),
! nobj - atom_getfloatarg(4, natom, nextmess) - 1,
! atom_getfloatarg(5, natom, nextmess));
}
}
--- 1017,1029 ----
binbuf_add(newb, natom + 3, outmess);
nobj++;
! } else if (!strcmp(second, "floatatom")) {
! binbuf_addv(newb, "ssfff;", gensym("#P"), gensym("flonum"),
atom_getfloatarg(2, natom, nextmess),
atom_getfloatarg(3, natom, nextmess), 35);
nobj++;
! } else if (!strcmp(second, "connect")) {
! binbuf_addv(newb, "ssffff;", gensym("#P"), gensym("connect"),
! nobj - atom_getfloatarg(2, natom, nextmess) - 1, atom_getfloatarg(3, natom, nextmess),
! nobj - atom_getfloatarg(4, natom, nextmess) - 1, atom_getfloatarg(5, natom, nextmess));
}
}
***************
*** 1137,1167 ****
binbuf_write(newb, "import-result.pd", "/tmp", 0);
#endif
! return (newb);
}
/* function to support searching */
! int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf)
! {
int indexin, nmatched;
! for (indexin = 0; indexin <= inbuf->b_n - searchbuf->b_n; indexin++)
! {
! for (nmatched = 0; nmatched < searchbuf->b_n; nmatched++)
! {
! t_atom *a1 = &inbuf->b_vec[indexin + nmatched],
! *a2 = &searchbuf->b_vec[nmatched];
if (a1->a_type != a2->a_type ||
! a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol
! ||
! a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float
! ||
! a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index
! ||
! a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol)
! goto nomatch;
}
! return (1);
nomatch: ;
}
! return (0);
}
--- 1036,1058 ----
binbuf_write(newb, "import-result.pd", "/tmp", 0);
#endif
! return newb;
}
/* function to support searching */
! int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) {
int indexin, nmatched;
! for (indexin = 0; indexin <= inbuf->b_n - searchbuf->b_n; indexin++) {
! for (nmatched = 0; nmatched < searchbuf->b_n; nmatched++) {
! t_atom *a1 = &inbuf->b_vec[indexin + nmatched], *a2 = &searchbuf->b_vec[nmatched];
if (a1->a_type != a2->a_type ||
! a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol ||
! a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float ||
! a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index ||
! a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol) goto nomatch;
}
! return 1;
nomatch: ;
}
! return 0;
}
***************
*** 1177,1188 ****
int dspstate = canvas_suspend_dsp();
glob_setfilename(0, name, dir);
! if (binbuf_read(b, name->s_name, dir->s_name, 0))
! {
perror(name->s_name);
! }
! else
! {
! if (import)
! {
t_binbuf *newb = binbuf_convert(b, 1);
binbuf_free(b);
--- 1068,1075 ----
int dspstate = canvas_suspend_dsp();
glob_setfilename(0, name, dir);
! if (binbuf_read(b, name->s_name, dir->s_name, 0)) {
perror(name->s_name);
! } else {
! if (import) {
t_binbuf *newb = binbuf_convert(b, 1);
binbuf_free(b);