-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-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, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, 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. --
-- on non-VMS systems.
with System.Parameters;
+
package System.CRTL is
-pragma Preelaborate (CRTL);
+ pragma Preelaborate;
subtype chars is System.Address;
-- Pointer to null-terminated array of characters
type size_t is mod 2 ** Standard'Address_Size;
+ type Filename_Encoding is (UTF8, ASCII_8bits, Unspecified);
+ for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1, Unspecified => 2);
+ pragma Convention (C, Filename_Encoding);
+ -- Describes the filename's encoding
+
function atoi (A : System.Address) return Integer;
pragma Import (C, atoi, "atoi");
procedure clearerr (stream : FILEs);
pragma Import (C, clearerr, "clearerr");
- function closedir (directory : DIRs) return Integer;
- pragma Import (C, closedir, "closedir");
-
function dup (handle : int) return int;
pragma Import (C, dup, "dup");
function fgets (strng : chars; n : int; stream : FILEs) return chars;
pragma Import (C, fgets, "fgets");
- function fopen (filename : chars; Mode : chars) return FILEs;
- pragma Import (C, fopen, "fopen");
+ function fopen
+ (filename : chars;
+ mode : chars;
+ encoding : Filename_Encoding := Unspecified) return FILEs;
+ pragma Import (C, fopen, "__gnat_fopen");
function fputc (C : int; stream : FILEs) return int;
pragma Import (C, fputc, "fputc");
function freopen
(filename : chars;
mode : chars;
- stream : FILEs)
- return FILEs;
- pragma Import (C, freopen, "freopen");
+ stream : FILEs;
+ encoding : Filename_Encoding := Unspecified) return FILEs;
+ pragma Import (C, freopen, "__gnat_freopen");
function fseek
(stream : FILEs;
function malloc (Size : size_t) return System.Address;
pragma Import (C, malloc, "malloc");
+ function malloc32 (Size : size_t) return System.Address;
+ pragma Import (C, malloc32, "malloc");
+ -- An uncalled alias for malloc except on 64bit systems needing to
+ -- allocate 32bit memory.
+
procedure memcpy (S1 : System.Address; S2 : System.Address; N : size_t);
pragma Import (C, memcpy, "memcpy");
procedure mktemp (template : chars);
pragma Import (C, mktemp, "mktemp");
- function opendir (file_name : String) return DIRs;
- pragma Import (C, opendir, "opendir");
+ function pclose (stream : System.Address) return int;
+ pragma Import (C, pclose, "pclose");
- function read (fd : int; buffer : chars; nbytes : int) return int;
- pragma Import (C, read, "read");
+ function popen (command, mode : System.Address) return System.Address;
+ pragma Import (C, popen, "popen");
function realloc
(Ptr : System.Address; Size : size_t) return System.Address;
pragma Import (C, realloc, "realloc");
+ function realloc32
+ (Ptr : System.Address; Size : size_t) return System.Address;
+ pragma Import (C, realloc32, "realloc");
+ -- An uncalled alias for realloc except on 64bit systems needing to
+ -- allocate 32bit memory.
+
procedure rewind (stream : FILEs);
pragma Import (C, rewind, "rewind");
- procedure rmdir (dir_name : String);
- pragma Import (C, rmdir, "rmdir");
+ function rmdir (dir_name : String) return int;
+ pragma Import (C, rmdir, "__gnat_rmdir");
+
+ function chdir (dir_name : String) return int;
+ pragma Import (C, chdir, "__gnat_chdir");
function setvbuf
(stream : FILEs;
pragma Import (C, ungetc, "ungetc");
function unlink (filename : chars) return int;
- pragma Import (C, unlink, "unlink");
+ pragma Import (C, unlink, "__gnat_unlink");
+
+ function open (filename : chars; oflag : int) return int;
+ pragma Import (C, open, "open");
+
+ function close (fd : int) return int;
+ pragma Import (C, close, "close");
+
+ function read (fd : int; buffer : chars; nbytes : int) return int;
+ pragma Import (C, read, "read");
function write (fd : int; buffer : chars; nbytes : int) return int;
pragma Import (C, write, "write");
+
end System.CRTL;