Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28977
Modified Files: Tag: devel_0_39 m_imp.h m_class.c Log Message: adding class_setfields
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.3.4.7.2.1 retrieving revision 1.3.4.7.2.2 diff -C2 -d -r1.3.4.7.2.1 -r1.3.4.7.2.2 *** m_class.c 5 Oct 2005 06:12:06 -0000 1.3.4.7.2.1 --- m_class.c 6 Oct 2005 06:58:45 -0000 1.3.4.7.2.2 *************** *** 234,237 **** --- 234,239 ---- c->c_firstin = ((flags & CLASS_NOINLET) == 0); c->c_firsttip = gensym("?"); + c->c_fields = malloc(sizeof(t_symbol *)*31); + c->c_nfields = 0; c->c_patchable = (typeflag == CLASS_PATCHABLE); c->c_gobj = (typeflag >= CLASS_GOBJ); *************** *** 927,928 **** --- 929,945 ---- x->c_firsttip = s; } + + /* ---------------------------------------------------------------- */ + + /* must be called only once */ + void class_setfieldnames(t_class *x, const char *s) { + char foo[64]; + while (*s) { + int i = strchr(s,' '); + if (i<0) return; + memcpy(foo,s,i); + foo[i]=0; + x->c_fields[x->c_nfields++] = gensym(foo); + s=s+i+1; + } + }
Index: m_imp.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_imp.h,v retrieving revision 1.3.4.1.2.1 retrieving revision 1.3.4.1.2.2 diff -C2 -d -r1.3.4.1.2.1 -r1.3.4.1.2.2 *** m_imp.h 21 Aug 2005 11:28:24 -0000 1.3.4.1.2.1 --- m_imp.h 6 Oct 2005 06:58:45 -0000 1.3.4.1.2.2 *************** *** 53,57 **** char c_firstin; /* if patchable, true if draw first inlet */ char c_drawcommand; /* a drawing command for a template */ ! t_symbol* c_firsttip; };
--- 53,59 ---- char c_firstin; /* if patchable, true if draw first inlet */ char c_drawcommand; /* a drawing command for a template */ ! t_symbol *c_firsttip; ! t_symbol **c_fields; /* names of fields aka attributes. */ ! int c_nfields; /* ... and how many of them */ };