Greetings,
This is where parley uses stty.
(define (enable-raw-mode port)
(let ((old-attrs (get-terminal-attributes port)))
(install-exit-handler! port old-attrs)
(stty port '(not echo icanon isig brkint icrnl inpck istrip ixon))
(stty port '(cs8 opost))
(set-buffering-mode! port #:none)
old-attrs)
Creating a complete Win32 replacement for stty would be a lot of work but
replacing only the parts which parley uses would be much less work. It
might look like this.
#include <windows.h>
HANDLE hConsolehandle;
DWORD fdwOldMode, fdwNewMode;
hConsoleHandle = GetStdHandle(STD_INPUT_HANDLE);
if ( hConsoleHandle == INVALID_HANDLE_VALUE ) {
ErrorExit("GetStdHandle"); /* or something more sensible */
}
if ( ! GetConsoleMode( hConsoleHandle, &fdwOldMode ) ) {
ErrorExit("GetConsoleMode"); /* or something more sensible */
}
fdwNewMode = fdwOldMode &
~( ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT );
if ( ! SetConsoleMode( hconsoleHandle, fdwNewMode ) ) {
ErrorExit("GetStdHandle"); /* or something more sensible */
}
Would the exit handler and set_buffering_mode require POSIX?
One would have to save the old mode for use by the exit handler.
Could this be put in-line? How would one handle the conditional inclusion
of the Win32 code?
Just thinking out loud. I hope you don't mind.
--
Claude Marinier
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users