comp.lang.ada
 help / color / mirror / Atom feed
* Interrupts service
@ 2001-01-05 12:28 Szygula
  2001-01-05 13:20 ` Marc A. Criley
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Szygula @ 2001-01-05 12:28 UTC (permalink / raw)


WHAT'S WRONG IN THIS PROGRAM ???


with Text_Io, Ada.Calendar, Ada.Integer_Text_Io;
use Text_Io, Ada.Calendar, Ada.Integer_Text_Io;
with Ada.Interrupts;
use Ada.Interrupts;

with Ada.Interrupts.Names;
use Ada.Interrupts.Names;
with System; use System;
with system.storage_elements; use system.storage_elements;


procedure program is

type Parameterless_Handler is access protected procedure;


protected type Sygnal(p:Interrupt_ID)is

procedure Steruj;
pragma Interrupt_handler(Steruj);
pragma Attach_Handler(Steruj,p);
end Sygnal;


protected body sygnal is

procedure Steruj is
begin
Put("przerwanie");
end steruj;

end sygnal;

begin
null;

end program;


I NEED INFORMATION OF INTERRUPTS IN ADA95.
thanks.

szygula@szygula.prv.pl
POLAND






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

* Re: Interrupts service
  2001-01-05 12:28 Interrupts service Szygula
@ 2001-01-05 13:20 ` Marc A. Criley
  2001-01-05 14:05 ` Florian Weimer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marc A. Criley @ 2001-01-05 13:20 UTC (permalink / raw)


What is this program supposed to do?  How does what it is doing differ
from what you expect?  What compiler are you using?  On what platform?

It is much easier to help if you provide that kind of information when
you ask a question like this.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com


Szygula wrote:
> 
> WHAT'S WRONG IN THIS PROGRAM ???
> 
> with Text_Io, Ada.Calendar, Ada.Integer_Text_Io;
> use Text_Io, Ada.Calendar, Ada.Integer_Text_Io;
> with Ada.Interrupts;
> use Ada.Interrupts;
> 
> with Ada.Interrupts.Names;
> use Ada.Interrupts.Names;
> with System; use System;
> with system.storage_elements; use system.storage_elements;
> 
> procedure program is
> 
> type Parameterless_Handler is access protected procedure;
> 
> protected type Sygnal(p:Interrupt_ID)is
> 
> procedure Steruj;
> pragma Interrupt_handler(Steruj);
> pragma Attach_Handler(Steruj,p);
> end Sygnal;
> 
> protected body sygnal is
> 
> procedure Steruj is
> begin
> Put("przerwanie");
> end steruj;
> 
> end sygnal;
> 
> begin
> null;
> 
> end program;
> 
> I NEED INFORMATION OF INTERRUPTS IN ADA95.
> thanks.
> 
> szygula@szygula.prv.pl
> POLAND



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

* Re: Interrupts service
  2001-01-05 12:28 Interrupts service Szygula
  2001-01-05 13:20 ` Marc A. Criley
@ 2001-01-05 14:05 ` Florian Weimer
  2001-01-05 14:06 ` Ken Garlington
  2001-01-05 14:49 ` Ted Dennison
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2001-01-05 14:05 UTC (permalink / raw)


"Szygula" <szygula@szygula.prv.pl> writes:

> pragma Interrupt_handler(Steruj);
> pragma Attach_Handler(Steruj,p);

'Steruj' has to declared at the outer level ('library level'), not
inside another procedure (as in your code).  For example, to make your
code compile, you can put 'Steruj' into a package.



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

* Re: Interrupts service
  2001-01-05 12:28 Interrupts service Szygula
  2001-01-05 13:20 ` Marc A. Criley
  2001-01-05 14:05 ` Florian Weimer
@ 2001-01-05 14:06 ` Ken Garlington
  2001-01-05 14:49 ` Ted Dennison
  3 siblings, 0 replies; 5+ messages in thread
From: Ken Garlington @ 2001-01-05 14:06 UTC (permalink / raw)


"Szygula" <szygula@szygula.prv.pl> wrote in message
news:934ecj$pdn$1@news.tpi.pl...
: WHAT'S WRONG IN THIS PROGRAM ???

It uses generic names (e.g. "program"), and it has no comments, so there's
no way to determine what capabilities it's supposed to provide? (Just a
guess...)





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

* Re: Interrupts service
  2001-01-05 12:28 Interrupts service Szygula
                   ` (2 preceding siblings ...)
  2001-01-05 14:06 ` Ken Garlington
@ 2001-01-05 14:49 ` Ted Dennison
  3 siblings, 0 replies; 5+ messages in thread
From: Ted Dennison @ 2001-01-05 14:49 UTC (permalink / raw)


In article <934ecj$pdn$1@news.tpi.pl>,
  "Szygula" <szygula@szygula.prv.pl> wrote:
> WHAT'S WRONG IN THIS PROGRAM ???
>

> procedure program is
>
...
> protected type Sygnal(p:Interrupt_ID)is
>
> procedure Steruj;
> pragma Interrupt_handler(Steruj);
> pragma Attach_Handler(Steruj,p);
> end Sygnal;

Well, for one thing, the LRM says that the protected type that contains
those pragmas must be declared at the library level (in a package spec),
while you have it declared within a procedure. I'd be suprised if your
compiler didn't tell you this too.

For another, I don't see you creating any objects of type "Sygnal".
(Those will also have to be declared at the library level.) A type
declaration by itself doesn't really do much of anything.

Thirdly, I don't think you need the Interrup_Handler pragma the way you
have things set up, but it probably won't hurt anything either.

>
> protected body sygnal is
>
> procedure Steruj is
> begin
> Put("przerwanie");
> end steruj;

Fourthly, I believe Text_IO operations are "potentially blocking", and
therefore are forbidden within protected operations.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



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

end of thread, other threads:[~2001-01-05 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-05 12:28 Interrupts service Szygula
2001-01-05 13:20 ` Marc A. Criley
2001-01-05 14:05 ` Florian Weimer
2001-01-05 14:06 ` Ken Garlington
2001-01-05 14:49 ` Ted Dennison

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