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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,63f1f8d3ec129778,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-18 13:16:41 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!sfo2-feed1.news.digex.net!intermedia!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!cyclone-sf.pbi.net!151.164.30.35!cyclone.swbell.net!nnrp2.sbc.net.POSTED!not-for-mail From: "file13" Newsgroups: comp.lang.ada Subject: Trouble translating a C expression to Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Thu, 18 Oct 2001 15:16:40 -0500 NNTP-Posting-Host: 208.188.29.210 X-Complaints-To: abuse@swbell.net X-Trace: nnrp2.sbc.net 1003436197 208.188.29.210 (Thu, 18 Oct 2001 15:16:37 CDT) NNTP-Posting-Date: Thu, 18 Oct 2001 15:16:37 CDT Organization: SBC Internet Services Xref: archiver1.google.com comp.lang.ada:14913 Date: 2001-10-18T15:16:40-05:00 List-Id: Howdy all, I've been going through "Programming Linux Games" ( http://www.nostarch.com/plg.htm ) and translating the SDL examples to Ada using AdaSDL ( https://sourceforge.net/projects/adasdl/ or http://www.adapower.net/%7Eavargas/ ) and I've run into a snag. How would one translate this expression into Ada: raw_pixels[offset] = pixel_color; where raw_pixels is a pointer to a SDL Uint16 type (i.e. Uint16 *raw_pixels;) offset is an integer, and pixel_color is a SDL Uint16 type (not a pointer). The original C is here: http://www.qlippoth.com/direct-pixel-drawing-sdl.c and what I've got so far on the Ada version is here: http://www.qlippoth.com/direct_pixel_drawing_sdl.adb I'm using Gnat-3.13p on Mandrake 8.1 Would SDL.Types.Increment be the correct way to do this and if so would we require more Unchecked_Conversions? one of it's prototypes is: function Increment ( Pointer : Uint16_Ptrs.Object_Pointer; Amount : Natural) return Uint16_Ptrs.Object_Pointer; pragma Inline (Increment); The gnathtml docs are here: http://www.adapower.net/~avargas/SDL/AdaSDLhtml/index.htm Also, if you find any other problems please let me know. :) Thank you! -- file13 http://www.qlippoth.com/