FSF GCC merge 02/23/03
[official-gcc.git] / gcc / ada / i-os2lib.ads
blob5a19a51c2232d9d60ceb4fe1a95a79ca206d6f54
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I N T E R F A C E S . O S 2 L I B --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1993-1997 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 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package (and children) provide interface definitions to the standard
36 -- OS/2 Library. They are merely a translation of the various <bse*.h> files.
38 -- It is intended that higher level interfaces (with better names, and
39 -- stronger typing!) be built on top of this one for Ada (i.e. clean)
40 -- programming.
42 -- We have chosen to keep names, types, etc. as close as possible to the
43 -- C definition to provide easier reference to the documentation. The main
44 -- exception is when a formal and its type (in C) differed only by the case
45 -- of letters (like in HMUX hmux). In this case, we have prepended "F_" to
46 -- the formal (i.e. F_hmux : HMUX).
48 with Interfaces.C;
49 with Interfaces.C.Strings;
50 with System;
52 package Interfaces.OS2Lib is
53 pragma Preelaborate (OS2Lib);
55 package IC renames Interfaces.C;
56 package ICS renames Interfaces.C.Strings;
58 -------------------
59 -- General Types --
60 -------------------
62 type APIRET is new IC.unsigned_long;
63 type APIRET16 is new IC.unsigned_short;
64 subtype APIRET32 is APIRET;
66 subtype PSZ is ICS.chars_ptr;
67 subtype PCHAR is ICS.chars_ptr;
68 subtype PVOID is System.Address;
69 type PPVOID is access all PVOID;
71 type BOOL32 is new IC.unsigned_long;
72 False32 : constant BOOL32 := 0;
73 True32 : constant BOOL32 := 1;
75 type UCHAR is new IC.unsigned_char;
76 type USHORT is new IC.unsigned_short;
77 type ULONG is new IC.unsigned_long;
78 type PULONG is access all ULONG;
80 -- Coprocessor stack register element.
82 type FPREG is record
83 losig : ULONG; -- Low 32-bits of the mantissa
84 hisig : ULONG; -- High 32-bits of the mantissa
85 signexp : USHORT; -- Sign and exponent
86 end record;
87 pragma Convention (C, FPREG);
89 type AULONG is array (IC.size_t range <>) of ULONG;
90 type AFPREG is array (IC.size_t range <>) of FPREG;
92 type LHANDLE is new IC.unsigned_long;
94 NULLHANDLE : constant := 0;
96 ---------------------
97 -- Time Management --
98 ---------------------
100 function DosSleep (How_long : ULONG) return APIRET;
101 pragma Import (C, DosSleep, "DosSleep");
103 type DATETIME is record
104 hours : UCHAR;
105 minutes : UCHAR;
106 seconds : UCHAR;
107 hundredths : UCHAR;
108 day : UCHAR;
109 month : UCHAR;
110 year : USHORT;
111 timezone : IC.short;
112 weekday : UCHAR;
113 end record;
115 type PDATETIME is access all DATETIME;
117 function DosGetDateTime (pdt : PDATETIME) return APIRET;
118 pragma Import (C, DosGetDateTime, "DosGetDateTime");
120 function DosSetDateTime (pdt : PDATETIME) return APIRET;
121 pragma Import (C, DosSetDateTime, "DosSetDateTime");
123 ----------------------------
124 -- Miscelleneous Features --
125 ----------------------------
127 -- Features which do not fit any child
129 function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET;
130 pragma Import (C, DosBeep, "DosBeep");
132 procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET);
133 pragma Inline (Must_Not_Fail);
134 -- Many OS/2 functions return APIRET and are not supposed to fail. In C
135 -- style, these would be called as procedures, disregarding the returned
136 -- value. This procedure can be used to achieve the same effect with a
137 -- call of the form: Must_Not_Fail (Some_OS2_Function (...));
139 procedure Sem_Must_Not_Fail (Return_Code : OS2Lib.APIRET);
140 pragma Inline (Sem_Must_Not_Fail);
141 -- Similar to Must_Not_Fail, but used in the case of DosPostEventSem,
142 -- where the "error" code ERROR_ALREADY_POSTED is not really an error.
144 end Interfaces.OS2Lib;