Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7327
Modified Files: Tag: desiredata m_pd.h kernel.c Log Message: merged t_list and t_binbuf
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.40 retrieving revision 1.4.4.11.2.33.2.41 diff -C2 -d -r1.4.4.11.2.33.2.40 -r1.4.4.11.2.33.2.41 *** m_pd.h 9 Jan 2007 19:39:15 -0000 1.4.4.11.2.33.2.40 --- m_pd.h 9 Jan 2007 21:41:05 -0000 1.4.4.11.2.33.2.41 *************** *** 64,68 **** typedef struct _outlet t_outlet; typedef struct _inlet t_inlet; - typedef struct _binbuf t_binbuf; typedef struct _clock t_clock; typedef struct _glist t_glist, t_canvas; --- 64,67 ---- *************** *** 87,97 **** #define s_next next
! typedef struct _list { ! struct _atom *at; ! t_pd *thing; /* dummy (unused) */ ! struct _symbol *next; /* dummy (unused) */ size_t refcount; size_t n; /* size of at */ ! } t_list;
typedef struct _array t_array; /* g_canvas.h */ --- 86,100 ---- #define s_next next
! #ifdef PD_PLUSPLUS_FACE ! typedef struct t_list : t_pd { ! #else ! typedef struct t_list { ! t_pd *pd; ! #endif ! struct _atom *v; ! size_t capa; size_t refcount; size_t n; /* size of at */ ! } t_list, t_binbuf;
typedef struct _array t_array; /* g_canvas.h */
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.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 *** kernel.c 9 Jan 2007 21:19:53 -0000 1.1.2.35 --- kernel.c 9 Jan 2007 21:41:05 -0000 1.1.2.36 *************** *** 852,857 **** }
! /* this one checks that a pd is indeed a patchable object, and returns ! it, correctly typed, or zero if the check failed. */ t_object *pd_checkobject(t_pd *x) { return x->_class->patchable ? (t_object *)x : 0; --- 852,857 ---- }
! /* this one checks that a pd is indeed a patchable object, and returns it, ! correctly typed, or zero if the check failed. */ t_object *pd_checkobject(t_pd *x) { return x->_class->patchable ? (t_object *)x : 0; *************** *** 1627,1635 ****
static t_class *binbuf_class; - struct _binbuf : t_pd { - int n; - int capa; /* capacity: how much n may grow without reallocating */ - t_atom *v; - };
t_binbuf *binbuf_new(void) { --- 1627,1630 ---- *************** *** 1647,1651 **** }
! void binbuf_free(t_binbuf *x) {free(x->v); free(x);}
t_binbuf *binbuf_duplicate(t_binbuf *y) { --- 1642,1647 ---- }
! void binbuf_free(t_binbuf *x) {pd_free(x);} ! void binbuf_free2(t_binbuf *x) {free(x->v);}
t_binbuf *binbuf_duplicate(t_binbuf *y) { *************** *** 1863,1867 **** binbuf_add(z, y->n, y->v); t_atom *ap = z->v; ! for (int i=0; i < z->n; i++, ap++) { char tbuf[MAXPDSTRING]; switch (ap->a_type) { --- 1859,1863 ---- binbuf_add(z, y->n, y->v); t_atom *ap = z->v; ! for (size_t i=0; i < z->n; i++, ap++) { char tbuf[MAXPDSTRING]; switch (ap->a_type) { *************** *** 1932,1937 ****
void binbuf_print(t_binbuf *x) { ! int i, startedpost = 0, newline = 1; ! for (i = 0; i < x->n; i++) { if (newline) { if (startedpost) endpost(); --- 1928,1933 ----
void binbuf_print(t_binbuf *x) { ! int startedpost = 0, newline = 1; ! for (size_t i=0; i < x->n; i++) { if (newline) { if (startedpost) endpost(); *************** *** 2499,2513 **** }
! /* function to support searching */ int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) { ! int indexin, nmatched; ! for (indexin = 0; indexin <= inbuf->n - searchbuf->n; indexin++) { ! for (nmatched = 0; nmatched < searchbuf->n; nmatched++) { t_atom *a1 = &inbuf->v[indexin + nmatched], *a2 = &searchbuf->v[nmatched]; if (a1->a_type != a2->a_type || ! a1->a_type == A_SYMBOL && a1->a_symbol != a2->a_symbol || ! a1->a_type == A_FLOAT && a1->a_float != a2->a_float || ! a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index || ! a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch; } return 1; --- 2495,2508 ---- }
! /* function to support searching */ int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) { ! for (size_t indexin = 0; indexin <= inbuf->n - searchbuf->n; indexin++) { ! for (size_t nmatched = 0; nmatched < searchbuf->n; nmatched++) { t_atom *a1 = &inbuf->v[indexin + nmatched], *a2 = &searchbuf->v[nmatched]; if (a1->a_type != a2->a_type || ! a1->a_type == A_SYMBOL && a1->a_symbol != a2->a_symbol || ! a1->a_type == A_FLOAT && a1->a_float != a2->a_float || ! a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index || ! a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch; } return 1; *************** *** 2568,2572 **** class_addanything(bindlist_class, (t_method)bindlist_anything); binbuf_class = class_new(gensym("__alist"), (t_newmethod)binbuf_new, ! (t_method)binbuf_free, sizeof(t_binbuf), CLASS_PD, A_GIMME, 0); wire_class = class_new(gensym("__wire"), (t_newmethod)wire_new, (t_method)wire_free, sizeof(t_wire), CLASS_GOBJ, A_GIMME, 0); --- 2563,2567 ---- class_addanything(bindlist_class, (t_method)bindlist_anything); binbuf_class = class_new(gensym("__alist"), (t_newmethod)binbuf_new, ! (t_method)binbuf_free2, sizeof(t_binbuf), CLASS_PD, A_GIMME, 0); wire_class = class_new(gensym("__wire"), (t_newmethod)wire_new, (t_method)wire_free, sizeof(t_wire), CLASS_GOBJ, A_GIMME, 0);