comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Converting Type Characters to type string
Date: Mon, 31 Mar 2008 15:33:45 -0700 (PDT)
Date: 2008-03-31T15:33:45-07:00	[thread overview]
Message-ID: <a3164cf1-d1ad-4009-b313-58be1bfb60ef@s19g2000prg.googlegroups.com> (raw)
In-Reply-To: 76c5beff-f3e9-44ae-ab96-7da01ea17a65@s37g2000prg.googlegroups.com

On Mar 31, 1:26 pm, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
> On 31 Mar, 17:41, Adam Beneschan <a...@irvine.com> wrote:
>
> > I almost never use single-character input.  The only time I would want
> > to is if, for some reason, you need the program to react immediately
> > to some key that's typed in (other than Return or Enter).  E.g. I've
> > written programs that will do something interesting if the user
> > presses the up-arrow or down-arrow keys on the keyboard.
>
> How did you do this?
> Normally, the operating system (the terminal, actually), isolates the
> process from all such things and feeds the complete line of text to
> the process' input queue *after* it is committed by Enter. The program
> has no way to react to individual keystrokes.

No, any decent OS would provide a way to input immediate keystrokes.
On Linux, I think it involves a call to either ioctl() or
tcsetattr()---I don't remember---to turn off the OS's complete-line
handling.

As Georg pointed out, Get_Immediate is available in Ada to do this for
you.  Actually, I may have written this program before Ada 95 was
available, which meant that Get_Immediate wasn't available, so
something tricky had to be done.  But my program still uses
Text_IO.Get.  Of course, whatever I did is non-portable.

Anyway, I'm a bit sorry I mentioned this, because it has nothing to do
with the point I was trying to make.

                                  -- Adam




  parent reply	other threads:[~2008-03-31 22:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-30 20:04 Converting Type Characters to type string jedivaughn
2008-03-30 20:19 ` Pascal Obry
2008-03-30 21:08   ` jedivaughn
2008-03-30 21:28     ` jimmaureenrogers
2008-03-30 21:38     ` Ludovic Brenta
2008-03-30 21:48   ` Georg Bauhaus
2008-03-30 23:52     ` jedivaughn
2008-03-31  3:04       ` george.priv
2008-03-31  4:00         ` tmoran
2008-03-31  8:54           ` Ludovic Brenta
2008-03-31  9:59             ` Dmitry A. Kazakov
2008-03-31 10:59               ` Jean-Pierre Rosen
2008-03-31 13:50                 ` jedivaughn
2008-03-31 14:11                   ` Ludovic Brenta
2008-03-31 14:21                   ` Dmitry A. Kazakov
2008-03-31 14:44                     ` jedivaughn
2008-03-31 15:41                       ` Adam Beneschan
2008-03-31 20:26                         ` Maciej Sobczak
2008-03-31 22:06                           ` Georg Bauhaus
2008-03-31 22:33                           ` Adam Beneschan [this message]
2008-04-01  1:00                             ` jedivaughn
2008-04-01  5:34                               ` Simon Wright
2008-04-01 11:22                                 ` jedivaughn
2008-04-01 12:00                                   ` jimmaureenrogers
2008-04-01 13:22                                     ` jedivaughn
2008-04-01 17:03                                       ` Adam Beneschan
2008-04-01 21:11                                   ` Simon Wright
2008-04-01 22:22                                     ` jedivaughn
2008-04-03  5:54                                   ` tmoran
2008-04-03 14:38                                     ` Adam Beneschan
2008-04-01 16:58                               ` Adam Beneschan
2008-03-31 15:45                       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox