[PD-cvs] pd/src kernel.c,1.1.2.38,1.1.2.39
Mathieu Bouchard
matju at users.sourceforge.net
Wed Jan 10 04:15:31 CET 2007
- Previous message: [PD-cvs] pd/extra/pureunity operator1-test.pd, NONE, 1.1.2.1 operator1-rule.pd, NONE, 1.1.2.1 operator2-test.pd, NONE, 1.1.2.1 operator2-rule.pd, NONE, 1.1.2.1
- Next message: [PD-cvs] pd/src TODO,1.1.2.28.2.30,1.1.2.28.2.31
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3043
Modified Files:
Tag: desiredata
kernel.c
Log Message:
fixed bug in binbuf_gettext2 and stuff
Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.38
retrieving revision 1.1.2.39
diff -C2 -d -r1.1.2.38 -r1.1.2.39
*** kernel.c 9 Jan 2007 23:13:21 -0000 1.1.2.38
--- kernel.c 10 Jan 2007 03:15:29 -0000 1.1.2.39
***************
*** 420,437 ****
#undef g_next
! typedef struct _gstack {
! t_pd *g_what;
! t_symbol *g_loadingabstraction;
! struct _gstack *g_next;
! } t_gstack;
static t_gstack *gstack_head = 0;
static t_pd *lastpopped;
! static t_symbol *pd_loadingabstraction;
int pd_setloadingabstraction(t_symbol *sym) {
t_gstack *foo = gstack_head;
! for (foo = gstack_head; foo; foo = foo->g_next) if (foo->g_loadingabstraction == sym) return 1;
! pd_loadingabstraction = sym;
return 0;
}
--- 420,437 ----
#undef g_next
! struct t_gstack {
! t_pd *what;
! t_symbol *loading_abstr;
! t_gstack *next;
! };
static t_gstack *gstack_head = 0;
static t_pd *lastpopped;
! static t_symbol *pd_loading_abstr;
int pd_setloadingabstraction(t_symbol *sym) {
t_gstack *foo = gstack_head;
! for (foo = gstack_head; foo; foo = foo->next) if (foo->loading_abstr == sym) return 1;
! pd_loading_abstr = sym;
return 0;
}
***************
*** 439,446 ****
void pd_pushsym(t_pd *x) {
t_gstack *y = (t_gstack *)malloc(sizeof(*y));
! y->g_what = s__X.thing;
! y->g_next = gstack_head;
! y->g_loadingabstraction = pd_loadingabstraction;
! pd_loadingabstraction = 0;
gstack_head = y;
s__X.thing = x;
--- 439,446 ----
void pd_pushsym(t_pd *x) {
t_gstack *y = (t_gstack *)malloc(sizeof(*y));
! y->what = s__X.thing;
! y->next = gstack_head;
! y->loading_abstr = pd_loading_abstr;
! pd_loading_abstr = 0;
gstack_head = y;
s__X.thing = x;
***************
*** 450,464 ****
if (!gstack_head || s__X.thing != x) {bug("gstack_pop"); return;}
t_gstack *headwas = gstack_head;
! s__X.thing = headwas->g_what;
! gstack_head = headwas->g_next;
free(headwas);
lastpopped = x;
}
- void pd_doloadbang(void) {
- if (lastpopped) pd_vmess(lastpopped, gensym("loadbang"), "");
- lastpopped = 0;
- }
-
void pd_bang(t_pd *x) {x->_class->bangmethod(x);}
void pd_float(t_pd *x, t_float f) {x->_class->floatmethod(x, f);}
--- 450,459 ----
if (!gstack_head || s__X.thing != x) {bug("gstack_pop"); return;}
t_gstack *headwas = gstack_head;
! s__X.thing = headwas->what;
! gstack_head = headwas->next;
free(headwas);
lastpopped = x;
}
void pd_bang(t_pd *x) {x->_class->bangmethod(x);}
void pd_float(t_pd *x, t_float f) {x->_class->floatmethod(x, f);}
***************
*** 682,693 ****
struct _outlet {
! t_object *o_owner;
! struct _outlet *o_next;
! t_outconnect *o_connections;
! t_symbol *o_sym;
};
t_inlet *t_object:: in(int n) {t_inlet *i= inlet; while(n--) i=i->next; return i;}
! t_outlet *t_object::out(int n) {t_outlet *o=outlet; while(n--) o=o->o_next; return o;}
t_class *wire_class;
--- 677,688 ----
struct _outlet {
! t_object *owner;
! struct _outlet *next;
! t_outconnect *connections;
! t_symbol *sym;
};
t_inlet *t_object:: in(int n) {t_inlet *i= inlet; while(n--) i=i->next; return i;}
! t_outlet *t_object::out(int n) {t_outlet *o=outlet; while(n--) o=o->next; return o;}
t_class *wire_class;
***************
*** 709,727 ****
t_outlet *outlet_new(t_object *owner, t_symbol *s) {
t_outlet *x = (t_outlet *)malloc(sizeof(*x)), *y, *y2;
! x->o_owner = owner;
! x->o_next = 0;
y = owner->ob_outlet;
if (y) {
! while ((y2 = y->o_next)) y = y2;
! y->o_next = x;
} else owner->ob_outlet = x;
! x->o_connections = 0;
! x->o_sym = s;
return x;
}
! static void outlet_stackerror(t_outlet *x) {pd_error(x->o_owner, "stack overflow");}
! #define each_connect(oc,x) for (t_outconnect *oc = x->o_connections; oc; oc = oc->next)
void outlet_bang(t_outlet *x) {ENTER{
each_connect(oc,x) pd_bang(oc->oc_to);
--- 704,722 ----
t_outlet *outlet_new(t_object *owner, t_symbol *s) {
t_outlet *x = (t_outlet *)malloc(sizeof(*x)), *y, *y2;
! x->owner = owner;
! x->next = 0;
y = owner->ob_outlet;
if (y) {
! while ((y2 = y->next)) y = y2;
! y->next = x;
} else owner->ob_outlet = x;
! x->connections = 0;
! x->sym = s;
return x;
}
! static void outlet_stackerror(t_outlet *x) {pd_error(x->owner, "stack overflow");}
! #define each_connect(oc,x) for (t_outconnect *oc = x->connections; oc; oc = oc->next)
void outlet_bang(t_outlet *x) {ENTER{
each_connect(oc,x) pd_bang(oc->oc_to);
***************
*** 745,755 ****
/* get the outlet's declared symbol */
! t_symbol *outlet_getsymbol(t_outlet *x) {return x->o_sym;}
void outlet_free(t_outlet *x) {
! t_object *y = x->o_owner;
! if (y->ob_outlet == x) y->ob_outlet = x->o_next;
! else for (t_outlet *x2 = y->ob_outlet; x2; x2 = x2->o_next) if (x2->o_next == x) {
! x2->o_next = x->o_next;
break;
}
--- 740,750 ----
/* get the outlet's declared symbol */
! t_symbol *outlet_getsymbol(t_outlet *x) {return x->sym;}
void outlet_free(t_outlet *x) {
! t_object *y = x->owner;
! if (y->ob_outlet == x) y->ob_outlet = x->next;
! else for (t_outlet *x2 = y->ob_outlet; x2; x2 = x2->next) if (x2->next == x) {
! x2->next = x->next;
break;
}
***************
*** 758,762 ****
#define each_inlet(i,obj) for ( t_inlet *i=obj->ob_inlet; i; i=i->next)
! #define each_outlet(o,obj) for (t_outlet *o=obj->ob_outlet; o; o=o->o_next)
static t_pd *find_inlet(t_object *to, int inlet) {
--- 753,757 ----
#define each_inlet(i,obj) for ( t_inlet *i=obj->ob_inlet; i; i=i->next)
! #define each_outlet(o,obj) for (t_outlet *o=obj->ob_outlet; o; o=o->next)
static t_pd *find_inlet(t_object *to, int inlet) {
***************
*** 782,790 ****
/* append it to the end of the list */
/* LATER we might cache the last "oc" to make this faster. */
! if ((oc2 = o->o_connections)) {
while (oc2->next) oc2 = oc2->next;
oc2->next = oc;
! } else o->o_connections = oc;
! if (o->o_sym == &s_signal) canvas_update_dsp();
return oc;
}
--- 777,785 ----
/* append it to the end of the list */
/* LATER we might cache the last "oc" to make this faster. */
! if ((oc2 = o->connections)) {
while (oc2->next) oc2 = oc2->next;
oc2->next = oc;
! } else o->connections = oc;
! if (o->sym == &s_signal) canvas_update_dsp();
return oc;
}
***************
*** 794,801 ****
t_pd *i = find_inlet(to,inlet);
if (!o||!i) return;
! t_outconnect *oc = o->o_connections, *oc2;
if (!oc) return;
if (oc->oc_to == i) {
! o->o_connections = oc->next;
pd_free((t_pd *)oc);
goto done;
--- 789,796 ----
t_pd *i = find_inlet(to,inlet);
if (!o||!i) return;
! t_outconnect *oc = o->connections, *oc2;
if (!oc) return;
if (oc->oc_to == i) {
! o->connections = oc->next;
pd_free((t_pd *)oc);
goto done;
***************
*** 810,814 ****
}
done:
! if (o->o_sym == &s_signal) canvas_update_dsp();
}
--- 805,809 ----
}
done:
! if (o->sym == &s_signal) canvas_update_dsp();
}
***************
*** 829,835 ****
t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, int nout) {
t_outlet *o = x->ob_outlet;
! while (nout-- && o) o = o->o_next;
*op = o;
! return o ? o->o_connections : 0;
}
--- 824,830 ----
t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, int nout) {
t_outlet *o = x->ob_outlet;
! while (nout-- && o) o = o->next;
*op = o;
! return o ? o->connections : 0;
}
***************
*** 871,877 ****
void obj_moveoutletfirst(t_object *x, t_outlet *o) {
if (x->ob_outlet == o) return;
! each_outlet(o2,x) if (o2->o_next == o) {
! o2->o_next = o->o_next;
! o->o_next = x->ob_outlet;
x->ob_outlet = o;
return;
--- 866,872 ----
void obj_moveoutletfirst(t_object *x, t_outlet *o) {
if (x->ob_outlet == o) return;
! each_outlet(o2,x) if (o2->next == o) {
! o2->next = o->next;
! o->next = x->ob_outlet;
x->ob_outlet = o;
return;
***************
*** 890,894 ****
int obj_nsigoutlets(t_object *x) {
int n=0;
! each_outlet(o,x) if (o->o_sym == &s_signal) n++;
return n;
}
--- 885,889 ----
int obj_nsigoutlets(t_object *x) {
int n=0;
! each_outlet(o,x) if (o->sym == &s_signal) n++;
return n;
}
***************
*** 908,912 ****
int obj_sigoutletindex(t_object *x, int m) {
int n=0;
! each_outlet(o,x) if (o->o_sym == &s_signal) {
if (m == 0) return n;
n++; m--;
--- 903,907 ----
int obj_sigoutletindex(t_object *x, int m) {
int n=0;
! each_outlet(o,x) if (o->sym == &s_signal) {
if (m == 0) return n;
n++; m--;
***************
*** 926,931 ****
int obj_issignaloutlet(t_object *x, int m) {
t_outlet *o2;
! for (o2 = x->ob_outlet; o2 && m--; o2 = o2->o_next) {}
! return o2 && o2->o_sym==&s_signal;
}
--- 921,926 ----
int obj_issignaloutlet(t_object *x, int m) {
t_outlet *o2;
! for (o2 = x->ob_outlet; o2 && m--; o2 = o2->next) {}
! return o2 && o2->sym==&s_signal;
}
***************
*** 952,956 ****
int outlet_getsignalindex(t_outlet *x) {
int n=0; t_outlet *o;
! for (o = x->o_owner->ob_outlet; o && o != x; o = o->o_next) if (o->o_sym == &s_signal) n++;
return n;
}
--- 947,951 ----
int outlet_getsignalindex(t_outlet *x) {
int n=0; t_outlet *o;
! for (o = x->owner->ob_outlet; o && o != x; o = o->next) if (o->sym == &s_signal) n++;
return n;
}
***************
*** 1815,1819 ****
int n;
binbuf_gettext(x,&buf,&n);
! return buf;
}
--- 1810,1815 ----
int n;
binbuf_gettext(x,&buf,&n);
! buf[n] = 0;
! return (char *)realloc(buf,n+1);
}
***************
*** 2520,2525 ****
}
- void pd_doloadbang(void);
-
/* LATER figure out how to log errors */
void binbuf_evalfile(t_symbol *name, t_symbol *dir) {
--- 2516,2519 ----
***************
*** 2551,2557 ****
int dspstate = canvas_suspend_dsp();
binbuf_evalfile(name, dir);
! while ((x != s__X.thing) && (x = s__X.thing))
! vmess(x, gensym("pop"), "i", 1);
! pd_doloadbang();
canvas_resume_dsp(dspstate);
}
--- 2545,2551 ----
int dspstate = canvas_suspend_dsp();
binbuf_evalfile(name, dir);
! while ((x != s__X.thing) && (x = s__X.thing)) vmess(x, gensym("pop"), "i", 1);
! if (lastpopped) pd_vmess(lastpopped, gensym("loadbang"), "");
! lastpopped = 0;
canvas_resume_dsp(dspstate);
}
- Previous message: [PD-cvs] pd/extra/pureunity operator1-test.pd, NONE, 1.1.2.1 operator1-rule.pd, NONE, 1.1.2.1 operator2-test.pd, NONE, 1.1.2.1 operator2-rule.pd, NONE, 1.1.2.1
- Next message: [PD-cvs] pd/src TODO,1.1.2.28.2.30,1.1.2.28.2.31
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list