1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . O S 2 L I B --
10 -- Copyright (C) 1993-1997 Free Software Foundation, Inc. --
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. --
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. --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc. --
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)
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).
49 with Interfaces
.C
.Strings
;
52 package Interfaces
.OS2Lib
is
53 pragma Preelaborate
(OS2Lib
);
55 package IC
renames Interfaces
.C
;
56 package ICS
renames Interfaces
.C
.Strings
;
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.
83 losig
: ULONG
; -- Low 32-bits of the mantissa
84 hisig
: ULONG
; -- High 32-bits of the mantissa
85 signexp
: USHORT
; -- Sign and exponent
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;
100 function DosSleep
(How_long
: ULONG
) return APIRET
;
101 pragma Import
(C
, DosSleep
, "DosSleep");
103 type DATETIME
is 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
;