Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3582
Modified Files: Tag: impd_0_37 g_all_guis.c g_all_guis.h Log Message: new function sys_mgui()
Index: g_all_guis.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_all_guis.h,v retrieving revision 1.1.1.4.2.2.2.4 retrieving revision 1.1.1.4.2.2.2.5 diff -C2 -d -r1.1.1.4.2.2.2.4 -r1.1.1.4.2.2.2.5 *** g_all_guis.h 28 Mar 2004 04:18:18 -0000 1.1.1.4.2.2.2.4 --- g_all_guis.h 28 Mar 2004 06:25:07 -0000 1.1.1.4.2.2.2.5 *************** *** 83,87 **** #define IEM_GUI_DRAW_MODE_IO 6
- #define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER) #define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) --- 83,86 ---- *************** *** 95,100 **** #define IEM_GUI_OLD_SND_FLAG 1 #define IEM_GUI_OLD_RCV_FLAG 2 ! ! #define IEM_GUI_COLOR_EDITED 16711680 #define IEMGUI_MAX_NUM_LEN 32
--- 94,98 ---- #define IEM_GUI_OLD_SND_FLAG 1 #define IEM_GUI_OLD_RCV_FLAG 2 ! #define IEM_GUI_COLOR_EDITED 0xFF0000 #define IEMGUI_MAX_NUM_LEN 32
*************** *** 309,310 **** --- 307,309 ---- EXTERN int pd_scanargs(int argc, t_atom *argv, char *format, ...); EXTERN void pd_upload(t_gobj *self); + EXTERN void sys_mgui(t_iemgui *self, const char *sel, const char *fmt, ...);
Index: g_all_guis.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v retrieving revision 1.1.1.4.2.4.2.7 retrieving revision 1.1.1.4.2.4.2.8 diff -C2 -d -r1.1.1.4.2.4.2.7 -r1.1.1.4.2.4.2.8 *** g_all_guis.c 28 Mar 2004 04:18:18 -0000 1.1.1.4.2.4.2.7 --- g_all_guis.c 28 Mar 2004 06:25:07 -0000 1.1.1.4.2.4.2.8 *************** *** 652,656 **** return 1; err: ! post("WARNING: pd_scanargs failed; fmt=%s, i=%d",fmt,i); return 0; } --- 652,656 ---- return 1; err: ! //post("WARNING: pd_scanargs failed; fmt=%s, i=%d",fmt,i); return 0; } *************** *** 663,668 **** c->c_savefn(self,buf); binbuf_gettext(buf,&s,&n); ! sys_vgui("update_object %x {%s}\n",self,s); binbuf_free(buf); free(s); } --- 663,693 ---- c->c_savefn(self,buf); binbuf_gettext(buf,&s,&n); ! sys_vgui("update_object %x {%s}\n",(unsigned)self,s); binbuf_free(buf); free(s); } + + void sys_mgui(t_iemgui *self, const char *sel, const char *fmt, ...) { + char buf[4096]; + int i=0, n=4096; + t_class *c = self->x_obj.te_g.g_pd; + const char *cname = c->c_name->s_name; + t_canvas *canvas=glist_getcanvas(self->x_glist); + va_list val; + va_start(val,fmt); + i+=snprintf(buf,n-i,"%s_%s %x .x%x.c", cname, sel, (unsigned)self, (unsigned)canvas); + if (i>=n) goto over; + while (*fmt) { + switch (*fmt) { + case 'f': case 'd': i+=snprintf(buf,n-i," %f",va_arg(val,double)); break; + case 's': i+=snprintf(buf,n-i," "%s"",va_arg(val,t_symbol *)->s_name); break; + case 'S': i+=snprintf(buf,n-i," "%s"",va_arg(val,const char *)); break; + } + if (i>=n) goto over; + fmt++; + } + va_end(val); + return; + over: + post("sys_mgui: can't send: buffer overflow"); + }