[plt-scheme] Custom READ?

From: Billy (thepaces at ardmore.net)
Date: Mon Mar 3 11:05:00 EST 2003

I am experimenting with writing a Scheme-based command shell for Windows and have the
following problem.

Rather than using the standard READ-LINE, READ-CHAR, etc routines which hang until end
of line or eof I'd like to intercept key presses as they occur.  This would allow me to
do things like command line completion on [TAB] (like bash), [CTRL+R] to search command
history, etc.  I "think" I need to use MAKE-CUSTOM-INPUT-PORT for this.

1) Is this correct?  What are my other alternatives (e.g., would setting
PORT-READ-HANDLER be more appropriate)?

2) If I do use MAKE-CUSTOM-INPUT-PORT, do I need to write a C module (linked into a DLL)
to handle all the keyboard events or can it all be done within Scheme?

Also, it might be useful to know that the application is text mode (no GUI) and once I
get it debugged I will compile it to a stand-alone application.

Thanks in advance,

Posted on the users mailing list.