[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] WindowsDevices and ncurses
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] WindowsDevices and ncurses |
Date: |
Mon, 07 Oct 2013 10:55:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
ROBERT SOLOMON <address@hidden> writes:
>>>> Gaius Mulley <address@hidden> 10/3/2013 5:02 PM >>>
> ROBERT SOLOMON <address@hidden> writes:
>
>>>>> Gaius Mulley <address@hidden> 10/3/2013 9:55 AM >>>
>> ROBERT SOLOMON <address@hidden> writes:
>>
>>> Hi. I am looking at the ncurses interface and WindowsDevices module. I
>>> noticed that this is an output only module.
>>>
>>> How do I do ncurses input?
>>>
>>> Thanks
>>
>> Hi Robert,
>>
>> you could use Terminal.Read from the pim libraries. I would
>> make this procedure the default by using StdIO.PushInput
>> and then use StrIO.Read, StrIO.ReadString and friends.
>>
>> You might want to put your terminal session (on Linux) into noecho
>> and raw mode - by using the command line program: stty.
>>
>> I sometimes run this from with my application by:
>>
>> libc.system(ADR('stty -echo -raw'))
>>
>> libc.system(ADR('reset'))
>>
>> For an example of how PushInput/PushOutput might be used see
>>
>> http://cvs.savannah.gnu.org/viewvc/*checkout*/gm2/examples/executive/
>> winexec.mod?revision=1.6&root=gm2
>>
>> although ignore the Executive related calls.
>>
>> regards,
>> Gaius
>>
>>
>> Why is that better than using the ncurses input routines?
>
> Hi Robert,
>
> it probably isn't - you could use those if you wished. The ncurses
> routines look pretty thorough - and you could still bundle them up
> to produce a:
>
> PROCEDURE Read (VAR ch: CHAR) ;
>
> and push this procedure onto the ReadInput. Then use standard M2
> input routines,
>
> regards,
> Gaius
>
> This still requires more C knowledge than I have.
> If I were to use the Terminal procedures that the documentation says not to
> use, how do I get input from different windows?
>
> How would I bundle up the C data types to corresponding M2?
>
> extern NCURSES_EXPORT(int) getch (void);
> extern NCURSES_EXPORT(int) getnstr (char *, int);
> extern NCURSES_EXPORT(int) getstr (char * );
Hi Rob,
you could add these to the ncurses.def file:
(*
extern NCURSES_EXPORT(int) getch (void);
*)
PROCEDURE getch () : INTEGER ;
(*
extern NCURSES_EXPORT(int) getnstr (char *, int);
*)
PROCEDURE getnstr (VAR s: ARRAY OF CHAR; n: INTEGER) : INTEGER ;
(*
extern NCURSES_EXPORT(int) getstr (char * );
*)
PROCEDURE getstr (VAR s: ARRAY OF CHAR) : INTEGER ;
lets us know how you get on with these
regards,
Gaius
> I think I only need a definition header to get started here. Too many void
> and
> * for my C knowledge base.
>
> Perhaps someone on the mailing list has already done something similar?
>
>