[sac-dev] readline/libedit patch

Kuang He icrazy at gmail.com
Tue Oct 7 18:23:29 PDT 2008


On Tue, Oct 7, 2008 at 3:14 PM, Brian Savage <savage at uri.edu> wrote:
> I was looking at your readline patch to handle the real readline library
> when used with a script.
> http://www.iris.washington.edu/pipermail/sac-dev/2008-September/000109.html
>
> It looks like when the tty is not being used (use_tty()) you avoid the
> select_loop().
> This seems fine with me.  We also have very similar code in the zgtmsg() and
> the code you added looks a lot like the original zgpmsg() code.

Dear Brian,

I've been meaning to ask you about the similar codes in zgtmsg.c and
zgpmsg.c. How come we need two sets of those functions in the first
place?

> Can we do some
> consolidation here, possibly just within the zgpmsg() to begin with. and
> include code
> when with HAVE_LIBEDIT or HAVE_READLINE ( currently just READLINE) is true.

Ideally, we could totally get rid of the file zgtmsg.c, couldn't we?

> To make the the code easier to handle in the future I would prefer the
> libedit and
> readline behave the same way if a tty is, or is not, encountered.
>
> - Use the select_loop() while in a tty session.
> - Avoid the select_loop() while no tty is available
> - Avoid the select_loop() while no line handling is available
>
> How about something like:
>
> #ifdef HAVE_READLINE || HAVE_LIBEDIT
> if( use_tty() ) {
>        select_loop()
> } else {
> #endif /* HAVE READLINE || HAVE_LIBEDIT */
>
>         getfline()
>
> #ifdef HAVE_READLINE || HAVE_LIBEDIT
> }
> #endif /* HAVE READLINE || HAVE_LIBEDIT */

I think this is a good idea. Will do in a while.

> For reference:
> zgtmsg() is only called from
> src/exm/xpause.c
> src/exm/xnews.c
> src/cpf/cresp.c  (Standard Error Recovery, not sure this is used)

We don't need src/exm/xnews.c anymore, so I'm going to get rid of it
-- one less thing to worry about. Is there anyway to get the dates of
those sac2000 releases in file aux/news?

There is a line in src/co/zgpmsg.c that reads:

#if !defined(READLINE) && !defined(USE_X11_DOUBLE_BUFFER)

I don't quite understand why USE_X11_DOUBLE_BUFFER has anything to do
with line editing functionality. Could you please explain a bit?
Thanks!


Best regards,

-- 
Kuang He
Department of Physics
University of Connecticut
Storrs, CT 06269-3046

Tel: +1.860.486.4919
Web: http://www.phys.uconn.edu/~he/


More information about the sac-dev mailing list