comp.lang.ada
 help / color / mirror / Atom feed
From: scott@shuksan.UUCP (Scott Moody)
Subject: Re: enumeration literal/internal codes query
Date: 19 Jan 89 19:44:28 GMT	[thread overview]
Message-ID: <1105@shuksan.UUCP> (raw)
In-Reply-To: 1438@trantor.harris-atd.com

In article <1438@trantor.harris-atd.com>, bbadger@x102c.uucp (Badger BA 64810) writes:
> In article <1074@shuksan.UUCP> scott@shuksan.UUCP (Scott Moody) writes:
> 
> I've been wondering why you *want* to access the ``internal'' representation.
> The standard use for representation clauses on enumeration types is to ``hide''
> The only thing I've thought of is to use it as an ``external representation''
> to be written to a file.  Normally, of course, you would just instantiate 
> SEQUENTIAL_IO on the enumeration type, or on a record type with a component

Try:
 type opcodes is
     ( op_no_op,
       op_integer,
       op_string,
       op_long_integer);

    for opcodes use
      (  
         op_no_op               => 16#00#,
         op_integer             => 16#41#,
         op_string              => 16#52#,
         op_long_integer        => 16#63#);

   Note the nice and clean syntax that Ada has supplied.

In my case, I am writing the internal representations 
of a lot of data structures to a file. Unfortunately 
there is no mixed_sequential_io so everything
must be broken into a common data type (unsigned bytes in my case).
Thus someone needs to make this conversion outside of the 'sequential_io' 
package. I supply a function to make this conversion which hides some
of the burden.

I agree that a sequential_io package would be nice, especially a mixed_io.

-- scott

  reply	other threads:[~1989-01-19 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-01-09 15:25 enumeration literal/internal codes query Arny B. Engelson
1989-01-10 23:15 ` Arny B. Engelson
1989-01-13 17:03   ` Scott Moody
1989-01-16 18:03     ` Badger BA 64810
1989-01-19 19:44       ` Scott Moody [this message]
1989-01-31 18:05         ` Arny B. Engelson
1989-01-15  4:42   ` John Goodenough
1989-01-12  0:31 ` Michael Murphy
1989-01-12 15:51 ` enumeration literal/internal codes stt
1989-01-20 15:04 ` ryer
  -- strict thread matches above, loose matches on Subject: below --
1989-01-13 21:29 enumeration literal/internal codes query rracine
replies disabled

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