OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-win32.ads] - Blame information for rev 713

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                        GNAT RUN-TIME COMPONENTS                          --
4
--                                                                          --
5
--                         S Y S T E M . W I N 3 2                          --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--         Copyright (C) 2008-2009, 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 3,  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  This package plus its child provide the low level interface to the Win32
33
--  API. The core part of the Win32 API (common to RTX and Win32) is in this
34
--  package, and an additional part of the Win32 API which is not supported by
35
--  RTX is in package System.Win33.Ext.
36
 
37
with Interfaces.C;
38
 
39
package System.Win32 is
40
   pragma Pure;
41
 
42
   -------------------
43
   -- General Types --
44
   -------------------
45
 
46
   --  The LARGE_INTEGER type is actually a fixed point type
47
   --  that only can represent integers. The reason for this is
48
   --  easier conversion to Duration or other fixed point types.
49
   --  (See Operations.Clock)
50
 
51
   type LARGE_INTEGER is delta 1.0 range -2.0**63 .. 2.0**63 - 1.0;
52
 
53
   subtype PVOID is Address;
54
 
55
   type HANDLE is new Interfaces.C.ptrdiff_t;
56
 
57
   INVALID_HANDLE_VALUE : constant HANDLE := -1;
58
   INVALID_FILE_SIZE    : constant := 16#FFFFFFFF#;
59
 
60
   type DWORD  is new Interfaces.C.unsigned_long;
61
   type WORD   is new Interfaces.C.unsigned_short;
62
   type BYTE   is new Interfaces.C.unsigned_char;
63
   type LONG   is new Interfaces.C.long;
64
   type CHAR   is new Interfaces.C.char;
65
 
66
   type BOOL   is new Interfaces.C.int;
67
   for BOOL'Size use Interfaces.C.int'Size;
68
 
69
   type Bits1  is range 0 .. 2 ** 1 - 1;
70
   type Bits2  is range 0 .. 2 ** 2 - 1;
71
   type Bits17 is range 0 .. 2 ** 17 - 1;
72
   for Bits1'Size  use 1;
73
   for Bits2'Size  use 2;
74
   for Bits17'Size use 17;
75
 
76
   FALSE : constant := 0;
77
   TRUE  : constant := 1;
78
 
79
   function GetLastError return DWORD;
80
   pragma Import (Stdcall, GetLastError, "GetLastError");
81
 
82
   -----------
83
   -- Files --
84
   -----------
85
 
86
   CP_UTF8                            : constant := 65001;
87
   CP_ACP                             : constant := 0;
88
 
89
   GENERIC_READ                       : constant := 16#80000000#;
90
   GENERIC_WRITE                      : constant := 16#40000000#;
91
 
92
   CREATE_NEW                         : constant := 1;
93
   CREATE_ALWAYS                      : constant := 2;
94
   OPEN_EXISTING                      : constant := 3;
95
   OPEN_ALWAYS                        : constant := 4;
96
   TRUNCATE_EXISTING                  : constant := 5;
97
 
98
   FILE_SHARE_DELETE                  : constant := 16#00000004#;
99
   FILE_SHARE_READ                    : constant := 16#00000001#;
100
   FILE_SHARE_WRITE                   : constant := 16#00000002#;
101
 
102
   FILE_BEGIN                         : constant := 0;
103
   FILE_CURRENT                       : constant := 1;
104
   FILE_END                           : constant := 2;
105
 
106
   PAGE_NOACCESS                      : constant := 16#0001#;
107
   PAGE_READONLY                      : constant := 16#0002#;
108
   PAGE_READWRITE                     : constant := 16#0004#;
109
   PAGE_WRITECOPY                     : constant := 16#0008#;
110
   PAGE_EXECUTE                       : constant := 16#0010#;
111
 
112
   FILE_MAP_ALL_ACCESS                : constant := 16#F001f#;
113
   FILE_MAP_READ                      : constant := 4;
114
   FILE_MAP_WRITE                     : constant := 2;
115
   FILE_MAP_COPY                      : constant := 1;
116
 
117
   FILE_ADD_FILE                      : constant := 16#0002#;
118
   FILE_ADD_SUBDIRECTORY              : constant := 16#0004#;
119
   FILE_APPEND_DATA                   : constant := 16#0004#;
120
   FILE_CREATE_PIPE_INSTANCE          : constant := 16#0004#;
121
   FILE_DELETE_CHILD                  : constant := 16#0040#;
122
   FILE_EXECUTE                       : constant := 16#0020#;
123
   FILE_LIST_DIRECTORY                : constant := 16#0001#;
124
   FILE_READ_ATTRIBUTES               : constant := 16#0080#;
125
   FILE_READ_DATA                     : constant := 16#0001#;
126
   FILE_READ_EA                       : constant := 16#0008#;
127
   FILE_TRAVERSE                      : constant := 16#0020#;
