OSDN Git Service

2008-08-20 Emmanuel Briot <briot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-winext.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                        GNAT RUN-TIME COMPONENTS                          --
4 --                                                                          --
5 --                     S Y S T E M . W I N 3 2 . E X T                      --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --            Copyright (C) 2008, 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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 provides the part of the low level Win32 interface which is
35 --  not supported by RTX (but supported by regular Windows platforms).
36
37 package System.Win32.Ext is
38    pragma Pure;
39
40    ---------------------
41    -- Time Management --
42    ---------------------
43
44    function QueryPerformanceFrequency
45      (lpFrequency : access LARGE_INTEGER) return Win32.BOOL;
46    pragma Import
47      (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency");
48
49    ---------------
50    -- Processor --
51    ---------------
52
53    function SetThreadIdealProcessor
54      (hThread          : HANDLE;
55       dwIdealProcessor : ProcessorId) return DWORD;
56    pragma Import (Stdcall, SetThreadIdealProcessor, "SetThreadIdealProcessor");
57
58    --------------
59    -- Com Port --
60    --------------
61
62    DTR_CONTROL_DISABLE : constant := 16#0#;
63    RTS_CONTROL_DISABLE : constant := 16#0#;
64    NOPARITY            : constant := 0;
65    ODDPARITY           : constant := 1;
66    EVENPARITY          : constant := 2;
67    ONESTOPBIT          : constant := 0;
68    TWOSTOPBITS         : constant := 2;
69
70    type DCB is record
71       DCBLENGTH         : DWORD;
72       BaudRate          : DWORD;
73       fBinary           : Bits1;
74       fParity           : Bits1;
75       fOutxCtsFlow      : Bits1;
76       fOutxDsrFlow      : Bits1;
77       fDtrControl       : Bits2;
78       fDsrSensitivity   : Bits1;
79       fTXContinueOnXoff : Bits1;
80       fOutX             : Bits1;
81       fInX              : Bits1;
82       fErrorChar        : Bits1;
83       fNull             : Bits1;
84       fRtsControl       : Bits2;
85       fAbortOnError     : Bits1;
86       fDummy2           : Bits17;
87       wReserved         : WORD;
88       XonLim            : WORD;
89       XoffLim           : WORD;
90       ByteSize          : BYTE;
91       Parity            : BYTE;
92       StopBits          : BYTE;
93       XonChar           : CHAR;
94       XoffChar          : CHAR;
95       ErrorChar         : CHAR;
96       EofChar           : CHAR;
97       EvtChar           : CHAR;
98       wReserved1        : WORD;
99    end record;
100    pragma Convention (C, DCB);
101    pragma Pack (DCB);
102
103    type COMMTIMEOUTS is record
104       ReadIntervalTimeout         : DWORD;
105       ReadTotalTimeoutMultiplier  : DWORD;
106       ReadTotalTimeoutConstant    : DWORD;
107       WriteTotalTimeoutMultiplier : DWORD;
108       WriteTotalTimeoutConstant   : DWORD;
109    end record;
110    pragma Convention (C, COMMTIMEOUTS);
111
112    function GetCommState
113      (hFile : HANDLE;
114       lpDCB : access DCB) return BOOL;
115    pragma Import (Stdcall, GetCommState, "GetCommState");
116
117    function SetCommState
118      (hFile : HANDLE;
119       lpDCB : access DCB) return BOOL;
120    pragma Import (Stdcall, SetCommState, "SetCommState");
121
122    function SetCommTimeouts
123      (hFile          : HANDLE;
124       lpCommTimeouts : access COMMTIMEOUTS) return BOOL;
125    pragma Import (Stdcall, SetCommTimeouts, "SetCommTimeouts");
126
127 end System.Win32.Ext;