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-- Copyright (C) 1993-1997 Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 2, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 17-- for more details. You should have received a copy of the GNU General -- 18-- Public License distributed with GNAT; see file COPYING. If not, write -- 19-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- 20-- MA 02111-1307, USA. -- 21-- -- 22-- As a special exception, if other files instantiate generics from this -- 23-- unit, or you link this unit with other files to produce an executable, -- 24-- this unit does not by itself cause the resulting executable to be -- 25-- covered by the GNU General Public License. This exception does not -- 26-- however invalidate any other reasons why the executable file might be -- 27-- covered by the GNU Public License. -- 28-- -- 29-- GNAT was originally developed by the GNAT team at New York University. -- 30-- Extensive contributions were provided by Ada Core Technologies Inc. -- 31-- -- 32------------------------------------------------------------------------------ 33 34-- This package (and children) provide interface definitions to the standard 35-- OS/2 Library. They are merely a translation of the various <bse*.h> files. 36 37-- It is intended that higher level interfaces (with better names, and 38-- stronger typing!) be built on top of this one for Ada (i.e. clean) 39-- programming. 40 41-- We have chosen to keep names, types, etc. as close as possible to the 42-- C definition to provide easier reference to the documentation. The main 43-- exception is when a formal and its type (in C) differed only by the case 44-- of letters (like in HMUX hmux). In this case, we have prepended "F_" to 45-- the formal (i.e. F_hmux : HMUX). 46 47with Interfaces.C; 48with Interfaces.C.Strings; 49with System; 50 51package Interfaces.OS2Lib is 52pragma Preelaborate (OS2Lib); 53 54 package IC renames Interfaces.C; 55 package ICS renames Interfaces.C.Strings; 56 57 ------------------- 58 -- General Types -- 59 ------------------- 60 61 type APIRET is new IC.unsigned_long; 62 type APIRET16 is new IC.unsigned_short; 63 subtype APIRET32 is APIRET; 64 65 subtype PSZ is ICS.chars_ptr; 66 subtype PCHAR is ICS.chars_ptr; 67 subtype PVOID is System.Address; 68 type PPVOID is access all PVOID; 69 70 type BOOL32 is new IC.unsigned_long; 71 False32 : constant BOOL32 := 0; 72 True32 : constant BOOL32 := 1; 73 74 type UCHAR is new IC.unsigned_char; 75 type USHORT is new IC.unsigned_short; 76 type ULONG is new IC.unsigned_long; 77 type PULONG is access all ULONG; 78 79 -- Coprocessor stack register element. 80 81 type FPREG is record 82 losig : ULONG; -- Low 32-bits of the mantissa 83 hisig : ULONG; -- High 32-bits of the mantissa 84 signexp : USHORT; -- Sign and exponent 85 end record; 86 pragma Convention (C, FPREG); 87 88 type AULONG is array (IC.size_t range <>) of ULONG; 89 type AFPREG is array (IC.size_t range <>) of FPREG; 90 91 type LHANDLE is new IC.unsigned_long; 92 93 NULLHANDLE : constant := 0; 94 95 --------------------- 96 -- Time Management -- 97 --------------------- 98 99 function DosSleep (How_long : ULONG) return APIRET; 100 pragma Import (C, DosSleep, "DosSleep"); 101 102 type DATETIME is record 103 hours : UCHAR; 104 minutes : UCHAR; 105 seconds : UCHAR; 106 hundredths : UCHAR; 107 day : UCHAR; 108 month : UCHAR; 109 year : USHORT; 110 timezone : IC.short; 111 weekday : UCHAR; 112 end record; 113 114 type PDATETIME is access all DATETIME; 115 116 function DosGetDateTime (pdt : PDATETIME) return APIRET; 117 pragma Import (C, DosGetDateTime, "DosGetDateTime"); 118 119 function DosSetDateTime (pdt : PDATETIME) return APIRET; 120 pragma Import (C, DosSetDateTime, "DosSetDateTime"); 121 122 ---------------------------- 123 -- Miscelleneous Features -- 124 ---------------------------- 125 126 -- Features which do not fit any child 127 128 function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET; 129 pragma Import (C, DosBeep, "DosBeep"); 130 131 procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET); 132 pragma Inline (Must_Not_Fail); 133 -- Many OS/2 functions return APIRET and are not supposed to fail. In C 134 -- style, these would be called as procedures, disregarding the returned 135 -- value. This procedure can be used to achieve the same effect with a 136 -- call of the form: Must_Not_Fail (Some_OS2_Function (...)); 137 138 procedure Sem_Must_Not_Fail (Return_Code : OS2Lib.APIRET); 139 pragma Inline (Sem_Must_Not_Fail); 140 -- Similar to Must_Not_Fail, but used in the case of DosPostEventSem, 141 -- where the "error" code ERROR_ALREADY_POSTED is not really an error. 142 143end Interfaces.OS2Lib; 144