[PD-cvs] pd/src m_pd.h, 1.4.4.11.2.31, 1.4.4.11.2.32 desire.c, 1.1.2.209, 1.1.2.210

Mathieu Bouchard matju at users.sourceforge.net
Tue Nov 28 03:53:37 CET 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28107

Modified Files:
      Tag: devel_0_39
	m_pd.h desire.c 
Log Message:
PD_PLUSPLUS_FACE: taking care of t_pd


Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.11.2.31
retrieving revision 1.4.4.11.2.32
diff -C2 -d -r1.4.4.11.2.31 -r1.4.4.11.2.32
*** m_pd.h	28 Nov 2006 01:17:57 -0000	1.4.4.11.2.31
--- m_pd.h	28 Nov 2006 02:53:33 -0000	1.4.4.11.2.32
***************
*** 65,72 ****
  typedef float t_floatarg;  /* floating-point type for function calls */
  
  typedef struct _symbol
  {
      char *s_name;
!     struct _class **s_thing;
      struct _symbol *s_next;
  } t_symbol;
--- 65,96 ----
  typedef float t_floatarg;  /* floating-point type for function calls */
  
+ EXTERN_STRUCT _class;
+ #define t_class struct _class
+ EXTERN_STRUCT _outlet;
+ #define t_outlet struct _outlet
+ EXTERN_STRUCT _inlet;
+ #define t_inlet struct _inlet
+ EXTERN_STRUCT _binbuf;
+ #define t_binbuf struct _binbuf
+ EXTERN_STRUCT _clock;
+ #define t_clock struct _clock
+ EXTERN_STRUCT _outconnect;
+ #define t_outconnect struct _outconnect
+ EXTERN_STRUCT _glist;
+ #define t_glist struct _glist
+ #define t_canvas struct _glist  /* LATER lose this */
+ 
+ #ifdef PD_PLUSPLUS_FACE
+ struct t_pd {
+ 	t_class *_class;
+ };
+ #else
+ typedef t_class *t_pd;      /* pure datum: nothing but a class pointer */
+ #endif
+ 
  typedef struct _symbol
  {
      char *s_name;
!     t_pd *s_thing;
      struct _symbol *s_next;
  } t_symbol;
***************
*** 140,167 ****
  } t_atom;
  
- EXTERN_STRUCT _class;
- #define t_class struct _class
- 
- EXTERN_STRUCT _outlet;
- #define t_outlet struct _outlet
- 
- EXTERN_STRUCT _inlet;
- #define t_inlet struct _inlet
- 
- EXTERN_STRUCT _binbuf;
- #define t_binbuf struct _binbuf
- 
- EXTERN_STRUCT _clock;
- #define t_clock struct _clock
- 
- EXTERN_STRUCT _outconnect;
- #define t_outconnect struct _outconnect
- 
- EXTERN_STRUCT _glist;
- #define t_glist struct _glist
- #define t_canvas struct _glist  /* LATER lose this */
- 
- typedef t_class *t_pd;      /* pure datum: nothing but a class pointer */
- 
  #ifdef DESIRE
  EXTERN_STRUCT _hash;
--- 164,167 ----
***************
*** 209,218 ****
  #endif
  
