aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.common7
-rw-r--r--shared/toxy/scriptlet.c28
-rw-r--r--shared/unstable/forky.h1
-rw-r--r--test/toxy/kb.wid2
-rw-r--r--test/toxy/setup.wid3
-rw-r--r--test/toxy/tot-query.pd29
-rw-r--r--toxy/Makefile2
-rw-r--r--toxy/Makefile.sources1
-rw-r--r--toxy/build_counter2
9 files changed, 46 insertions, 29 deletions
diff --git a/Makefile.common b/Makefile.common
index da2aa7f..3e44de2 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,8 +1,11 @@
# next line has to be edited manually
PD_DIR = $(ROOT_DIR)/../../pd/src
-# FIXME ./configure should set this (or not) before "include Makefile.sources"
-TCL_LIB = -l`grep -osm1 'tcl8\.[345]' $(PD_DIR)/makefile`
+# remove this restriction LATER, when TCL_LIB is ./configured
+ifeq ($(shell whoami),krzYszcz)
+# TCL_LIB should be set (or not) before "include Makefile.sources"
+TCL_LIB = -l$(shell grep -osm1 'tcl8\.[345]' $(PD_DIR)/makefile)
+endif
OS_NAME = $(shell uname -s)
ifneq ($(OS_NAME),Linux)
diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c
index 954c596..f7ce800 100644
--- a/shared/toxy/scriptlet.c
+++ b/shared/toxy/scriptlet.c
@@ -422,16 +422,26 @@ void scriptlet_qpush(t_scriptlet *sp)
{
char buf[MAXPDSTRING];
char *tail = sp->s_tail;
+ /* Could not find any other way, than to postpone processing of the
+ query, after everything which might have been glued to our tail,
+ is evaluated. Otherwise, any command arriving later, during
+ blocking of the query (e.g. in a Tk dialog), would be evaluated
+ prior to our tail, via Tcl_DoOneEvent(). We postpone also the
+ setup step (defining the query proc), in order to be able to
+ handle several queries at once. All this is far from ideal --
+ the sequence "query this, tot that", is swapped, unless written
+ as "query this, tot after 0 .(that.)", which is going to cause
+ much confusion... LATER revisit. Do not forget, that since
+ pd_readsocket() is not reentrant, sys_gui()d commands should never
+ enter event loop directly by blocking on a dialog, vwait, etc.,
+ because the pd_readsocket handler is event-driven on unix. */
+ sys_gui("after 0 {\n");
strcpy(tail, "]}}\n");
sys_gui(sp->s_buffer);
*tail = 0;
- /* Could not find anything more flexible, than blocking while waiting
- for ::toxy::query to complete. The model case is a Tk dialog
- hanging over the arrival of new queries. LATER probably use
- a thread-safe replacement of the 'pd' command in order to prevent
- competing tcl threads from corrupting the gui-to-pd stream. */
- sprintf(buf, "after 0 {::toxy::query}\nvwait ::toxy::reply\n\
- pd [concat %s _rp $::toxy::reply \\;]\n", sp->s_rptarget->s_name);
+ sprintf(buf, "\
+ trace add variable ::toxy::reply write \"::toxy::doreply %s\"\n\
+ ::toxy::query}\n", sp->s_rptarget->s_name);
sys_gui(buf);
}
}
@@ -761,6 +771,10 @@ t_scriptlet *scriptlet_new(t_pd *owner, t_symbol *rptarget, t_symbol *cbtarget,
if (!configured)
{
sys_gui("image create bitmap ::toxy::img::empty -data {}\n");
+ sys_gui("proc ::toxy::doreply {target vname vndx op} {\n");
+ sys_gui(" pd [concat $target _rp $::toxy::reply \\;]\n");
+ sys_gui(" unset ::toxy::reply\n");
+ sys_gui("}\n");
}
sp->s_owner = owner;
sp->s_glist = gl;
diff --git a/shared/unstable/forky.h b/shared/unstable/forky.h
index bf59783..b7cbee1 100644
--- a/shared/unstable/forky.h
+++ b/shared/unstable/forky.h
@@ -16,6 +16,7 @@
#if FORKY_VERSION >= 37
#define FORKY_WIDGETPADDING
#else
+#warning You are entering a back-compatibility mode. Delete this warning from forky.h to proceed.
#define FORKY_WIDGETPADDING 0,0
#endif
diff --git a/test/toxy/kb.wid b/test/toxy/kb.wid
index bfba5ac..8a081d7 100644
--- a/test/toxy/kb.wid
+++ b/test/toxy/kb.wid
@@ -1,4 +1,6 @@
proc ::toxy::kb {path target remote noctaves size} {
+# guard against BadAlloc crashes
+ if {$size > 10} {set size 10}
set lft [expr {round(5 * $size)}]
set top [expr {round(5 * $size)}]
set bot [expr {round(100 * $size)}]
diff --git a/test/toxy/setup.wid b/test/toxy/setup.wid
index f5aff1c..9da8775 100644
--- a/test/toxy/setup.wid
+++ b/test/toxy/setup.wid
@@ -98,8 +98,7 @@ proc ::toxy::item_visconfig {path target name varname cvpath px py} {
# FIXME explicit traces
set needtraces 0
} else {
-# set needtraces 1
- set needtraces 0
+ set needtraces 1
}
if {$needtraces != 0} {
diff --git a/test/toxy/tot-query.pd b/test/toxy/tot-query.pd
index d646f78..36286b3 100644
--- a/test/toxy/tot-query.pd
+++ b/test/toxy/tot-query.pd
@@ -1,4 +1,4 @@
-#N canvas 421 109 778 551 12;
+#N canvas 210 60 778 551 12;
#X msg 21 8 symbol pinecone;
#X obj 455 142 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
@@ -15,9 +15,6 @@ r];
\, qpush;
#X msg 21 44 tot global ans .: regsub cone \$1 apple ans \, query global
ans .: concat set $ans;
-#X msg 60 369 tot global ch .: set ch [open ~/.pdrc] \, query global
-ch .: concat set [read $ch] \, tot global ch .: close $ch .: unset
-ch;
#X msg 199 266 tot global txt ch .: set txt [gets $ch] \, query global
txt .: concat set $txt;
#N canvas 0 0 578 346 more 0;
@@ -41,22 +38,24 @@ txt .: concat set $txt;
#X obj 21 468 tot .;
#X obj 67 238 tot .;
#X msg 67 202 tot eval .< [global ch .: info exists ch] .>;
+#X msg 54 376 tot set ::ch [open ~/.pdrc] \, query concat set [read
+$::ch] \, after 0 .(tot close $::ch .: unset ::ch.);
#X msg 21 502;
#X connect 0 0 11 0;
#X connect 1 0 3 0;
#X connect 2 0 11 0;
-#X connect 3 0 17 0;
+#X connect 3 0 16 0;
#X connect 3 1 6 0;
#X connect 4 0 7 0;
#X connect 4 1 6 0;
-#X connect 6 0 13 0;
+#X connect 6 0 12 0;
#X connect 7 0 5 0;
-#X connect 8 0 15 0;
-#X connect 9 0 15 0;
-#X connect 10 0 15 0;
-#X connect 11 0 15 0;
-#X connect 12 0 15 0;
-#X connect 13 0 15 0;
-#X connect 15 0 18 0;
-#X connect 16 1 4 0;
-#X connect 17 0 16 0;
+#X connect 8 0 14 0;
+#X connect 9 0 14 0;
+#X connect 10 0 14 0;
+#X connect 11 0 14 0;
+#X connect 12 0 14 0;
+#X connect 14 0 18 0;
+#X connect 15 1 4 0;
+#X connect 16 0 15 0;
+#X connect 17 0 14 0;
diff --git a/toxy/Makefile b/toxy/Makefile
index 4ae80d2..1a1e2f5 100644
--- a/toxy/Makefile
+++ b/toxy/Makefile
@@ -15,6 +15,6 @@ $(WIQFILE): $(WIDPATH)
-e 's/\([\\\"]\)/\\\1/g' \
-e 's/^.*$$/\"&\\n\"/' > $@
@if [ -f $(WIQFILE) ] && ! [ -s $(WIQFILE) ] ; then \
- echo ERROR: quoteinitializer failed... $(WIQFILE) removed ; \
+ echo ERROR: transfer failed... $(WIQFILE) removed ; \
rm -f $(WIQFILE) ; fi
include $(ROOT_DIR)/Makefile.common
diff --git a/toxy/Makefile.sources b/toxy/Makefile.sources
index 8befa8d..3cc3f7a 100644
--- a/toxy/Makefile.sources
+++ b/toxy/Makefile.sources
@@ -1,4 +1,3 @@
-# this conditional will make sense LATER, when TCL_LIB is ./configured
ifdef TCL_LIB
TYPES = TOT TOW WIDGET PLUSTOT
else
diff --git a/toxy/build_counter b/toxy/build_counter
index 2c83711..f292bc7 100644
--- a/toxy/build_counter
+++ b/toxy/build_counter
@@ -1,3 +1,3 @@
#define TOXY_VERSION "0.1"
#define TOXY_RELEASE "alpha"
-#define TOXY_BUILD 8
+#define TOXY_BUILD 9