OSDN Git Service

2010-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-crtl.ads
index 4ad2cee..345e9a5 100644 (file)
@@ -31,6 +31,8 @@
 
 --  This package provides the low level interface to the C runtime library
 
+pragma Compiler_Unit;
+
 with System.Parameters;
 
 package System.CRTL is
@@ -38,6 +40,9 @@ package System.CRTL is
 
    subtype chars is System.Address;
    --  Pointer to null-terminated array of characters
+   --  Should use Interfaces.C.Strings types instead, but this causes bootstrap
+   --  issues as i-c contains Ada 2005 specific features, not compatible with
+   --  older, Ada 95-only base compilers???
 
    subtype DIRs is System.Address;
    --  Corresponds to the C type DIR*
@@ -48,12 +53,15 @@ package System.CRTL is
    subtype int is Integer;
 
    type long is range -(2 ** (System.Parameters.long_bits - 1))
-      .. +(2 ** (System.Parameters.long_bits - 1)) - 1;
+                   .. +(2 ** (System.Parameters.long_bits - 1)) - 1;
 
    subtype off_t is Long_Integer;
 
    type size_t is mod 2 ** Standard'Address_Size;
 
+   type ssize_t is range -(2 ** (Standard'Address_Size - 1))
+                      .. +(2 ** (Standard'Address_Size - 1)) - 1;
+
    type Filename_Encoding is (UTF8, ASCII_8bits, Unspecified);
    for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1, Unspecified => 2);
    pragma Convention (C, Filename_Encoding);
@@ -111,8 +119,7 @@ package System.CRTL is
    function fseek
      (stream : FILEs;
       offset : long;
-      origin : int)
-      return   int;
+      origin : int) return int;
    pragma Import (C, fseek, "fseek");
 
    function ftell (stream : FILEs) return long;
@@ -162,8 +169,7 @@ package System.CRTL is
      (stream : FILEs;
       buffer : chars;
       mode   : int;
-      size   : size_t)
-      return   int;
+      size   : size_t) return int;
    pragma Import (C, setvbuf, "setvbuf");
 
    procedure tmpnam (string : chars);
@@ -184,13 +190,10 @@ package System.CRTL is
    function close (fd : int) return int;
    pragma Import (C, close, "close");
 
-   function read (fd : int; buffer : chars; nbytes : int) return int;
+   function read (fd : int; buffer : chars; count : size_t) return ssize_t;
    pragma Import (C, read, "read");
 
-   function write (fd : int; buffer : chars; nbytes : int) return int;
+   function write (fd : int; buffer : chars; count : size_t) return ssize_t;
    pragma Import (C, write, "write");
 
-   function strerror (errno : int) return chars;
-   pragma Import (C, strerror, "strerror");
-
 end System.CRTL;