This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: readline and guile


> 1. Accept command line user input using readline. it should not be in
> scheme syntax. I mean, I want "QUIT" not "(QUIT)" command.
> 
> 2. Listen to am TCP socket connection and read and process data as it
> becomes available.

I have done something very similar to that by using the alarm interrupt
to poll the listener socket for connections and also poll the connected
sockets for new data. It only polls once per second but I figure that a
one second lag on internet connections is hardly a big deal.

Since most of the processing is done by the signal handler, the main
repl prompt is still available as a control console.

> All data gathered from socket and command line will be first analyzed by C
> code and them eventually might call one or move guile functions.

Well I use guile's signal handling code because when you are using
guile you have pretty much no choice about the signal handling code
but then the guile signal handler calls a C function that does that
actual reading of the socket. Sockets are kept as guile ports just to
keep guile happy but none of guile's port handling code is actually used,
I just grab the file descriptor and run with that. Probably it wastes
some memory allocating file buffers that never get used but it is fast.

	- Tel