OSDN Git Service

ada:
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-win32.ads
index 2d26485..37a6f3d 100644 (file)
@@ -6,25 +6,23 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---            Copyright (C) 2008, Free Software Foundation, Inc.            --
+--         Copyright (C) 2008-2009, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -32,7 +30,7 @@
 ------------------------------------------------------------------------------
 
 --  This package plus its child provide the low level interface to the Win32
---  API. The core part of the Win32 API (commont to RTX and Win32) is in this
+--  API. The core part of the Win32 API (common to RTX and Win32) is in this
 --  package, and an additional part of the Win32 API which is not supported by
 --  RTX is in package System.Win33.Ext.
 
@@ -54,9 +52,10 @@ package System.Win32 is
 
    subtype PVOID is Address;
 
-   type HANDLE is new Interfaces.C.long;
+   type HANDLE is new Interfaces.C.ptrdiff_t;
 
    INVALID_HANDLE_VALUE : constant HANDLE := -1;
+   INVALID_FILE_SIZE    : constant := 16#FFFFFFFF#;
 
    type DWORD  is new Interfaces.C.unsigned_long;
    type WORD   is new Interfaces.C.unsigned_short;
@@ -84,51 +83,54 @@ package System.Win32 is
    -- Files --
    -----------
 
-   GENERIC_READ  : constant := 16#80000000#;
-   GENERIC_WRITE : constant := 16#40000000#;
-
-   CREATE_NEW        : constant := 1;
-   CREATE_ALWAYS     : constant := 2;
-   OPEN_EXISTING     : constant := 3;
-   OPEN_ALWAYS       : constant := 4;
-   TRUNCATE_EXISTING : constant := 5;
-
-   FILE_SHARE_DELETE : constant := 16#00000004#;
-   FILE_SHARE_READ   : constant := 16#00000001#;
-   FILE_SHARE_WRITE  : constant := 16#00000002#;
-
-   FILE_BEGIN        : constant := 0;
-   FILE_CURRENT      : constant := 1;
-   FILE_END          : constant := 2;
-
-   PAGE_NOACCESS       : constant := 16#0001#;
-   PAGE_READONLY       : constant := 16#0002#;
-   PAGE_READWRITE      : constant := 16#0004#;
-   PAGE_WRITECOPY      : constant := 16#0008#;
-   PAGE_EXECUTE        : constant := 16#0010#;
-
-   FILE_MAP_ALL_ACCESS : constant := 16#F001f#;
-   FILE_MAP_READ       : constant := 4;
-   FILE_MAP_WRITE      : constant := 2;
-   FILE_MAP_COPY       : constant := 1;
-
-   FILE_ADD_FILE             : constant := 16#0002#;
-   FILE_ADD_SUBDIRECTORY     : constant := 16#0004#;
-   FILE_APPEND_DATA          : constant := 16#0004#;
-   FILE_CREATE_PIPE_INSTANCE : constant := 16#0004#;
-   FILE_DELETE_CHILD         : constant := 16#0040#;
-   FILE_EXECUTE              : constant := 16#0020#;
-   FILE_LIST_DIRECTORY       : constant := 16#0001#;
-   FILE_READ_ATTRIBUTES      : constant := 16#0080#;
-   FILE_READ_DATA            : constant := 16#0001#;
-   FILE_READ_EA              : constant := 16#0008#;
-   FILE_TRAVERSE             : constant := 16#0020#;
-   FILE_WRITE_ATTRIBUTES     : constant := 16#0100#;
-   FILE_WRITE_DATA           : constant := 16#0002#;
-   FILE_WRITE_EA             : constant := 16#0010#;
-   STANDARD_RIGHTS_READ      : constant := 16#20000#;
-   STANDARD_RIGHTS_WRITE     : constant := 16#20000#;
-   SYNCHRONIZE               : constant := 16#100000#;
+   CP_UTF8                            : constant := 65001;
+   CP_ACP                             : constant := 0;
+
+   GENERIC_READ                       : constant := 16#80000000#;
+   GENERIC_WRITE                      : constant := 16#40000000#;
+
+   CREATE_NEW                         : constant := 1;
+   CREATE_ALWAYS                      : constant := 2;
+   OPEN_EXISTING                      : constant := 3;
+   OPEN_ALWAYS                        : constant := 4;
+   TRUNCATE_EXISTING                  : constant := 5;
+
+   FILE_SHARE_DELETE                  : constant := 16#00000004#;
+   FILE_SHARE_READ                    : constant := 16#00000001#;
+   FILE_SHARE_WRITE                   : constant := 16#00000002#;
+
+   FILE_BEGIN                         : constant := 0;
+   FILE_CURRENT                       : constant := 1;
+   FILE_END                           : constant := 2;
+
+   PAGE_NOACCESS                      : constant := 16#0001#;
+   PAGE_READONLY                      : constant := 16#0002#;
+   PAGE_READWRITE                     : constant := 16#0004#;
+   PAGE_WRITECOPY                     : constant := 16#0008#;
+   PAGE_EXECUTE                       : constant := 16#0010#;
+
+   FILE_MAP_ALL_ACCESS                : constant := 16#F001f#;
+   FILE_MAP_READ                      : constant := 4;
+   FILE_MAP_WRITE                     : constant := 2;
+   FILE_MAP_COPY                      : constant := 1;
+
+   FILE_ADD_FILE                      : constant := 16#0002#;
+   FILE_ADD_SUBDIRECTORY              : constant := 16#0004#;
+   FILE_APPEND_DATA                   : constant := 16#0004#;
+   FILE_CREATE_PIPE_INSTANCE          : constant := 16#0004#;
+   FILE_DELETE_CHILD                  : constant := 16#0040#;
+   FILE_EXECUTE                       : constant := 16#0020#;
+   FILE_LIST_DIRECTORY                : constant := 16#0001#;
+   FILE_READ_ATTRIBUTES               : constant := 16#0080#;
+   FILE_READ_DATA                     : constant := 16#0001#;
+   FILE_READ_EA                       : constant := 16#0008#;
+   FILE_TRAVERSE                      : constant := 16#0020#;
+   FILE_WRITE_ATTRIBUTES              : constant := 16#0100#;
+   FILE_WRITE_DATA                    : constant := 16#0002#;
+   FILE_WRITE_EA                      : constant := 16#0010#;
+   STANDARD_RIGHTS_READ               : constant := 16#20000#;
+   STANDARD_RIGHTS_WRITE              : constant := 16#20000#;
+   SYNCHRONIZE                        : constant := 16#100000#;
 
    FILE_ATTRIBUTE_READONLY            : constant := 16#00000001#;
    FILE_ATTRIBUTE_HIDDEN              : constant := 16#00000002#;
@@ -161,6 +163,16 @@ package System.Win32 is
       bInheritHandle      : BOOL;
    end record;
 
+   function CreateFileA
+     (lpFileName            : Address;
+      dwDesiredAccess       : DWORD;
+      dwShareMode           : DWORD;
+      lpSecurityAttributes  : access SECURITY_ATTRIBUTES;
+      dwCreationDisposition : DWORD;
+      dwFlagsAndAttributes  : DWORD;
+      hTemplateFile         : HANDLE) return HANDLE;
+   pragma Import (Stdcall, CreateFileA, "CreateFileA");
+
    function CreateFile
      (lpFileName            : Address;
       dwDesiredAccess       : DWORD;
@@ -169,7 +181,7 @@ package System.Win32 is
       dwCreationDisposition : DWORD;
       dwFlagsAndAttributes  : DWORD;
       hTemplateFile         : HANDLE) return HANDLE;
-   pragma Import (Stdcall, CreateFile, "CreateFileA");
+   pragma Import (Stdcall, CreateFile, "CreateFileW");
 
    function GetFileSize
      (hFile          : HANDLE;
@@ -222,6 +234,15 @@ package System.Win32 is
    function UnmapViewOfFile (lpBaseAddress : System.Address) return BOOL;
    pragma Import (Stdcall, UnmapViewOfFile, "UnmapViewOfFile");
 
+   function MultiByteToWideChar
+     (CodePage       : WORD;
+      dwFlags        : DWORD;
+      lpMultiByteStr : System.Address;
+      cchMultiByte   : WORD;
+      lpWideCharStr  : System.Address;
+      cchWideChar    : WORD) return WORD;
+   pragma Import (Stdcall, MultiByteToWideChar, "MultiByteToWideChar");
+
    ------------------------
    -- System Information --
    ------------------------