Hi all,

Boh Yap asked me a few days ago about using readline() with PicoLisp.
(He now also subscribed to this list. Welcome, Boh Yap!)

I had never bothered about readline(), as I felt perfectly comfortable
with "lib/led.l". But, on the other hand, just having an incomplete 'vi'
mode might not be enough for some people.


So I sent him a quick hack:

################################################################
# 27nov08abu
# (c) Software Lab. Alexander Burger

(load "lib/gcc.l")

(gcc "readline" '("-lreadline") '_led)

#include <readline/readline.h>
#include <readline/history.h>

any _led(any ex __attribute__((unused))) {
   char *p = readline("");
   any x = mkStr(p);
   free(p);
   return x;
}

/**/

# Enable line editing
(de *Led (_led))

# vi:et:ts=3:sw=3
################################################################

Make sure that you have a readline development package (like
"libreadline5-dev") installed.


Basically, it works

   $ ./p readline.l

but somehow not as I would expect. Though I can edit and execute lines,
the history seems not available, and perhaps other things, too.

Does anybody have experiences with readline()?

Any other comments or tips?

If we get it to run fine, I will put it into the official release as
"lib/readline.l". It could then be used as a replacement for "lib/led.l"
in "dbg.l", for example.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to