comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org>
Subject: Re: interfaces.C - Import struct
Date: Sun, 13 Mar 2005 12:06:55 +0100
Date: 2005-03-13T12:06:04+01:00	[thread overview]
Message-ID: <pan.2005.03.13.11.06.53.748598@nospam.a2lf.org> (raw)
In-Reply-To: 1315747.Nh4vHchO3h@linux1.krischik.com

Le Sun, 13 Mar 2005 10:05:35 +0100, Martin Krischik a ᅵcritᅵ:

> Jean-Baptiste CAMPESATO wrote:
> 
>> Hello;
>> In a C Header file i've got this struct :
>>     typedef struct {
>>         void (*driver_setpixel_func) (int, int, int);
> 
> type driver_setpixel_type
> is access procedure (
>    A : Interfaces.C.int;
>    B  : Interfaces.C.int;
>    C : Interfaces.C.int);
> 
> pragma Convetion (C, driver_setpixel_type);
> 
>>         int (*driver_getpixel_func) (int, int);
>>         void (*driver_hline_func) (int, int, int, int);
>>         void (*driver_fillbox_func) (int, int, int, int, int);
>>         void (*driver_putbox_func) (int, int, int, int, void *, int);
>>         void (*driver_getbox_func) (int, int, int, int, void *, int);
>>         void (*driver_putboxmask_func) (int, int, int, int, void *);
>>         void (*driver_putboxpart_func) (int, int, int, int, int, int, void
>>         *,
>>                                         int, int);
>>         void (*driver_getboxpart_func) (int, int, int, int, int, int, void
>>         *,
>>                                         int, int);
>>         void (*driver_copybox_func) (int, int, int, int, int, int);
>>     } framebufferfunctions;
>> 
>> And with the package interfaces.C i wan't to import this structure as
>> "type framebufferfunctions is record" but i don't know the equivalent of a
>> pointer for a function in Ada, and if i must import all the possible
>> function.
>> And c2ada doesn't work under SlackwareLinux 10.1, Debian Sarge, Fedora2.
>> I've a lot of error when i compile.
>> Somebody can help please ? (use c2ada on vgagl.h or explicate me how
>> translat this struct)
> 
> You will need to define access to procedure type for each produre - as shown
> above. And you don't need to import the functions.
> 
> With Regards
> 
> Martin
> 
> BTW: do you know about:
> 
> typedef void driver_setpixel_type (int, int, int);
> 
> Looks much nicer then the (*xxxx) stuff - It is also easer to type: just
> copy the original prototype and replace extern/static with typedef - done.
> And the code would become symetic to the Ada code making maintance easier.

Thanks a looot :)



  reply	other threads:[~2005-03-13 11:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-13  7:53 interfaces.C - Import struct Jean-Baptiste CAMPESATO
2005-03-13  9:05 ` Martin Krischik
2005-03-13 11:06   ` Jean-Baptiste CAMPESATO [this message]
2005-03-13 12:31   ` Simon Wright
2005-03-13 17:27     ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox