From: "file13" <file13@qlippoth.zzn.com>
Subject: Trouble translating a C expression to Ada
Date: Thu, 18 Oct 2001 15:16:40 -0500
Date: 2001-10-18T15:16:40-05:00 [thread overview]
Message-ID: <FMGz7.5$7a6.89@nnrp2.sbc.net> (raw)
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/
next reply other threads:[~2001-10-18 20:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-18 20:16 file13 [this message]
2001-10-18 22:43 ` Trouble translating a C expression to Ada Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox