Two tcltk questions and Re: [R] tcltk package functionality
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sun Oct 1 21:37:52 CEST 2000
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
...
> Alternatively tell me how to avoid producing that "%..." argument on
> callbacks and command=function(...)tkyview(tl.yscroll,...) should
> work. I suspect that it might be easy.
Done for the development version.
> By fixing the bug ;) This has been waiting to happen. The quoting
> mechanisms of Tcl makes it impossible to get an unbalanced set of
> braces into a {...}-delimited string and this is what the .Tcl
> interface is producing. So one really needs to use "..." delimiting
> with the entire morass of special character escapes. This is due to
> sheer laziness on my part (or slightly nicer put: my mind was
> focused elsewhere at the time).
Ditto (in fact simpler than I thought, since it seems that one can get
away with just handling quotes, backslashes, and left square
brackets).
The patches are these:
$ cvs diff -ur 1.3 src/library/tcltk/src/tcltk.c
Index: src/library/tcltk/src/tcltk.c
===================================================================
RCS file: /home/rdevel/CVS-ARCHIVE/R/src/library/tcltk/src/tcltk.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- src/library/tcltk/src/tcltk.c 2000/08/07 22:24:35 1.3
+++ src/library/tcltk/src/tcltk.c 2000/10/01 19:24:16 1.4
@@ -133,10 +133,13 @@
is protected from later GCs. Otherwise we'll have buttons that
make R go Boom... We need register_callback(closure) or
something to that effect + a run through registered callbacks
- in the MarkPhase of GC */
+ in the MarkPhase of GC. [Currently, this is handled by having
+ .Tcl.args assign an alias to the function in the environment of
+ the window with which the callback is associated] */
while ( formals != R_NilValue )
{
+ if (TAG(formals) == R_DotsSymbol) break;
sprintf(tmp, " %%%s", CHAR(PRINTNAME(TAG(formals))));
strcat(buf, tmp);
formals = CDR(formals);
$ cvs diff -ur 1.5 src/library/tcltk/R/Tk.R
Index: src/library/tcltk/R/Tk.R
===================================================================
RCS file: /home/rdevel/CVS-ARCHIVE/R/src/library/tcltk/R/Tk.R,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- src/library/tcltk/R/Tk.R 2000/06/08 16:17:33 1.5
+++ src/library/tcltk/R/Tk.R 2000/10/01 19:24:16 1.6
@@ -21,7 +21,11 @@
assign(callback, .Alias(x), envir=current.win)
return(callback)
}
- paste("{", x, "}", sep="", collapse=" ")
+ ## quoting hell...
+ x <- gsub("\\\\", "\\\\\\\\", as.character(x))
+ x <- gsub("\"","\\\\\"", as.character(x))
+ x <- gsub("\\[","\\\\[", as.character(x))
+ paste("\"", x, "\"", sep = "", collapse = " ")
}
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list