[PD-cvs] externals/miXed/toxy Makefile,1.8,1.9 plustot.print.c,1.1,1.2 widget.c,1.9,1.10 widgettype.c,1.7,1.8 widgettype.h,1.2,1.3

Krzysztof Czaja krzyszcz at users.sourceforge.net
Wed Dec 8 16:40:16 CET 2004


Update of /cvsroot/pure-data/externals/miXed/toxy
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10934/toxy

Modified Files:
	Makefile plustot.print.c widget.c widgettype.c widgettype.h 
Log Message:
various bug-fixes, maxmode, toxy .#args

Index: plustot.print.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/toxy/plustot.print.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** plustot.print.c	19 Feb 2004 22:23:18 -0000	1.1
--- plustot.print.c	8 Dec 2004 15:40:14 -0000	1.2
***************
*** 17,20 ****
--- 17,25 ----
  static t_class *plustot_print_class;
  
+ static char *plustot_print_symbolname(t_symbol *s)
+ {
+     return (s && s != &s_ ? s->s_name : "???");
+ }
+ 
  static void plustot_print_symbol(t_plustot_print *x, t_symbol *s)
  {
***************
*** 37,44 ****
  		if (av->a_type == A_SYMBOL || av->a_type == A_FLOAT)
  		{
! 		    char *lstring =
! 			(x->x_label ? x->x_label->s_name :
! 			 loud_symbolname(plustag_typename(s, 1, (t_pd *)x),
! 					 "???"));
  		    if (glname)
  			startpost("%s (%s):", lstring, glname->s_name);
--- 42,48 ----
  		if (av->a_type == A_SYMBOL || av->a_type == A_FLOAT)
  		{
! 		    char *lstring = (x->x_label ? x->x_label->s_name :
! 				     plustot_print_symbolname(
! 					 plustag_typename(s, 1, (t_pd *)x)));
  		    if (glname)
  			startpost("%s (%s):", lstring, glname->s_name);

Index: widgettype.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/toxy/widgettype.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** widgettype.c	17 Apr 2004 17:45:29 -0000	1.7
--- widgettype.c	8 Dec 2004 15:40:14 -0000	1.8
***************
*** 17,21 ****
  
  #define WIDGETTYPE_VERBOSE
! //#define WIDGETTYPE_DEBUG
  
  struct _widgettype
--- 17,21 ----
  
  #define WIDGETTYPE_VERBOSE
! #define WIDGETTYPE_DEBUG
  
  struct _widgettype
***************
*** 29,32 ****
--- 29,34 ----
      t_props      *wt_arguments;
      t_scriptlet  *wt_iniscript;
+     t_scriptlet  *wt_newscript;
+     t_scriptlet  *wt_freescript;
  };
  
***************
*** 37,41 ****
      t_scriptlet   *mw_setupscript;
      t_dict        *mw_typemap;
!     t_widgettype  *mw_mastertype;  /* contains master iniscript */
      t_widgettype  *mw_parsedtype;  /* the type currently parsed, if loading */
      t_binbuf      *mw_bb;          /* auxiliary, LATER remove */
--- 39,43 ----
      t_scriptlet   *mw_setupscript;
      t_dict        *mw_typemap;
!     t_widgettype  *mw_mastertype;  /* contains master initializer */
      t_widgettype  *mw_parsedtype;  /* the type currently parsed, if loading */
      t_binbuf      *mw_bb;          /* auxiliary, LATER remove */
***************
*** 69,72 ****
--- 71,78 ----
      wt->wt_iniscript = scriptlet_new((t_pd *)wt, mw->mw_target, mw->mw_target,
  				     0, 0, widgettype_cvhook);
+     wt->wt_newscript = scriptlet_new((t_pd *)wt, mw->mw_target, mw->mw_target,
+ 				     0, 0, widgettype_cvhook);
+     wt->wt_freescript = scriptlet_new((t_pd *)wt, mw->mw_target, mw->mw_target,
+ 				      0, 0, widgettype_cvhook);
      dict_bind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey);
      return (wt);
***************
*** 94,98 ****
  	    cls = buf;
  	typekey = dict_key(mw->mw_typemap, buf);
! 	typeval = (t_widgettype *)dict_value(mw->mw_typemap, typekey);
  	if (caller == (t_pd *)mw)
  	{  /* setup.wid or built-in defaults */
--- 100,104 ----
  	    cls = buf;
  	typekey = dict_key(mw->mw_typemap, buf);
! 	typeval = (t_widgettype *)dict_firstvalue(mw->mw_typemap, typekey, 0);
  	if (caller == (t_pd *)mw)
  	{  /* setup.wid or built-in defaults */
***************
*** 163,166 ****
--- 169,190 ----
  	}
      }
+     else if (sel == '@')
+     {  /* multiline definition of a handler */
+ 	scriptlet_nextword(buf);
+ 	if (mw->mw_parsedtype)
+ 	{
+ 	    if (!strcmp(buf, "vis") || !strcmp(buf, "ini"))
+ 		return (mw->mw_parsedtype->wt_iniscript);
+ 	    else if (!strcmp(buf, "new"))
+ 		return (mw->mw_parsedtype->wt_newscript);
+ 	    else if (!strcmp(buf, "free"))
+ 		return (mw->mw_parsedtype->wt_freescript);
+ 	    else
+ 	    {
+ 		/* LATER start parsing any method handler: search for it,
+ 		   create if not found, return */
+ 	    }
+ 	}
+     }
      return (SCRIPTLET_UNLOCK);
  }
