comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dstanbro@bigpond.net.au>
Subject: Re: Wrapping / Interfacing to C macros
Date: Thu, 22 Aug 2002 22:42:35 GMT
Date: 2002-08-22T22:42:35+00:00	[thread overview]
Message-ID: <dstanbro-3D832F.08423623082002@news-server.bigpond.net.au> (raw)
In-Reply-To: ec0cf315.0208221356.7356d38a@posting.google.com

In article <ec0cf315.0208221356.7356d38a@posting.google.com>,
 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



  reply	other threads:[~2002-08-22 22:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-22 21:56 Wrapping / Interfacing to C macros Le Snelson
2002-08-22 22:42 ` Dale Stanbrough [this message]
2002-08-22 23:29 ` tmoran
2002-08-23  8:26 ` Thierry Lelegard
2002-08-23 16:13   ` Warren W. Gay VE3WWG
2002-08-23 10:18 ` Lutz Donnerhacke
2002-08-31 15:03 ` Florian Weimer
replies disabled

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