comp.lang.ada
 help / color / mirror / Atom feed
From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Re: Concatenate enumeration
Date: Tue, 24 Nov 2009 11:42:59 -0800 (PST)
Date: 2009-11-24T11:42:59-08:00	[thread overview]
Message-ID: <3b19f303-1443-4e92-bdf2-21960ee92288@h10g2000vbm.googlegroups.com> (raw)
In-Reply-To: be502fa4-37e4-47c0-a0ba-1618eee9a35e@1g2000vbm.googlegroups.com

On Nov 23, 1:15 pm, Pablo <pablit...@gmail.com> wrote:
> Hi, I have a enumerate type and I have another one which I want to add
> some enumerations.
> So:
> type Enumerate_Type is
>   (
>    NONE,
>    READY
>   );
> for Enumerate_Type use
>   (
>    NONE  => 0,
>    READY=> 1
>   );
> for Enumerate_Type'Size use 1;
>
> and I want to create a new type Enumerate2_Type which could be the
> form
> type Enumerate_Type is
>   (
>    NONE,
>    READY,
>    OFF
>   );
> for Enumerate_Type use
>   (
>    NONE  => 0,
>    READY=> 1,
>    OFF     => 2
>   );
> for Enumerate_Type'Size use 2;
>
> How to I do this without having to explicit clone the first one?
> Thanks

It sounds as if you want the binary values of your enumerations to be
concatenated within a field.  You *can* do this by declaring a record
that has 2 fields, one for each enumeration.  You then can use a
representation clause to specify that the first type is contained in,
say, the first bit of the record and that the second type is contained
in the next 2 bits of the record.

This has the effect of concatenating the bit representations of the
types, but, of course, it does not concatenate the enumerations at the
Ada level, that is, the literals themselves.

Eryndlia



  parent reply	other threads:[~2009-11-24 19:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 18:15 Concatenate enumeration Pablo
2009-11-23 19:14 ` Jeffrey R. Carter
2009-11-23 23:21   ` Robert A Duff
2009-11-25 22:53     ` Randy Brukardt
2009-11-26  8:59       ` Dmitry A. Kazakov
2009-11-26  9:48         ` Georg Bauhaus
2009-11-26 10:03           ` Dmitry A. Kazakov
2009-11-24 19:42 ` Eryndlia Mavourneen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-10-22 19:49 okellogg
2010-10-26  0:29 ` Yannick Duchêne (Hibou57)
2010-11-12 17:55 ` Randy Brukardt
replies disabled

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