comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Semantics of 'Image and 'Wide_Image on wide enumerations
Date: Fri, 3 Dec 2010 12:56:19 -0800 (PST)
Date: 2010-12-03T12:56:19-08:00	[thread overview]
Message-ID: <3602a004-b50b-42d5-9613-dc4dd522b47d@y19g2000prb.googlegroups.com> (raw)
In-Reply-To: 70d703e3-816a-4ad2-bf46-99ba9fab209e@z20g2000pra.googlegroups.com

On Dec 3, 12:25 pm, Michael R <mich...@zanyblue.com> wrote:
> Hi Folks,
>
> I'm trying to figure out how to get wide enumeration types to generate
> wide images of the values and am not getting results I would expect.
> Using the simple 'Image, e.g.,
>
> with Ada.Text_IO;
> procedure WEnum1 is
>    use Ada.Text_IO;
>    type Greek is (α, β, γ);
> begin
>    Put_Line ("Alpha is " & Greek'Image (α));
> end WEnum
>
> Gives, (possibly encoded?):
>
> $ gnatmake -gnat05 -gnatW8 wenum1.adb
> gcc -c -gnat05 -gnatW8 wenum1.adb
> gnatbind -x wenum1.ali
> gnatlink wenum1.ali
> $ ./wenum1
> Alpha is Α[]
>
> Using 'Wide_Image gives something more reasonable but not the actual
> wide characters:
>
> with Ada.Wide_Text_IO;
> procedure WEnum2 is
>    use Ada.Wide_Text_IO;
>    type Greek is (α, β, γ);
> begin
>    Put_Line ("Alpha is " & Greek'Wide_Image (α));
> end WEnum2;
>
> $ gnatmake -gnat05 -gnatW8 wenum2.adb
> gcc -c -gnat05 -gnatW8 wenum2.adb
> gnatbind -x wenum2.ali
> gnatlink wenum2.ali
> $ ./wenum2
> Alpha is Α
>
> Is this the expected behaviour?

I think that 'Image, 'Wide_Image, and 'Wide_Wide_Image of enumerations
(other than character literals) put the output in upper case, where
there is an upper case.  So what you're seeing is an upper-case alpha,
which looks just like an A.

                        -- Adam




  reply	other threads:[~2010-12-03 20:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-03 20:25 Semantics of 'Image and 'Wide_Image on wide enumerations Michael R
2010-12-03 20:56 ` Adam Beneschan [this message]
2010-12-03 21:15   ` Michael R
2010-12-03 21:17   ` Adam Beneschan
replies disabled

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