***************
*** 171,177 ****
      /* Design decision: setup.wid defs are NOT overridden by <type>.wid
         (sacrificing flexibility for feature stability). */
!     if (wt = (t_widgettype *)dict_value(masterwidget->mw_typemap,
! 					dict_key(masterwidget->mw_typemap,
! 						 s->s_name)))
  	masterwidget->mw_parsedtype = 0;
      else
--- 195,201 ----
      /* Design decision: setup.wid defs are NOT overridden by <type>.wid
         (sacrificing flexibility for feature stability). */
!     if (wt = (t_widgettype *)dict_firstvalue(masterwidget->mw_typemap,
! 					     dict_key(masterwidget->mw_typemap,
! 						      s->s_name), 0))
  	masterwidget->mw_parsedtype = 0;
      else
***************
*** 194,198 ****
  	{
  #ifdef WIDGETTYPE_VERBOSE
! 	    post("using %s's initializer", s->s_name);
  #endif
  	    if (!scriptlet_isempty(mwsp))
--- 218,222 ----
  	{
  #ifdef WIDGETTYPE_VERBOSE
! 	    post("using a separate %s's definition file", s->s_name);
  #endif
  	    if (!scriptlet_isempty(mwsp))
***************
*** 240,250 ****
  }
  
! char *widgettype_getcontents(t_widgettype *wt, int *szp)
  {
      return (scriptlet_getcontents(wt->wt_iniscript, szp));
  }
  
! int widgettype_evaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			int visedonly, int ac, t_atom *av, t_props *argprops)
  {
      return (scriptlet_evaluate(wt->wt_iniscript, outsp,
--- 264,284 ----
  }
  
! char *widgettype_getinitializer(t_widgettype *wt, int *szp)
  {
      return (scriptlet_getcontents(wt->wt_iniscript, szp));
  }
  
! char *widgettype_getconstructor(t_widgettype *wt, int *szp)
! {
!     return (scriptlet_getcontents(wt->wt_newscript, szp));
! }
! 
! char *widgettype_getdestructor(t_widgettype *wt, int *szp)
! {
!     return (scriptlet_getcontents(wt->wt_freescript, szp));
! }
! 
! int widgettype_ievaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			 int visedonly, int ac, t_atom *av, t_props *argprops)
  {
      return (scriptlet_evaluate(wt->wt_iniscript, outsp,
***************
*** 252,255 ****
--- 286,303 ----
  }
  
+ int widgettype_cevaluate(t_widgettype *wt, t_scriptlet *outsp,
+ 			 int visedonly, int ac, t_atom *av, t_props *argprops)
+ {
+     return (scriptlet_evaluate(wt->wt_newscript, outsp,
+ 			       visedonly, ac, av, argprops));
+ }
+ 
+ int widgettype_devaluate(t_widgettype *wt, t_scriptlet *outsp,
+ 			 int visedonly, int ac, t_atom *av, t_props *argprops)
+ {
+     return (scriptlet_evaluate(wt->wt_freescript, outsp,
+ 			       visedonly, ac, av, argprops));
+ }
+ 
  void widgettype_setup(void)
  {
***************
*** 265,273 ****
  }
  
! int masterwidget_evaluate(t_scriptlet *outsp, int visedonly,
! 			  int ac, t_atom *av, t_props *argprops)
  {
!     return (scriptlet_evaluate(masterwidget->mw_mastertype->wt_iniscript,
! 			       outsp, visedonly, ac, av, argprops));
  }
  
--- 313,320 ----
  }
  
! char *masterwidget_getinitializer(int *szp)
  {
!     return (scriptlet_getcontents(masterwidget->mw_mastertype->wt_iniscript,
! 				  szp));
  }
  
***************
*** 277,281 ****
  }
  
! void masterwidget_initialize(void)
  {
      int rcresult;
--- 324,335 ----
  }
  
! int masterwidget_ievaluate(t_scriptlet *outsp, int visedonly,
! 			   int ac, t_atom *av, t_props *argprops)
! {
!     return (scriptlet_evaluate(masterwidget->mw_mastertype->wt_iniscript,
! 			       outsp, visedonly, ac, av, argprops));
! }
! 
! void masterwidget_validate(void)
  {
      int rcresult;
***************
*** 316,320 ****
      }
      typekey = dict_key(masterwidget->mw_typemap, "master");
!     if ((typeval = (t_widgettype *)dict_value(masterwidget->mw_typemap, typekey))
  	&& !scriptlet_isempty(masterwidget->mw_setupscript))
      {
--- 370,375 ----
      }
      typekey = dict_key(masterwidget->mw_typemap, "master");
!     if ((typeval = (t_widgettype *)dict_firstvalue(masterwidget->mw_typemap,
! 						   typekey, 0))
  	&& !scriptlet_isempty(masterwidget->mw_setupscript))
      {

Index: widgettype.h
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/toxy/widgettype.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** widgettype.h	19 Feb 2004 22:23:18 -0000	1.2
--- widgettype.h	8 Dec 2004 15:40:14 -0000	1.3
***************
*** 1,3 ****
! /* Copyright (c) 2003 krzYszcz and others.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
--- 1,3 ----
! /* Copyright (c) 2003-2004 krzYszcz and others.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
***************
*** 19,31 ****
  t_props *widgettype_getarguments(t_widgettype *wt);
  char *widgettype_propname(t_symbol *s);
! char *widgettype_getcontents(t_widgettype *wt, int *szp);
! int widgettype_evaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			int visedonly, int ac, t_atom *av, t_props *argprops);
  void widgettype_setup(void);
  
  char *masterwidget_getcontents(int *szp);
! int masterwidget_evaluate(t_scriptlet *outsp, int visedonly,
! 			  int ac, t_atom *av, t_props *argprops);
! void masterwidget_initialize(void);
  
  #endif
--- 19,38 ----
  t_props *widgettype_getarguments(t_widgettype *wt);
  char *widgettype_propname(t_symbol *s);
! char *widgettype_getinitializer(t_widgettype *wt, int *szp);
! char *widgettype_getconstructor(t_widgettype *wt, int *szp);
! char *widgettype_getdestructor(t_widgettype *wt, int *szp);
! int widgettype_ievaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			 int visedonly, int ac, t_atom *av, t_props *argprops);
! int widgettype_cevaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			 int visedonly, int ac, t_atom *av, t_props *argprops);
! int widgettype_devaluate(t_widgettype *wt, t_scriptlet *outsp,
! 			 int visedonly, int ac, t_atom *av, t_props *argprops);
  void widgettype_setup(void);
  
+ char *masterwidget_getinitializer(int *szp);
  char *masterwidget_getcontents(int *szp);
! int masterwidget_ievaluate(t_scriptlet *outsp, int visedonly,
! 			   int ac, t_atom *av, t_props *argprops);
! void masterwidget_validate(void);
  
  #endif

Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/toxy/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Makefile	31 Mar 2004 10:24:19 -0000	1.8
--- Makefile	8 Dec 2004 15:40:14 -0000	1.9
***************
*** 9,12 ****
--- 9,13 ----
  $(WIQFILE): $(WIDPATH)
  	@echo transferring widget definitions from \"$<\" to \"$@\"
+ # LATER think how to replace puts with pdtk_post
  	@echo -e '// Do not edit this file (edit "$<", and run "make").\
  \n//\nputs stderr [concat loading built-in widget definitions]' \

Index: widget.c
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/toxy/widget.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** widget.c	17 Apr 2004 17:45:29 -0000	1.9
--- widget.c	8 Dec 2004 15:40:14 -0000	1.10
***************
*** 3,8 ****
   * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
  
- /* LATER consider supporting a special @ini handler, also think about
-    differentiating 'ini' from 'vis' */
  /* LATER think about reloading method for .wid files */
  
--- 3,6 ----
***************
*** 40,43 ****
--- 38,53 ----
  } t_widgetentry;
  
+ /* move to widgettype.c&h */
+ typedef struct _widgethandlers
+ {
+     t_scriptlet  *wh_initializer;
+     t_scriptlet  *wh_new;
+     t_scriptlet  *wh_free;
+     t_scriptlet  *wh_bang;
+     t_scriptlet  *wh_float;
+     t_scriptlet  *wh_symbol;
+     /* ... (varsized vector) */
+ } t_widgethandlers;
+ 
  typedef struct _widget
  {
***************
*** 56,59 ****
--- 66,70 ----
      t_props       *x_handlers;    /* instance handlers */
      t_props       *x_arguments;   /* instance arguments */
+     t_widgethandlers  x_cache;    /* actual handlers */
      t_scriptlet   *x_iniscript;   /* instance initializer */
      t_scriptlet   *x_optscript;   /* option scriptlet */
***************
*** 146,161 ****
  }
  
! static void widget_postatoms(char *msg, int ac, t_atom *av)
  {
!     startpost(msg);
!     while (ac--)
      {
! 	if (av->a_type == A_FLOAT)
! 	    postfloat(av->a_w.w_float);
! 	else if (av->a_type == A_SYMBOL)
! 	    poststring(av->a_w.w_symbol->s_name);
! 	av++;
      }
-     endpost();
  }
  
--- 157,189 ----
  }
  
