Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29237
Modified Files:
Tag: desiredata
kernel.c
Log Message:
added canvas_base_o_index() to get a backup of next_o_index at time of last pd_pushsym()
Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.83
retrieving revision 1.1.2.84
diff -C2 -d -r1.1.2.83 -r1.1.2.84
*** kernel.c 12 Aug 2007 03:19:13 -0000 1.1.2.83
--- kernel.c 12 Aug 2007 20:57:03 -0000 1.1.2.84
***************
*** 343,346 ****
--- 343,347 ----
t_symbol *loading_abstr;
t_gstack *next;
+ long base_o_index;
};
***************
*** 356,359 ****
--- 357,364 ----
}
+ long canvas_base_o_index(void) {
+ return gstack_head ? gstack_head->base_o_index : 0;
+ }
+
void pd_pushsym(t_pd *x) {
t_gstack *y = (t_gstack *)malloc(sizeof(*y));
***************
*** 361,364 ****
--- 366,370 ----
y->next = gstack_head;
y->loading_abstr = pd_loading_abstr;
+ y->base_o_index = x->_class == canvas_class ? ((t_canvas *)x)->next_o_index : -666;
pd_loading_abstr = 0;
gstack_head = y;
***************
*** 2076,2080 ****
t_binbuf *newb = binbuf_new();
t_atom *vec = oldb->v;
! t_int n = oldb->n, nextindex, stackdepth = 0, stack[MAXSTACK], nobj = 0, i;
t_atom outmess[MAXSTACK], *nextmess;
if (!maxtopd) binbuf_addv(newb,"tt;","max","v2");
--- 2082,2086 ----
t_binbuf *newb = binbuf_new();
t_atom *vec = oldb->v;
! t_int n = oldb->n, nextindex, stackdepth = 0, stack[MAXSTACK], nobj = 0;
t_atom outmess[MAXSTACK], *nextmess;
if (!maxtopd) binbuf_addv(newb,"tt;","max","v2");
***************
*** 2095,2099 ****
if (maxtopd) { /* case 1: importing a ".pat" file into Pd. */
/* dollar signs in file translate to symbols */
! for (i = 0; i < natom; i++) {
if (nextmess[i].a_type == A_DOLLAR) {
SETSYMBOL(nextmess+i, symprintf("$%ld",nextmess[i].a_index));
--- 2101,2105 ----
if (maxtopd) { /* case 1: importing a ".pat" file into Pd. */
/* dollar signs in file translate to symbols */
! for (int i=0; i<natom; i++) {
if (nextmess[i].a_type == A_DOLLAR) {
SETSYMBOL(nextmess+i, symprintf("$%ld",nextmess[i].a_index));
***************
*** 2131,2135 ****
t_symbol *classname = atom_getsymbolarg(6, natom, nextmess);
if (classname == gensym("trigger") || classname == gensym("t")) {
! for (i = 7; i < natom; i++)
if (nextmess[i].a_type == A_SYMBOL && nextmess[i].a_symbol == gensym("i"))
nextmess[i].a_symbol = gensym("f");
--- 2137,2141 ----
t_symbol *classname = atom_getsymbolarg(6, natom, nextmess);
if (classname == gensym("trigger") || classname == gensym("t")) {
! for (int i=7; i<natom; i++)
if (nextmess[i].a_type == A_SYMBOL && nextmess[i].a_symbol == gensym("i"))
nextmess[i].a_symbol = gensym("f");
***************
*** 2141,2145 ****
outmess[3] = nextmess[3];
SETSYMBOL(outmess+4, classname);
! for (i = 7; i < natom; i++) outmess[i-2] = nextmess[i];
SETSEMI(outmess + natom - 2);
binbuf_add(newb, natom - 1, outmess);
--- 2147,2151 ----
outmess[3] = nextmess[3];
SETSYMBOL(outmess+4, classname);
! for (int i=7; i<natom; i++) outmess[i-2] = nextmess[i];
SETSEMI(outmess + natom - 2);
binbuf_add(newb, natom - 1, outmess);
***************
*** 2150,2154 ****
outmess[2] = nextmess[2];
outmess[3] = nextmess[3];
! for (i = 6; i < natom; i++) outmess[i-2] = nextmess[i];
SETSEMI(outmess + natom - 2);
binbuf_add(newb, natom - 1, outmess);
--- 2156,2160 ----
outmess[2] = nextmess[2];
outmess[3] = nextmess[3];
! for (int i=6; i<natom; i++) outmess[i-2] = nextmess[i];
SETSEMI(outmess + natom - 2);
binbuf_add(newb, natom - 1, outmess);
***************
*** 2250,2257 ****
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_index != a2->a_index ||
! a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch;
}
return 1;
--- 2256,2263 ----
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_index != a2->a_index ||
! a1->a_type == A_DOLLSYM && a1->a_symbol != a2->a_symbol) goto nomatch;
}
return 1;
***************
*** 2265,2269 ****
t_binbuf *b = binbuf_new();
int import = !strcmp(name->name + strlen(name->name) - 4, ".pat");
! /* set filename so that new canvases can pick them up */
int dspstate = canvas_suspend_dsp();
glob_setfilename(0, name, dir);
--- 2271,2275 ----
t_binbuf *b = binbuf_new();
int import = !strcmp(name->name + strlen(name->name) - 4, ".pat");
! /* set filename so that new canvases can pick them up */
int dspstate = canvas_suspend_dsp();
glob_setfilename(0, name, dir);