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.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!mailrus!cornell!uw-beaver!ssc-vax!shuksan!scott From: scott@shuksan.UUCP (Scott Moody) Newsgroups: comp.lang.ada Subject: Re: enumeration literal/internal codes query Summary: mixed_io Keywords: enumeration, literal, representation Message-ID: <1105@shuksan.UUCP> Date: 19 Jan 89 19:44:28 GMT References: <1494@wayback.UUCP> <1499@wayback.UUCP> <1074@shuksan.UUCP> <1438@trantor.harris-atd.com> Organization: The Boeing Co., BAC MMST, Seattle, WA List-Id: 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