! /* pity cannot set sys_printtostderr... */
! static void widget_postatoms(FILE *fp, char *msg, int ac, t_atom *av)
  {
!     if (fp)
      {
! 	fputs(msg, fp);
! 	while (ac--)
! 	{
! 	    char buf[80];
! 	    atom_string(av, buf, 80);
! 	    fputc(' ', fp);
! 	    fputs(buf, fp);
! 	    av++;
! 	}
! 	fputc('\n', fp);
!     }
!     else
!     {
! 	startpost(msg);
! 	while (ac--)
! 	{
! 	    if (av->a_type == A_FLOAT)
! 		postfloat(av->a_w.w_float);
! 	    else if (av->a_type == A_SYMBOL)
! 		poststring(av->a_w.w_symbol->s_name);
! 	    av++;
! 	}
! 	endpost();
      }
  }
  
***************
*** 293,298 ****
  static void widget_pushinits(t_widget *x)
  {
!     if (masterwidget_evaluate(x->x_transient, 0, 0, 0, x->x_arguments))
! 	scriptlet_vpush(x->x_transient, "masterinits");
      else
  	bug("widget_pushinits (master)");
--- 321,326 ----
  static void widget_pushinits(t_widget *x)
  {
!     if (masterwidget_ievaluate(x->x_transient, 0, 0, 0, x->x_arguments))
! 	scriptlet_vpush(x->x_transient, "masterinit");
      else
  	bug("widget_pushinits (master)");
***************
*** 300,316 ****
      {
  	int sz;
! 	if (widgettype_evaluate(x->x_typedef, x->x_transient, 0,
! 				0, 0, x->x_arguments))
! 	    scriptlet_vpush(x->x_transient, "typeinits");
! 	else if (*widgettype_getcontents(x->x_typedef, &sz) && sz > 0)
  	    bug("widget_pushinits (type)");
      }
      if (scriptlet_evaluate(x->x_iniscript, x->x_transient, 0,
  			   0, 0, x->x_arguments))
! 	scriptlet_vpush(x->x_transient, "iteminits");
      else if (!scriptlet_isempty(x->x_iniscript))
  	bug("widget_pushinits (instance)");
  }
  
  static void widget_getconfig(t_widget *x)
  {
--- 328,372 ----
      {
  	int sz;
! 	if (widgettype_ievaluate(x->x_typedef, x->x_transient, 0,
! 				 0, 0, x->x_arguments))
! 	    scriptlet_vpush(x->x_transient, "typeinit");
! 	else if (*widgettype_getinitializer(x->x_typedef, &sz) && sz > 0)
  	    bug("widget_pushinits (type)");
      }
      if (scriptlet_evaluate(x->x_iniscript, x->x_transient, 0,
  			   0, 0, x->x_arguments))
! 	scriptlet_vpush(x->x_transient, "iteminit");
      else if (!scriptlet_isempty(x->x_iniscript))
  	bug("widget_pushinits (instance)");
  }
  
+ static void widget_pushconstructors(t_widget *x)
+ {
+     /* LATER master constructor */
+     if (widgettype_isdefined(x->x_typedef))
+     {
+ 	int sz;
+ 	if (widgettype_cevaluate(x->x_typedef, x->x_transient, 0,
+ 				 0, 0, x->x_arguments))
+ 	    scriptlet_push(x->x_transient);
+ 	else if (*widgettype_getconstructor(x->x_typedef, &sz) && sz > 0)
+ 	    bug("widget_pushconstructors (type)");
+     }
+ }
+ 
+ static void widget_pushdestructors(t_widget *x)
+ {
+     /* LATER master destructor */
+     if (widgettype_isdefined(x->x_typedef))
+     {
+ 	int sz;
+ 	if (widgettype_devaluate(x->x_typedef, x->x_transient, 0,
+ 				 0, 0, x->x_arguments))
+ 	    scriptlet_push(x->x_transient);
+ 	else if (*widgettype_getdestructor(x->x_typedef, &sz) && sz > 0)
+ 	    bug("widget_pushdestructors (type)");
+     }
+ }
+ 
  static void widget_getconfig(t_widget *x)
  {
***************
*** 466,470 ****
      else
      {
! 	/* LATER cache handlers */
      }
  }
--- 522,528 ----
      else
      {
! 	/* LATER cache handlers.
! 	   We get here both during construction, and after any change
! 	   in our handlers -- the cache never stales. */
      }
  }
