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,9bd91636f2b444a0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-29 19:31:28 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttln1.wa.home.com.POSTED!not-for-mail From: "DuckE" Newsgroups: comp.lang.ada References: <9p5rd30202n@drn.newsguy.com> Subject: Re: how to print position number of an enumeration variable? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <3uvt7.55862$QK.36794657@news1.sttln1.wa.home.com> Date: Sun, 30 Sep 2001 02:31:27 GMT NNTP-Posting-Host: 24.248.45.203 X-Complaints-To: abuse@home.net X-Trace: news1.sttln1.wa.home.com 1001817087 24.248.45.203 (Sat, 29 Sep 2001 19:31:27 PDT) NNTP-Posting-Date: Sat, 29 Sep 2001 19:31:27 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:13534 Date: 2001-09-30T02:31:27+00:00 List-Id: Perhaps: Put_Line( "the position number of the first enumeration element is " & Integer'Image( Day_Type'Pos( Day_Type'First ) ) ); SteveD "mike@athome" wrote in message news:9p5rd30202n@drn.newsguy.com... > hello, > > suppose I have a variable of some enumeration type, and I want to > print or find the position number in the enumeration type that this > variable holds. How can do that? > > for example: > > ----------- > with Ada.Text_Io; use Ada.Text_Io; > > procedure Enum is > type Day_type is (Monday, Tuesday, Wednesday, Thursday, > Friday, Saturday, Sunday); > > Day Day_Type := Monday; > > begin > > Put_Line("the position number of first enumeration elemenet is " & > Day_type'Image( ???? ) ); > > end Enum; > > --------------- > > I know that the first enumeration literal will have a position of 0. But > I just wanted to see if one can print this value. I looked at the attributes > of scalar data types, and do not see something like S'pos ? > > thanks, > mike >