- typedef struct _gobj        /* a graphical object */
- {
  #ifdef PD_PLUSPLUS_FACE
  #define g_pd _class
!     t_pd _class;              /* pure datum header (class) */
  #else
      t_pd g_pd;              /* pure datum header (class) */
  #endif
--- 209,218 ----
  #endif
  
  #ifdef PD_PLUSPLUS_FACE
  #define g_pd _class
! typedef struct _gobj : t_pd {
  #else
+ typedef struct _gobj        /* a graphical object */
+ {
      t_pd g_pd;              /* pure datum header (class) */
  #endif
***************
*** 400,404 ****
--- 400,409 ----
  EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv);
  EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv);
+ 
+ #ifdef PD_PLUSPLUS_FACE
+ #define pd_class(x) ((x)->_class)
+ #else
  #define pd_class(x) (*(x))
+ #endif
  
  #ifdef DESIRE

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.209
retrieving revision 1.1.2.210
diff -C2 -d -r1.1.2.209 -r1.1.2.210
*** desire.c	28 Nov 2006 02:19:33 -0000	1.1.2.209
--- desire.c	28 Nov 2006 02:53:33 -0000	1.1.2.210
***************
*** 541,545 ****
         abstraction inside another patch.  A separate mechanism prevents
         the toplevel abstraction from showing up. */
!     if (vis && gensym("#X")->s_thing && *gensym("#X")->s_thing == canvas_class) {
          t_canvas *zzz = (t_canvas *)(gensym("#X")->s_thing);
          while (zzz && !zzz->env) zzz = zzz->owner;
--- 541,545 ----
         abstraction inside another patch.  A separate mechanism prevents
         the toplevel abstraction from showing up. */
!     if (vis && gensym("#X")->s_thing && gensym("#X")->s_thing->_class == canvas_class) {
          t_canvas *zzz = (t_canvas *)(gensym("#X")->s_thing);
          while (zzz && !zzz->env) zzz = zzz->owner;
***************
*** 800,804 ****
      t_pd *z = gensym("#X")->s_thing;
      if (!z) pd_error(x,"canvas_restore: out of context");
!     else if (*z != canvas_class) pd_error(x,"canvas_restore: wasn't a canvas");
      else {
          t_canvas *x2 = (t_canvas *)z;
--- 800,804 ----
      t_pd *z = gensym("#X")->s_thing;
      if (!z) pd_error(x,"canvas_restore: out of context");
!     else if (z->_class != canvas_class) pd_error(x,"canvas_restore: wasn't a canvas");
      else {
          t_canvas *x2 = (t_canvas *)z;
***************
*** 822,830 ****
      t_symbol *s = gensym("loadbang");
      canvas_each(y,x) if (y->_class == canvas_class)
!         if (!canvas_isabstraction((t_canvas *)y))
!             canvas_loadbangsubpatches((t_canvas *)y);
!     canvas_each(y,x)
!         if ((y->_class != canvas_class) && zgetfn(&y->_class, s))
!                 pd_vmess(&y->_class, s, "");
  }
  
--- 822,827 ----
      t_symbol *s = gensym("loadbang");
      canvas_each(y,x) if (y->_class == canvas_class)
!         if (!canvas_isabstraction((t_canvas *)y)) canvas_loadbangsubpatches((t_canvas *)y);
!     canvas_each(y,x) if ((y->_class != canvas_class) && zgetfn(y,s)) pd_vmess(y,s,"");
  }
  
***************
*** 975,979 ****
  
      /* find all the "dsp" boxes and add them to the graph */
!     canvas_each(y,x) if ((ob = pd_checkobject(y)) && zgetfn(&y->_class, dspsym)) ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
--- 972,976 ----
  
      /* find all the "dsp" boxes and add them to the graph */
!     canvas_each(y,x) if ((ob = pd_checkobject(y)) && zgetfn(y,dspsym)) ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
***************
*** 1397,1401 ****
      /* if object creation failed, make dummy inlets or outlets as needed */
      if (is_dummy(from)) while (outlet >= obj_noutlets(from)) outlet_new(from, &s_);
!     if (is_dummy(to))   while ( inlet >= obj_ninlets(to)) inlet_new(to, &to->ob_pd, &s_, &s_);
      gobj_changed(x,0);
      if (!(oc = obj_connect(from,outlet,to,inlet))) goto bad;
--- 1394,1398 ----
      /* if object creation failed, make dummy inlets or outlets as needed */
      if (is_dummy(from)) while (outlet >= obj_noutlets(from)) outlet_new(from, &s_);
!     if (is_dummy(to))   while ( inlet >= obj_ninlets(to)) inlet_new(to,to,&s_,&s_);
      gobj_changed(x,0);
      if (!(oc = obj_connect(from,outlet,to,inlet))) goto bad;
***************
*** 2303,2307 ****
  /* delete an object from a canvas and free it */
  void canvas_delete(t_canvas *x, t_gobj *y) {
!     t_gotfn chkdsp = zgetfn(&y->_class, gensym("dsp"));
      int drawcommand = class_isdrawcommand(y->_class);
  
--- 2300,2304 ----
  /* delete an object from a canvas and free it */
  void canvas_delete(t_canvas *x, t_gobj *y) {
!     t_gotfn chkdsp = zgetfn(y,gensym("dsp"));
      int drawcommand = class_isdrawcommand(y->_class);
  
***************
*** 2332,2336 ****
      while ((y = x->list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP only if we find a DSP object. */
!         if (!suspended && pd_checkobject(y) && zgetfn(&y->_class, dspsym)) {
              dspstate = canvas_suspend_dsp();
              suspended = 1;
--- 2329,2333 ----
      while ((y = x->list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP only if we find a DSP object. */
!         if (!suspended && pd_checkobject(y) && zgetfn(y,dspsym)) {
              dspstate = canvas_suspend_dsp();
              suspended = 1;
***************
*** 2443,2447 ****
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = vinlet_getit(&y->_class);
          obj_moveinletfirst(x,ip);
      }
--- 2440,2444 ----
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = vinlet_getit(y);
          obj_moveinletfirst(x,ip);
      }
***************
*** 2464,2468 ****
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = voutlet_getit(&y->_class);
          obj_moveoutletfirst(x,ip);
      }
--- 2461,2465 ----
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = voutlet_getit(y);
          obj_moveoutletfirst(x,ip);
      }
***************
*** 3292,3296 ****
      t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
      x->canvas = canvas_getcurrent();
!     x->inlet = canvas_addinlet(x->canvas, &x->ob_pd, 0, s);
      x->bufsize = 0;
      x->buf = 0;
--- 3289,3293 ----
      t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
      x->canvas = canvas_getcurrent();
!     x->inlet = canvas_addinlet(x->canvas,x,0,s);
      x->bufsize = 0;
      x->buf = 0;
***************
*** 3460,3464 ****
      t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
      x->canvas = canvas_getcurrent();
!     x->inlet = canvas_addinlet(x->canvas, &x->ob_pd, &s_signal,s);
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
--- 3457,3461 ----
      t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
      x->canvas = canvas_getcurrent();
!     x->inlet = canvas_addinlet(x->canvas,x,&s_signal,s);
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
***************
*** 3523,3528 ****
      t_voutlet *x = (t_voutlet *)pd_new(voutlet_class);
      x->canvas = canvas_getcurrent();
!     x->parentoutlet = canvas_addoutlet(x->canvas, &x->ob_pd, 0);
!     inlet_new(x, &x->ob_pd, 0, 0);
      x->bufsize = 0;
      x->buf = 0;
--- 3520,3525 ----
      t_voutlet *x = (t_voutlet *)pd_new(voutlet_class);
      x->canvas = canvas_getcurrent();
!     x->parentoutlet = canvas_addoutlet(x->canvas,x,0);
!     inlet_new(x,x,0,0);
      x->bufsize = 0;
      x->buf = 0;
***************
*** 3699,3704 ****
      t_voutlet *x = (t_voutlet *)pd_new(voutlet_class);
      x->canvas = canvas_getcurrent();
!     x->parentoutlet = canvas_addoutlet(x->canvas, &x->ob_pd, &s_signal);
!     inlet_new(x, &x->ob_pd, &s_signal, &s_signal);
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
--- 3696,3701 ----
      t_voutlet *x = (t_voutlet *)pd_new(voutlet_class);
      x->canvas = canvas_getcurrent();
!     x->parentoutlet = canvas_addoutlet(x->canvas,x,&s_signal);
!     inlet_new(x,x,&s_signal,&s_signal);
      x->endbuf = x->buf = (t_float *)getalignedbytes(0);
      x->bufsize = 0;
***************
*** 3870,3874 ****
      }
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
          if (wb) wb->w_parentvisfn(y, owner, x->sc_vec, t, basex, basey, vis);
      }
--- 3867,3871 ----
      }
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(y);
          if (wb) wb->w_parentvisfn(y, owner, x->sc_vec, t, basex, basey, vis);
      }
***************
*** 3892,3896 ****
      float basey = template_getfloat(t, gensym("y"), data, 0);
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
          if (!wb) continue;
          hit = wb->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc,
--- 3889,3893 ----
      float basey = template_getfloat(t, gensym("y"), data, 0);
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(y);
          if (!wb) continue;
          hit = wb->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc,
***************
*** 4908,4912 ****
  	    canvas_each(y,elemtemplatecanvas) {
  		int xx1, xx2, yy1, yy2;
! 		t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
  		if (!wb) continue;
  		wb->w_parentgetrectfn(y, canvas, (t_word *)((char *)array->vec + elemsize*i),
--- 4905,4909 ----
  	    canvas_each(y,elemtemplatecanvas) {
  		int xx1, xx2, yy1, yy2;
! 		t_parentwidgetbehavior *wb = pd_getparentwidget(y);
  		if (!wb) continue;
  		wb->w_parentgetrectfn(y, canvas, (t_word *)((char *)array->vec + elemsize*i),
***************
*** 5069,5073 ****
                  useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i),
  			elemtemplate, usexloc, useyloc, tovis);
--- 5066,5070 ----
                  useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(y);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i),
  			elemtemplate, usexloc, useyloc, tovis);
***************
*** 5080,5084 ****
              for (int i=0; i<nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0);
                  }
--- 5077,5081 ----
              for (int i=0; i<nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(y);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0);
                  }
***************
*** 5261,5265 ****
      template_class = class_new(gensym("template"), 0, (t_method)template_free,
          sizeof(t_template), CLASS_PD, 0);
!     class_addmethod3(pd_canvasmaker, template_usetemplate, "struct", "*");
      gtemplate_class = class_new(gensym("struct"), (t_newmethod)gtemplate_new, (t_method)gtemplate_free,
          sizeof(t_gtemplate), CLASS_NOINLET, A_GIMME, 0);
--- 5258,5262 ----
      template_class = class_new(gensym("template"), 0, (t_method)template_free,
          sizeof(t_template), CLASS_PD, 0);
!     class_addmethod3(pd_canvasmaker._class, template_usetemplate, "struct", "*");
      gtemplate_class = class_new(gensym("struct"), (t_newmethod)gtemplate_new, (t_method)gtemplate_free,
          sizeof(t_gtemplate), CLASS_NOINLET, A_GIMME, 0);
***************
*** 6185,6189 ****
  void canvas_msg(t_canvas *gl, t_symbol *s, int argc, t_atom *argv) {
      t_message *x = (t_message *)pd_new(message_class);
!     x->mresp.mr_pd = mresp_class;
      x->mresp.outlet = outlet_new(x,&s_float);
      x->te_width = 0; /* don't know it yet. */
--- 6182,6186 ----
  void canvas_msg(t_canvas *gl, t_symbol *s, int argc, t_atom *argv) {
      t_message *x = (t_message *)pd_new(message_class);
!     x->mresp.mr_pd._class = mresp_class;
      x->mresp.outlet = outlet_new(x,&s_float);
      x->te_width = 0; /* don't know it yet. */
***************
*** 6327,6333 ****
      t_canvas *c = (t_canvas *)z; /* in case it is */
      if (x->te_type == T_OBJECT) {
!     	if (zgetfn(&x->te_pd, gensym("saveto")) &&
  	 !(x->_class==canvas_class && (canvas_isabstraction(c) || canvas_istable(c)))) {
!     	    mess1(&x->te_pd, gensym("saveto"), b);
      	    binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->te_xpix, (t_int)x->te_ypix);
      	} else {
--- 6324,6330 ----
      t_canvas *c = (t_canvas *)z; /* in case it is */
      if (x->te_type == T_OBJECT) {
!     	if (zgetfn(x,gensym("saveto")) &&
  	 !(x->_class==canvas_class && (canvas_isabstraction(c) || canvas_istable(c)))) {
!     	    mess1(x,gensym("saveto"),b);
      	    binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->te_xpix, (t_int)x->te_ypix);
      	} else {
***************
*** 7617,7621 ****
      /* here is the real creator function, invoked in patch files
         by sending the "canvas" message to #N, which is bound to pd_canvasmaker. */
!     class_addmethod3(pd_canvasmaker,canvas_new,"canvas","*");
      class_addmethod3(c,canvas_restore,"restore","*");
      class_addmethod3(c,canvas_coords,"coords","*");
--- 7614,7618 ----
      /* here is the real creator function, invoked in patch files
         by sending the "canvas" message to #N, which is bound to pd_canvasmaker. */
!     class_addmethod3(pd_canvasmaker._class,canvas_new,"canvas","*");
      class_addmethod3(c,canvas_restore,"restore","*");
      class_addmethod3(c,canvas_coords,"coords","*");





More information about the Pd-cvs mailing list