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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9d06e958bd4b5e53 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!proxad.net!proxad.net!teaser.fr!news.wanadoo.fr!news.wanadoo.fr!not-for-mail From: Jean-Baptiste CAMPESATO Organization: a2lf - Association pour le Logiciel Libre Francophone Subject: Re: interfaces.C - Import struct Date: Sun, 13 Mar 2005 12:06:55 +0100 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table) Message-ID: Newsgroups: comp.lang.ada References: <1315747.Nh4vHchO3h@linux1.krischik.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 13 Mar 2005 12:06:04 CET NNTP-Posting-Host: 83.200.98.214 X-Trace: 1110711964 news.wanadoo.fr 3117 83.200.98.214:36735 X-Complaints-To: abuse@wanadoo.fr Xref: g2news1.google.com comp.lang.ada:9306 Date: 2005-03-13T12:06:04+01:00 List-Id: 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 :)