OSDN Git Service

* objc/objc-act.c (UTAG_STATICS, UTAG_PROTOCOL_LIST, USERTYPE):
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-interr.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4 --                                                                          --
5 --                         A D A . I N T E R R U P T S                      --
6 --                                                                          --
7 --                                  B o d y                                 --
8 --                                                                          --
9 --                                                                          --
10 --             Copyright (C) 1991-2001 Florida State University             --
11 --                                                                          --
12 -- GNARL is free software; you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- As a special exception,  if other files  instantiate  generics from this --
24 -- unit, or you link  this unit with other files  to produce an executable, --
25 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
26 -- covered  by the  GNU  General  Public  License.  This exception does not --
27 -- however invalidate  any other reasons why  the executable file  might be --
28 -- covered by the  GNU Public License.                                      --
29 --                                                                          --
30 -- GNARL was developed by the GNARL team at Florida State University. It is --
31 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
32 -- State University (http://www.gnat.com).                                  --
33 --                                                                          --
34 ------------------------------------------------------------------------------
35
36 with System.Interrupts;
37 --  used for Interrupt_ID
38 --           Parameterless_Handler
39 --           Is_Reserved
40 --           Is_Handler_Attached
41 --           Current_Handler
42 --           Attach_Handler
43 --           Exchange_Handler
44 --           Detach_Handler
45 --           Reference
46
47 with Unchecked_Conversion;
48
49 package body Ada.Interrupts is
50
51    package SI renames System.Interrupts;
52
53    function To_System is new Unchecked_Conversion
54      (Parameterless_Handler, SI.Parameterless_Handler);
55
56    function To_Ada is new Unchecked_Conversion
57      (SI.Parameterless_Handler, Parameterless_Handler);
58
59    --------------------
60    -- Attach_Handler --
61    --------------------
62
63    procedure Attach_Handler
64      (New_Handler : Parameterless_Handler;
65       Interrupt   : Interrupt_ID)
66    is
67    begin
68       SI.Attach_Handler
69         (To_System (New_Handler), SI.Interrupt_ID (Interrupt), False);
70    end Attach_Handler;
71
72    ---------------------
73    -- Current_Handler --
74    ---------------------
75
76    function Current_Handler
77      (Interrupt : Interrupt_ID)
78       return      Parameterless_Handler
79    is
80    begin
81       return To_Ada (SI.Current_Handler (SI.Interrupt_ID (Interrupt)));
82    end Current_Handler;
83
84    --------------------
85    -- Detach_Handler --
86    --------------------
87
88    procedure Detach_Handler (Interrupt : in Interrupt_ID) is
89    begin
90       SI.Detach_Handler (SI.Interrupt_ID (Interrupt), False);
91    end Detach_Handler;
92
93    ----------------------
94    -- Exchange_Handler --
95    ----------------------
96
97    procedure Exchange_Handler
98      (Old_Handler : out Parameterless_Handler;
99       New_Handler : Parameterless_Handler;
100       Interrupt   : Interrupt_ID)
101    is
102       H : SI.Parameterless_Handler;
103
104    begin
105       SI.Exchange_Handler
106         (H, To_System (New_Handler),
107          SI.Interrupt_ID (Interrupt), False);
108       Old_Handler := To_Ada (H);
109    end Exchange_Handler;
110
111    -----------------
112    -- Is_Attached --
113    -----------------
114
115    function Is_Attached (Interrupt : Interrupt_ID) return Boolean is
116    begin
117       return SI.Is_Handler_Attached (SI.Interrupt_ID (Interrupt));
118    end Is_Attached;
119
120    -----------------
121    -- Is_Reserved --
122    -----------------
123
124    function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is
125    begin
126       return SI.Is_Reserved (SI.Interrupt_ID (Interrupt));
127    end Is_Reserved;
128
129    ---------------
130    -- Reference --
131    ---------------
132
133    function Reference (Interrupt : Interrupt_ID) return System.Address is
134    begin
135       return SI.Reference (SI.Interrupt_ID (Interrupt));
136    end Reference;
137
138 end Ada.Interrupts;