From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f21f69f50399d723 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: problem with ada.interrupts Date: 10 Aug 2005 11:19:37 -0700 Organization: http://groups.google.com Message-ID: <1123697977.213739.89920@g14g2000cwa.googlegroups.com> References: <1123689689.517640.262600@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 209.194.156.4 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1123697982 28390 127.0.0.1 (10 Aug 2005 18:19:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 10 Aug 2005 18:19:42 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=209.194.156.4; posting-account=SqOfxAwAAAAkL81YAPGH1JdBwpUXw9ZG Xref: g2news1.google.com comp.lang.ada:4072 Date: 2005-08-10T11:19:37-07:00 List-Id: evangeli@cnam.fr wrote: > hello > in my program i want to catch the interruption by the user, e.g., > ctrl+c. > i looked at the RM and it seems that package ada.interrupts is designed > to do this kind of things. > so i tested this little program (my compiler is gnat 3.15p) : > Consider the following statements from the Ada Reference Manual: The form of a pragma Interrupt_Handler is as follows: pragma Interrupt_Handler(handler_name); The form of a pragma Attach_Handler is as follows: pragma Attach_Handler(handler_name, expression); Name Resolution Rules For the Interrupt_Handler and Attach_Handler pragmas, the handler_name shall resolve to denote a protected procedure with a parameterless profile. For the Attach_Handler pragma, the expected type for the expression is Interrupts.Interrupt_ID (see C.3.2). Legality Rules The Attach_Handler pragma is only allowed immediately within the protected_definition where the corresponding subprogram is declared. The corresponding protected_type_declaration or single_protected_declaration shall be a library level declaration. The Interrupt_Handler pragma is only allowed immediately within a protected_definition. The corresponding protected_type_declaration shall be a library level declaration. In addition, any object_declaration of such a type shall be a library level declaration. ------- Your Attach_Handler pragma is misplaced. You do not have an Interrupt_Handler pragma. Your protected object is not defined at a library level. Jim Rogers