From: gaffney@ewir-wr (GAFFNEY.BRIAN)
Subject: "Use"ing Enumerated type values?
Date: 1996/02/23
Date: 1996-02-23T00:00:00+00:00 [thread overview]
Message-ID: <23FEB199614115172@ewir-wr> (raw)
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?
BTW I'm "use"ing GNAT 3.01 on DOS(DJGPP).
-- LONG pause while I check the RM --
The RM seems to indicate that "use type" is intended for using operations of
the type, so I guess it doesn't work with values... (?)
--Bg
next reply other threads:[~1996-02-23 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-02-23 0:00 GAFFNEY.BRIAN [this message]
1996-02-23 0:00 ` "Use"ing Enumerated type values? James A. Krzyzanowski
1996-02-24 0:00 ` Robert Dewar
1996-02-24 0:00 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox