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-Thread: a07f3367d7,b85c1b84f840dc22,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!d5g2000yqm.googlegroups.com!not-for-mail From: Harry Tucker Newsgroups: comp.lang.ada Subject: I need a little help - it's been a long time - with enumeration type and for use representation Date: Fri, 13 Nov 2009 08:03:23 -0800 (PST) Organization: http://groups.google.com Message-ID: <7495d29e-0361-4eba-9e22-a770ae50f113@d5g2000yqm.googlegroups.com> NNTP-Posting-Host: 69.154.142.246 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1258128203 32606 127.0.0.1 (13 Nov 2009 16:03:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Nov 2009 16:03:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d5g2000yqm.googlegroups.com; posting-host=69.154.142.246; posting-account=gm6zjwoAAADRUx8sKB8rAyyVV-bSRk9M User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Media Center PC 5.0; OfficeLiveConnector.1.4; OfficeLivePatch.0.0; SLCC1; .NET4.0C; .NET4.0E; Tablet PC 2.0; Creative AutoUpdate v1.40.01; msn OptimizedIE8;ENUS),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8084 Date: 2009-11-13T08:03:23-08:00 List-Id: I haven't played with Ada for many years. I've read John Barnes' book, Programming in Ada 2005, and picked through the ARM on my problem. I have a piece of data which represents a enumeration as a hexadecimal value. It is a bit field but I see the data most usefull as an enumeration. for example in the CSV file the data is represented as '0x1'. So I defined the enum as: type Spell_School_Type is ( UNKNOWN, PHYSICAL, HOLY, FIRE, ... And since the data has a value I use a represetation clause as: for Spell_School_Type use (UNKNOWN => 2#0000_0000#, PHYSICAL => 2#0000_0001#, HOLY => 2#0000_0010#, FIRE => 2#0000_0100#, ... Is the best way to parse the raw info (i.e. 0x1) into the enumeration (i.e PHYSICAL) to use a if/elsif and assign the enum position or is there an attribute which works best. Harry