[PD-cvs] pd/src desire.c,1.1.2.121,1.1.2.122
Mathieu Bouchard
matju at users.sourceforge.net
Mon Aug 21 07:45:11 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5400
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
.
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.121
retrieving revision 1.1.2.122
diff -C2 -d -r1.1.2.121 -r1.1.2.122
*** desire.c 21 Aug 2006 05:34:37 -0000 1.1.2.121
--- desire.c 21 Aug 2006 05:45:08 -0000 1.1.2.122
***************
*** 7672,7691 ****
/* create a gstub which is "owned" by a glist (gl) or an array ("a"). */
!
! t_gstub *gstub_new(t_glist *gl, t_array *a)
! {
t_gstub *gs = (t_gstub *)t_getbytes(sizeof(*gs));
! if (gl)
! {
gs->gs_which = GP_GLIST;
gs->gs_un.gs_glist = gl;
! }
! else
! {
gs->gs_which = GP_ARRAY;
gs->gs_un.gs_array = a;
}
gs->gs_refcount = 0;
! return (gs);
}
--- 7672,7686 ----
/* create a gstub which is "owned" by a glist (gl) or an array ("a"). */
! t_gstub *gstub_new(t_glist *gl, t_array *a) {
t_gstub *gs = (t_gstub *)t_getbytes(sizeof(*gs));
! if (gl) {
gs->gs_which = GP_GLIST;
gs->gs_un.gs_glist = gl;
! } else {
gs->gs_which = GP_ARRAY;
gs->gs_un.gs_array = a;
}
gs->gs_refcount = 0;
! return gs;
}
***************
*** 7694,7703 ****
whenever a gpointer is unset from pointing here. If the owner is
gone and the refcount goes to zero, we can free the gstub safely. */
!
! static void gstub_dis(t_gstub *gs)
! {
int refcount = --gs->gs_refcount;
! if ((!refcount) && gs->gs_which == GP_NONE)
! t_freebytes(gs, sizeof (*gs));
else if (refcount < 0) bug("gstub_dis");
}
--- 7689,7695 ----
whenever a gpointer is unset from pointing here. If the owner is
gone and the refcount goes to zero, we can free the gstub safely. */
! static void gstub_dis(t_gstub *gs) {
int refcount = --gs->gs_refcount;
! if ((!refcount) && gs->gs_which == GP_NONE) t_freebytes(gs, sizeof (*gs));
else if (refcount < 0) bug("gstub_dis");
}
***************
*** 7706,7712 ****
being deleted. If no gpointers are pointing here, we can free the gstub;
otherwise we wait for the last gstub_dis() to free it. */
!
! void gstub_cutoff(t_gstub *gs)
! {
gs->gs_which = GP_NONE;
if (gs->gs_refcount < 0) bug("gstub_cutoff");
--- 7698,7702 ----
being deleted. If no gpointers are pointing here, we can free the gstub;
otherwise we wait for the last gstub_dis() to free it. */
! void gstub_cutoff(t_gstub *gs) {
gs->gs_which = GP_NONE;
if (gs->gs_refcount < 0) bug("gstub_cutoff");
***************
*** 7718,7781 ****
the object hasn't disappeared since this pointer was generated.
Unless "headok" is set, the routine also fails for the head of a list. */
!
! int gpointer_check(const t_gpointer *gp, int headok)
! {
t_gstub *gs = gp->gp_stub;
if (!gs) return (0);
! if (gs->gs_which == GP_ARRAY)
! {
! if (gs->gs_un.gs_array->a_valid != gp->gp_valid) return (0);
! else return (1);
! }
! else if (gs->gs_which == GP_GLIST)
! {
! if (!headok && !gp->gp_un.gp_scalar) return (0);
! else if (gs->gs_un.gs_glist->gl_valid != gp->gp_valid) return (0);
! else return (1);
! }
! else return (0);
}
/* get the template for the object pointer to. Assumes we've already checked
freshness. Returns 0 if head of list. */
!
! static t_symbol *gpointer_gettemplatesym(const t_gpointer *gp)
! {
t_gstub *gs = gp->gp_stub;
! if (gs->gs_which == GP_GLIST)
! {
t_scalar *sc = gp->gp_un.gp_scalar;
! if (sc)
! return (sc->sc_template);
! else return (0);
! }
! else
! {
t_array *a = gs->gs_un.gs_array;
! return (a->a_templatesym);
}
}
! /* copy a pointer to another, assuming the second one hasn't yet been
! initialized. New gpointers should be initialized either by this
! routine or by gpointer_init below. */
! void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto)
! {
*gpto = *gpfrom;
! if (gpto->gp_stub)
! gpto->gp_stub->gs_refcount++;
else bug("gpointer_copy");
}
! /* clear a gpointer that was previously set, releasing the associted
! gstub if this was the last reference to it. */
! void gpointer_unset(t_gpointer *gp)
! {
t_gstub *gs = gp->gp_stub;
if (gs) {gstub_dis(gs); gp->gp_stub = 0;}
}
! void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x)
! {
t_gstub *gs = gp->gp_stub;
if (gs) gstub_dis(gs);
--- 7708,7752 ----
the object hasn't disappeared since this pointer was generated.
Unless "headok" is set, the routine also fails for the head of a list. */
! int gpointer_check(const t_gpointer *gp, int headok) {
t_gstub *gs = gp->gp_stub;
if (!gs) return (0);
! if (gs->gs_which == GP_ARRAY) return gs->gs_un.gs_array->a_valid == gp->gp_valid;
! if (gs->gs_which == GP_GLIST) {
! if (!headok && !gp->gp_un.gp_scalar) return 0;
! if (gs->gs_un.gs_glist->gl_valid != gp->gp_valid) return 0;
! return 1;
! } else return 0;
}
/* get the template for the object pointer to. Assumes we've already checked
freshness. Returns 0 if head of list. */
! static t_symbol *gpointer_gettemplatesym(const t_gpointer *gp) {
t_gstub *gs = gp->gp_stub;
! if (gs->gs_which == GP_GLIST) {
t_scalar *sc = gp->gp_un.gp_scalar;
! return sc ? sc->sc_template : 0;
! } else {
t_array *a = gs->gs_un.gs_array;
! return a->a_templatesym;
}
}
! /* copy a pointer to another, assuming the second one hasn't yet been
! initialized. New gpointers should be initialized either by this
! routine or by gpointer_init below. */
! void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) {
*gpto = *gpfrom;
! if (gpto->gp_stub) gpto->gp_stub->gs_refcount++;
else bug("gpointer_copy");
}
! /* clear a gpointer that was previously set, releasing the associted
! gstub if this was the last reference to it. */
! void gpointer_unset(t_gpointer *gp) {
t_gstub *gs = gp->gp_stub;
if (gs) {gstub_dis(gs); gp->gp_stub = 0;}
}
! void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) {
t_gstub *gs = gp->gp_stub;
if (gs) gstub_dis(gs);
***************
*** 7786,7791 ****
}
! static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w)
! {
t_gstub *gs = gp->gp_stub;
if (gs) gstub_dis(gs);
--- 7757,7761 ----
}
! static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) {
t_gstub *gs = gp->gp_stub;
if (gs) gstub_dis(gs);
***************
*** 7796,7801 ****
}
! void gpointer_init(t_gpointer *gp)
! {
gp->gp_stub = 0;
gp->gp_valid = 0;
--- 7766,7770 ----
}
! void gpointer_init(t_gpointer *gp) {
gp->gp_stub = 0;
gp->gp_valid = 0;
***************
*** 7807,7818 ****
static t_class *ptrobj_class;
! typedef struct
! {
t_symbol *to_type;
t_outlet *to_outlet;
} t_typedout;
! typedef struct _ptrobj
! {
t_object x_obj;
t_gpointer x_gp;
--- 7776,7785 ----
static t_class *ptrobj_class;
! typedef struct {
t_symbol *to_type;
t_outlet *to_outlet;
} t_typedout;
! typedef struct _ptrobj {
t_object x_obj;
t_gpointer x_gp;
***************
*** 7823,7828 ****
} t_ptrobj;
! static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv)
! {
t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class);
t_typedout *to;
--- 7790,7794 ----
} t_ptrobj;
! static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv) {
t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class);
t_typedout *to;
***************
*** 7831,7836 ****
x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to));
x->x_ntypedout = n = argc;
! for (; n--; to++)
! {
to->to_outlet = outlet_new(&x->x_obj, &s_pointer);
to->to_type = canvas_makebindsym(atom_getsymbol(argv++));
--- 7797,7801 ----
x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to));
x->x_ntypedout = n = argc;
! for (; n--; to++) {
to->to_outlet = outlet_new(&x->x_obj, &s_pointer);
to->to_type = canvas_makebindsym(atom_getsymbol(argv++));
***************
*** 7839,7847 ****
x->x_bangout = outlet_new(&x->x_obj, &s_bang);
pointerinlet_new(&x->x_obj, &x->x_gp);
! return (x);
}
! static void ptrobj_traverse(t_ptrobj *x, t_symbol *s)
! {
t_glist *glist = (t_glist *)pd_findbyclass(s, canvas_class);
if (glist) gpointer_setglist(&x->x_gp, glist, 0);
--- 7804,7811 ----
x->x_bangout = outlet_new(&x->x_obj, &s_bang);
pointerinlet_new(&x->x_obj, &x->x_gp);
! return x;
}
! static void ptrobj_traverse(t_ptrobj *x, t_symbol *s) {
t_glist *glist = (t_glist *)pd_findbyclass(s, canvas_class);
if (glist) gpointer_setglist(&x->x_gp, glist, 0);
***************
*** 7849,7854 ****
}
! static void ptrobj_vnext(t_ptrobj *x, float f)
! {
t_gobj *gobj;
t_gpointer *gp = &x->x_gp;
--- 7813,7817 ----
}
! static void ptrobj_vnext(t_ptrobj *x, float f) {
t_gobj *gobj;
t_gpointer *gp = &x->x_gp;
***************
*** 7887,7892 ****
static void ptrobj_next(t_ptrobj *x) {ptrobj_vnext(x, 0);}
! static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv)
! {
t_glist *glist;
t_pd *canvas;
--- 7850,7854 ----
static void ptrobj_next(t_ptrobj *x) {ptrobj_vnext(x, 0);}
! static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) {
t_glist *glist;
t_pd *canvas;
***************
*** 7907,7912 ****
}
! static void ptrobj_bang(t_ptrobj *x)
! {
t_symbol *templatesym;
int n;
--- 7869,7873 ----
}
! static void ptrobj_bang(t_ptrobj *x) {
t_symbol *templatesym;
int n;
***************
*** 7921,7926 ****
! static void ptrobj_pointer(t_ptrobj *x, t_gpointer *gp)
! {
gpointer_unset(&x->x_gp);
gpointer_copy(gp, &x->x_gp);
--- 7882,7886 ----
! static void ptrobj_pointer(t_ptrobj *x, t_gpointer *gp) {
gpointer_unset(&x->x_gp);
gpointer_copy(gp, &x->x_gp);
***************
*** 7929,7934 ****
! static void ptrobj_rewind(t_ptrobj *x)
! {
t_glist *glist;
t_gstub *gs;
--- 7889,7893 ----
! static void ptrobj_rewind(t_ptrobj *x) {
t_glist *glist;
t_gstub *gs;
***************
*** 7936,7961 ****
gs = x->x_gp.gp_stub;
if (gs->gs_which != GP_GLIST) {pd_error(x, "pointer_rewind: sorry, unavailable for arrays"); return;}
! glist = gs->gs_un.gs_glist;
gpointer_setglist(&x->x_gp, glist, 0);
ptrobj_bang(x);
}
! static void ptrobj_free(t_ptrobj *x)
! {
freebytes(x->x_typedout, x->x_ntypedout * sizeof (*x->x_typedout));
gpointer_unset(&x->x_gp);
}
! static void ptrobj_setup(void)
! {
t_class *c = ptrobj_class = class_new(gensym("pointer"), (t_newmethod)ptrobj_new,
(t_method)ptrobj_free, sizeof(t_ptrobj), 0, A_GIMME, 0);
! class_addmethod3(c, ptrobj_traverse,"traverse", "s");
! class_addmethod3(c, ptrobj_next,"next","");
class_addmethod3(c, ptrobj_vnext,"vnext","F");
! class_addmethod3(c, ptrobj_sendwindow,"send-window","*");
class_addmethod3(c, ptrobj_rewind, "rewind","");
! class_addpointer(c, ptrobj_pointer);
! class_addbang(c, ptrobj_bang);
}
--- 7895,7918 ----
gs = x->x_gp.gp_stub;
if (gs->gs_which != GP_GLIST) {pd_error(x, "pointer_rewind: sorry, unavailable for arrays"); return;}
! glist = gs->gs_un.gs_glist;
gpointer_setglist(&x->x_gp, glist, 0);
ptrobj_bang(x);
}
! static void ptrobj_free(t_ptrobj *x) {
freebytes(x->x_typedout, x->x_ntypedout * sizeof (*x->x_typedout));
gpointer_unset(&x->x_gp);
}
! static void ptrobj_setup(void) {
t_class *c = ptrobj_class = class_new(gensym("pointer"), (t_newmethod)ptrobj_new,
(t_method)ptrobj_free, sizeof(t_ptrobj), 0, A_GIMME, 0);
! class_addmethod3(c, ptrobj_traverse,"traverse", "s");
! class_addmethod3(c, ptrobj_next,"next","");
class_addmethod3(c, ptrobj_vnext,"vnext","F");
! class_addmethod3(c, ptrobj_sendwindow,"send-window","*");
class_addmethod3(c, ptrobj_rewind, "rewind","");
! class_addpointer(c, ptrobj_pointer);
! class_addbang(c, ptrobj_bang);
}
***************
*** 7964,7975 ****
static t_class *get_class;
! typedef struct _getvariable
! {
t_symbol *gv_sym;
t_outlet *gv_outlet;
} t_getvariable;
! typedef struct _get
! {
t_object x_obj;
t_symbol *x_templatesym;
--- 7921,7930 ----
static t_class *get_class;
! typedef struct _getvariable {
t_symbol *gv_sym;
t_outlet *gv_outlet;
} t_getvariable;
! typedef struct _get {
t_object x_obj;
t_symbol *x_templatesym;
***************
*** 7978,7983 ****
} t_get;
! static void *get_new(t_symbol *why, int argc, t_atom *argv)
! {
t_get *x = (t_get *)pd_new(get_class);
int i;
--- 7933,7937 ----
} t_get;
! static void *get_new(t_symbol *why, int argc, t_atom *argv) {
t_get *x = (t_get *)pd_new(get_class);
int i;
***************
*** 7985,8009 ****
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
if (argc) argc--, argv++;
! x->x_variables
! = (t_getvariable *)getbytes(argc * sizeof (*x->x_variables));
x->x_nout = argc;
! for (i = 0, sp = x->x_variables; i < argc; i++, sp++)
! {
sp->gv_sym = atom_getsymbolarg(i, argc, argv);
sp->gv_outlet = outlet_new(&x->x_obj, 0);
! /* LATER connect with the template and set the outlet's type
! correctly. We can't yet guarantee that the template is there
! before we hit this routine. */
}
! return (x);
}
! static void get_pointer(t_get *x, t_gpointer *gp)
! {
int nitems = x->x_nout, i;
t_symbol *templatesym = x->x_templatesym;
t_template *template = template_findbyname(templatesym);
t_gstub *gs = gp->gp_stub;
! t_word *vec;
t_getvariable *vp;
TEMPLATE_CHECK(x,)
--- 7939,7960 ----
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
if (argc) argc--, argv++;
! x->x_variables = (t_getvariable *)getbytes(argc * sizeof (*x->x_variables));
x->x_nout = argc;
! for (i = 0, sp = x->x_variables; i < argc; i++, sp++) {
sp->gv_sym = atom_getsymbolarg(i, argc, argv);
sp->gv_outlet = outlet_new(&x->x_obj, 0);
! /* LATER connect with the template and set the outlet's type
! correctly. We can't yet guarantee that the template is there
! before we hit this routine. */
}
! return x;
}
! static void get_pointer(t_get *x, t_gpointer *gp) {
int nitems = x->x_nout, i;
t_symbol *templatesym = x->x_templatesym;
t_template *template = template_findbyname(templatesym);
t_gstub *gs = gp->gp_stub;
! t_word *vec;
t_getvariable *vp;
TEMPLATE_CHECK(x,)
***************
*** 8023,8033 ****
}
! static void get_free(t_get *x)
! {
freebytes(x->x_variables, x->x_nout * sizeof (*x->x_variables));
}
! static void get_setup(void)
! {
get_class = class_new(gensym("get"), (t_newmethod)get_new,
(t_method)get_free, sizeof(t_get), 0, A_GIMME, 0);
--- 7974,7982 ----
}
! static void get_free(t_get *x) {
freebytes(x->x_variables, x->x_nout * sizeof (*x->x_variables));
}
! static void get_setup(void) {
get_class = class_new(gensym("get"), (t_newmethod)get_new,
(t_method)get_free, sizeof(t_get), 0, A_GIMME, 0);
***************
*** 8039,8050 ****
static t_class *set_class;
! typedef struct _setvariable
! {
t_symbol *gv_sym;
union word gv_w;
} t_setvariable;
! typedef struct _set
! {
t_object x_obj;
t_gpointer x_gp;
--- 7988,7997 ----
static t_class *set_class;
! typedef struct _setvariable {
t_symbol *gv_sym;
union word gv_w;
} t_setvariable;
! typedef struct _set {
t_object x_obj;
t_gpointer x_gp;
***************
*** 8055,8066 ****
} t_set;
! static void *set_new(t_symbol *why, int argc, t_atom *argv)
! {
t_set *x = (t_set *)pd_new(set_class);
int i;
t_setvariable *sp;
! if (argc && (argv[0].a_type == A_SYMBOL) &&
! !strcmp(argv[0].a_w.w_symbol->s_name, "-symbol"))
! {
x->x_issymbol = 1;
argc--;
--- 8002,8010 ----
} t_set;
! static void *set_new(t_symbol *why, int argc, t_atom *argv) {
t_set *x = (t_set *)pd_new(set_class);
int i;
t_setvariable *sp;
! if (argc && (argv[0].a_type == A_SYMBOL) && !strcmp(argv[0].a_w.w_symbol->s_name, "-symbol")) {
x->x_issymbol = 1;
argc--;
***************
*** 8070,8089 ****
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
if (argc) argc--, argv++;
! x->x_variables
! = (t_setvariable *)getbytes(argc * sizeof (*x->x_variables));
x->x_nin = argc;
! if (argc)
! {
! for (i = 0, sp = x->x_variables; i < argc; i++, sp++)
! {
sp->gv_sym = atom_getsymbolarg(i, argc, argv);
! if (x->x_issymbol)
! sp->gv_w.w_symbol = &s_;
else sp->gv_w.w_float = 0;
! if (i)
! {
! if (x->x_issymbol)
! symbolinlet_new(&x->x_obj, &sp->gv_w.w_symbol);
! else floatinlet_new(&x->x_obj, &sp->gv_w.w_float);
}
}
--- 8014,8027 ----
x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
if (argc) argc--, argv++;
! x->x_variables = (t_setvariable *)getbytes(argc * sizeof (*x->x_variables));
x->x_nin = argc;
! if (argc) {
! for (i = 0, sp = x->x_variables; i < argc; i++, sp++) {
sp->gv_sym = atom_getsymbolarg(i, argc, argv);
! if (x->x_issymbol) sp->gv_w.w_symbol = &s_;
else sp->gv_w.w_float = 0;
! if (i) {
! if (x->x_issymbol) symbolinlet_new(&x->x_obj, &sp->gv_w.w_symbol);
! else floatinlet_new(&x->x_obj, &sp->gv_w.w_float);
}
}
***************
*** 8094,8099 ****
}
! static void set_bang(t_set *x)
! {
int nitems = x->x_nin, i;
t_symbol *templatesym = x->x_templatesym;
--- 8032,8036 ----
}
! static void set_bang(t_set *x) {
int nitems = x->x_nin, i;
t_symbol *templatesym = x->x_templatesym;
***************
*** 8136,8152 ****
}
! static void set_free(t_set *x)
! {
freebytes(x->x_variables, x->x_nin * sizeof (*x->x_variables));
gpointer_unset(&x->x_gp);
}
! static void set_setup(void)
! {
set_class = class_new(gensym("set"), (t_newmethod)set_new,
(t_method)set_free, sizeof(t_set), 0, A_GIMME, 0);
! class_addfloat(set_class, set_float);
! class_addsymbol(set_class, set_symbol);
! class_addbang(set_class, set_bang);
}
--- 8073,8087 ----
}
! static void set_free(t_set *x) {
freebytes(x->x_variables, x->x_nin * sizeof (*x->x_variables));
gpointer_unset(&x->x_gp);
}
! static void set_setup(void) {
set_class = class_new(gensym("set"), (t_newmethod)set_new,
(t_method)set_free, sizeof(t_set), 0, A_GIMME, 0);
! class_addfloat(set_class, set_float);
! class_addsymbol(set_class, set_symbol);
! class_addbang(set_class, set_bang);
}
***************
*** 8155,8160 ****
static t_class *elem_class;
! typedef struct _elem
! {
t_object x_obj;
t_symbol *x_templatesym;
--- 8090,8094 ----
static t_class *elem_class;
! typedef struct _elem {
t_object x_obj;
t_symbol *x_templatesym;
***************
*** 8164,8169 ****
} t_elem;
! static void *elem_new(t_symbol *templatesym, t_symbol *fieldsym)
! {
t_elem *x = (t_elem *)pd_new(elem_class);
x->x_templatesym = canvas_makebindsym(templatesym);
--- 8098,8102 ----
} t_elem;
! static void *elem_new(t_symbol *templatesym, t_symbol *fieldsym) {
t_elem *x = (t_elem *)pd_new(elem_class);
x->x_templatesym = canvas_makebindsym(templatesym);
***************
*** 8173,8184 ****
pointerinlet_new(&x->x_obj, &x->x_gparent);
outlet_new(&x->x_obj, &s_pointer);
! return (x);
}
! static void elem_float(t_elem *x, t_float f)
! {
int indx = f, nitems, onset;
! t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym,
! *elemtemplatesym;
t_template *template = template_findbyname(templatesym);
t_template *elemtemplate;
--- 8106,8115 ----
pointerinlet_new(&x->x_obj, &x->x_gparent);
outlet_new(&x->x_obj, &s_pointer);
! return x;
}
! static void elem_float(t_elem *x, t_float f) {
int indx = f, nitems, onset;
! t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym, *elemtemplatesym;
t_template *template = template_findbyname(templatesym);
t_template *elemtemplate;
***************
*** 8187,8191 ****
t_array *array;
int elemsize, type;
!
if (!gpointer_check(gparent, 0)) {pd_error(x, "element: empty pointer"); return;}
if (gpointer_gettemplatesym(gparent) != x->x_templatesym)
--- 8118,8122 ----
t_array *array;
int elemsize, type;
!
if (!gpointer_check(gparent, 0)) {pd_error(x, "element: empty pointer"); return;}
if (gpointer_gettemplatesym(gparent) != x->x_templatesym)
***************
*** 8819,8824 ****
{binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, argc, argv);}
! static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {
binbuf_clear(x->m_text.te_binbuf);
binbuf_add(x->m_text.te_binbuf, argc, argv);
--- 8750,8754 ----
{binbuf_eval(x->m_text.te_binbuf, &x->m_mresp.mr_pd, argc, argv);}
! static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv) {
binbuf_clear(x->m_text.te_binbuf);
binbuf_add(x->m_text.te_binbuf, argc, argv);
***************
*** 8826,8837 ****
}
! static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {
binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text);
}
! static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {
binbuf_add(x->m_text.te_binbuf, argc, argv);
binbuf_addsemi(x->m_text.te_binbuf);
--- 8756,8765 ----
}
! static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv) {
binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text);
}
! static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) {
binbuf_add(x->m_text.te_binbuf, argc, argv);
binbuf_addsemi(x->m_text.te_binbuf);
***************
*** 8839,8844 ****
}
! static void message_addcomma(t_message *x)
! {
t_atom a;
SETCOMMA(&a);
--- 8767,8771 ----
}
! static void message_addcomma(t_message *x) {
t_atom a;
SETCOMMA(&a);
***************
*** 8847,8857 ****
}
! static void message_addsemi(t_message *x)
! {
message_add(x, 0, 0, 0);
}
! static void message_adddollar(t_message *x, t_floatarg f)
! {
t_atom a;
int n = f;
--- 8774,8782 ----
}
! static void message_addsemi(t_message *x) {
message_add(x, 0, 0, 0);
}
! static void message_adddollar(t_message *x, t_floatarg f) {
t_atom a;
int n = f;
***************
*** 8863,8868 ****
}
! static void message_adddollsym(t_message *x, t_symbol *s)
! {
t_atom a;
SETDOLLSYM(&a, s);
--- 8788,8792 ----
}
! static void message_adddollsym(t_message *x, t_symbol *s) {
t_atom a;
SETDOLLSYM(&a, s);
***************
*** 8871,8876 ****
}
! void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
! {
t_message *x = (t_message *)pd_new(message_class);
x->m_mresp.mr_pd = mresp_class;
--- 8795,8799 ----
}
! void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) {
t_message *x = (t_message *)pd_new(message_class);
x->m_mresp.mr_pd = mresp_class;
***************
*** 8880,8885 ****
x->m_text.te_binbuf = binbuf_new();
x->m_glist = gl;
! if (argc > 1)
! {
x->m_text.te_xpix = atom_getfloatarg(0, argc, argv);
x->m_text.te_ypix = atom_getfloatarg(1, argc, argv);
--- 8803,8807 ----
x->m_text.te_binbuf = binbuf_new();
x->m_glist = gl;
! if (argc > 1) {
x->m_text.te_xpix = atom_getfloatarg(0, argc, argv);
x->m_text.te_ypix = atom_getfloatarg(1, argc, argv);
***************
*** 8990,9057 ****
{t_atom at; SETSYMBOL(&at, s); gatom_set(x, 0, 1, &at); gatom_bang(x);}
- /*
- static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy) {
- t_gatom *x = (t_gatom *)z;
- if (dy == 0) return;
- if (x->a_atom.a_type == A_FLOAT) {
- if (x->a_shift) {
- double nval = x->a_atom.a_w.w_float - 0.01 * dy;
- double trunc = 0.01 * (floor(100. * nval + 0.5));
- if (trunc < nval + 0.0001 && trunc > nval - 0.0001) nval = trunc;
- } else {
- double nval = x->a_atom.a_w.w_float - dy;
- double trunc = 0.01 * (floor(100. * nval + 0.5));
- if (trunc < nval + 0.0001 && trunc > nval - 0.0001) nval = trunc;
- trunc = floor(nval + 0.5);
- if (trunc < nval + 0.001 && trunc > nval - 0.001) nval = trunc;
- }
- gatom_clipfloat(x, nval);
- }
- }
- */
-
- /*
- static void gatom_key(void *z, t_floatarg f) {
- t_gatom *x = (t_gatom *)z;
- int c = f;
- int len = strlen(x->a_buf);
- t_atom at;
- char sbuf[ATOMBUFSIZE + 4];
- if (c == 0) {
- // we're being notified that no more keys will come for this grab
- if (x->a_buf[0])
- gatom_retext(x, 1);
- return;
- } else if (c == ' ') return;
- else if (c == '\b') {
- if (len > 0)
- x->a_buf[len-1] = 0;
- goto redraw;
- } else if (c == '\n') {
- if (x->a_atom.a_type == A_FLOAT)
- x->a_atom.a_w.w_float = atof(x->a_buf);
- else if (x->a_atom.a_type == A_SYMBOL)
- x->a_atom.a_w.w_symbol = gensym(x->a_buf);
- else bug("gatom_key");
- gatom_bang(x);
- gatom_retext(x, 1);
- x->a_buf[0] = 0;
- } else if (len < (ATOMBUFSIZE-1)) {
- if ((x->a_atom.a_type == A_SYMBOL) ||
- (c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e' || c == 'E') {
- x->a_buf[len] = c;
- x->a_buf[len+1] = 0;
- goto redraw;
- }
- }
- return;
- redraw:
- sprintf(sbuf, "%s...", x->a_buf);
- SETSYMBOL(&at, gensym(sbuf));
- binbuf_clear(x->a_text.te_binbuf);
- binbuf_add(x->a_text.te_binbuf, 1, &at);
- glist_retext(x->a_glist, &x->a_text);
- }*/
-
/* message back from dialog window */
static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
--- 8912,8915 ----
More information about the Pd-cvs
mailing list