From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f17381a34283299,start X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Enumeration I/O Date: 1998/02/09 Message-ID: #1/1 X-Deja-AN: 323627547 Content-Transfer-Encoding: 8bit References: <34DF9BBF.9FEA859B@er.uqam.ca> Content-Type: text/plain; charset=ISO-8859-1 Organization: Estormza Software Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-02-09T00:00:00+00:00 List-Id: In article <34DF9BBF.9FEA859B@er.uqam.ca>, Melanie Shatilla wrote: >I've declared an enumeration type with character literals, and a >variable of this type, for example : > TYPE Symbols is ('%', '$', 'a'); Don't name a type with a plural, unless it refers to a composite object. An instance of the Symbol(s) type contains only a single value, so that's how you should name the type: type Symbol is ('%', '$', 'a'); > Symb : Symbols := '$'; > > package Symbols_IO is new Text_IO.Enumeration_IO(Symbols); > >When I give the instruction : > Symbols_IO.Put(Symb); > >...I get the right symbol but with the quotes (and I don't want them). That is the defined behavior: character literals print out using the quotes. >Obviously, I've thought of writing something like : > > If Symb = '$' then > Text_IO.Put ('$'); > end if; > >..but there must be a more convenient way, I hope! Any suggestions >anyone ? You could implement a table: type Symbol_Character_Array is array (Symbol) of Character; function To_Character : constant Symbol_Character_Array := ('%' => '%', '$' => '$', 'a' => 'a'); begin Text_IO.Put (To_Charcter (Symb)); Another thing you can do is Put the Symbol object to a string, then just print the middle character of the 3-byte string. declare Symbol_As_String : String (1 .. 3); Symbol_As_Character : Character renames Symbol_As_String (2); begin Put (To => Symbol_As_String, Item => Symb); Put (Symbol_As_Character); end;