1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . O S 2 L I B --
9 -- $Revision: 1.14 $ --
11 -- Copyright (C) 1993-1997 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 -- This package (and children) provide interface definitions to the standard
37 -- OS/2 Library. They are merely a translation of the various <bse*.h> files.
39 -- It is intended that higher level interfaces (with better names, and
40 -- stronger typing!) be built on top of this one for Ada (i.e. clean)
43 -- We have chosen to keep names, types, etc. as close as possible to the
44 -- C definition to provide easier reference to the documentation. The main
45 -- exception is when a formal and its type (in C) differed only by the case
46 -- of letters (like in HMUX hmux). In this case, we have prepended "F_" to
47 -- the formal (i.e. F_hmux : HMUX).
50 with Interfaces
.C
.Strings
;
53 package Interfaces
.OS2Lib
is
54 pragma Preelaborate
(OS2Lib
);
56 package IC
renames Interfaces
.C
;
57 package ICS
renames Interfaces
.C
.Strings
;
63 type APIRET
is new IC
.unsigned_long
;
64 type APIRET16
is new IC
.unsigned_short
;
65 subtype APIRET32
is APIRET
;
67 subtype PSZ
is ICS
.chars_ptr
;
68 subtype PCHAR
is ICS
.chars_ptr
;
69 subtype PVOID
is System
.Address
;
70 type PPVOID
is access all PVOID
;
72 type BOOL32
is new IC
.unsigned_long
;
73 False32
: constant BOOL32
:= 0;
74 True32
: constant BOOL32
:= 1;
76 type UCHAR
is new IC
.unsigned_char
;
77 type USHORT
is new IC
.unsigned_short
;
78 type ULONG
is new IC
.unsigned_long
;
79 type PULONG
is access all ULONG
;
81 -- Coprocessor stack register element.
84 losig
: ULONG
; -- Low 32-bits of the mantissa
85 hisig
: ULONG
; -- High 32-bits of the mantissa
86 signexp
: USHORT
; -- Sign and exponent
88 pragma Convention
(C
, FPREG
);
90 type AULONG
is array (IC
.size_t
range <>) of ULONG
;
91 type AFPREG
is array (IC
.size_t
range <>) of FPREG
;
93 type LHANDLE
is new IC
.unsigned_long
;
95 NULLHANDLE
: constant := 0;
101 function DosSleep
(How_long
: ULONG
) return APIRET
;
102 pragma Import
(C
, DosSleep
, "DosSleep");
104 type DATETIME
is record
116 type PDATETIME
is access all DATETIME
;
118 function DosGetDateTime
(pdt
: PDATETIME
) return APIRET
;
119 pragma Import
(C
, DosGetDateTime
, "DosGetDateTime");
121 function DosSetDateTime
(pdt
: PDATETIME
) return APIRET
;
122 pragma Import
(C
, DosSetDateTime
, "DosSetDateTime");
124 ----------------------------
125 -- Miscelleneous Features --
126 ----------------------------
128 -- Features which do not fit any child
130 function DosBeep
(Freq
: ULONG
; Dur
: ULONG
) return APIRET
;
131 pragma Import
(C
, DosBeep
, "DosBeep");
133 procedure Must_Not_Fail
(Return_Code
: OS2Lib
.APIRET
);
134 pragma Inline
(Must_Not_Fail
);
135 -- Many OS/2 functions return APIRET and are not supposed to fail. In C
136 -- style, these would be called as procedures, disregarding the returned
137 -- value. This procedure can be used to achieve the same effect with a
138 -- call of the form: Must_Not_Fail (Some_OS2_Function (...));
140 procedure Sem_Must_Not_Fail
(Return_Code
: OS2Lib
.APIRET
);
141 pragma Inline
(Sem_Must_Not_Fail
);
142 -- Similar to Must_Not_Fail, but used in the case of DosPostEventSem,
143 -- where the "error" code ERROR_ALREADY_POSTED is not really an error.
145 end Interfaces
.OS2Lib
;