Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30145
Modified Files: Tag: desiredata kernel.c desire.c builtins.c Log Message: actual use of symsprintf
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.50 retrieving revision 1.1.2.51 diff -C2 -d -r1.1.2.50 -r1.1.2.51 *** kernel.c 11 Jul 2007 19:50:18 -0000 1.1.2.50 --- kernel.c 11 Jul 2007 19:56:52 -0000 1.1.2.51 *************** *** 1319,1323 **** t_symbol *gensym( const char *s) {return dogensym(s,strlen(s),0);} t_symbol *gensym2(const char *s, size_t n) {return dogensym(s,n,0);} ! t_symbol *symsprintf(const char *s, ...) { char *buf; va_list args; --- 1319,1323 ---- t_symbol *gensym( const char *s) {return dogensym(s,strlen(s),0);} t_symbol *gensym2(const char *s, size_t n) {return dogensym(s,n,0);} ! extern "C" t_symbol *symsprintf(const char *s, ...) { char *buf; va_list args;
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.154 retrieving revision 1.1.2.217.2.155 diff -C2 -d -r1.1.2.217.2.154 -r1.1.2.217.2.155 *** desire.c 11 Jul 2007 19:39:45 -0000 1.1.2.217.2.154 --- desire.c 11 Jul 2007 19:56:52 -0000 1.1.2.217.2.155 *************** *** 593,605 **** float px1, float py1, float px2, float py2) { static int gcount = 0; - int zz; int menu = 0; t_canvas *x = canvas_new2(); if (!*sym->name) { ! char buf[40]; ! sprintf(buf, "graph%d", ++gcount); ! sym = gensym(buf); menu = 1; ! } else if (!strncmp(sym->name,"graph",5) && (zz = atoi(sym->name+5)) > gcount) gcount = zz; /* in 0.34 and earlier, the pixel rectangle and the y bounds were reversed; this would behave the same, except that the dialog window would be confusing. The "correct" way is to have "py1" be the value --- 593,605 ---- float px1, float py1, float px2, float py2) { static int gcount = 0; int menu = 0; t_canvas *x = canvas_new2(); if (!*sym->name) { ! sym = symsprintf("graph%d", ++gcount); menu = 1; ! } else if (!strncmp(sym->name,"graph",5)) { ! int zz = atoi(sym->name+5); ! if (zz>gcount) gcount = zz; ! } /* in 0.34 and earlier, the pixel rectangle and the y bounds were reversed; this would behave the same, except that the dialog window would be confusing. The "correct" way is to have "py1" be the value *************** *** 670,678 **** }
! t_symbol *canvas_makebindsym(t_symbol *s) { ! char buf[MAXPDSTRING]; ! sprintf(buf,"pd-%s",s->name); ! return gensym(buf); ! }
static void canvas_vis(t_canvas *x, t_floatarg f); --- 670,674 ---- }
! t_symbol *canvas_makebindsym(t_symbol *s) {return symsprintf("pd-%s",s->name);}
static void canvas_vis(t_canvas *x, t_floatarg f); *************** *** 878,886 **** t_atom a[9]; t_canvas *z = canvas_getcurrent(); ! if (s == &s_) { ! char tabname[255]; ! sprintf(tabname, "table%d", tabcount++); ! s = gensym(tabname); ! } if (f <= 1) f = 100; SETFLOAT(a, 0); --- 874,878 ---- t_atom a[9]; t_canvas *z = canvas_getcurrent(); ! if (s == &s_) s = symsprintf("table%d", tabcount++); if (f <= 1) f = 100; SETFLOAT(a, 0); *************** *** 4689,4696 **** #define DRAWNUMBER_BUFSIZE 80 static void drawnumber_sprintf(t_drawnumber *x, char *buf, t_atom *ap) { - int nchars; strncpy(buf, x->label->name, DRAWNUMBER_BUFSIZE); buf[DRAWNUMBER_BUFSIZE - 1] = 0; ! nchars = strlen(buf); atom_string(ap, buf + nchars, DRAWNUMBER_BUFSIZE - nchars); } --- 4681,4687 ---- #define DRAWNUMBER_BUFSIZE 80 static void drawnumber_sprintf(t_drawnumber *x, char *buf, t_atom *ap) { strncpy(buf, x->label->name, DRAWNUMBER_BUFSIZE); buf[DRAWNUMBER_BUFSIZE - 1] = 0; ! int nchars = strlen(buf); atom_string(ap, buf + nchars, DRAWNUMBER_BUFSIZE - nchars); } *************** *** 6247,6255 **** }
! t_symbol *pd_makebindsym(t_pd *x) { ! char buf[42]; ! sprintf(buf,".x%lx",(long)x); ! return gensym(buf); ! }
t_iemgui *iemgui_new(t_class *qlass) { --- 6238,6242 ---- }
! t_symbol *pd_makebindsym(t_pd *x) {return symsprintf(".x%lx",(long)x);}
t_iemgui *iemgui_new(t_class *qlass) {
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.27 retrieving revision 1.1.2.28 diff -C2 -d -r1.1.2.27 -r1.1.2.28 *** builtins.c 9 Jul 2007 19:56:28 -0000 1.1.2.27 --- builtins.c 11 Jul 2007 19:56:55 -0000 1.1.2.28 *************** *** 98,105 **** }; static void *openpanel_new(t_symbol *s) { - char buf[50]; t_openpanel *x = (t_openpanel *)pd_new(openpanel_class); ! sprintf(buf, "d%lx", (t_int)x); ! x->s = gensym(buf); x->path = s; pd_bind(x,x->s); --- 98,103 ---- }; static void *openpanel_new(t_symbol *s) { t_openpanel *x = (t_openpanel *)pd_new(openpanel_class); ! x->s = symsprintf("d%lx",(t_int)x); x->path = s; pd_bind(x,x->s); *************** *** 131,138 **** }; static void *savepanel_new(t_symbol*s) { - char buf[50]; t_savepanel *x = (t_savepanel *)pd_new(savepanel_class); ! sprintf(buf, "d%lx", (t_int)x); ! x->s = gensym(buf); x->path=s; pd_bind(x, x->s); --- 129,134 ---- }; static void *savepanel_new(t_symbol*s) { t_savepanel *x = (t_savepanel *)pd_new(savepanel_class); ! x->s = symsprintf("d%lx",(t_int)x); x->path=s; pd_bind(x, x->s); *************** *** 1899,1909 ****
/* doesn't do any typechecking or even counting the % signs properly */ ! static void makefilename_float(t_makefilename *x, t_floatarg f) { ! char *buf; asprintf(&buf, x->format->name, (int)f); outlet_symbol(x->outlet, gensym(buf)); free(buf); ! } ! static void makefilename_symbol(t_makefilename *x, t_symbol *s) { ! char *buf; asprintf(&buf, x->format->name, s->name); outlet_symbol(x->outlet, gensym(buf)); free(buf); ! } ! static void makefilename_set(t_makefilename *x, t_symbol *s) {x->format = s;}
--- 1895,1900 ----
/* 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,symsprintf(x->format->name,(int)f));} ! static void makefilename_symbol(t_makefilename *x, t_symbol *s) {outlet_symbol(x->outlet,symsprintf(x->format->name,s->name));} static void makefilename_set(t_makefilename *x, t_symbol *s) {x->format = s;}
*************** *** 3122,3125 **** --- 3113,3117 ---- t_unparse *x = (t_unparse *)pd_new(unparse_class); outlet_new(x,&s_symbol); + return x; } void unparse_list (t_unparse *x, t_symbol *s, int argc, t_atom *argv) {