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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f2513845b4ef39f,start X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: More C Date: 2000/01/28 Message-ID: <3890ECFE.5FFAFCB3@earthlink.net>#1/1 X-Deja-AN: 578593701 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: Thu Jan 27 19:13:16 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 949029196 63.11.142.87 (Thu, 27 Jan 2000 19:13:16 PST) Organization: EarthLink Network, Inc. MIME-Version: 1.0 Reply-To: jrcarter@acm.org NNTP-Posting-Date: Thu, 27 Jan 2000 19:13:16 PST Newsgroups: comp.lang.ada Date: 2000-01-28T00:00:00+00:00 List-Id: Jan Kroken wrote: > I have the following C structs > > typedef struct { > Uint8 r; > Uint8 g; > Uint8 b; > Uint8 unused; > } SDL_Color; > > typedef struct { > int ncolors; /* number of colors */ > SDL_Color *colors; /* array of colors */ > } SDL_Palette; > > and have included them in Ada as > > type SDL_Color is record > R, G, B, Unused: C.Unsigned_Char; > end record; Note the comment that this is an array. The best way to treat this in Ada is probably as an array: type SDL_Palette is record Num_Colors : C.Int; Address_Of_Color_Array : System.Address; end record; Given: Palette : SDL_Palette; containing data from C, use type Color_Set is array (C.Int range <>) of SDL_Color; Colors : Color_Set (1 .. Palette.Num_Colors); for Colors'Address use Palette.Address_Of_Color_Array; That only answers 1 of your 2 questions, I'm afraid. -- Jeff Carter "We burst our pimples at you." Monty Python & the Holy Grail