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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d02b0db8c2d7bd81 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Representation Clauses for tagged types Date: 1998/08/26 Message-ID: <6s1evf$koe@hacgate2.hac.com>#1/1 X-Deja-AN: 384971599 References: <6s129l$i82$1@emperor.ssd.ray.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Hughes Aircraft Company Newsgroups: comp.lang.ada Date: 1998-08-26T00:00:00+00:00 List-Id: Courville wrote in message <6s129l$i82$1@emperor.ssd.ray.com>... >Help! > >I'm trying to define a representation clause for a tagged type >and I can't find any information about specifying where the >"tag" goes. I wan't to do something like this: > Why would you want a representation clause for a tagged type? If you really care about how a tagged type resides in memory this can be a real problem. More about this, later. If, on the other hand, you only care about how the type appears in a file or on a network, or other form of byte stream, then you can use the stream-oriented attributes, 'read, 'write, 'input, and 'output to achieve this. I have a small example of this on my FTP site at ftp://ftp.ada95.com/pub/tagged_types. Although my examples don't show it (they probably should), you can use the 'external_tag attribute to force the external form of the tag to be what you want. Finally, getting back to the problem of exact representation of the tagged type in memory (if that's what you really need), then you can use a memory stream package (such as the one on my FTP site -- part of the tagged_types example) to read and write between the exact representation you need in memory, and the compiler's representation of the tagged type. In this case, the tag in your memory stream will have the external tag you specify, and the compiler's representation of the tagged type will have its internal tag necessary for access to the dispatch table, etc. I hope this helps, David C. Hoos, Sr.