Re: How does TCL (internals) generate output to stdout



On Jan 20, 10:31 pm, sam appleton <sam.s.apple...@xxxxxxxxx> wrote:
Hi

(TCL version 8.5.8)

I would like to understand how TCL generates output to stdout, for
example,
when I type at the tclsh prompt,

% set x 1
1
% set x
1
%

how does this output get generated? I traced the behavior of
Tcl_PutsObjCmd (tclIOCmd.c),
which calls Tcl_WriteObj (tclIO.c) which then calls Tcl_WriteChars,
which then calls DoWriteChars.
How does the above command sequence get captured and printed to
stdout?

I am trying to intercept the write function at some point with a patch
that allows me to log the output.
(externally wrapping functions like tee -a are not acceptable in the
environment our software goes into).

Sam

You can try script(1) if you are using Unix. The problem is that it
captures the terminal's control escapes.

pmarin
.



Relevant Pages

  • How does TCL (internals) generate output to stdout
    ... (TCL version 8.5.8) ... I would like to understand how TCL generates output to stdout, ... when I type at the tclsh prompt, ... (externally wrapping functions like tee -a are not acceptable in the ...
    (comp.lang.tcl)
  • Re: TCL and Python
    ... > natives, so I find that Tcl is more satisfying, more of the time. ... get both stdin and stdout connected to a readable, ... Also, I dislike the use of redirects in general, because I've had issues, ...
    (comp.lang.tcl)
  • Re: Vignette and Tcl (was Re: Veblenesque rant)
    ... There is no native TCL process for doing what PHP's phpinfo ... HTMLized display of::env now, but only include it in the stream ... redirect stdout to a variable ...
    (comp.lang.tcl)
  • Re: Q: How to catch stdout in tcl
    ... With stacked channels you can capture everything written to the ... Tcl channel named "stdout". ...
    (comp.lang.tcl)
  • Re: Subprocess with and without shell
    ... command when it runs through the shell but not without it. ... # this captures both stdout and stderr as expected ... but the specific executable being spawned is not a python ...
    (comp.lang.python)