From 5af9cc14b70f907f0d10a75aa28ad04bbd65ec0d Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 10 Dec 2004 20:47:06 +0000 Subject: restricted debug garbage to krzYszcz, few fixes in toxy svn path=/trunk/externals/miXed/; revision=2364 --- Makefile.common | 5 +++ ViCious/cyclone/makefile | 7 ++-- ViCious/toxy/makefile | 2 +- ViCious/toxy/snapfiles | 2 +- cyclone/hammer/Table.c | 2 + cyclone/hammer/coll.c | 4 +- cyclone/hammer/comment.c | 2 + cyclone/hammer/mtr.c | 4 +- cyclone/hammer/prob.c | 4 +- cyclone/hammer/seq.c | 2 + cyclone/hammer/sprintf.c | 2 + cyclone/hammer/zl.c | 2 + cyclone/shadow/dummies.c | 2 + cyclone/sickle/Line.c | 2 + cyclone/sickle/Scope.c | 2 + cyclone/sickle/bitshift.c | 2 + cyclone/sickle/curve.c | 2 + cyclone/sickle/pong.c | 2 + shared/common/binport.c | 4 +- shared/common/dict.c | 24 +++++++----- shared/common/mifi.c | 2 + shared/common/port.c | 2 + shared/common/props.c | 2 + shared/common/vefl.c | 8 ++-- shared/hammer/gui.c | 24 +++++++----- shared/sickle/sic.c | 9 +++-- shared/toxy/plusbob.c | 2 + shared/toxy/scriptlet.c | 9 ++++- shared/unstable/forky.c | 6 ++- shared/unstable/fringe.c | 6 ++- test/toxy/testmess.wid | 21 ++++++++-- toxy/build_counter | 4 +- toxy/plustot.c | 98 ++++++++++++++++++++++++----------------------- toxy/plustot.h | 6 ++- toxy/plustot.qlist.c | 2 + toxy/tot.c | 2 + toxy/widget.c | 2 + toxy/widgettype.c | 9 ++++- toxy/widgettype.h | 4 ++ 39 files changed, 199 insertions(+), 97 deletions(-) diff --git a/Makefile.common b/Makefile.common index 2184624..93ffeb3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -89,8 +89,13 @@ SOURCES = $(CX_SOURCES) $(AX_SOURCES) $(LX_SOURCES) $(OTHER_SOURCES) \ INCLUDES = -I. -I$(PD_DIR) -I$(SHARED_DIR) +ifeq ($(shell whoami),krzYszcz) WARN_CFLAGS = -Wall -W -Wstrict-prototypes -Werror \ -Wno-unused -Wno-parentheses -Wno-switch +else +WARN_CFLAGS = -Wall -W -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch +endif DBG_CFLAGS = CFLAGS = $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(INCLUDES) diff --git a/ViCious/cyclone/makefile b/ViCious/cyclone/makefile index 6fcc05f..58c2457 100644 --- a/ViCious/cyclone/makefile +++ b/ViCious/cyclone/makefile @@ -27,7 +27,7 @@ LIBS = $(VCLIBDIR)\libc.lib \ cyclone: cyclone.dll hammer.dll sickle.dll dummies.dll maxmode.dll cyclist.exe @cd $(ROOTDIR) - @$(ZIPCOMMAND) cyclone-$(CYCLONE_SNAPSHOT).zip $(SNAPFILES) + @$(ZIPCOMMAND) cyclone-$(CYCLONE_SNAPSHOT)-dll.zip $(SNAPFILES) cyclone.dll: $(CYCLONE_OBJECTS) -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) @@ -66,12 +66,13 @@ maxmode.dll: $(MAXMODE_OBJECTS) cyclist.exe: $(SHAREDDIR)\common\binport.c \ $(SHAREDDIR)\common\lex.c $(SHAREDDIR)\unstable\standalone.c - -del /S $(SHAREDDIR)\common\binport.obj $(SHAREDDIR)\common\lex.obj + -del /S $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\lex.obj $(SHAREDDIR)\unstable\standalone.obj -cl $(CFLAGS) $(INCLUDES) /DMIXED_STANDALONE /o $@ \ $(VCLIBDIR)\libc.lib $(SHAREDDIR)\common\binport.c \ $(SHAREDDIR)\common\lex.c $(SHAREDDIR)\unstable\standalone.c -@move $@ $(BINDIR) - -del /S binport.obj lex.obj + -del /S binport.obj lex.obj standalone.obj .c.obj: ; cl /c $(CFLAGS) $(INCLUDES) /Fo$*.obj $*.c diff --git a/ViCious/toxy/makefile b/ViCious/toxy/makefile index cf55984..15e1bc5 100644 --- a/ViCious/toxy/makefile +++ b/ViCious/toxy/makefile @@ -27,7 +27,7 @@ LIBS = $(VCLIBDIR)\libc.lib \ toxy: tot.dll tow.dll widget.dll @cd $(ROOTDIR) - @$(ZIPCOMMAND) toxy-$(TOXY_SNAPSHOT).zip $(SNAPFILES) + @$(ZIPCOMMAND) toxy-$(TOXY_SNAPSHOT)-dll.zip $(SNAPFILES) tot.dll: $(TOT_OBJECTS) -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) diff --git a/ViCious/toxy/snapfiles b/ViCious/toxy/snapfiles index 301180a..ee0ad69 100644 --- a/ViCious/toxy/snapfiles +++ b/ViCious/toxy/snapfiles @@ -6,5 +6,5 @@ SNAPFILES = \ miXed\ViCious\toxy\objects \ miXed\ViCious\toxy\snapfiles \ miXed\LICENSE.txt \ - miXed\test\toxy*.* \ + miXed\test\toxy\*.* \ miXed\test\toxy\stress\*.* diff --git a/cyclone/hammer/Table.c b/cyclone/hammer/Table.c index e613293..66543e3 100644 --- a/cyclone/hammer/Table.c +++ b/cyclone/hammer/Table.c @@ -15,7 +15,9 @@ #include "common/rand.h" #include "hammer/file.h" +#ifdef KRZYSZCZ #define TABLE_DEBUG +#endif #define TABLE_INISIZE 256 /* LATER rethink */ #define TABLE_DEFLENGTH 128 /* CHECKED */ diff --git a/cyclone/hammer/coll.c b/cyclone/hammer/coll.c index 031f6c6..ee2da0c 100644 --- a/cyclone/hammer/coll.c +++ b/cyclone/hammer/coll.c @@ -14,7 +14,9 @@ /* LATER make sure that ``reentrancy protection hack'' is really working... */ /* CHECKME default fname for 'write' -- c_filename, x_name, nothing? */ -#define COLL_DEBUG +#ifdef KRZYSZCZ +//#define COLL_DEBUG +#endif enum { COLL_HEADRESET, COLL_HEADNEXT, COLL_HEADPREV, /* distinction not used, currently */ diff --git a/cyclone/hammer/comment.c b/cyclone/hammer/comment.c index 03d4d03..567c5b1 100644 --- a/cyclone/hammer/comment.c +++ b/cyclone/hammer/comment.c @@ -20,7 +20,9 @@ /* our proxy of the text_class (not in the API), LATER do not cheat */ static t_class *makeshift_class; +#ifdef KRZYSZCZ //#define COMMENT_DEBUG +#endif #define COMMENT_LMARGIN 1 #define COMMENT_RMARGIN 1 diff --git a/cyclone/hammer/mtr.c b/cyclone/hammer/mtr.c index 51ba856..8b1b220 100644 --- a/cyclone/hammer/mtr.c +++ b/cyclone/hammer/mtr.c @@ -12,7 +12,9 @@ #include "common/loud.h" #include "hammer/file.h" -#define MTR_DEBUG +#ifdef KRZYSZCZ +//#define MTR_DEBUG +#endif #define MTR_C74MAXTRACKS 32 #define MTR_FILEBUFSIZE 4096 diff --git a/cyclone/hammer/prob.c b/cyclone/hammer/prob.c index 114a41d..6053808 100644 --- a/cyclone/hammer/prob.c +++ b/cyclone/hammer/prob.c @@ -12,7 +12,9 @@ were added to the list's head, and new transition-entries were added to the sublist's head. No sorting of any kind. */ -#define PROB_DEBUG 0 +#ifdef KRZYSZCZ +//#define PROB_DEBUG +#endif typedef struct _probtrans { diff --git a/cyclone/hammer/seq.c b/cyclone/hammer/seq.c index f29c803..c239478 100644 --- a/cyclone/hammer/seq.c +++ b/cyclone/hammer/seq.c @@ -15,7 +15,9 @@ #include "unstable/forky.h" #include "hammer/file.h" +#ifdef KRZYSZCZ #define SEQ_DEBUG +#endif #define SEQ_INISEQSIZE 256 /* LATER rethink */ #define SEQ_INITEMPOMAPSIZE 128 /* LATER rethink */ diff --git a/cyclone/hammer/sprintf.c b/cyclone/hammer/sprintf.c index cc9f2a7..47d94ec 100644 --- a/cyclone/hammer/sprintf.c +++ b/cyclone/hammer/sprintf.c @@ -7,7 +7,9 @@ #include "m_pd.h" #include "common/loud.h" +#ifdef KRZYSZCZ //#define SPRINTF_DEBUG +#endif /* Pattern types. These are the parsing routine's return values. If returned value is >= SPRINTF_MINSLOTTYPE, then another slot diff --git a/cyclone/hammer/zl.c b/cyclone/hammer/zl.c index 994eef9..7a5d471 100644 --- a/cyclone/hammer/zl.c +++ b/cyclone/hammer/zl.c @@ -12,7 +12,9 @@ /* CHECKME bang behaviour (every mode) */ /* LATER test reentrancy, tune speedwise */ +#ifdef KRZYSZCZ #define ZL_DEBUG +#endif #define ZL_INISIZE 32 /* LATER rethink */ #define ZL_MAXSIZE 256 diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c index 7e26e25..0a3c218 100644 --- a/cyclone/shadow/dummies.c +++ b/cyclone/shadow/dummies.c @@ -13,7 +13,9 @@ #include "common/loud.h" #include "common/port.h" +#ifdef KRZYSZCZ //#define DUMMIES_DEBUG +#endif static t_class *ccdummies_class; static int dummy_nclasses = 0; diff --git a/cyclone/sickle/Line.c b/cyclone/sickle/Line.c index 1b9e76c..20a81d2 100644 --- a/cyclone/sickle/Line.c +++ b/cyclone/sickle/Line.c @@ -8,7 +8,9 @@ #include "common/loud.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define LINE_DEBUG +#endif #define LINE_INISIZE 64 /* LATER rethink */ #define LINE_MAXSIZE 64 diff --git a/cyclone/sickle/Scope.c b/cyclone/sickle/Scope.c index adfa51b..adc4888 100644 --- a/cyclone/sickle/Scope.c +++ b/cyclone/sickle/Scope.c @@ -19,7 +19,9 @@ #include "unstable/forky.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define SCOPE_DEBUG +#endif /* these are powers of 2 + margins */ #define SCOPE_DEFWIDTH 130 /* CHECKED */ diff --git a/cyclone/sickle/bitshift.c b/cyclone/sickle/bitshift.c index db30fcd..28ee744 100644 --- a/cyclone/sickle/bitshift.c +++ b/cyclone/sickle/bitshift.c @@ -10,7 +10,9 @@ #include "m_pd.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define BITSHIFT_DEBUG +#endif typedef struct _bitshift { diff --git a/cyclone/sickle/curve.c b/cyclone/sickle/curve.c index 2bad587..78f1427 100644 --- a/cyclone/sickle/curve.c +++ b/cyclone/sickle/curve.c @@ -10,7 +10,9 @@ #include "common/clc.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define CURVE_DEBUG +#endif /* CHECKED apparently c74's formula has not been carefully tuned (yet?). It has 5% deviation from the straight line for ccinput = 0 at half-domain, diff --git a/cyclone/sickle/pong.c b/cyclone/sickle/pong.c index d52ed44..2878842 100644 --- a/cyclone/sickle/pong.c +++ b/cyclone/sickle/pong.c @@ -8,7 +8,9 @@ #include "unstable/forky.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define PONG_DEBUG +#endif #define PONG_DEFLO 0. #define PONG_DEFHI 1. diff --git a/shared/common/binport.c b/shared/common/binport.c index cb3d201..4fe46e8 100644 --- a/shared/common/binport.c +++ b/shared/common/binport.c @@ -28,9 +28,11 @@ #include "unstable/standalone.h" -#define BINPORT_VERBOSE +#ifdef KRZYSZCZ //#define BINPORT_DEBUG #endif +#define BINPORT_VERBOSE +#endif #include "common/lex.h" #include "binport.h" diff --git a/shared/common/dict.c b/shared/common/dict.c index 0871f81..f2dd838 100644 --- a/shared/common/dict.c +++ b/shared/common/dict.c @@ -10,8 +10,10 @@ #include "m_pd.h" #include "common/dict.h" -#define DICT_VERBOSE +#ifdef KRZYSZCZ //#define DICT_DEBUG +#endif +#define DICT_VERBOSE #define DICT_HASHSIZE_DEFAULT 1024 #define DICT_HASHSIZE_MIN 8 @@ -62,7 +64,8 @@ t_dict *dict_new(size_t hashsize) else for (sz = DICT_HASHSIZE_MAX; sz > DICT_HASHSIZE_MIN; sz >>= 1) if (sz <= hashsize) break; #ifdef DICT_DEBUG - post("allocating dictionary with %d-element hashtable", sz); + fprintf(stderr, + "allocating dictionary with %d-element hashtable\n", sz); #endif if (x->d_hashtable = getbytes((x->d_hashsize = sz) * sizeof(*x->d_hashtable))) @@ -91,7 +94,7 @@ t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym) char *s2 = s; int mask = x->d_hashsize - 1; #ifdef DICT_DEBUG - startpost("make symbol-key from \"%s\"", s); + fprintf(stderr, "make symbol-key from \"%s\"", s); #endif while (*s2) { @@ -102,17 +105,17 @@ t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym) } sym1 = x->d_hashtable + (hash2 & mask); #ifdef DICT_DEBUG - post(" in slot %d", (hash2 & mask)); + fprintf(stderr, " in slot %d\n", (hash2 & mask)); #endif while (sym2 = *sym1) { #ifdef DICT_DEBUG - post("try \"%s\"", sym2->s_name); + fprintf(stderr, "try \"%s\"\n", sym2->s_name); #endif if (!strcmp(sym2->s_name, s)) { #ifdef DICT_DEBUG - post("found at address %x", (int)sym2); + fprintf(stderr, "found at address %x\n", (int)sym2); #endif return(sym2); } @@ -129,7 +132,7 @@ t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym) } *sym1 = sym2; #ifdef DICT_DEBUG - post("appended at address %x", (int)sym2); + fprintf(stderr, "appended at address %x\n", (int)sym2); #endif return (sym2); } @@ -144,12 +147,12 @@ t_symbol *dict_key(t_dict *x, char *s) void dict_bind(t_dict *x, t_pd *obj, t_symbol *s) { #ifdef DICT_DEBUG - post("bind %x to \"%s\" at %x", (int)obj, s->s_name, (int)s); + fprintf(stderr, "bind %x to \"%s\" at %x\n", (int)obj, s->s_name, (int)s); #endif if (s->s_thing) { #ifdef DICT_DEBUG - post("(next one)"); + fprintf(stderr, "(next one)\n"); #endif if (*s->s_thing == x->d_bindlist_class) { @@ -183,7 +186,8 @@ void dict_bind(t_dict *x, t_pd *obj, t_symbol *s) void dict_unbind(t_dict *x, t_pd *obj, t_symbol *s) { #ifdef DICT_DEBUG - post("unbind %x from \"%s\" at %x", (int)obj, s->s_name, (int)s); + fprintf(stderr, "unbind %x from \"%s\" at %x\n", + (int)obj, s->s_name, (int)s); #endif if (s->s_thing == obj) s->s_thing = 0; else if (s->s_thing && *s->s_thing == x->d_bindlist_class) diff --git a/shared/common/mifi.c b/shared/common/mifi.c index 1b9d367..ac491f5 100644 --- a/shared/common/mifi.c +++ b/shared/common/mifi.c @@ -69,7 +69,9 @@ typedef unsigned char uchar; #endif #endif +#ifdef KRZYSZCZ #define MIFI_DEBUG +#endif #define MIFI_VERBOSE #define MIFI_SHORTESTEVENT 2 /* singlebyte delta and one databyte */ diff --git a/shared/common/port.c b/shared/common/port.c index 99f8211..5c14acb 100644 --- a/shared/common/port.c +++ b/shared/common/port.c @@ -26,7 +26,9 @@ #include "common/binport.h" #include "common/port.h" +#ifdef KRZYSZCZ //#define PORT_DEBUG +#endif #define PORT_LOG #define PORT_DUMP /* fill separate files with ignored data, e.g. pictures */ diff --git a/shared/common/props.c b/shared/common/props.c index 6079308..f5f2763 100644 --- a/shared/common/props.c +++ b/shared/common/props.c @@ -7,7 +7,9 @@ #include "common/grow.h" #include "common/props.h" +#ifdef KRZYSZCZ //#define PROPS_DEBUG +#endif #define PROPS_INISIZE 32 /* LATER rethink */ #define PROPS_MAXOTHERS 32 diff --git a/shared/common/vefl.c b/shared/common/vefl.c index 19f37a2..b7230d5 100644 --- a/shared/common/vefl.c +++ b/shared/common/vefl.c @@ -19,12 +19,10 @@ #include "common/loud.h" #include "common/vefl.h" -#if 1 -#define VEFL_VERBOSE -#if 0 -#define VEFL_DEBUG -#endif +#ifdef KRZYSZCZ +//#define VEFL_DEBUG #endif +#define VEFL_VERBOSE /* on failure *vszp is not modified */ t_float *vefl_get(t_symbol *name, int *vszp, int indsp, t_pd *complain) diff --git a/shared/hammer/gui.c b/shared/hammer/gui.c index 7106a0a..388b14b 100644 --- a/shared/hammer/gui.c +++ b/shared/hammer/gui.c @@ -10,7 +10,9 @@ #include "g_canvas.h" #include "hammer/gui.h" +#ifdef KRZYSZCZ //#define HAMMERGUI_DEBUG +#endif static t_class *hammergui_class = 0; static t_hammergui *hammergui_sink = 0; @@ -27,6 +29,7 @@ static void hammergui_anything(t_hammergui *snk, needed in order to keep Pd's message system happy in a ``gray period'' -- after last master is unbound, and before gui bindings are cleared. */ #ifdef HAMMERGUI_DEBUG + /* FIXME */ startpost("%s", s->s_name); postatom(ac, av); post(" (sink %x)", (int)snk); @@ -37,7 +40,7 @@ static void hammergui_anything(t_hammergui *snk, static void hammergui__up(t_hammergui *snk, t_floatarg f) { #ifdef HAMMERGUI_DEBUG - post("_up %g (sink %x)", f, (int)snk); + fprintf(stderr, "_up %g (sink %x)\n", f, (int)snk); #endif if (!snk->g_psmouse) { @@ -75,7 +78,8 @@ static void hammergui__up(t_hammergui *snk, t_floatarg f) static void hammergui__focus(t_hammergui *snk, t_symbol *s, t_floatarg f) { #ifdef HAMMERGUI_DEBUG - post("_focus %s %g (sink %x)", (s ? s->s_name : "???"), f, (int)snk); + fprintf(stderr, "_focus %s %g (sink %x)\n", + (s ? s->s_name : "???"), f, (int)snk); #endif if (!snk->g_psfocus) { @@ -94,7 +98,8 @@ static void hammergui__focus(t_hammergui *snk, t_symbol *s, t_floatarg f) static void hammergui__vised(t_hammergui *snk, t_symbol *s, t_floatarg f) { #ifdef HAMMERGUI_DEBUG - post("_vised %s %g (sink %x)", (s ? s->s_name : "???"), f, (int)snk); + fprintf(stderr, "_vised %s %g (sink %x)\n", + (s ? s->s_name : "???"), f, (int)snk); #endif if (!snk->g_psvised) { @@ -120,7 +125,7 @@ static void hammergui__vised(t_hammergui *snk, t_symbol *s, t_floatarg f) static void hammergui_dobindmouse(t_hammergui *snk) { #ifdef HAMMERGUI_DEBUG - post("dobindmouse (sink %x)", (int)snk); + fprintf(stderr, "dobindmouse (sink %x)\n", (int)snk); #endif #if 0 /* How to be notified about changes of button state, prior to gui objects @@ -185,7 +190,7 @@ static void hammergui__refocus(t_hammergui *snk) static void hammergui_dobindvised(t_hammergui *snk) { #ifdef HAMMERGUI_DEBUG - post("dobindvised (sink %x)", (int)snk); + fprintf(stderr, "dobindvised (sink %x)\n", (int)snk); #endif sys_vgui("bind Canvas <> \ {if {[hammergui_ispatcher %%W]} \ @@ -224,8 +229,9 @@ static int hammergui_setup(void) { char *cname = class_getname(*ps_hashhammergui->s_thing); #ifdef HAMMERGUI_DEBUG - post("'%s' already registered as the global hammergui sink ", - (cname ? cname : "???")); + fprintf(stderr, + "'%s' already registered as the global hammergui sink \n", + (cname ? cname : "???")); #endif if (strcmp(cname, ps__hammergui->s_name)) { @@ -417,7 +423,7 @@ static int hammergui_visedvalidate(int dosetup) void hammergui_bindmouse(t_pd *master) { #ifdef HAMMERGUI_DEBUG - post("bindmouse, master %x", (int)master); + fprintf(stderr, "bindmouse, master %x\n", (int)master); #endif hammergui_validate(1); hammergui_mousevalidate(1); @@ -506,7 +512,7 @@ void hammergui_unbindfocus(t_pd *master) void hammergui_bindvised(t_pd *master) { #ifdef HAMMERGUI_DEBUG - post("bindvised, master %x", (int)master); + fprintf(stderr, "bindvised, master %x\n", (int)master); #endif hammergui_validate(1); hammergui_visedvalidate(1); diff --git a/shared/sickle/sic.c b/shared/sickle/sic.c index 003120e..4557c4b 100644 --- a/shared/sickle/sic.c +++ b/shared/sickle/sic.c @@ -10,7 +10,9 @@ #include "common/loud.h" #include "sickle/sic.h" +#ifdef KRZYSZCZ //#define SIC_DEBUG +#endif #if defined(NT) || defined(MACOSX) /* cf pd/src/x_arithmetic.c */ @@ -58,8 +60,9 @@ t_float *sic_makecostable(int *sizep) if (sz >= *sizep) break; #ifdef SIC_DEBUG - post("request for a costable of %d points (effective %d, ndx %d)", - *sizep, sz, ndx); + fprintf(stderr, + "request for a costable of %d points (effective %d, ndx %d)\n", + *sizep, sz, ndx); #endif *sizep = sz; if (sic_costables[ndx]) @@ -74,7 +77,7 @@ t_float *sic_makecostable(int *sizep) if (table) { #ifdef SIC_DEBUG - post("got %d points of a costable", cnt); + fprintf(stderr, "got %d points of a costable\n", cnt); #endif while (cnt--) { diff --git a/shared/toxy/plusbob.c b/shared/toxy/plusbob.c index fb587cc..4ea96e2 100644 --- a/shared/toxy/plusbob.c +++ b/shared/toxy/plusbob.c @@ -7,7 +7,9 @@ #include "common/loud.h" #include "plusbob.h" +#ifdef KRZYSZCZ //#define PLUSBOB_DEBUG +#endif /* LATER let there be a choice of using either fake-symbols, or gpointers. The gpointer layout would be such: gs_un points to a plusbob-like diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c index be5ff41..7d5146c 100644 --- a/shared/toxy/scriptlet.c +++ b/shared/toxy/scriptlet.c @@ -17,7 +17,9 @@ #include "common/props.h" #include "scriptlet.h" -#define SCRIPTLET_DEBUG +#ifdef KRZYSZCZ +//#define SCRIPTLET_DEBUG +#endif #define SCRIPTLET_INISIZE 1024 #define SCRIPTLET_INIDOTSIZE 256 @@ -641,6 +643,9 @@ static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, else builtin++; } } + else for (ptr = buf; *ptr; ptr++) + if (*ptr == '\r') + *ptr = ' '; /* LATER rethink */ ptr = buf; while (*ptr == ' ' || *ptr == '\t') ptr++; if (*ptr == '#') @@ -669,7 +674,7 @@ static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, else if (newsp != outsp) { outsp->s_locked = 0; - scriptlet_reset(outsp = newsp); + outsp = newsp; } } } diff --git a/shared/unstable/forky.c b/shared/unstable/forky.c index 2e17253..fcdbd61 100644 --- a/shared/unstable/forky.c +++ b/shared/unstable/forky.c @@ -14,7 +14,9 @@ #include "unstable/pd_imp.h" #endif +#ifdef KRZYSZCZ //#define FORKY_DEBUG +#endif t_pd *forky_newobject(t_symbol *s, int ac, t_atom *av) { @@ -36,7 +38,7 @@ void forky_setsavefn(t_class *c, t_forkysavefn fn) /* cloning is necessary, because class_setwidget has not been called */ t_widgetbehavior *wb = getbytes(sizeof(*wb)); /* never freed */ #ifdef FORKY_DEBUG - post("cloning widgetbehavior..."); + fprintf(stderr, "cloning widgetbehavior...\n"); #endif *wb = *c->c_wb; wb->w_savefn = fn; @@ -97,7 +99,7 @@ t_int forky_getbitmask(int ac, t_atom *av) } /* CHECKED missing are zero */ #ifdef FORKY_DEBUG - post("mask set to %.8x", result); + fprintf(stderr, "mask set to %.8x\n", result); #endif } else bug("sizeof(shared_t_bitmask)"); diff --git a/shared/unstable/fringe.c b/shared/unstable/fringe.c index 913d201..2bfe478 100644 --- a/shared/unstable/fringe.c +++ b/shared/unstable/fringe.c @@ -9,7 +9,9 @@ #include "unstable/forky.h" #include "unstable/fringe.h" +#ifdef KRZYSZCZ //#define FRINGE_DEBUG +#endif static int gobj_getindex(t_glist *gl, t_gobj *ob) { @@ -60,7 +62,7 @@ static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb) gobj_getindex(gl, (t_gobj *)lt.tr_ob2), lt.tr_inno); } #ifdef FRINGE_DEBUG - post("packed connections:"); + fprintf(stderr, "packed connections:\n"); binbuf_print(bb); #endif } @@ -68,7 +70,7 @@ static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb) static void gobj_restoreconnections(t_glist *gl, t_binbuf *bb) { #ifdef FRINGE_DEBUG - post("restoring connections:"); + fprintf(stderr, "restoring connections:\n"); binbuf_print(bb); #endif canvas_setcurrent(gl); diff --git a/test/toxy/testmess.wid b/test/toxy/testmess.wid index 3263fa4..0481e2f 100644 --- a/test/toxy/testmess.wid +++ b/test/toxy/testmess.wid @@ -1,4 +1,4 @@ -puts setup +puts "setup script: evaluated once per Pd session" proc testmess_list {path target args} { set sum 0 @@ -25,10 +25,23 @@ proc testmess_command {path} { #. @float testmess_list .- .| .#args #. @list testmess_list .- .| .#args -puts initializer +puts "\nwidget initializer: evaluated whenever a Tk widget is created" +puts "which may happen several times during Pd object\'s lifetime" +puts "widget needs reinitializing after:" +puts ". closing and reopening of a subpatch window" +puts ". minimizing and maximizing a window" +puts ". switching virtual desktops" #@ new -puts constructor +puts "\nconstructor: evaluated once per Pd object" +puts "(after Pd object creation, before Tk widget creation)" + +#@ vis +puts "another initializer part added from \"#@ vis\" block" #@ free -puts destructor +puts "\ndestructor: evaluated once, after Pd object destruction" +puts "(Tk widget should be already gone)" + +#@ ini +puts "yet another initializer part added from \"#@ ini\" block" diff --git a/toxy/build_counter b/toxy/build_counter index 749f20b..601f7ac 100644 --- a/toxy/build_counter +++ b/toxy/build_counter @@ -1,7 +1,7 @@ #define TOXY_VERSION "0.1" #define TOXY_RELEASE "alpha" -#define TOXY_BUILD 11 +#define TOXY_BUILD 13 #if 0 -TOXY_SNAPSHOT = 0.1-alpha11 +TOXY_SNAPSHOT = 0.1-alpha13 #endif diff --git a/toxy/plustot.c b/toxy/plustot.c index ec1c575..3e6ec7c 100644 --- a/toxy/plustot.c +++ b/toxy/plustot.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* 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. */ @@ -15,20 +15,19 @@ #include "build_counter" #define PLUSTOT_VERBOSE -#define PLUSTOT_DEBUG -//#define PLUSTOT_DEBUGREFCOUNTS #ifdef PLUSTOT_DEBUG -# define PLUSDEBUG_ENDPOST(fn) endpost() +//# define PLUSTOT_DEBUGREFCOUNTS +# define PLUSDEBUG_ENDPOST(fn) fputc('\n', stderr) #else # define PLUSDEBUG_ENDPOST(fn) #endif #ifdef PLUSTOT_DEBUGREFCOUNTS # define PLUSDEBUG_INCRREFCOUNT(ob, fn) \ - {post("++ %x "fn, (int)(ob)); Tcl_IncrRefCount(ob);} + {fprintf(stderr, "++ %x "fn"\n", (int)(ob)); Tcl_IncrRefCount(ob);} # define PLUSDEBUG_DECRREFCOUNT(ob, fn) \ - {post("-- %x "fn, (int)(ob)); Tcl_DecrRefCount(ob);} + {fprintf(stderr, "-- %x "fn"\n", (int)(ob)); Tcl_DecrRefCount(ob);} #else # define PLUSDEBUG_INCRREFCOUNT(ob, fn) Tcl_IncrRefCount(ob) # define PLUSDEBUG_DECRREFCOUNT(ob, fn) Tcl_DecrRefCount(ob) @@ -100,8 +99,8 @@ t_plustin *plustin_create(t_plustype *tp, t_plusbob *parent, t_symbol *id) if (interp && (tin = (t_plustin *)plusenv_create(tp, parent, id))) { #ifdef PLUSTOT_DEBUG - post("plustin_create '%s' over %x", - (id ? id->s_name : "default"), (int)interp); + fprintf(stderr, "plustin_create '%s' over %x\n", + (id ? id->s_name : "default"), (int)interp); #endif tin->tin_interp = interp; Tcl_Preserve(interp); @@ -119,8 +118,8 @@ static void plustin_delete(t_plustin *tin) { #ifdef PLUSTOT_DEBUG t_symbol *id = plusenv_getid((t_plusenv *)tin); - post("plustin_delete '%s' over %x", - (id ? id->s_name : "default"), (int)tin->tin_interp); + fprintf(stderr, "plustin_delete '%s' over %x\n", + (id ? id->s_name : "default"), (int)tin->tin_interp); #endif Tcl_Preserve(tin->tin_interp); if (!Tcl_InterpDeleted(tin->tin_interp)) @@ -460,7 +459,8 @@ Tcl_Obj *plustob_setlist(t_plustob *tob, int ac, t_atom *av) if (count > tob->tob_elbufsize) { #ifdef PLUSTOT_DEBUG - post("growing +To %d -> %d", tob->tob_elbufsize, count); + fprintf(stderr, "growing +To %d -> %d\n", + tob->tob_elbufsize, count); #endif tob->tob_elbuf = grow_nodata(&count, &tob->tob_elbufsize, tob->tob_elbuf, @@ -576,7 +576,8 @@ Tcl_Obj *plustob_setbinbuf(t_plustob *tob, t_binbuf *bb) { int n = count; #ifdef PLUSTOT_DEBUG - post("growing +To %d -> %d", tob->tob_elbufsize, count); + fprintf(stderr, "growing +To %d -> %d\n", + tob->tob_elbufsize, count); #endif tob->tob_elbuf = grow_nodata(&n, &tob->tob_elbufsize, tob->tob_elbuf, @@ -778,11 +779,11 @@ static Tcl_Obj *plusvar_postset(t_plusvar *var) { #ifdef PLUSTOT_DEBUGREFCOUNTS if (var->var_index) - post("vv %x plusvar_postset [%s(%s)]", - (int)tob->tob_value, var->var_name, var->var_index); + fprintf(stderr, "vv %x plusvar_postset [%s(%s)]\n", + (int)tob->tob_value, var->var_name, var->var_index); else - post("vv %x plusvar_postset [%s]", - (int)tob->tob_value, var->var_name); + fprintf(stderr, "vv %x plusvar_postset [%s]\n", + (int)tob->tob_value, var->var_name); #endif } else plusloud_tclerror(0, interp, "cannot set variable"); @@ -1011,8 +1012,8 @@ static t_plusproxy *plusproxy_new(t_pd *master, int ndx, t_plustin *tin) static void plusproxy_free(t_plusproxy *pp) { #ifdef PLUSTOT_DEBUG - post("plusproxy_free (%s %d)", - (pp->pp_var ? pp->pp_var->var_name : "empty"), pp->pp_ndx); + fprintf(stderr, "plusproxy_free (%s %d)\n", + (pp->pp_var ? pp->pp_var->var_name : "empty"), pp->pp_ndx); #endif if (pp->pp_var) plusbob_release((t_plusbob *)pp->pp_var); @@ -1065,10 +1066,11 @@ static void plusproxy_debug(t_plusproxy *pp) t_plustin *tin = ((t_plustob *)pp->pp_var)->tob_tin; t_symbol *id = plusenv_getid((t_plusenv *)tin); t_symbol *glname = plustin_getglistname(tin); - post("+proxy %d, glist %x", - pp->pp_ndx, (int)((t_plustot *)pp->pp_master)->x_glist); - post(" plustin '%s' (%s) over %x", (id ? id->s_name : "default"), - (glname ? glname->s_name : ""), (int)tin->tin_interp); + fprintf(stderr, "+proxy %d, glist %x\n", + pp->pp_ndx, (int)((t_plustot *)pp->pp_master)->x_glist); + fprintf(stderr, " plustin '%s' (%s) over %x\n", + (id ? id->s_name : "default"), + (glname ? glname->s_name : ""), (int)tin->tin_interp); } #endif @@ -1092,7 +1094,7 @@ static int plustot_usevariable(t_plustot *x, Tcl_Token *tp, int doit) } else buf[size] = 0; strncpy(buf, tp->start, size); - startpost("%s ", buf); + fprintf(stderr, "%s ", buf); } #endif tp++; @@ -1158,7 +1160,7 @@ static int plustot_usevariable(t_plustot *x, Tcl_Token *tp, int doit) if (!doit) { #ifdef PLUSTOT_DEBUG - startpost("(inlet %d) ", inno); + fprintf(stderr, "(inlet %d) ", inno); #endif if (inno >= x->x_nproxies) x->x_nproxies = inno + 1; @@ -1255,7 +1257,7 @@ static int plustot_doparsevariables(t_plustot *x, Tcl_Interp *interp, int sz = (tp->size < MAXPDSTRING ? tp->size : MAXPDSTRING); strncpy(buf, tp->start, sz); buf[sz] = 0; - post("simple word's text: %s", buf); + fprintf(stderr, "simple word's text: %s\n", buf); } #endif if (ntok-- && tp->type == TCL_TOKEN_TEXT && tp->size > 0) @@ -1287,7 +1289,7 @@ static int plustot_doparsevariables(t_plustot *x, Tcl_Interp *interp, int sz = (tp->size < MAXPDSTRING ? tp->size : MAXPDSTRING); strncpy(buf, tp->start, sz); buf[sz] = 0; - post("other type (%d): %s", tp->type, buf); + fprintf(stderr, "other type (%d): %s\n", tp->type, buf); } #endif tp++; @@ -1305,7 +1307,7 @@ static int plustot_parsevariables(t_plustot *x, Tcl_Interp *interp, { int nvars; #ifdef PLUSTOT_DEBUG - if (!doit) startpost("variables: "); + if (!doit) fprintf(stderr, "variables: "); #endif nvars = plustot_doparsevariables(x, interp, buf, len, parsep, doit); #ifdef PLUSTOT_DEBUG @@ -1313,10 +1315,10 @@ static int plustot_parsevariables(t_plustot *x, Tcl_Interp *interp, { if (nvars > 0) { - post("\n%d variable substitutions", nvars); - post("%d inlets requested", x->x_nproxies); + fprintf(stderr, "\n%d variable substitutions\n", nvars); + fprintf(stderr, "%d inlets requested\n", x->x_nproxies); } - else if (nvars == 0) post("none"); + else if (nvars == 0) fprintf(stderr, "none\n"); } #endif return (nvars); @@ -1394,7 +1396,7 @@ static int plustot_resetwords(t_plustot *x) { int n = nwords; #ifdef PLUSTOT_DEBUG - post("growing words %d -> %d", x->x_maxwords, nwords); + fprintf(stderr, "growing words %d -> %d\n", x->x_maxwords, nwords); #endif x->x_words = grow_nodata(&n, &x->x_maxwords, x->x_words, PLUSTOT_INIMAXWORDS, x->x_wordsini, @@ -1421,7 +1423,7 @@ static int plustot_resetargs(t_plustot *x) { int n = nargs; #ifdef PLUSTOT_DEBUG - post("growing argv %d -> %d", x->x_maxargs, nargs); + fprintf(stderr, "growing argv %d -> %d\n", x->x_maxargs, nargs); #endif x->x_argv = grow_nodata(&n, &x->x_maxargs, x->x_argv, PLUSTOT_INIMAXWORDS, x->x_argvini, @@ -1455,16 +1457,17 @@ static int plustot_makewords(t_plustot *x) int len; char buf[TCL_UTF_MAX]; #ifdef PLUSTOT_DEBUG - post("arguments:"); + fprintf(stderr, "arguments:\n"); #endif for (i = 1, tp = x->x_tailparse.tokenPtr; i < nwords; i++, tp += ncomponents) { #ifdef PLUSTOT_DEBUG - post(" %s token: type %d[%d], having %d[%d] component%s", - loud_ordinal(i), tp->type, tp[1].type, - tp->numComponents, tp[1].numComponents, - (tp->numComponents > 1 ? "s" : "")); + fprintf(stderr, + " %s token: type %d[%d], having %d[%d] component%s\n", + loud_ordinal(i), tp->type, tp[1].type, + tp->numComponents, tp[1].numComponents, + (tp->numComponents > 1 ? "s" : "")); #endif ncomponents = tp->numComponents; tp++; @@ -1602,16 +1605,16 @@ static int plustot_argsfromtokens(t_plustot *x, Tcl_Interp *interp) int i, nwords = x->x_tailparse.numWords + 1; Tcl_Token *tp; #ifdef PLUSTOT_DEBUG - post("arguments:"); + fprintf(stderr, "arguments:\n"); #endif for (i = 1, tp = x->x_tailparse.tokenPtr; i < nwords; i++, tp += (tp->numComponents + 1)) { int result; #ifdef PLUSTOT_DEBUG - startpost(" %s token: type %d[%d], having %d component%s", - loud_ordinal(i), tp->type, tp[1].type, - tp->numComponents, (tp->numComponents > 1 ? "s" : "")); + fprintf(stderr, " %s token: type %d[%d], having %d component%s", + loud_ordinal(i), tp->type, tp[1].type, + tp->numComponents, (tp->numComponents > 1 ? "s" : "")); #endif result = Tcl_EvalTokensStandard(interp, tp + 1, tp->numComponents); if (result == TCL_OK) @@ -1622,9 +1625,9 @@ static int plustot_argsfromtokens(t_plustot *x, Tcl_Interp *interp) "plustot_argsfromwords"); Tcl_ResetResult(interp); #ifdef PLUSTOT_DEBUG - post(", %sshared: '%s'", - (Tcl_IsShared(x->x_argv[i]) ? "" : "not "), - Tcl_GetString(x->x_argv[i])); + fprintf(stderr, ", %sshared: '%s'\n", + (Tcl_IsShared(x->x_argv[i]) ? "" : "not "), + Tcl_GetString(x->x_argv[i])); #endif } else @@ -1784,9 +1787,10 @@ static void plustot_debug(t_plustot *x) t_plustin *tin = x->x_tob->tob_tin; t_symbol *id = plusenv_getid((t_plusenv *)tin); t_symbol *glname = plustin_getglistname(tin); - post("+tot, glist %x", (int)x->x_glist); - post(" plustin '%s' (%s) over %x", (id ? id->s_name : "default"), - (glname ? glname->s_name : ""), (int)tin->tin_interp); + fprintf(stderr, "+tot, glist %x\n", (int)x->x_glist); + fprintf(stderr, " plustin '%s' (%s) over %x\n", + (id ? id->s_name : "default"), + (glname ? glname->s_name : ""), (int)tin->tin_interp); if (x->x_mainproxy) plusproxy_debug(x->x_mainproxy); } diff --git a/toxy/plustot.h b/toxy/plustot.h index e08e7b0..ad72d29 100644 --- a/toxy/plustot.h +++ b/toxy/plustot.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* 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. */ @@ -12,6 +12,10 @@ #define EXTERN PD_EXTERN #undef PD_EXTERN +#ifdef KRZYSZCZ +#define PLUSTOT_DEBUG +#endif + EXTERN_STRUCT _plustin; #define t_plustin struct _plustin EXTERN_STRUCT _plustob; diff --git a/toxy/plustot.qlist.c b/toxy/plustot.qlist.c index b49aeb1..e077177 100644 --- a/toxy/plustot.qlist.c +++ b/toxy/plustot.qlist.c @@ -9,7 +9,9 @@ #include "toxy/plusbob.h" #include "plustot.h" +#ifdef KRZYSZCZ #define PLUSTOT_QLIST_DEBUG +#endif /* Need only an access to x_binbuf field. */ typedef struct _qlist diff --git a/toxy/tot.c b/toxy/tot.c index cf6e742..9e1c07d 100644 --- a/toxy/tot.c +++ b/toxy/tot.c @@ -15,7 +15,9 @@ #include "toxy/scriptlet.h" #include "build_counter" +#ifdef KRZYSZCZ //#define TOT_DEBUG +#endif /* probably much more than needed for canvas messages from gui */ #define TOTSPY_MAXSIZE 32 diff --git a/toxy/widget.c b/toxy/widget.c index 7bfbb74..8daa588 100644 --- a/toxy/widget.c +++ b/toxy/widget.c @@ -20,8 +20,10 @@ /* our proxy of the text_class (not in the API), LATER do not cheat */ static t_class *makeshift_class; +#ifdef KRZYSZCZ //#define WIDGET_DEBUG //#define TOW_DEBUG +#endif enum { WIDGET_NOVIS = 0, WIDGET_PUSHVIS, WIDGET_REVIS }; diff --git a/toxy/widgettype.c b/toxy/widgettype.c index 0b8163f..408ba4a 100644 --- a/toxy/widgettype.c +++ b/toxy/widgettype.c @@ -16,7 +16,6 @@ static char masterwidget_builtin[] = ; #define WIDGETTYPE_VERBOSE -#define WIDGETTYPE_DEBUG struct _widgettype { @@ -138,6 +137,7 @@ static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, #ifdef WIDGETTYPE_DEBUG post("adding widget type '%s'", typeval->wt_typekey->s_name); #endif + scriptlet_reset(typeval->wt_iniscript); return (typeval->wt_iniscript); } else if (sel == '.') @@ -174,11 +174,18 @@ static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, if (mw->mw_parsedtype) { if (!strcmp(buf, "vis") || !strcmp(buf, "ini")) + /* already reset */ return (mw->mw_parsedtype->wt_iniscript); else if (!strcmp(buf, "new")) + { + scriptlet_reset(mw->mw_parsedtype->wt_newscript); return (mw->mw_parsedtype->wt_newscript); + } else if (!strcmp(buf, "free")) + { + scriptlet_reset(mw->mw_parsedtype->wt_freescript); return (mw->mw_parsedtype->wt_freescript); + } else { /* LATER start parsing any method handler: search for it, diff --git a/toxy/widgettype.h b/toxy/widgettype.h index 4894d00..d2d9858 100644 --- a/toxy/widgettype.h +++ b/toxy/widgettype.h @@ -5,6 +5,10 @@ #ifndef __WIDGETTYPE_H__ #define __WIDGETTYPE_H__ +#ifdef KRZYSZCZ +//#define WIDGETTYPE_DEBUG +#endif + EXTERN_STRUCT _widgettype; #define t_widgettype struct _widgettype -- cgit v1.2.1