comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Help on record to a Newbie
Date: Thu, 27 Dec 2012 12:25:06 -0800 (PST)
Date: 2012-12-27T12:25:06-08:00	[thread overview]
Message-ID: <1dc74aed-badc-40fc-8182-b63d5e401686@googlegroups.com> (raw)
In-Reply-To: <e0c99332-4f90-4d84-bc54-43d0fb7f5754@googlegroups.com>

Partitioning the code given into a package, called terminal, compiled quite easily. I cleaned up the names, a bit, too.

   -- Declare a package for defining types and operations on a terminal.
   Package Terminal is

      type terminal_type is (black_n_white, black_n_yellow,
                             black_n_green, color);
      type terminal_color is (red, green, blue, yellow, black, white, grey);
      type terminal_configuration is
         record
            terminal   : terminal_type;
            foreground,
            background : terminal_color;
         end record;

      -- Declare a variable for the configuration; use of this package implies
      -- usage of a terminal.
      t_config : terminal_configuration;
   End Terminal;

   Package Body Terminal is
      
   -- Here we set the defaults for the configuration. Alternatively, in the
   -- package specification we could have used named association to set the
   -- default: 
   -- t_config : terminal_configuration := 
   --    (Terminal => black_n_white, background => black, foreground => white);
   Begin
      t_config.terminal   := black_n_white;
      t_config.background := black;
      t_config.foreground := white; 
   End Terminal;



  parent reply	other threads:[~2012-12-27 20:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 19:31 Help on record to a Newbie Cedric
2012-12-27 19:50 ` Jeffrey Carter
2012-12-27 19:51 ` Niklas Holsti
2012-12-27 20:25 ` Shark8 [this message]
2012-12-27 23:53 ` Cedric
2012-12-28  8:00   ` Niklas Holsti
2012-12-28  8:30     ` Cedric
2012-12-28  9:29       ` Simon Wright
2012-12-30 17:29       ` Niklas Holsti
2012-12-28 11:52 ` Cedric
2012-12-28 15:36   ` Shark8
2012-12-30 16:03   ` Niklas Holsti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox