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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95cb9cc00d809d62,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-23 04:43:34 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: wojtek@power.com.pl (Wojtek Narczynski) Newsgroups: comp.lang.ada Subject: Reading a C record from socket - chicken / egg problem - now complete Date: 23 Nov 2002 04:43:33 -0800 Organization: http://groups.google.com/ Message-ID: <5ad0dd8a.0211230443.4b476252@posting.google.com> NNTP-Posting-Host: 217.98.138.16 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1038055413 6737 127.0.0.1 (23 Nov 2002 12:43:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 23 Nov 2002 12:43:33 GMT Xref: archiver1.google.com comp.lang.ada:31176 Date: 2002-11-23T12:43:33+00:00 List-Id: Hello, (sorry for my previous "post", hand slipped...) I want to read a record like this: typedef struct { unsigned char version; unsigned char type; unsigned char requestIdB1; unsigned char requestIdB0; unsigned char contentLengthB1; unsigned char contentLengthB0; unsigned char paddingLength; unsigned char reserved; unsigned char contentData[contentLength]; unsigned char paddingData[paddingLength]; } FCGI_Record; from socket. The 'type' field indicates different record type, so I could declare different record types in Ada, but when I know 'type' the record is already in memory. How should I approach this: 1. use Unchecked_Conversion to convert to appropriate type? 2. Copy data into a new record of appropriate type? 3. Just live with the structure C imposes? Another question is: can I declare non-contiguous enumeration subtypes, or only range x..y? I've been unable to figure out how to declare non-contiguous subtype, so I guess this isn't allowable, but why? How am I supposed to write a strong typing program if I am not able to declare a type that clearly "exists" (in math sense)? For example: -- Doestn't work type Animal is ( Pig, Dog, Fish ); subtype Nice_Animal is Animal ( Pig, Dog ); subtype Home_Animail is Animal ( Dog, Fish ); subtype Eatable_Animal is Animal ( Pig, Fish ); In reality I wanted to declare subtypes of request type that don't span a contiguous range. Thanks for your patience & regards, Wojtek Narczynski P.S. Another question, slightly offtopic, is there any server where I could get posting access to this group? Currently I use Google Groups.