Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16854
Modified Files: Tag: desiredata builtins.c Log Message: cleanup
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.35 retrieving revision 1.1.2.36 diff -C2 -d -r1.1.2.35 -r1.1.2.36 *** builtins.c 19 Jul 2007 15:38:48 -0000 1.1.2.35 --- builtins.c 19 Jul 2007 17:07:16 -0000 1.1.2.36 *************** *** 119,127 **** static void openpanel_free(t_openpanel *x) {pd_unbind(x, x->s);} static void openpanel_setup() { ! openpanel_class = class_new2("openpanel",openpanel_new,openpanel_free,sizeof(t_openpanel),0,"S"); ! class_addbang(openpanel_class, openpanel_bang); ! class_addmethod2(openpanel_class, openpanel_path, "path","s"); ! class_addmethod2(openpanel_class, openpanel_callback,"callback","s"); ! class_addsymbol(openpanel_class, openpanel_symbol); }
--- 119,127 ---- static void openpanel_free(t_openpanel *x) {pd_unbind(x, x->s);} static void openpanel_setup() { ! t_class *c = openpanel_class = class_new2("openpanel",openpanel_new,openpanel_free,sizeof(t_openpanel),0,"S"); ! class_addbang(c, openpanel_bang); ! class_addmethod2(c, openpanel_path, "path","s"); ! class_addmethod2(c, openpanel_callback,"callback","s"); ! class_addsymbol(c, openpanel_symbol); }
*************** *** 149,157 **** static void savepanel_free(t_savepanel *x) {pd_unbind(x, x->s);} static void savepanel_setup() { ! savepanel_class = class_new2("savepanel",savepanel_new,savepanel_free,sizeof(t_savepanel),0,"S"); ! class_addbang(savepanel_class, savepanel_bang); ! class_addmethod2(savepanel_class, openpanel_path, "path","s"); ! class_addmethod2(savepanel_class, savepanel_callback, "callback","s"); ! class_addsymbol(savepanel_class, savepanel_symbol); }
--- 149,157 ---- static void savepanel_free(t_savepanel *x) {pd_unbind(x, x->s);} static void savepanel_setup() { ! t_class *c = savepanel_class = class_new2("savepanel",savepanel_new,savepanel_free,sizeof(t_savepanel),0,"S"); ! class_addbang(c, savepanel_bang); ! class_addmethod2(c, openpanel_path, "path","s"); ! class_addmethod2(c, savepanel_callback, "callback","s"); ! class_addsymbol(c, savepanel_symbol); }
*************** *** 1007,1016 **** } static void print_setup() { ! print_class = class_new2("print",print_new,0,sizeof(t_print),0,"S"); ! class_addbang(print_class, print_bang); ! class_addfloat(print_class, print_float); ! class_addpointer(print_class, print_pointer); ! class_addlist(print_class, print_list); ! class_addanything(print_class, print_anything); }
--- 1007,1016 ---- } static void print_setup() { ! t_class *c = print_class = class_new2("print",print_new,0,sizeof(t_print),0,"S"); ! class_addbang(c, print_bang); ! class_addfloat(c, print_float); ! class_addpointer(c, print_pointer); ! class_addlist(c, print_list); ! class_addanything(c, print_anything); }
*************** *** 1225,1229 **** class_addcreator2("f",pdfloat_new2,"F"); class_addbang(pdfloat_class, pdfloat_bang); ! class_addfloat(pdfloat_class, (t_method)pdfloat_float); }
--- 1225,1229 ---- class_addcreator2("f",pdfloat_new2,"F"); class_addbang(pdfloat_class, pdfloat_bang); ! class_addfloat(pdfloat_class, pdfloat_float); }
*************** *** 1247,1250 **** --- 1247,1251 ---- where empty lists aren't equivalent to "bang"??? Should Pd's message passer always check and call the more specific method, or should it be the object's responsibility? Dunno... */ + #if 0 static void pdsymbol_list(t_pdsymbol *x, t_symbol *s, int ac, t_atom *av) { if (!ac) pdsymbol_bang(x); *************** *** 1252,1255 **** --- 1253,1257 ---- else pdsymbol_anything(x, s, ac, av); } + #endif void pdsymbol_setup() { pdsymbol_class = class_new2("symbol",pdsymbol_new,0,sizeof(t_pdsymbol),0,"S"); *************** *** 1271,1281 **** static void bang_bang(t_bang *x) {outlet_bang(x->outlet);} void bang_setup() { ! bang_class = class_new2("bang",bang_new,0,sizeof(t_bang),0,""); class_addcreator2("b",bang_new2,""); ! class_addbang(bang_class, bang_bang); ! class_addfloat(bang_class, bang_bang); ! class_addsymbol(bang_class, bang_bang); ! class_addlist(bang_class, bang_bang); ! class_addanything(bang_class, bang_bang); }
--- 1273,1283 ---- static void bang_bang(t_bang *x) {outlet_bang(x->outlet);} void bang_setup() { ! t_class *c = bang_class = class_new2("bang",bang_new,0,sizeof(t_bang),0,""); class_addcreator2("b",bang_new2,""); ! class_addbang(c, bang_bang); ! class_addfloat(c, bang_bang); ! class_addsymbol(c, bang_bang); ! class_addlist(c, bang_bang); ! class_addanything(c, bang_bang); }
*************** *** 1305,1316 **** } static void send_setup() { ! send_class = class_new2("send",send_new,0,sizeof(t_send),0,"S"); class_addcreator2("s",send_new,"S"); ! class_addbang(send_class, send_bang); ! class_addfloat(send_class, send_float); ! class_addsymbol(send_class, send_symbol); ! class_addpointer(send_class, send_pointer); ! class_addlist(send_class, send_list); ! class_addanything(send_class, send_anything); }
--- 1307,1318 ---- } static void send_setup() { ! t_class *c = send_class = class_new2("send",send_new,0,sizeof(t_send),0,"S"); class_addcreator2("s",send_new,"S"); ! class_addbang(c, send_bang); ! class_addfloat(c, send_float); ! class_addsymbol(c, send_symbol); ! class_addpointer(c, send_pointer); ! class_addlist(c, send_list); ! class_addanything(c, send_anything); }
*************** *** 1340,1351 **** static void receive_free(t_receive *x) {pd_unbind(x, x->sym);} static void receive_setup() { ! receive_class = class_new2("receive",receive_new,receive_free,sizeof(t_receive),CLASS_NOINLET,"S"); class_addcreator2("r",receive_new,"S"); ! class_addbang(receive_class, receive_bang); ! class_addfloat(receive_class, (t_method)receive_float); ! class_addsymbol(receive_class, receive_symbol); ! class_addpointer(receive_class, receive_pointer); ! class_addlist(receive_class, receive_list); ! class_addanything(receive_class, receive_anything); }
--- 1342,1353 ---- static void receive_free(t_receive *x) {pd_unbind(x, x->sym);} static void receive_setup() { ! t_class *c = receive_class = class_new2("receive",receive_new,receive_free,sizeof(t_receive),CLASS_NOINLET,"S"); class_addcreator2("r",receive_new,"S"); ! class_addbang(c, receive_bang); ! class_addfloat(c, receive_float); ! class_addsymbol(c, receive_symbol); ! class_addpointer(c, receive_pointer); ! class_addlist(c, receive_list); ! class_addanything(c, receive_anything); }
*************** *** 1357,1361 **** }; static void sel1_float(t_sel1 *x, t_float f) { ! if (x->atom.a_type==A_FLOAT && f == x->atom.a_float) outlet_bang(x->out(0)); else outlet_float(x->out(1),f); } static void sel1_symbol(t_sel1 *x, t_symbol *s) { --- 1359,1363 ---- }; static void sel1_float(t_sel1 *x, t_float f) { ! if (x->atom.a_type==A_FLOAT && f == x->atom.a_float) outlet_bang(x->out(0)); else outlet_float(x->out(1),f); } static void sel1_symbol(t_sel1 *x, t_symbol *s) { *************** *** 1489,1503 **** } } else if (argc == 0) { ! route_eachr(e,x) { ! if (e->e_w.w_symbol == &s_bang) {outlet_bang(e->out); return;} ! } } else if (argv[0].a_type == A_FLOAT) { ! route_eachr(e,x) { ! if (e->e_w.w_symbol == &s_float) {outlet_float(e->out, argv[0].a_float); return;} ! } } else { ! route_eachr(e,x) { ! if (e->e_w.w_symbol == &s_symbol) {outlet_symbol(e->out, argv[0].a_symbol); return;} ! } } } --- 1491,1499 ---- } } else if (argc == 0) { ! route_eachr(e,x) {if (e->e_w.w_symbol == &s_bang ) {outlet_bang(e->out); return;}} } else if (argv[0].a_type == A_FLOAT) { ! route_eachr(e,x) {if (e->e_w.w_symbol == &s_float ) {outlet_float(e->out, argv[0].a_float); return;}} } else { ! route_eachr(e,x) {if (e->e_w.w_symbol == &s_symbol) {outlet_symbol(e->out, argv[0].a_symbol); return;}} } } *************** *** 1639,1649 **** } static void pack_setup() { ! pack_class = class_new2("pack",pack_new,pack_free,sizeof(t_pack),0,"*"); ! class_addbang(pack_class, pack_bang); ! class_addpointer(pack_class, pack_pointer); ! class_addfloat(pack_class, pack_float); ! class_addsymbol(pack_class, pack_symbol); ! class_addlist(pack_class, pack_list); ! class_addanything(pack_class, pack_anything); }
--- 1635,1645 ---- } static void pack_setup() { ! t_class *c = pack_class = class_new2("pack",pack_new,pack_free,sizeof(t_pack),0,"*"); ! class_addbang(c, pack_bang); ! class_addpointer(c, pack_pointer); ! class_addfloat(c, pack_float); ! class_addsymbol(c, pack_symbol); ! class_addlist(c, pack_list); ! class_addanything(c, pack_anything); }
*************** *** 1787,1798 **** static void trigger_free(t_trigger *x) {free(x->vec);} static void trigger_setup() { ! trigger_class = class_new2("trigger",trigger_new,trigger_free,sizeof(t_trigger),0,"*"); class_addcreator2("t",trigger_new,"*"); ! class_addlist(trigger_class, trigger_list); ! class_addbang(trigger_class, trigger_bang); ! class_addpointer(trigger_class, trigger_pointer); ! class_addfloat(trigger_class, (t_method)trigger_float); ! class_addsymbol(trigger_class, trigger_symbol); ! class_addanything(trigger_class, trigger_anything); }
--- 1783,1794 ---- static void trigger_free(t_trigger *x) {free(x->vec);} static void trigger_setup() { ! t_class *c = trigger_class = class_new2("trigger",trigger_new,trigger_free,sizeof(t_trigger),0,"*"); class_addcreator2("t",trigger_new,"*"); ! class_addlist(c, trigger_list); ! class_addbang(c, trigger_bang); ! class_addpointer(c, trigger_pointer); ! class_addfloat(c, trigger_float); ! class_addsymbol(c, trigger_symbol); ! class_addanything(c, trigger_anything); }
*************** *** 1819,1829 **** if (x->state) outlet_anything(x->outlet, s, argc, argv);} static void spigot_setup() { ! spigot_class = class_new2("spigot",spigot_new,0,sizeof(t_spigot),0,"F"); ! class_addbang(spigot_class, spigot_bang); ! class_addpointer(spigot_class, spigot_pointer); ! class_addfloat(spigot_class, spigot_float); ! class_addsymbol(spigot_class, spigot_symbol); ! class_addlist(spigot_class, spigot_list); ! class_addanything(spigot_class, spigot_anything); }
--- 1815,1825 ---- if (x->state) outlet_anything(x->outlet, s, argc, argv);} static void spigot_setup() { ! t_class *c = spigot_class = class_new2("spigot",spigot_new,0,sizeof(t_spigot),0,"F"); ! class_addbang(c, spigot_bang); ! class_addpointer(c, spigot_pointer); ! class_addfloat(c, spigot_float); ! class_addsymbol(c, spigot_symbol); ! class_addlist(c, spigot_list); ! class_addanything(c, spigot_anything); }
*************** *** 1883,1901 **** }
- /* untested */ - /* - extern "C" char *masprintf (const char *s, ...) { - va_list args; - va_start(args,s); - int n = vsnprintf(0,0,s,args); - va_end(args); - char *buf = (char *)malloc(n+1); - va_start(args,s); - vsnprintf(buf,n+1,s,args); - va_end(args); - return buf; - } - */ - /* doesn't do any typechecking or even counting the % signs properly */ static void makefilename_float(t_makefilename *x, t_floatarg f) {outlet_symbol(x->outlet,symprintf(x->format->name,(int)f));} --- 1879,1882 ---- *************** *** 2469,2473 **** struct t_hang { t_clock *clock; ! struct t_hang *next; t_float pitch; struct t_makenote *owner; --- 2450,2454 ---- struct t_hang { t_clock *clock; ! t_hang *next; t_float pitch; struct t_makenote *owner; *************** *** 2505,2513 **** } static void makenote_float(t_makenote *x, t_float f) { - t_hang *hang; if (!x->velo) return; outlet_float(x->out(1), x->velo); outlet_float(x->out(0), f); ! hang = (t_hang *)getbytes(sizeof *hang); hang->next = x->hang; x->hang = hang; --- 2486,2493 ---- } static void makenote_float(t_makenote *x, t_float f) { if (!x->velo) return; outlet_float(x->out(1), x->velo); outlet_float(x->out(0), f); ! t_hang *hang = (t_hang *)getbytes(sizeof *hang); hang->next = x->hang; x->hang = hang; *************** *** 2757,2761 **** class_addmethod2(delay_class,delay_stop,"stop",""); class_addmethod2(delay_class,delay_ft1,"ft1","f"); ! class_addfloat(delay_class, (t_method)delay_float); }
--- 2737,2741 ---- class_addmethod2(delay_class,delay_stop,"stop",""); class_addmethod2(delay_class,delay_ft1,"ft1","f"); ! class_addfloat(delay_class, delay_float); }
*************** *** 2793,2797 **** class_addmethod2(metro_class,metro_stop,"stop",""); class_addmethod2(metro_class,metro_ft1,"ft1","f"); ! class_addfloat(metro_class, (t_method)metro_float); }
--- 2773,2777 ---- class_addmethod2(metro_class,metro_stop,"stop",""); class_addmethod2(metro_class,metro_ft1,"ft1","f"); ! class_addfloat(metro_class, metro_float); }
*************** *** 2869,2878 **** } static void line_setup() { ! line_class = class_new2("line",line_new,line_free,sizeof(t_line),0,"FF"); ! class_addmethod2(line_class,line_ft1,"ft1","f"); ! class_addmethod2(line_class,line_stop,"stop",""); ! class_addmethod2(line_class,line_set,"set","f"); ! class_addmethod2(line_class,line_set_granularity,"granularity","f"); ! class_addfloat(line_class, (t_method)line_float); }
--- 2849,2858 ---- } static void line_setup() { ! t_class *c = line_class = class_new2("line",line_new,line_free,sizeof(t_line),0,"FF"); ! class_addmethod2(c,line_ft1,"ft1","f"); ! class_addmethod2(c,line_stop,"stop",""); ! class_addmethod2(c,line_set,"set","f"); ! class_addmethod2(c,line_set_granularity,"granularity","f"); ! class_addfloat(c,line_float); }
*************** *** 2924,2930 **** if (argc) { if (argv[argc-1].a_type != A_FLOAT) { ! char stupid[80]; ! atom_string(&argv[argc-1], stupid, 79); ! post("pipe: %s: bad time delay value", stupid); deltime = 0; } else deltime = argv[argc-1].a_float; --- 2904,2910 ---- if (argc) { if (argv[argc-1].a_type != A_FLOAT) { ! std::ostringstream os; ! atom_ostream(&argv[argc-1], os); ! post("pipe: %s: bad time delay value", os.str().data()); deltime = 0; } else deltime = argv[argc-1].a_float;