comp.lang.ada
 help / color / mirror / Atom feed
From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner)
Subject: Re: Handling signals in ADA
Date: 15 Mar 2001 18:48:09 GMT
Date: 2001-03-15T18:48:09+00:00	[thread overview]
Message-ID: <98r2p9$9ic1@news.cis.okstate.edu> (raw)
In-Reply-To: 3AADFFCF.691F1F8@labe.felk.cvut.cz

On Tue, 13 Mar 2001 12:09:03 +0100, Tomas Hlavaty
<hlavaty@labe.felk.cvut.cz> wrote:
>Hi, could you help me with translating following C code to ADA?

Someone else posted a literal translation*. The question is, what do you
want to do? For most Ada programming, signals aren't the right tool for
the job. Tasks and exceptions can handle many signal uses; others may
take a little more thought to rewrite, but it's usually better to
program in the language you're programming in, than force a design for C
into Ada. (As a side note, SIGUSR1 is not always safe to use in an Ada
program - GNAT in the standard (ACT) configuration uses it for
threading.) 

However, sometimes the external enviroment hands a signal you have to
handle. In which case, my solution would be to write a little C
encapsulating all the signal details and call it. You could also check
out the Ada packages listed below, or look up Florist, a free Ada Posix
binding.

* To properly use SIGUSR1, you could write a one line C function 
returning SIGUSR1 and import it, or write a compile time program that
finds the value of SIGUSR1 and includes it. If you're using GNAT, you
should check out Ada.Interrupts.Names and System.OS_Interface, which
also tell you all the reserved signals.

-- 
David Starner - dstarner98@aasaa.ofe.org
Pointless website: http://dvdeug.dhis.org
"I don't care if Bill personally has my name and reads my email and 
laughs at me. In fact, I'd be rather honored." - Joseph_Greg



  parent reply	other threads:[~2001-03-15 18:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-13 11:09 Handling signals in ADA Tomas Hlavaty
2001-03-15  5:21 ` DuckE
2001-03-15 18:48 ` David Starner [this message]
2001-03-16 17:17   ` Robert A Duff
2001-03-15 22:05 ` Florian Weimer
2001-03-15 23:42   ` Ed Falis
2001-03-16  1:27   ` David C. Hoos, Sr.
2001-03-16  1:48     ` Jeffrey Carter
2001-03-16 21:06     ` Florian Weimer
2001-03-17  1:00       ` David C. Hoos, Sr.
2001-03-16  3:06   ` (null)
2001-03-16 13:10     ` Tomas Hlavaty
replies disabled

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