128
   FILE_WRITE_ATTRIBUTES              : constant := 16#0100#;
129
   FILE_WRITE_DATA                    : constant := 16#0002#;
130
   FILE_WRITE_EA                      : constant := 16#0010#;
131
   STANDARD_RIGHTS_READ               : constant := 16#20000#;
132
   STANDARD_RIGHTS_WRITE              : constant := 16#20000#;
133
   SYNCHRONIZE                        : constant := 16#100000#;
134
 
135
   FILE_ATTRIBUTE_READONLY            : constant := 16#00000001#;
136
   FILE_ATTRIBUTE_HIDDEN              : constant := 16#00000002#;
137
   FILE_ATTRIBUTE_SYSTEM              : constant := 16#00000004#;
138
   FILE_ATTRIBUTE_DIRECTORY           : constant := 16#00000010#;
139
   FILE_ATTRIBUTE_ARCHIVE             : constant := 16#00000020#;
140
   FILE_ATTRIBUTE_DEVICE              : constant := 16#00000040#;
141
   FILE_ATTRIBUTE_NORMAL              : constant := 16#00000080#;
142
   FILE_ATTRIBUTE_TEMPORARY           : constant := 16#00000100#;
143
   FILE_ATTRIBUTE_SPARSE_FILE         : constant := 16#00000200#;
144
   FILE_ATTRIBUTE_REPARSE_POINT       : constant := 16#00000400#;
145
   FILE_ATTRIBUTE_COMPRESSED          : constant := 16#00000800#;
146
   FILE_ATTRIBUTE_OFFLINE             : constant := 16#00001000#;
147
   FILE_ATTRIBUTE_NOT_CONTENT_INDEXED : constant := 16#00002000#;
148
   FILE_ATTRIBUTE_ENCRYPTED           : constant := 16#00004000#;
149
   FILE_ATTRIBUTE_VALID_FLAGS         : constant := 16#00007fb7#;
150
   FILE_ATTRIBUTE_VALID_SET_FLAGS     : constant := 16#000031a7#;
151
 
152
   type OVERLAPPED is record
153
      Internal     : DWORD;
154
      InternalHigh : DWORD;
155
      Offset       : DWORD;
156
      OffsetHigh   : DWORD;
157
      hEvent       : HANDLE;
158
   end record;
159
 
160
   type SECURITY_ATTRIBUTES is record
161
      nLength             : DWORD;
162
      pSecurityDescriptor : PVOID;
163
      bInheritHandle      : BOOL;
164
   end record;
165
 
166
   function CreateFileA
167
     (lpFileName            : Address;
168
      dwDesiredAccess       : DWORD;
169
      dwShareMode           : DWORD;
170
      lpSecurityAttributes  : access SECURITY_ATTRIBUTES;
171
      dwCreationDisposition : DWORD;
172
      dwFlagsAndAttributes  : DWORD;
173
      hTemplateFile         : HANDLE) return HANDLE;
174
   pragma Import (Stdcall, CreateFileA, "CreateFileA");
175
 
176
   function CreateFile
177
     (lpFileName            : Address;
178
      dwDesiredAccess       : DWORD;
179
      dwShareMode           : DWORD;
180
      lpSecurityAttributes  : access SECURITY_ATTRIBUTES;
181
      dwCreationDisposition : DWORD;
182
      dwFlagsAndAttributes  : DWORD;
183
      hTemplateFile         : HANDLE) return HANDLE;
184
   pragma Import (Stdcall, CreateFile, "CreateFileW");
185
 
186
   function GetFileSize
187
     (hFile          : HANDLE;
188
      lpFileSizeHigh : access DWORD) return BOOL;
189
   pragma Import (Stdcall, GetFileSize, "GetFileSize");
190
 
191
   function SetFilePointer
192
     (hFile                : HANDLE;
193
      lDistanceToMove      : LONG;
194
      lpDistanceToMoveHigh : access LONG;
195
      dwMoveMethod         : DWORD) return DWORD;
196
   pragma Import (Stdcall, SetFilePointer, "SetFilePointer");
197
 
198
   function WriteFile
199
     (hFile                  : HANDLE;
200
      lpBuffer               : Address;
201
      nNumberOfBytesToWrite  : DWORD;
202
      lpNumberOfBytesWritten : access DWORD;
203
      lpOverlapped           : access OVERLAPPED) return BOOL;
204
   pragma Import (Stdcall, WriteFile, "WriteFile");
205
 
206
   function ReadFile
207
     (hFile                : HANDLE;
208
      lpBuffer             : Address;
209
      nNumberOfBytesToRead : DWORD;
210
      lpNumberOfBytesRead  : access DWORD;
211
      lpOverlapped         : access OVERLAPPED) return BOOL;
212
   pragma Import (Stdcall, ReadFile, "ReadFile");
213
 
214
   function CloseHandle (hObject : HANDLE) return BOOL;
215
   pragma Import (Stdcall, CloseHandle, "CloseHandle");
216
 
217
   function CreateFileMapping
218
     (hFile                : HANDLE;
219
      lpSecurityAttributes : access SECURITY_ATTRIBUTES;
220
      flProtect            : DWORD;
221
      dwMaximumSizeHigh    : DWORD;
222
      dwMaximumSizeLow     : DWORD;
223
      lpName               : Address) return HANDLE;
224
   pragma Import (Stdcall, CreateFileMapping, "CreateFileMappingA");
225
 
226
   function MapViewOfFile
227
     (hFileMappingObject   : HANDLE;
228
      dwDesiredAccess      : DWORD;
229
      dwFileOffsetHigh     : DWORD;
230
      dwFileOffsetLow      : DWORD;
231
      dwNumberOfBytesToMap : DWORD) return System.Address;
232
   pragma Import (Stdcall, MapViewOfFile, "MapViewOfFile");
233
 
234
   function UnmapViewOfFile (lpBaseAddress : System.Address) return BOOL;
235
   pragma Import (Stdcall, UnmapViewOfFile, "UnmapViewOfFile");
236
 
237
   function MultiByteToWideChar
238
     (CodePage       : WORD;
239
      dwFlags        : DWORD;
240
      lpMultiByteStr : System.Address;
241
      cchMultiByte   : WORD;
242
      lpWideCharStr  : System.Address;
243
      cchWideChar    : WORD) return WORD;
244
   pragma Import (Stdcall, MultiByteToWideChar, "MultiByteToWideChar");
245
 
246
   ------------------------
247
   -- System Information --
248
   ------------------------
249
 
250
   subtype ProcessorId is DWORD;
251
 
252
   type SYSTEM_INFO is record
253
      dwOemId                     : DWORD;
254
      dwPageSize                  : DWORD;
255
      lpMinimumApplicationAddress : PVOID;
256
      lpMaximumApplicationAddress : PVOID;
257
      dwActiveProcessorMask       : DWORD;
258
      dwNumberOfProcessors        : DWORD;
259
      dwProcessorType             : DWORD;
260
      dwAllocationGranularity     : DWORD;
261
      dwReserved                  : DWORD;
262
   end record;
263
 
264
   procedure GetSystemInfo (SI : access SYSTEM_INFO);
265
   pragma Import (Stdcall, GetSystemInfo, "GetSystemInfo");
266
 
267
   ---------------------
268
   -- Time Management --
269
   ---------------------
270
 
271
   type SYSTEMTIME is record
272
      wYear         : WORD;
273
      wMonth        : WORD;
274
      wDayOfWeek    : WORD;
275
      wDay          : WORD;
276
      wHour         : WORD;
277
      wMinute       : WORD;
278
      wSecond       : WORD;
279
      wMilliseconds : WORD;
280
   end record;
281
 
282
   procedure GetSystemTime (pSystemTime : access SYSTEMTIME);
283
   pragma Import (Stdcall, GetSystemTime, "GetSystemTime");
284
 
285
   procedure GetSystemTimeAsFileTime (lpFileTime : access Long_Long_Integer);
286
   pragma Import (Stdcall, GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime");
287
 
288
   function FileTimeToSystemTime
289
     (lpFileTime   : access Long_Long_Integer;
290
      lpSystemTime : access SYSTEMTIME) return BOOL;
291
   pragma Import (Stdcall, FileTimeToSystemTime, "FileTimeToSystemTime");
292
 
293
   function SystemTimeToFileTime
294
     (lpSystemTime : access SYSTEMTIME;
295
      lpFileTime   : access Long_Long_Integer) return BOOL;
296
   pragma Import (Stdcall, SystemTimeToFileTime, "SystemTimeToFileTime");
297
 
298
   function FileTimeToLocalFileTime
299
     (lpFileTime      : access Long_Long_Integer;
300
      lpLocalFileTime : access Long_Long_Integer) return BOOL;
301
   pragma Import (Stdcall, FileTimeToLocalFileTime, "FileTimeToLocalFileTime");
302
 
303
   function LocalFileTimeToFileTime
304
     (lpFileTime      : access Long_Long_Integer;
305
      lpLocalFileTime : access Long_Long_Integer) return BOOL;
306
   pragma Import (Stdcall, LocalFileTimeToFileTime, "LocalFileTimeToFileTime");
307
 
308
   procedure Sleep (dwMilliseconds : DWORD);
309
   pragma Import (Stdcall, Sleep, External_Name => "Sleep");
310
 
311
   function QueryPerformanceCounter
312
     (lpPerformanceCount : access LARGE_INTEGER) return BOOL;
313
   pragma Import
314
     (Stdcall, QueryPerformanceCounter, "QueryPerformanceCounter");
315
 
316
end System.Win32;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.