|
From: Dave D. <dde...@es...> - 2005-07-14 17:10:09
|
Hans-Bernhard Broeker <br...@ph...> writes:
> Ethan Merritt wrote:
>> While I was trying to use the term->suspend() and term->resume()
>> API to implement Harald Harders' treatment of front/back text labels
>> in epslatex, I discovered that it is pretty much useless.
>
> I strongly suspect that to be a premature conclusion.
>
>> The suspend() and resume() functions are only called if you are
>> in interactive mode.
>
> Not so.
>
> Here's the relevant snippet from term.c:term_check_multiplot_ok(),
> reindented for legibility.
>
> if (!f_interactive
> || (term->flags & TERM_CAN_MULTIPLOT)
> || ((gpoutfile != stdout)
> && !(term->flags & TERM_CANNOT_MULTIPLOT)
> )
> ) {
> /* it's okay to use multiplot here, but suspend first */
> term_suspend();
> return;
> }
>
I think the comment just above that block is possibly even more
legible :
/* make sure that it is safe to issue an interactive prompt
* it is safe if
* it is not an interactive read, or
* the terminal supports interactive multiplot, or
* we are not writing to stdout and terminal doesn't
* refuse multiplot outright
*/
> So term->suspend, if it exists, will be called on entering multiplot
> mode, in each of the following cases:
>
Don't think so. This function is called just before attempting to
issue a prompt while already in multiplot mode. It is there to decide
if it is safe to issue a prompt while in multiplot mode, or if the
display driver cannot preserve graphics content across a switch to
text mode.
I think the point is that the following will work with *any* terminal
driver :
set multi ; plot sin(x) ; plot cos(x) ; unset multi
because we enter graphics mode once, issue a sequence of calls, then
leave. The terminal driver need never know it has done a multiplot.
This is why the checks are deferred until we try to issue a prompt,
because it is only then that things can go wrong.
I can't remember right now what TERM_CANNOT_MULTIPLOT means : probably
referring to issuing a prompt during multiplot at all. (Many direct
graphics drivers don't honour the output redirection. Eg X11, linux
vga)
It's not clear why we call suspend at all for a non-interactive
read. Ah - non-interactive read means from stdin without
prompting. Presumably interactive means isatty(stdin) or something
like that.
dd
--
Dave Denholm <dde...@es...> http://www.esmertec.com
|