groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] [off] micro-typography


From: Thomas Baruchel
Subject: Re: [Groff] [off] micro-typography
Date: Wed, 13 Feb 2002 13:28:00 +0100
User-agent: Mutt/1.2.5i

On Wed, Feb 13, 2002 at 10:59:06AM +0000, Colin Watson wrote:
> Perl certainly can (eval), and I believe Python can too. You also don't
OK
> have to worry about whether the co-language can handle sockets; just
> connect its stdin and stdout to the pipe/socket to troff.

I don't completely agree. Of course you can do this in many cases, but it
isn't very clean and therefore you have some exceptions. I don't see for
the moment an unix language interpreter that couldn't do that, but I have in
mind the difficulty to do that with the unix 'dc' calculator. If you try
to launch it from a process and write on its stdin, you will not have
the evaluations on stdout. I don't remember exactly why; it probably has to
do with some termios stuff.

Anyway, it won't be very clean, because your initial script would have
to do everything (ie. define macros) BEFORE reading stdin. The script
would be much more powerful by using a socket. Have an example:
Troff will send two sorts of things to the interpreter:
sequences belonging to a general protocol like the word 'EVALUATE'
and code. For instance:

[troff->interpreter] EVALUATE (troff-print (log 5)) END

EVALUATE doesn't look like a Scheme macro. It would be very heavy
and inelegant to cheat the interpreter with that. If in the contrary
the interpreter is in the middle of a loop waiting for some
information on the socket, it will see what is protocol, what is code,
and will redirect everything where it should go in a much cleaner way.

-- 
'\   (define Thomas_Baruchel
  \    ((lambda (k) (k k))
  /\     (call-with-current-continuation
 /  \      (lambda (k) (k k)))))                          baruchel @ usa , net

reply via email to

[Prev in Thread] Current Thread [Next in Thread]