comp.lang.ada
 help / color / mirror / Atom feed
From: le_snelson@juno.com (Le Snelson)
Subject: Wrapping / Interfacing to C macros
Date: 22 Aug 2002 14:56:02 -0700
Date: 2002-08-22T21:56:02+00:00	[thread overview]
Message-ID: <ec0cf315.0208221356.7356d38a@posting.google.com> (raw)

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? */


I have one alternative in mind - create a C function to provide all of
these macros through a parameterized selection.

Any other ideas?



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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-22 21:56 Le Snelson [this message]
2002-08-22 22:42 ` Wrapping / Interfacing to C macros Dale Stanbrough
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