Re: console with readline

From: Erick Gallesio <Erick.Gallesio_at_unice.fr>
Date: Mon, 13 Sep 1999 22:34:48 +0200 (CEST)

Walter Moreira writes:
>
> Hello. I was trying to make my own STk text console using the
> GNU readline & history library. I just use readline for reading
> input, call eval or eval-string and print the result. But the
> Tk commands don't work! The widgets are displayed correctly but
> when you click on them they are not actived. Have you got an idea
> about why this happens?
>

Yes. The problem is when STk is idle (typically hen waiting for input)
it asks to Tcl to treat incoming events. Look at the io.c file for the
StdinProc procedure to see how it is done (I'm not very proud of that,
but it works).

> Or a more clearly stated question: How can you make a console using
> readline with the full functionality of STk?
>

If You can plug some idle function in readline, you win. You just
have to declare that the event loop is interested with event with a
Tcl_CreateFileHandler (as in toplevel.c) and do Tcl_DoOneEvent in your
ile function.


BTW, it is a long time that I have give up with the idea with to
integrate the readline function with STk (and any other line command)
This is bad idea IMHO, because it has a poor integration with emacs
(and all the interactive program should be used through emacs) and
because all the work is to be redone for each tool. A better idea is
the one that exists many years ago with ile or fep (the front end
processor). The idea of such a tool is to open a tty between you and
the program and to manage all the editing commands. and only send your
input when you type the enter key. I have personally an alias which says:
        stk='fep \stk'
which allows me to use stk under the shell with command history (and
without problem under emacs). But I also have such an alias for ed,
lpc, ...).

The only problem with these tools is that I have lost any reference to
ile since a long time, and fep works only with BSD tty conventions (if I
remember). Anyway, it only works when linked with libc5.

If you plan to do stuff with readline, I think it wold be a better
approach to adapt a tool like fep to it (readline editing command are
far superior to the limited fep ones) and I would really like to test
it ;-)


                -- Erick
Received on Mon Sep 13 1999 - 23:01:17 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST