From: Tero Koskinen on
On Mon, 12 Apr 2010 03:36:42 -0700 (PDT) Jerry wrote:

> Thanks, Georg and Manuel, for testing. I'm on OS X 10.5.8 and:

Most likely Get_Immediate is not implemented for OS X and
the code is defaulting to blocking behaviour.

Look at getc_immediate_common in sysdep.c.

I have there (gcc 4.3.4) following #ifdef jungle:
....
{
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__)
....

__MACHTEN__ might be related to OS X, but I don't have a Mac around, so
I am just guessing.

> Jerry


--
Tero Koskinen - http://iki.fi/tero.koskinen/
From: John B. Matthews on
In article <20100412181434.dd154269.tero.koskinen(a)iki.fi>,
Tero Koskinen <tero.koskinen(a)iki.fi> wrote:

> On Mon, 12 Apr 2010 03:36:42 -0700 (PDT) Jerry wrote:
>
> > Thanks, Georg and Manuel, for testing. I'm on OS X 10.5.8 and:
>
> Most likely Get_Immediate is not implemented for OS X and
> the code is defaulting to blocking behaviour.
>
> Look at getc_immediate_common in sysdep.c.
>
> I have there (gcc 4.3.4) following #ifdef jungle:
> ...
> {
> #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
> || (defined (__osf__) && ! defined (__alpha_vxworks)) \
> || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
> || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
> || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__)
> ...
>
> __MACHTEN__ might be related to OS X, but I don't have a Mac around, so
> I am just guessing.

For reference, MachTen is a product to run the GNU development toolset,
including GNAT, on Mac OS 9.

<http://www.tenon.com/products/machten/>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: Simon Wright on
Tero Koskinen <tero.koskinen(a)iki.fi> writes:

> On Mon, 12 Apr 2010 03:36:42 -0700 (PDT) Jerry wrote:
>
>> Thanks, Georg and Manuel, for testing. I'm on OS X 10.5.8 and:
>
> Most likely Get_Immediate is not implemented for OS X and
> the code is defaulting to blocking behaviour.
>
> Look at getc_immediate_common in sysdep.c.
>
> I have there (gcc 4.3.4) following #ifdef jungle:
> ...
> {
> #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
> || (defined (__osf__) && ! defined (__alpha_vxworks)) \
> || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
> || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
> || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__)
> ...
>
> __MACHTEN__ might be related to OS X, but I don't have a Mac around, so
> I am just guessing.

The current source (r156233) says

{
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__)

and it's the __APPLE__ that does the trick. This was fixed 2009-04-15
(r146098) and is OK in GNAT GPL 2009 and, of course, in GCC 4.5.0 (still
only 'experimental').
From: Alex Mentis on
On Apr 12, 12:12 am, Jerry <lancebo...(a)qwest.net> wrote:
> [Sorry for the cross-post.]

> I thought Get_Immediate would work (reading Cohen's book) but it does
> not do what I want. For example, the following program stops looping
> and requires me to hit RETURN even if I hit another key first. It
> continues looping (very slowly) if I hold down the RETURN key.
>

Are you using GPS as your IDE by any chance? When I run programs
using Get_Immediate from inside GPS, Get_Immediate does not work as it
should (it requires a CR after the character input). When I run those
same programs in an external terminal window it works fine. Perhaps
something between your keyboard and your program is buffering your
input without your knowledge?

Alex

From: Jerry on
On Apr 12, 1:57 pm, Alex Mentis <asmen...(a)gmail.com> wrote:
snip
> Are you using GPS as your IDE by any chance?  When I run programs
> using Get_Immediate from inside GPS, Get_Immediate does not work as it
> should (it requires a CR after the character input).  When I run those
> same programs in an external terminal window it works fine.  Perhaps
> something between your keyboard and your program is buffering your
> input without your knowledge?
>
> Alex

I'm not using GPS, but I thought of the possibility of a problem with
the development environment which in my case is Apple's Xcode. That's
why I executed in three other terminal programs (including Apple's
Terminal.app, the terminal in Path Finder, and something called
iTerm), but all gave the same result. Which doesn't completely answer
the question of stealth buffering. But given the discussion above
about a patch I'm guessing the problem is not weird buffering.

Jerry