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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32ba5f24e70f4e55 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-07 20:51:49 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.skycache.com!Cidera!netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3AF76021.14CF06A9@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: accesing internal codes used for an enumeration References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 08 May 2001 03:51:49 GMT NNTP-Posting-Host: 158.252.122.165 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 989293909 158.252.122.165 (Mon, 07 May 2001 20:51:49 PDT) NNTP-Posting-Date: Mon, 07 May 2001 20:51:49 PDT X-Received-Date: Mon, 07 May 2001 20:50:15 PDT (newsmaster1.prod.itd.earthlink.net) Xref: newsfeed.google.com comp.lang.ada:7298 Date: 2001-05-08T03:51:49+00:00 List-Id: Marius Amado Alves wrote: > > I am trying to implement a lexicon (in the database sense) as an > enumeration with a representation clause. > > Example lexicon: > > Name <-> Code > ------------- > Ping 123 > Pong 456 > > Implementation: > > type Names is (Ping, Pong); > for Names use (Ping => 123, Pong => 456); > > I found out the hardway that attribute Pos does not return the internal > code. The ARM says this at 13.4(11), and tells you to use > Unchecked_Conversion instead--but does not instruct you on the types of > the conversion. Where might one learn that? Thanks. If you're using GNAT and don't mind going non-portable, GNAT provides the 'Enum_Rep attribute to extract the specified enumeration representation. (See the GNAT Reference Manual.) Marc A. Criley Senior Staff Engineer Quadrus Corporation www.quadruscorp.com