From: cts@kampong.aedinc.net ((null))
Subject: Re: Handling signals in ADA
Date: Fri, 16 Mar 2001 03:06:09 GMT
Date: 2001-03-16T03:06:09+00:00 [thread overview]
Message-ID: <Bqfs6.524$5R6.5373@newsfeed.slurp.net> (raw)
In-Reply-To: 87y9u6k7s6.fsf@deneb.enyo.de
In article <87y9u6k7s6.fsf@deneb.enyo.de>,
Florian Weimer <fw@deneb.enyo.de> wrote:
>Tomas Hlavaty <hlavaty@labe.felk.cvut.cz> writes:
>
>> Hi, could you help me with translating following C code to ADA?
>
>
>The standard Ada library does not support signals. Typical Ada
>programs use other communication mechanisms,
Yes, but typical Unix programs use signals.
Florist will have what you want. You can find those at
ftp://ftp.cs.fsu.edu/pub/PART
Alternatively if you're using the gnat compiler you can the facilities
in Ada.Interrupts. Here's an example-
-- cut here --
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Interrupts.names;
with Interrupt_Handler; use Interrupt_Handler;
pragma Unreserve_All_Interrupts;
procedure When_Is_It_Over is
Fat_Lady: Singer(Ada.Interrupts.Names.SIGINT);
begin
loop
New_Line;
delay 1.0;
Put("It ain't over...");
exit when Fat_Lady.Sings;
end loop;
Put_Line(" until the fat lady sings.");
end When_Is_It_over;
-- cut here --
with Ada.Interrupts;
package Interrupt_Handler is
protected type Singer (Id: Ada.Interrupts.Interrupt_Id) is
function Sings return Boolean;
procedure Handler;
pragma Attach_Handler(Handler, Id);
private
Done: Boolean := False;
end Singer;
end;
-- cut here --
package body Interrupt_Handler is
protected body Singer is
function Sings return Boolean is
begin
return Done;
end Sings;
procedure handler is
begin
done := True;
end handler;
end Singer;
end;
--
=======================================================================
Life is short. | Craig Spannring
Bike hard, ski fast. | cts@internetcds.com
--------------------------------+------------------------------------
next prev parent reply other threads:[~2001-03-16 3:06 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
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) [this message]
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