Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / ada / s-crtl.ads
blob42bdf02c73e3ba6d1c62637e67a6a74424ebab26
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . C R T L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2003-2005 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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, 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 ------------------------------------------------------------------------------
34 -- This package provides the low level interface to the C Run Time Library
35 -- on non-VMS systems.
37 with System.Parameters;
38 package System.CRTL is
39 pragma Preelaborate (CRTL);
41 subtype chars is System.Address;
42 -- Pointer to null-terminated array of characters
44 subtype DIRs is System.Address;
45 -- Corresponds to the C type DIR*
47 subtype FILEs is System.Address;
48 -- Corresponds to the C type FILE*
50 subtype int is Integer;
52 type long is range -(2 ** (System.Parameters.long_bits - 1))
53 .. +(2 ** (System.Parameters.long_bits - 1)) - 1;
55 subtype off_t is Long_Integer;
57 type size_t is mod 2 ** Standard'Address_Size;
59 function atoi (A : System.Address) return Integer;
60 pragma Import (C, atoi, "atoi");
62 procedure clearerr (stream : FILEs);
63 pragma Import (C, clearerr, "clearerr");
65 function closedir (directory : DIRs) return Integer;
66 pragma Import (C, closedir, "closedir");
68 function dup (handle : int) return int;
69 pragma Import (C, dup, "dup");
71 function dup2 (from, to : int) return int;
72 pragma Import (C, dup2, "dup2");
74 function fclose (stream : FILEs) return int;
75 pragma Import (C, fclose, "fclose");
77 function fdopen (handle : int; mode : chars) return FILEs;
78 pragma Import (C, fdopen, "fdopen");
80 function fflush (stream : FILEs) return int;
81 pragma Import (C, fflush, "fflush");
83 function fgetc (stream : FILEs) return int;
84 pragma Import (C, fgetc, "fgetc");
86 function fgets (strng : chars; n : int; stream : FILEs) return chars;
87 pragma Import (C, fgets, "fgets");
89 function fopen (filename : chars; Mode : chars) return FILEs;
90 pragma Import (C, fopen, "fopen");
92 function fputc (C : int; stream : FILEs) return int;
93 pragma Import (C, fputc, "fputc");
95 function fputs (Strng : chars; Stream : FILEs) return int;
96 pragma Import (C, fputs, "fputs");
98 procedure free (Ptr : System.Address);
99 pragma Import (C, free, "free");
101 function freopen
102 (filename : chars;
103 mode : chars;
104 stream : FILEs)
105 return FILEs;
106 pragma Import (C, freopen, "freopen");
108 function fseek
109 (stream : FILEs;
110 offset : long;
111 origin : int)
112 return int;
113 pragma Import (C, fseek, "fseek");
115 function ftell (stream : FILEs) return long;
116 pragma Import (C, ftell, "ftell");
118 function getenv (S : String) return System.Address;
119 pragma Import (C, getenv, "getenv");
121 function isatty (handle : int) return int;
122 pragma Import (C, isatty, "isatty");
124 function lseek (fd : int; offset : off_t; direction : int) return off_t;
125 pragma Import (C, lseek, "lseek");
127 function malloc (Size : size_t) return System.Address;
128 pragma Import (C, malloc, "malloc");
130 procedure memcpy (S1 : System.Address; S2 : System.Address; N : size_t);
131 pragma Import (C, memcpy, "memcpy");
133 procedure memmove (S1 : System.Address; S2 : System.Address; N : size_t);
134 pragma Import (C, memmove, "memmove");
136 procedure mktemp (template : chars);
137 pragma Import (C, mktemp, "mktemp");
139 function opendir (file_name : String) return DIRs;
140 pragma Import (C, opendir, "opendir");
142 function read (fd : int; buffer : chars; nbytes : int) return int;
143 pragma Import (C, read, "read");
145 function realloc
146 (Ptr : System.Address; Size : size_t) return System.Address;
147 pragma Import (C, realloc, "realloc");
149 procedure rewind (stream : FILEs);
150 pragma Import (C, rewind, "rewind");
152 procedure rmdir (dir_name : String);
153 pragma Import (C, rmdir, "rmdir");
155 function setvbuf
156 (stream : FILEs;
157 buffer : chars;
158 mode : int;
159 size : size_t)
160 return int;
161 pragma Import (C, setvbuf, "setvbuf");
163 procedure tmpnam (string : chars);
164 pragma Import (C, tmpnam, "tmpnam");
166 function tmpfile return FILEs;
167 pragma Import (C, tmpfile, "tmpfile");
169 function ungetc (c : int; stream : FILEs) return int;
170 pragma Import (C, ungetc, "ungetc");
172 function unlink (filename : chars) return int;
173 pragma Import (C, unlink, "unlink");
175 function write (fd : int; buffer : chars; nbytes : int) return int;
176 pragma Import (C, write, "write");
177 end System.CRTL;