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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8b691ded59393771 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-22 15:42:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!intgwlon.nntp.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: Wrapping / Interfacing to C macros References: User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: Date: Thu, 22 Aug 2002 22:42:35 GMT NNTP-Posting-Host: 144.132.42.132 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1030056155 144.132.42.132 (Fri, 23 Aug 2002 08:42:35 EST) NNTP-Posting-Date: Fri, 23 Aug 2002 08:42:35 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:28324 Date: 2002-08-22T22:42:35+00:00 List-Id: In article , le_snelson@juno.com (Le Snelson) wrote: > I'm hoping someone has seen a dialect or pattern for interfacing to C > macros. I need to use the ioctl() mechanisms of VxWorks to control > some low level features of a couple of serial cards. I've never seen > any Ada applications wrapping up linguistic attributes such as the > following from Tornado/target/h/sys/ioctl.h : > > #define _IO(x,y) (IOC_VOID|((x)<<8)|y) > #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y) > #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y) > /* this should be _IORW, but stdio got there first */ > #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y) > > > #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ > #define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ > #define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ > #define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ > #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ Given the fact that you have a type parameter, a generic would seem the only solution for doing it in Ada. The rest can be done in standard (type safe!) Ada. Dale