comp.lang.ada
 help / color / mirror / Atom feed
* Wrapping / Interfacing to C macros
@ 2002-08-22 21:56 Le Snelson
  2002-08-22 22:42 ` Dale Stanbrough
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Le Snelson @ 2002-08-22 21:56 UTC (permalink / 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?



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-08-31 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-22 21:56 Wrapping / Interfacing to C macros Le Snelson
2002-08-22 22:42 ` 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

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