Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3627
Modified Files:
Tag: desiredata
desire.c
Log Message:
reenabled sys_load_lib in [declare]
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.120
retrieving revision 1.1.2.217.2.121
diff -C2 -d -r1.1.2.217.2.120 -r1.1.2.217.2.121
*** desire.c 10 Jan 2007 00:23:56 -0000 1.1.2.217.2.120
--- desire.c 11 Jan 2007 17:31:11 -0000 1.1.2.217.2.121
***************
*** 110,114 ****
void appendix_save (t_gobj *master, t_binbuf *b) {
! t_hash *h = master->g_adix->visual;
//fprintf(stderr,"appendix_save %p size=%ld\n",master,hash_size(h));
if (hash_size(h)) {
--- 110,114 ----
void appendix_save (t_gobj *master, t_binbuf *b) {
! t_hash *h = master->dix->visual;
//fprintf(stderr,"appendix_save %p size=%ld\n",master,hash_size(h));
if (hash_size(h)) {
***************
*** 131,135 ****
void appendix_free (t_gobj *master) {
! t_appendix *self = master->g_adix;
hashkey k;
hashvalue v;
--- 131,135 ----
void appendix_free (t_gobj *master) {
! t_appendix *self = master->dix;
hashkey k;
hashvalue v;
***************
*** 144,148 ****
/* subscribing N spies takes N*N time, but it's not important for now */
void gobj_subscribe (t_gobj *self, t_gobj *observer) {
! t_appendix *d = self->g_adix;
for (int i=0; i<d->nobs; i++) if (d->obs[i]) return;
d->obs=(t_gobj **)realloc(d->obs,sizeof(t_gobj *)*(1+d->nobs));
--- 144,148 ----
/* subscribing N spies takes N*N time, but it's not important for now */
void gobj_subscribe (t_gobj *self, t_gobj *observer) {
! t_appendix *d = self->dix;
for (int i=0; i<d->nobs; i++) if (d->obs[i]) return;
d->obs=(t_gobj **)realloc(d->obs,sizeof(t_gobj *)*(1+d->nobs));
***************
*** 151,155 ****
void gobj_unsubscribe (t_gobj *self, t_gobj *observer) {
! t_appendix *d = self->g_adix;
int i;
for (i=0; i<d->nobs; i++) if (d->obs[i]) break;
--- 151,155 ----
void gobj_unsubscribe (t_gobj *self, t_gobj *observer) {
! t_appendix *d = self->dix;
int i;
for (i=0; i<d->nobs; i++) if (d->obs[i]) break;
***************
*** 183,187 ****
void gobj_changed3 (t_gobj *self, t_gobj *origin, int argc, t_atom *argv) {
! t_appendix *d = self->g_adix;
//printf("gobj_changed3 self=%lx origin=%lx\n",(long)self,(long)origin);
if (!d) {post("gobj_changed3: no appendix in %p",self); return;}
--- 183,187 ----
void gobj_changed3 (t_gobj *self, t_gobj *origin, int argc, t_atom *argv) {
! t_appendix *d = self->dix;
//printf("gobj_changed3 self=%lx origin=%lx\n",(long)self,(long)origin);
if (!d) {post("gobj_changed3: no appendix in %p",self); return;}
***************
*** 198,202 ****
// when this becomes too small, use a bigger constant or a better impl.
! #define QUEUE_SIZE 4096
struct t_queue {
int start,len;
--- 198,202 ----
// when this becomes too small, use a bigger constant or a better impl.
! #define QUEUE_SIZE 16384
struct t_queue {
int start,len;
***************
*** 315,321 ****
pd_free(o);
} else {
! if (o->g_adix->dirtyc) {
pd_upload(o);
! o->g_adix->dirtyc = 0;
}
}
--- 315,321 ----
pd_free(o);
} else {
! if (o->dix->dirtyc) {
pd_upload(o);
! o->dix->dirtyc = 0;
}
}
***************
*** 326,330 ****
void manager_notice (t_gobj *self_, t_gobj *origin, int argc, t_atom *argv) {
t_manager *self = (t_manager *)self_;
! t_appendix *a = (t_appendix *)origin->g_adix;
if (!a->dirtyc) {
queue_put(self->q,origin);
--- 326,330 ----
void manager_notice (t_gobj *self_, t_gobj *origin, int argc, t_atom *argv) {
t_manager *self = (t_manager *)self_;
! t_appendix *a = (t_appendix *)origin->dix;
if (!a->dirtyc) {
queue_put(self->q,origin);
***************
*** 500,506 ****
t_outconnect *linetraverser_next(t_linetraverser *t) {
t_outconnect *rval = t->next;
- int outno;
while (!rval) {
! outno = t->nextoutno;
while (outno == t->nout) {
t_object *ob = 0;
--- 500,505 ----
t_outconnect *linetraverser_next(t_linetraverser *t) {
t_outconnect *rval = t->next;
while (!rval) {
! int outno = t->nextoutno;
while (outno == t->nout) {
t_object *ob = 0;
***************
*** 523,532 ****
/* -------------------- the canvas object -------------------------- */
- int canvas_valid = 10000;
-
static int hack = 1;
void canvas_init(t_canvas *x) {
! /* zero out everyone except "pd" and "g_adix" fields */
memset(((char *)x) + sizeof(t_gobj), 0, sizeof(*x) - sizeof(t_gobj));
x->xlabel = (t_symbol **)getbytes(0);
--- 522,529 ----
/* -------------------- the canvas object -------------------------- */
static int hack = 1;
void canvas_init(t_canvas *x) {
! /* zero out everyone except "pd" and "dix" fields */
memset(((char *)x) + sizeof(t_gobj), 0, sizeof(*x) - sizeof(t_gobj));
x->xlabel = (t_symbol **)getbytes(0);
***************
*** 713,716 ****
--- 710,714 ----
static void canvas_vis(t_canvas *x, t_floatarg f) {
+ /* if window contents have never been subscribed it should subscribe them here but it doesn't */
SET(havewindow,!!f);
}
***************
*** 6294,6297 ****
--- 6292,6296 ----
return 1;
err:
+ /* maybe it should fill in some default values */
//post("WARNING: pd_scanargs failed; fmt=%s, i=%d",fmt,i);
return 0;
***************
*** 6502,6509 ****
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
- t_atom foo;
t_binbuf *buf = x->binbuf;
if (!buf) return;
binbuf_clear(buf);
SETSYMBOL(&foo,qlass);
binbuf_add(buf,1,&foo);
--- 6501,6508 ----
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
t_binbuf *buf = x->binbuf;
if (!buf) return;
binbuf_clear(buf);
+ t_atom foo;
SETSYMBOL(&foo,qlass);
binbuf_add(buf,1,&foo);
***************
*** 7155,7195 ****
before any objects are created in it. */
! typedef struct _declare
! {
! t_object x_obj;
! t_canvas *x_canvas;
! int x_useme;
! } t_declare;
! static void *declare_new(t_symbol *s, int argc, t_atom *argv)
! {
t_declare *x = (t_declare *)pd_new(declare_class);
! x->x_useme = 1;
! x->x_canvas = canvas_getcurrent();
! /* LATER update environment and/or load libraries */
! return (x);
}
! static void declare_free(t_declare *x)
! {
! x->x_useme = 0;
! /* LATER update environment */
}
void canvas_savedeclarationsto(t_canvas *x, t_binbuf *b) {
canvas_each(y,x) {
! if (pd_class(y) == declare_class)
! {
binbuf_addv(b,"t","#X");
! binbuf_addbinbuf(b, ((t_declare *)y)->x_obj.te_binbuf);
binbuf_addv(b, ";");
! }
! else if (pd_class(y) == canvas_class)
! canvas_savedeclarationsto((t_canvas *)y, b);
}
}
! static void canvas_declare(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
! {
int i;
t_canvasenvironment *e = canvas_getenv(x);
--- 7154,7186 ----
before any objects are created in it. */
! struct t_declare : t_object {
! t_canvas *canvas; /* obsolete field */
! int useme;
! };
! static void *declare_new(t_symbol *s, int argc, t_atom *argv) {
t_declare *x = (t_declare *)pd_new(declare_class);
! x->useme = 1;
! x->canvas = canvas_getcurrent();
! /* LATER update environment and/or load libraries */
! return x;
}
! static void declare_free(t_declare *x) {
! x->useme = 0;
! /* LATER update environment */
}
void canvas_savedeclarationsto(t_canvas *x, t_binbuf *b) {
canvas_each(y,x) {
! if (pd_class(y) == declare_class) {
binbuf_addv(b,"t","#X");
! binbuf_addbinbuf(b, ((t_declare *)y)->binbuf);
binbuf_addv(b, ";");
! } else if (pd_class(y) == canvas_class) canvas_savedeclarationsto((t_canvas *)y, b);
}
}
! static void canvas_declare(t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
int i;
t_canvasenvironment *e = canvas_getenv(x);
***************
*** 7199,7241 ****
endpost();
#endif
! for (i = 0; i < argc; i++)
! {
char strbuf[MAXPDSTRING];
char *flag = atom_getsymbolarg(i, argc, argv)->name;
! if ((argc > i+1) && !strcmp(flag, "-path"))
! {
e->path = namelist_append(e->path, atom_getsymbolarg(i+1, argc, argv)->name, 0);
i++;
! }
! else if ((argc > i+1) && !strcmp(flag, "-stdpath"))
! {
strncpy(strbuf, sys_libdir->name, MAXPDSTRING-3);
strbuf[MAXPDSTRING-4] = 0;
strcat(strbuf, "/");
! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name,
! MAXPDSTRING-strlen(strbuf));
strbuf[MAXPDSTRING-1] = 0;
e->path = namelist_append(e->path, strbuf, 0);
i++;
! }
! else if ((argc > i+1) && !strcmp(flag, "-lib"))
! {
! pd_error(x, "not implemented for now, ask matju");
! /* sys_load_lib(x, atom_getsymbolarg(i+1, argc, argv)->name); */
i++;
! }
! else if ((argc > i+1) && !strcmp(flag, "-stdlib"))
! {
strncpy(strbuf, sys_libdir->name, MAXPDSTRING-3);
strbuf[MAXPDSTRING-4] = 0;
strcat(strbuf, "/");
! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name,
! MAXPDSTRING-strlen(strbuf));
strbuf[MAXPDSTRING-1] = 0;
! pd_error(x, "not implemented for now, ask matju");
! /* sys_load_lib(0, strbuf);*/
i++;
! }
! else post("declare: %s: unknown declaration", flag);
}
}
--- 7190,7221 ----
endpost();
#endif
! for (i = 0; i < argc; i++) {
char strbuf[MAXPDSTRING];
char *flag = atom_getsymbolarg(i, argc, argv)->name;
! if ((argc > i+1) && !strcmp(flag, "-path")) {
e->path = namelist_append(e->path, atom_getsymbolarg(i+1, argc, argv)->name, 0);
i++;
! } else if (argc>i+1 && !strcmp(flag, "-stdpath")) {
strncpy(strbuf, sys_libdir->name, MAXPDSTRING-3);
strbuf[MAXPDSTRING-4] = 0;
strcat(strbuf, "/");
! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name, MAXPDSTRING-strlen(strbuf));
strbuf[MAXPDSTRING-1] = 0;
e->path = namelist_append(e->path, strbuf, 0);
i++;
! } else if (argc>i+1 && !strcmp(flag, "-lib")) {
! /* pd_error(x, "not implemented for now, ask matju"); */
! sys_load_lib(x, atom_getsymbolarg(i+1, argc, argv)->name);
i++;
! } else if (argc>i+1 && !strcmp(flag, "-stdlib")) {
strncpy(strbuf, sys_libdir->name, MAXPDSTRING-3);
strbuf[MAXPDSTRING-4] = 0;
strcat(strbuf, "/");
! strncpy(strbuf, atom_getsymbolarg(i+1, argc, argv)->name, MAXPDSTRING-strlen(strbuf));
strbuf[MAXPDSTRING-1] = 0;
! /* pd_error(x, "not implemented for now, ask matju"); */
! sys_load_lib(0, strbuf);
i++;
! } else post("declare: %s: unknown declaration", flag);
}
}
***************
*** 7378,7382 ****
//printf("#V reading '%s':\n",s->name);
if (!newest) {pd_error(self,"#V: there is no newest object\n"); return;}
! h = ((t_gobj *)newest)->g_adix->visual;
if (hash_exists(h,s)) {
//printf("'%s' exists, deleting\n",s->name);
--- 7358,7362 ----
//printf("#V reading '%s':\n",s->name);
if (!newest) {pd_error(self,"#V: there is no newest object\n"); return;}
! h = ((t_gobj *)newest)->dix->visual;
if (hash_exists(h,s)) {
//printf("'%s' exists, deleting\n",s->name);