comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <sam_harris@hso.link.com>
Subject: Re: Unix SELECT Ada binding
Date: 1999/07/22
Date: 1999-07-22T00:00:00+00:00	[thread overview]
Message-ID: <379780B7.51868604@hso.link.com> (raw)
In-Reply-To: 379638B1.101427E5@res.raytheon.com

Andy Askey wrote:
> 
> Has anyone created an Ada package with binding into the SELECT C library
> function that does I/O multiplexing?  The binding is straight forward
> but there are several macros (FD_SET, FD_CLR, ...) that have to be
> translated into Ada.
> 
> For example, the select.h file has the following macro for FD_SET:
> 
> #define FD_SET(__n, __p)        ((__p)->fds_bits[(__n)/FD_NFDBITS] |= \
>                                     ((unsigned)1 << ((__n) %
> FD_NFDBITS)))
> 
> If anyone has an example of this they care to share, we will greatly
> appreciated it.
> 
> Thanx.
> Andy
> --

Doing this ages ago in another life, I found the easiest
thing to do was write a C helper routine which used the
macro instead of trying to duplicate the macro in Ada.
Interface to the C helpers and viola. Takes about 5 mins work.

While Ada purists may cringe at this, I find that one
of my favorite features of Ada are the interface capabilities
which allows me to glue stuff together when that is
appropriate. I don't like C, but I recognize the need
to use it when it gets the job done.

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Scientific and Technical Systems
"If you can make it, We can fake it!"




  parent reply	other threads:[~1999-07-22  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-21  0:00 Unix SELECT Ada binding Andy Askey
1999-07-21  0:00 ` David C. Hoos, Sr.
1999-07-22  0:00 ` Samuel T. Harris [this message]
1999-07-22  0:00 ` Andi Kleen
1999-07-22  0:00 ` Gisle S�lensminde
replies disabled

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