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,83f6fc8b31eceebe,start X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: C struct import Date: 2000/01/27 Message-ID: <%hOj4.120$hb5.4849@nnrp3-w.snfc21.pbi.net>#1/1 X-Deja-AN: 578136957 References: X-Complaints-To: abuse@pacbell.net X-Trace: nnrp3-w.snfc21.pbi.net 948941051 206.170.2.205 (Wed, 26 Jan 2000 18:44:11 PST) Organization: SBC Internet Services NNTP-Posting-Date: Wed, 26 Jan 2000 18:44:11 PST Newsgroups: comp.lang.ada Date: 2000-01-27T00:00:00+00:00 List-Id: Assuming the unused things are really unused, the 1 bit flags are Booleans, and Uint32 and SDL_PixelFormat types are elsewhere defined, you might say: type Access_SDL_Pixel_Format is access all SDL_PixelFormat; type SDL_VideoInfo is record hw_available, -- Can you create hardware surfaces? wm_available, -- Can you talk to a window manager? blit_hw, -- Accelerated blits HW --> HW blit_hw_CC, -- Accelerated blits with Colorkey blit_hw_A, -- Accelerated blits with Alpha blit_sw, -- Accelerated blits SW --> HW blit_sw_CC, -- Accelerated blits with Colorkey blit_sw_A, -- Accelerated blits with Alpha blit_fill : Boolean; -- Accelerated color fill video_mem : Uint32; -- The total amount of video memory (in K) vfmt : Access_SDL_Pixel_Format; -- Value: The format of the video surface end record; If you not only need a record with these things, but you need the bits to occur at specific places in the bytes (if you're interfacing to hardware or an OS, say), then you'll have to find out just where your C compiler puts things (since that's implementation dependent) and then include a record representation clause to ensure the Ada compiler puts things in the same places. My Microsoft VC++ says that it allocates bit fields from the right. My Windows targetted Ada compilers label bit locations Low_Order_First. So to make sure the Ada structure, using such an Ada compiler, matches the C ordering, using the Microsoft compiler, you would include: for SDL_VideoInfo use record hw_available at 0 range 0 .. 0; wm_available at 0 range 1 .. 1; blit_hw at 1 range 1 .. 1; blit_hw_CC at 1 range 2 .. 2; blit_hw_A at 1 range 3 .. 3; blit_sw at 1 range 4 .. 4; blit_sw_CC at 1 range 5 .. 5; blit_sw_A at 1 range 6 .. 6; blit_fill at 1 range 7 .. 7; video_mem at 4 range 0 .. 31; vfmt at 8 range 0 .. 31; -- Assuming Access types are 32 bits. end record;