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=0.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bff026af2839ecbd X-Google-Attributes: gid103376,public From: jakrzy@ss2.magec.com (James A. Krzyzanowski) Subject: Re: "Use"ing Enumerated type values? Date: 1996/02/23 Message-ID: #1/1 X-Deja-AN: 140854414 sender: usenet@most.fw.hac.com x-nntp-posting-host: ss2 references: <23FEB199614115172@ewir-wr> organization: Magnavox Electronics Systems Company newsgroups: comp.lang.ada Date: 1996-02-23T00:00:00+00:00 List-Id: GAFFNEY.BRIAN (gaffney@ewir-wr) wrote: : I'm trying to write a program utilizing the ANSI screen package posted by : Ray Toal. What I'd like to do for clarity is something like this: : -- : with Text_IO; : with Ansi_Terminal; : procedure Test_Ansi is : package Ansi renames Ansi_Terminal; : ForeGrd, BackGrd : Ansi.Color; -- type Color is (Black,..., White); : begin : Ansi.Erase_Display; : BackGrd := White; --Error, White not visible : ForeGrd := Black; --Error, Black not visible : Ansi.Set_Character_Colors (BackGrd, ForeGrd); : Text_IO.Put("This should be home."); : end Ansi_Test; : -- : However, to use the values for Ansi.Color, I need to specify "Ansi.White" and : "Ansi.Black". I'd like to use the values of Color without the "Ansi." : everytime. Since I don't want to "use" Ansi_Terminal, I thought "use type : Ansi.Color" would work but I still can't use the values directly. If I define : my own Color as a subtype of Ansi.Color, I can define my variables as Colors, : and refer to the values of Color, but I can't use these variables as parameters : to routines in Ansi (they expect type Ansi.Color). : Is there any way to refer directly to the values of a type without "use"ing the : entire package? In Ada83, you can do the following; although it is NOT recommended (I would recommend that you just use the "package"."value")... function Black return Ansi.Color renames Ansi.Black; function White return Ansi.Color renames Ansi.White; ... -- Not necessarily the opinion of the company... -- --------------------------------------------------------------------------- James A. Krzyzanowski - Senior Software Engineer - AFATDS Magnavox Electronic Systems Company * Fort Wayne, IN 46808 * (219) 429-6446 Internet: jakrzy@most.fw.hac.com * AOL: JimShiz@AOL.com * MOST: jakrzy@most "I'd rather be right than politically correct !!!" ---------------------------------------------------------------------------