Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23590
Modified Files:
Tag: desiredata
kernel.c
Log Message:
cleanup
Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.48
retrieving revision 1.1.2.49
diff -C2 -d -r1.1.2.48 -r1.1.2.49
*** kernel.c 11 Jul 2007 19:04:50 -0000 1.1.2.48
--- kernel.c 11 Jul 2007 19:39:10 -0000 1.1.2.49
***************
*** 29,34 ****
#endif
! #define a_float a_w.w_float
! #define a_symbol a_w.w_symbol
/* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */
--- 29,35 ----
#endif
! #define a_float a_w.w_float
! #define a_symbol a_w.w_symbol
! #define a_gpointer a_w.w_gpointer
/* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */
***************
*** 650,658 ****
if (!argc) return;
for (count = argc-1, ap = argv+1; ip && count--; ap++, ip = ip->next) {
! if (ap->a_type == A_POINTER) pd_pointer(ip,ap->a_w.w_gpointer);
else if (ap->a_type == A_FLOAT) pd_float(ip,ap->a_float);
else pd_symbol(ip,ap->a_symbol);
}
! if (argv->a_type == A_POINTER) pd_pointer(x, argv->a_w.w_gpointer);
else if (argv->a_type == A_FLOAT) pd_float(x, argv->a_float);
else pd_symbol(x, argv->a_symbol);
--- 651,659 ----
if (!argc) return;
for (count = argc-1, ap = argv+1; ip && count--; ap++, ip = ip->next) {
! if (ap->a_type == A_POINTER) pd_pointer(ip,ap->a_gpointer);
else if (ap->a_type == A_FLOAT) pd_float(ip,ap->a_float);
else pd_symbol(ip,ap->a_symbol);
}
! if (argv->a_type == A_POINTER) pd_pointer(x, argv->a_gpointer);
else if (argv->a_type == A_FLOAT) pd_float(x, argv->a_float);
else pd_symbol(x, argv->a_symbol);
***************
*** 1460,1464 ****
else {
if (argv->a_type!=A_POINTER) goto badarg;
! *ap = (t_int)(argv->a_w.w_gpointer);
argc--;
argv++;
--- 1461,1465 ----
else {
if (argv->a_type!=A_POINTER) goto badarg;
! *ap = (t_int)(argv->a_gpointer);
argc--;
argv++;
***************
*** 1526,1530 ****
int nargs = 0;
char *fp = fmt;
-
va_start(ap, fmt);
while (1) {
--- 1527,1530 ----
***************
*** 1551,1561 ****
if (argc) {
t_atomtype t = argv->a_type;
! if (t == A_SYMBOL) pd_typedmess(x, argv->a_symbol, argc-1, argv+1);
! else if (t == A_POINTER) {
! if (argc == 1) pd_pointer(x, argv->a_w.w_gpointer); else pd_list(x, &s_list, argc, argv);
! }
! else if (t == A_FLOAT) {
! if (argc == 1) pd_float(x, argv->a_float); else pd_list(x, &s_list, argc, argv);
! }
else bug("pd_forwardmess");
}
--- 1551,1557 ----
if (argc) {
t_atomtype t = argv->a_type;
! if (t == A_SYMBOL) pd_typedmess(x, argv->a_symbol, argc-1, argv+1);
! else if (t == A_POINTER) {if (argc==1) pd_pointer(x, argv->a_gpointer); else pd_list(x, &s_list, argc, argv);}
! else if (t == A_FLOAT) {if (argc==1) pd_float( x, argv->a_float); else pd_list(x, &s_list, argc, argv);}
else bug("pd_forwardmess");
}
***************
*** 1793,1798 ****
char string[MAXPDSTRING];
t_atom *ap = x->v;
! int indx;
! for (indx = x->n; indx--; ap++) {
if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && length && buf[length-1] == ' ') length--;
atom_string(ap, string, MAXPDSTRING);
--- 1789,1793 ----
char string[MAXPDSTRING];
t_atom *ap = x->v;
! for (int i=x->n; i--; ap++) {
if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && length && buf[length-1] == ' ') length--;
atom_string(ap, string, MAXPDSTRING);
***************
*** 1904,1916 ****
void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) {
! int newsize = x->n + argc, i;
! t_atom *ap;
! ap = (t_atom *)realloc(x->v,(newsize+1)*sizeof(*x->v));
! if (!ap) {
! error("binbuf_addmessage: out of space");
! return;
! }
x->v = ap;
! for (ap = x->v + x->n, i = argc; i--; ap++) {
if (argv->a_type == A_SYMBOL) {
char *str = argv->a_symbol->name, *str2;
--- 1899,1908 ----
void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) {
! int newsize = x->n + argc;
! t_atom *ap = (t_atom *)realloc(x->v,(newsize+1)*sizeof(*x->v));
! if (!ap) {error("binbuf_addmessage: out of space"); return;}
x->v = ap;
! ap = x->v + x->n;
! for (int i = argc; i--; ap++) {
if (argv->a_type == A_SYMBOL) {
char *str = argv->a_symbol->name, *str2;
***************
*** 1937,1941 ****
}
-
#define MSTACKSIZE 2048
--- 1929,1932 ----
***************
*** 2005,2009 ****
char buf2[MAXPDSTRING];
char*str=s->name;
- char*substr;
int next=0, i=MAXPDSTRING;
t_atom dollarnull;
--- 1996,1999 ----
***************
*** 2011,2019 ****
while(i--)buf2[i]=0;
/* JMZ: currently, a symbol is detected to be A_DOLLSYM if it starts with '$'
! * the leading $ is stripped and the rest stored in "s"
! * i would suggest to NOT strip the leading $
! * and make everything a A_DOLLSYM that contains(!) a $
! * whenever this happened, enable this code */
! substr=strchr(str, '$');
if(!substr || substr-str >= MAXPDSTRING) return s;
strncat(buf2, str, (substr-str));
--- 2001,2007 ----
while(i--)buf2[i]=0;
/* JMZ: currently, a symbol is detected to be A_DOLLSYM if it starts with '$'
! * the leading $ is stripped and the rest stored in "s". i would suggest to NOT strip the leading $
! * and make everything a A_DOLLSYM that contains(!) a $ whenever this happened, enable this code */
! char *substr=strchr(str, '$');
if(!substr || substr-str >= MAXPDSTRING) return s;
strncat(buf2, str, (substr-str));
***************
*** 2029,2033 ****
str+=next;
substr=strchr(str, '$');
! if(substr){
strncat(buf2, str, (substr-str));
str=substr+1;
--- 2017,2021 ----
str+=next;
substr=strchr(str, '$');
! if(substr) {
strncat(buf2, str, (substr-str));
str=substr+1;
***************
*** 2128,2133 ****
error("%s: argument number out of range", at->a_symbol->name);
SETSYMBOL(msp, at->a_symbol);
! }
! else SETSYMBOL(msp, s9);
break;
default:
--- 2116,2120 ----
error("%s: argument number out of range", at->a_symbol->name);
SETSYMBOL(msp, at->a_symbol);
! } else SETSYMBOL(msp, s9);
break;
default:
***************
*** 2143,2153 ****
if (nargs) {
switch (stackwas->a_type) {
! case A_SYMBOL:
! typedmess(target, stackwas->a_symbol, nargs-1, stackwas+1);
! break;
! case A_FLOAT:
! if (nargs == 1) pd_float(target, stackwas->a_float);
! else pd_list(target, 0, nargs, stackwas);
! break;
default: {}
}
--- 2130,2135 ----
if (nargs) {
switch (stackwas->a_type) {
! case A_SYMBOL: typedmess(target, stackwas->a_symbol, nargs-1, stackwas+1); break;
! case A_FLOAT: if (nargs == 1) pd_float(target, stackwas->a_float); else pd_list(target, 0, nargs, stackwas); break;
default: {}
}
***************
*** 2310,2314 ****
for (nextindex = 0; nextindex < n; ) {
int endmess, natom;
- char *first, *second;
for (endmess = nextindex; endmess < n && vec[endmess].a_type != A_SEMI; endmess++) {}
if (endmess == n) break;
--- 2292,2295 ----
***************
*** 2321,2326 ****
if (natom > MAXSTACK-10) natom = MAXSTACK-10;
nextmess = vec + nextindex;
! first = nextmess->a_symbol->name;
! second = (nextmess+1)->a_symbol->name;
if (maxtopd) { /* case 1: importing a ".pat" file into Pd. */
/* dollar signs in file translate to symbols */
--- 2302,2307 ----
if (natom > MAXSTACK-10) natom = MAXSTACK-10;
nextmess = vec + nextindex;
! char *first = nextmess ->a_symbol->name;
! char *second = (nextmess+1)->a_symbol->name;
if (maxtopd) { /* case 1: importing a ".pat" file into Pd. */
/* dollar signs in file translate to symbols */
***************
*** 2345,2350 ****
stackdepth++;
nobj = 0;
! binbuf_addv(newb,"ttfffff;","#N","canvas", GETF(2), GETF(3),
! GETF(4)-GETF(2), GETF(5)-GETF(3), 10.);
}
}
--- 2326,2330 ----
stackdepth++;
nobj = 0;
! binbuf_addv(newb,"ttfffff;","#N","canvas", GETF(2), GETF(3), GETF(4)-GETF(2), GETF(5)-GETF(3), 10.);
}
}
***************
*** 2367,2372 ****
if (classname == gensym("trigger") || classname == gensym("t")) {
for (i = 7; i < natom; i++)
! if (nextmess[i].a_type == A_SYMBOL &&
! nextmess[i].a_symbol == gensym("i"))
nextmess[i].a_symbol = gensym("f");
}
--- 2347,2351 ----
if (classname == gensym("trigger") || classname == gensym("t")) {
for (i = 7; i < natom; i++)
! if (nextmess[i].a_type == A_SYMBOL && nextmess[i].a_symbol == gensym("i"))
nextmess[i].a_symbol = gensym("f");
}
***************
*** 2407,2416 ****
nobj++;
} else if (!strcmp(second, "inlet")) {
! binbuf_addv(newb,"ttfft;","#X","obj",GETF(2),GETF(3),
! (char *)(natom > 5 ? "inlet~" : "inlet"));
nobj++;
} else if (!strcmp(second, "outlet")) {
! binbuf_addv(newb,"ttfft;","#X","obj", GETF(2), GETF(3),
! (char *)(natom > 5 ? "outlet~" : "outlet"));
nobj++;
} else if (!strcmp(second, "user")) {
--- 2386,2393 ----
nobj++;
} else if (!strcmp(second, "inlet")) {
! binbuf_addv(newb,"ttfft;","#X","obj",GETF(2),GETF(3), natom > 5 ? "inlet~" : "inlet");
nobj++;
} else if (!strcmp(second, "outlet")) {
! binbuf_addv(newb,"ttfft;","#X","obj",GETF(2),GETF(3), natom > 5 ? "outlet~" : "outlet");
nobj++;
} else if (!strcmp(second, "user")) {
***************
*** 2418,2423 ****
nobj++;
} else if (!strcmp(second, "connect") || !strcmp(second, "fasten")) {
! binbuf_addv(newb,"ttffff;","#X","connect",
! nobj-GETF(2)-1, GETF(3), nobj-GETF(4)-1, GETF(5));
}
}
--- 2395,2399 ----
nobj++;
} else if (!strcmp(second, "connect") || !strcmp(second, "fasten")) {
! binbuf_addv(newb,"ttffff;","#X","connect", nobj-GETF(2)-1, GETF(3), nobj-GETF(4)-1, GETF(5));
}
}
***************
*** 2445,2486 ****
} else if (!strcmp(second, "obj")) {
t_symbol *classname = atom_getsymbolarg(4, natom, nextmess);
! if (classname == gensym("inlet"))
! binbuf_addv(newb,"ttfff;","#P","inlet", GETF(2), GETF(3), 15.);
! else if (classname == gensym("inlet~"))
! binbuf_addv(newb,"ttffff;","#P","inlet", GETF(2), GETF(3), 15., 1.);
! else if (classname == gensym("outlet"))
! binbuf_addv(newb,"ttfff;","#P","outlet", GETF(2), GETF(3), 15.);
! else if (classname == gensym("outlet~"))
! binbuf_addv(newb,"ttffff;","#P","outlet", GETF(2), GETF(3), 15., 1.);
! else if (classname == gensym("bng"))
! binbuf_addv(newb,"ttffff;","#P","button", GETF(2), GETF(3), GETF(5), 0.);
! else if (classname == gensym("tgl"))
! binbuf_addv(newb,"ttffff;","#P","toggle", GETF(2), GETF(3), GETF(5), 0.);
! else if (classname == gensym("vsl"))
! binbuf_addv(newb,"ttffffff;","#P","slider", GETF(2), GETF(3), GETF(5), GETF(6),
! (GETF(8)-GETF(7)) / (GETF(6)==1?1:GETF(6)-1), GETF(7));
else {
! SETSYMBOL(outmess, gensym("#P"));
! SETSYMBOL(outmess + 1, gensym("newex"));
! outmess[2] = nextmess[2];
! outmess[3] = nextmess[3];
! 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];
! 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, "floatatom")) {
--- 2421,2444 ----
} else if (!strcmp(second, "obj")) {
t_symbol *classname = atom_getsymbolarg(4, natom, nextmess);
! if (classname == gensym("inlet")) binbuf_addv(newb,"ttfff;","#P","inlet", GETF(2), GETF(3), 15.);
! else if (classname == gensym("inlet~")) binbuf_addv(newb,"ttffff;","#P","inlet", GETF(2), GETF(3), 15., 1.);
! else if (classname == gensym("outlet")) binbuf_addv(newb,"ttfff;","#P","outlet", GETF(2), GETF(3), 15.);
! else if (classname == gensym("outlet~")) binbuf_addv(newb,"ttffff;","#P","outlet", GETF(2), GETF(3), 15., 1.);
! else if (classname == gensym("bng")) binbuf_addv(newb,"ttffff;","#P","button", GETF(2), GETF(3), GETF(5), 0.);
! else if (classname == gensym("tgl")) binbuf_addv(newb,"ttffff;","#P","toggle", GETF(2), GETF(3), GETF(5), 0.);
! else if (classname == gensym("vsl")) binbuf_addv(newb,"ttffffff;","#P","slider",
! GETF(2), GETF(3), GETF(5), GETF(6), (GETF(8)-GETF(7)) / (GETF(6)==1?1:GETF(6)-1), GETF(7));
else {
! binbuf_addv(newb,"ttffff","#P","newex", GETF(2), GETF(3), 50., 1.);
! for (int i=4; i<natom; i++) outmess[i-4] = nextmess[i];
! binbuf_add(newb, natom-4, outmess);
! binbuf_addv(newb,";");
}
nobj++;
} else if (!strcmp(second, "msg") || !strcmp(second, "text")) {
! binbuf_addv(newb,"ttffff","#P",strcmp(second, "msg") ? "comment" : "message",GETF(2),GETF(3),50.,1.);
! for (int i=4; i<natom; i++) outmess[i-4] = nextmess[i];
! binbuf_add(newb, natom-4, outmess);
! binbuf_addv(newb,";");
nobj++;
} else if (!strcmp(second, "floatatom")) {
***************
*** 2488,2493 ****
nobj++;
} else if (!strcmp(second, "connect")) {
! binbuf_addv(newb, "ttffff;", "#P", "connect",
! nobj-GETF(2)-1, GETF(3), nobj-GETF(4)-1, GETF(5));
}
}
--- 2446,2450 ----
nobj++;
} else if (!strcmp(second, "connect")) {
! binbuf_addv(newb, "ttffff;", "#P", "connect", nobj-GETF(2)-1, GETF(3), nobj-GETF(4)-1, GETF(5));
}
}