* Claude Marinier <[email protected]> [130729 00:26]: > 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.
Thanks for your suggestions! I think they are alright and one could compile or include different files while building the egg. Together with your other (off-list) patches I think we can improve parley and windows support in general. I appreciate your help here! I will try to integrate this into parley and will probably ask for your help! Thanks, Christian -- In the world, there is nothing more submissive and weak than water. Yet for attacking that which is hard and strong, nothing can surpass it. --- Lao Tzu _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