***************
*** 698,702 ****
  {
  #if 0
!     /* moved to the gui side, in order to alow special chars in error message */
      startpost("tcl error:");
      postatom(ac, av);
--- 756,760 ----
  {
  #if 0
!     /* moved to the gui side -- supporting special chars in error message */
      startpost("tcl error:");
      postatom(ac, av);
***************
*** 840,876 ****
      int sz, i, nopt;
      t_atom *ap;
      char *bp, *key;
!     post("containing glist: %x", x->x_glist);
!     post("cv pathname%s %s", (pn ? ":" : ""), (pn ? pn->s_name : "unknown"));
!     post("my pathname%s %s", (mn ? ":" : ""), (mn ? mn->s_name : "unknown"));
      if (ap = props_getall(widgettype_getoptions(x->x_typedef), &nopt))
! 	widget_postatoms("default options:", nopt, ap);
      if (ap = props_getall(x->x_options, &nopt))
! 	widget_postatoms("instance options:", nopt, ap);
      if (ap = props_getall(widgettype_gethandlers(x->x_typedef), &nopt))
! 	widget_postatoms("default handlers:", nopt, ap);
      if (ap = props_getall(x->x_handlers, &nopt))
! 	widget_postatoms("instance handlers:", nopt, ap);
      if (ap = props_getall(widgettype_getarguments(x->x_typedef), &nopt))
! 	widget_postatoms("default arguments:", nopt, ap);
      if (ap = props_getall(x->x_arguments, &nopt))
! 	widget_postatoms("instance arguments:", nopt, ap);
!     post("dictionary:");
      bp = props_firstvalue(x->x_arguments, &key);
      while (bp)
      {
! 	post("\t%s: \"%s\"", key, bp);
  	bp = props_nextvalue(x->x_arguments, &key);
      }
      bp = scriptlet_getcontents(x->x_transient, &sz);
!     post("transient buffer (size %d):\n\"%s\"", sz, bp);
      bp = scriptlet_getcontents(x->x_optscript, &sz);
!     post("option buffer (size %d):\n\"%s\"", sz, bp);
!     bp = widgettype_getcontents(x->x_typedef, &sz);
!     post("type initializer (size %d):\n\"%s\"", sz, bp);
      bp = scriptlet_getcontents(x->x_iniscript, &sz);
!     post("instance initializer (size %d):\n\"%s\"", sz, bp);
      bp = masterwidget_getcontents(&sz);
!     post("setup definitions (size %d):\n\"%s\"", sz, bp);
  }
  #endif
--- 898,951 ----
      int sz, i, nopt;
      t_atom *ap;
+     static char bempty[] = "<empty>";
      char *bp, *key;
!     fprintf(stderr, "containing glist: %x\n", (int)x->x_glist);
!     fprintf(stderr, "cv pathname%s %s\n",
! 	    (pn ? ":" : ""), (pn ? pn->s_name : "unknown"));
!     fprintf(stderr, "my pathname%s %s\n",
! 	    (mn ? ":" : ""), (mn ? mn->s_name : "unknown"));
      if (ap = props_getall(widgettype_getoptions(x->x_typedef), &nopt))
! 	widget_postatoms(stderr, "default options:", nopt, ap);
      if (ap = props_getall(x->x_options, &nopt))
! 	widget_postatoms(stderr, "instance options:", nopt, ap);
      if (ap = props_getall(widgettype_gethandlers(x->x_typedef), &nopt))
! 	widget_postatoms(stderr, "default handlers:", nopt, ap);
      if (ap = props_getall(x->x_handlers, &nopt))
! 	widget_postatoms(stderr, "instance handlers:", nopt, ap);
      if (ap = props_getall(widgettype_getarguments(x->x_typedef), &nopt))
! 	widget_postatoms(stderr, "default arguments:", nopt, ap);
      if (ap = props_getall(x->x_arguments, &nopt))
! 	widget_postatoms(stderr, "instance arguments:", nopt, ap);
!     fprintf(stderr, "dictionary:\n");
      bp = props_firstvalue(x->x_arguments, &key);
      while (bp)
      {
! 	fprintf(stderr, "\t%s: \"%s\"\n", key, bp);
  	bp = props_nextvalue(x->x_arguments, &key);
      }
      bp = scriptlet_getcontents(x->x_transient, &sz);
!     fprintf(stderr, "transient buffer (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
      bp = scriptlet_getcontents(x->x_optscript, &sz);
!     fprintf(stderr, "option buffer (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
!     bp = widgettype_getconstructor(x->x_typedef, &sz);
!     fprintf(stderr, "type constructor (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
!     bp = widgettype_getdestructor(x->x_typedef, &sz);
!     fprintf(stderr, "type destructor (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
!     bp = masterwidget_getinitializer(&sz);
!     fprintf(stderr, "master initializer (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
!     bp = widgettype_getinitializer(x->x_typedef, &sz);
!     fprintf(stderr, "type initializer (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
      bp = scriptlet_getcontents(x->x_iniscript, &sz);
!     fprintf(stderr, "instance initializer (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
      bp = masterwidget_getcontents(&sz);
!     fprintf(stderr, "setup definitions (size %d):\n\"%s\"\n",
! 	    sz, (bp ? bp : bempty));
  }
  #endif
***************
*** 890,893 ****
--- 965,969 ----
  {
      widget_novis(x);
+     widget_pushdestructors(x);
      gui_unbind((t_pd *)x, x->x_cbtarget);
      gui_unbind((t_pd *)x, x->x_rptarget);
***************
*** 908,912 ****
      if (widget_transforming)
  	return (0);
!     masterwidget_initialize();
      x = (t_widget *)pd_new(widget_class);
      x->x_type = 0;
--- 984,988 ----
      if (widget_transforming)
  	return (0);
!     masterwidget_validate();
      x = (t_widget *)pd_new(widget_class);
      x->x_type = 0;
***************
*** 979,982 ****
--- 1055,1059 ----
      x->x_vised = 0;
      widget_attach(x);
+     widget_pushconstructors(x);
      return (x);
  }
***************
*** 989,993 ****
      if (!glist && complain)
  	loud_error((t_pd *)x, "bad canvas name '%s'", x->x_cvname->s_name);
!     return (glist);
  }
  
--- 1066,1070 ----
      if (!glist && complain)
  	loud_error((t_pd *)x, "bad canvas name '%s'", x->x_cvname->s_name);
!     return (glist_getcanvas(glist));
  }
  
***************
*** 1161,1165 ****
  {
      t_widgetentry *we;
!     post("attached widgets:");
      for (we = x->x_widgetlist; we; we = we->we_next)
      {
--- 1238,1242 ----
  {
      t_widgetentry *we;
!     fprintf(stderr, "attached widgets:\n");
      for (we = x->x_widgetlist; we; we = we->we_next)
      {
***************
*** 1167,1171 ****
  	t_towentry *te;
  	int other = 0, found = 0;
! 	startpost("\t%s %s", w->x_type->s_name, w->x_cbtarget->s_name);
  	for (te = w->x_towlist; te; te = te->te_next)
  	    if (te->te_tow == x)
--- 1244,1248 ----
  	t_towentry *te;
  	int other = 0, found = 0;
! 	fprintf(stderr, "\t%s %s", w->x_type->s_name, w->x_cbtarget->s_name);
  	for (te = w->x_towlist; te; te = te->te_next)
  	    if (te->te_tow == x)
***************
*** 1173,1178 ****
  	    else
  		other++;
! 	post(" (%d other tow%s)", other, (other == 1 ? "" : "s"));
! 	if (found != 1) post("BUG: listed %d times in widget's towlist", found);
      }
  }
--- 1250,1257 ----
  	    else
  		other++;
! 	fprintf(stderr, " (%d other tow%s)\n", other, (other == 1 ? "" : "s"));
! 	if (found != 1)
! 	    fprintf(stderr, "BUG: listed %d times in widget's towlist\n",
! 		    found);
      }
  }
***************
*** 1208,1213 ****
      char buf[64];
      x->x_glist = canvas_getcurrent();
!     if (s1 && s1 != &s_ && strcmp(s1->s_name, "."))
! 	x->x_cvremote = canvas_makebindsym(x->x_cvname = s1);
      else
      {
--- 1287,1312 ----
      char buf[64];
      x->x_glist = canvas_getcurrent();
!     if (s1 == &s_ || !strcmp(s1->s_name, "."))
! 	s1 = 0;
!     if (s1)
!     {
! 	if (strcmp(s1->s_name, ".parent"))
! 	    x->x_cvremote = canvas_makebindsym(x->x_cvname = s1);
! 	else
! 	{
! 	    if (x->x_glist->gl_owner)
! 	    {
! 		x->x_glist = x->x_glist->gl_owner;
! 		x->x_cvremote = 0;
! 		x->x_cvname = x->x_glist->gl_name;
! 	    }
! 	    else
! 	    {
! 		/* FIXME */
! 		loud_error((t_pd *)x, "no parent patch");
! 		x->x_cvremote = canvas_makebindsym(x->x_cvname = s1);
! 	    }
! 	}
!     }
      else
      {





More information about the Pd-cvs mailing list