chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] porting parley to MS Windows ?


From: Christian Kellermann
Subject: Re: [Chicken-users] porting parley to MS Windows ?
Date: Mon, 29 Jul 2013 10:12:34 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

* Claude Marinier <address@hidden> [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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]