OSDN Git Service

* approved by rth
[pf3gnuchains/gcc-fork.git] / gcc / ada / dec-io.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUNTIME COMPONENTS                          --
4 --                                                                          --
5 --                               D E C . I O                                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1996-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT 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.  GNAT 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 GNAT;  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 -- GNAT was originally developed  by the GNAT team at  New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  This is an AlphaVMS package that contains the declarations and
36 --  function specifications needed by the DECLib IO packages.
37
38 with System.Task_Primitives;
39 package DEC.IO is
40 private
41
42    type Exception_Number is (
43      GNAT_EN_LOCK_ERROR,
44      GNAT_EN_EXISTENCE_ERROR,
45      GNAT_EN_KEY_ERROR,
46      GNAT_EN_KEYSIZERR,
47      GNAT_EN_STAOVF,
48      GNAT_EN_CONSTRAINT_ERRO,
49      GNAT_EN_IOSYSFAILED,
50      GNAT_EN_LAYOUT_ERROR,
51      GNAT_EN_STORAGE_ERROR,
52      GNAT_EN_DATA_ERROR,
53      GNAT_EN_DEVICE_ERROR,
54      GNAT_EN_END_ERROR,
55      GNAT_EN_MODE_ERROR,
56      GNAT_EN_NAME_ERROR,
57      GNAT_EN_STATUS_ERROR,
58      GNAT_EN_NOT_OPEN,
59      GNAT_EN_ALREADY_OPEN,
60      GNAT_EN_USE_ERROR,
61      GNAT_EN_UNSUPPORTED,
62      GNAT_EN_FAC_MODE_MISMAT,
63      GNAT_EN_ORG_MISMATCH,
64      GNAT_EN_RFM_MISMATCH,
65      GNAT_EN_RAT_MISMATCH,
66      GNAT_EN_MRS_MISMATCH,
67      GNAT_EN_MRN_MISMATCH,
68      GNAT_EN_KEY_MISMATCH,
69      GNAT_EN_MAXLINEXC,
70      GNAT_EN_LINEXCMRS);
71
72    for Exception_Number'Size use 32;
73
74    for Exception_Number use (
75      GNAT_EN_LOCK_ERROR => 1,
76      GNAT_EN_EXISTENCE_ERROR => 2,
77      GNAT_EN_KEY_ERROR => 3,
78      GNAT_EN_KEYSIZERR => 4,
79      GNAT_EN_STAOVF => 5,
80      GNAT_EN_CONSTRAINT_ERRO => 6,
81      GNAT_EN_IOSYSFAILED => 7,
82      GNAT_EN_LAYOUT_ERROR => 8,
83      GNAT_EN_STORAGE_ERROR => 9,
84      GNAT_EN_DATA_ERROR => 10,
85      GNAT_EN_DEVICE_ERROR => 11,
86      GNAT_EN_END_ERROR => 12,
87      GNAT_EN_MODE_ERROR => 13,
88      GNAT_EN_NAME_ERROR => 14,
89      GNAT_EN_STATUS_ERROR => 15,
90      GNAT_EN_NOT_OPEN => 16,
91      GNAT_EN_ALREADY_OPEN => 17,
92      GNAT_EN_USE_ERROR => 18,
93      GNAT_EN_UNSUPPORTED => 19,
94      GNAT_EN_FAC_MODE_MISMAT => 20,
95      GNAT_EN_ORG_MISMATCH => 21,
96      GNAT_EN_RFM_MISMATCH => 22,
97      GNAT_EN_RAT_MISMATCH => 23,
98      GNAT_EN_MRS_MISMATCH => 24,
99      GNAT_EN_MRN_MISMATCH => 25,
100      GNAT_EN_KEY_MISMATCH => 26,
101      GNAT_EN_MAXLINEXC => 27,
102      GNAT_EN_LINEXCMRS => 28);
103
104    procedure Raise_IO_Exception (EN : Exception_Number);
105    pragma Export_Procedure (Raise_IO_Exception, "GNAT$RAISE_IO_EXCEPTION",
106       Mechanism => Value);
107
108    package IO_Locking is
109       type Access_Mutex is private;
110       function Create_Mutex return Access_Mutex;
111       procedure Acquire (M : Access_Mutex);
112       procedure Release (M : Access_Mutex);
113
114    private
115       type Access_Mutex is access System.Task_Primitives.RTS_Lock;
116       pragma Export_Function (Create_Mutex, "GNAT$CREATE_MUTEX",
117           Mechanism => Value);
118       pragma Export_Procedure (Acquire, "GNAT$ACQUIRE_MUTEX",
119           Mechanism => Value);
120       pragma Export_Procedure (Release, "GNAT$RELEASE_MUTEX",
121           Mechanism => Value);
122    end IO_Locking;
123
124 end DEC.IO;