From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Converting Char to Enum
Date: Mon, 4 Mar 2002 17:17:05 -0600
Date: 2002-03-04T17:17:05-06:00 [thread overview]
Message-ID: <mailman.1015283462.19162.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: Xns91C7B32C8C0DELars17NoCBW@larsno.fqdn.th-h.de
----- Original Message -----
From: "Lars Noschinski" <lars@usenet.noschinski.de>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Monday, March 04, 2002 10:36 AM
Subject: Re: Converting Char to Enum
> "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote:
> > I think the reason that V'alue and 'Image are not appropriate
> > for the original poster's case is that his case was a subset of
> > the type Character.
>
> | type Symbols is ('0', '1', 'B', 'T', 'U');
>
> Is that really a subset of character? I'm asking, because the following
> code prints "'0'", "'B'" etc. and not "0", "B".
>
Take a look at two things, viz.:
1. The definition of the Character type in LRM A.1 (35)
2. The output of this program:
with Ada.Text_IO;
procedure Lars
is
type Symbols is ('0', '1', 'B', 'T', 'U');
package Symbol_IO is new Ada.Text_IO.Enumeration_IO (Symbols);
package Character_IO is new Ada.Text_IO.Enumeration_IO (Character);
begin
Ada.Text_IO.Put_Line ("Symbols:");
for S in Symbols loop
Symbol_IO.Put (S);
Ada.Text_IO.Put (", ");
end loop;
Ada.Text_IO.New_Line (2);
Ada.Text_IO.Put_Line ("Characters:");
for C in Character loop
Character_IO.Put (C);
Ada.Text_IO.Put (", ");
end loop;
Ada.Text_IO.New_Line (2);
end Lars;
> --------------------------------------------------------------------
> procedure Put_Symbol(sym : symbol) is
>
> package TIO is new Ada.Text_Io.Enumeration_Io(Symbols);
>
> begin -- Put_Symbol
> TIO.Put(Sym);
> end Put_Symbol.
> --------------------------------------------------------------------
>
>
> CU Lars Noschinski
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
next prev parent reply other threads:[~2002-03-04 23:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-02 18:17 Converting Char to Enum Lars Noschinski
2002-03-03 1:15 ` sk
2002-03-03 16:43 ` Robert Dewar
2002-03-03 18:54 ` Lars Noschinski
2002-03-03 20:07 ` Larry Kilgallen
2002-03-03 20:21 ` Lars Noschinski
2002-03-03 22:46 ` Larry Kilgallen
2002-03-04 6:55 ` Jeffrey Carter
2002-03-03 20:13 ` tmoran
2002-03-03 6:30 ` tmoran
2002-03-04 11:01 ` sk
[not found] ` <3C835426.DA864199@myob.com>
2002-03-04 12:48 ` David C. Hoos, Sr.
2002-03-04 16:36 ` Lars Noschinski
2002-03-04 23:17 ` David C. Hoos [this message]
2002-03-05 15:55 ` Lars Noschinski
2002-03-05 20:15 ` David C. Hoos
-- strict thread matches above, loose matches on Subject: below --
2002-03-06 6:23 Christoph Grein
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox