* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do not make
[official-gcc.git] / gcc / ada / adaint.h
blobe9ef42c6b2b74642f10c22ed88e02fde5fe71118
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * A D A I N T *
6 * *
7 * C Header File *
8 * *
9 * Copyright (C) 1992-2010, 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 ****************************************************************************/
32 #include <sys/stat.h>
33 #include <stdio.h>
35 #ifdef _WIN32
36 #include "mingw32.h"
37 #endif
39 #include <dirent.h>
41 /* Constants used for the form parameter encoding values */
42 #define Encoding_UTF8 0 /* UTF-8 */
43 #define Encoding_8bits 1 /* Standard 8bits, CP_ACP on Windows. */
44 #define Encoding_Unspecified 2 /* Based on GNAT_CODE_PAGE env variable. */
46 /* Large file support. It is unclear what portable mechanism we can use to
47 determine at compile time what support the system offers for large files.
48 For now we just list the platforms we have manually tested. */
50 #if defined (__GLIBC__) || defined (sun) || (defined (__sgi) && defined(_LFAPI))
51 #define GNAT_FOPEN fopen64
52 #define GNAT_STAT stat64
53 #define GNAT_FSTAT fstat64
54 #define GNAT_LSTAT lstat64
55 #define GNAT_STRUCT_STAT struct stat64
56 #else
57 #define GNAT_FOPEN fopen
58 #define GNAT_STAT stat
59 #define GNAT_FSTAT fstat
60 #define GNAT_LSTAT lstat
61 #define GNAT_STRUCT_STAT struct stat
62 #endif
64 /* Type corresponding to GNAT.OS_Lib.OS_Time */
65 #if defined (_WIN64)
66 typedef long long OS_Time;
67 #else
68 typedef long OS_Time;
69 #endif
71 /* A lazy cache for the attributes of a file. On some systems, a single call to
72 stat() will give all this information, so it is better than doing a system
73 call every time. On other systems this require several system calls.
76 struct file_attributes {
77 unsigned char exists;
79 unsigned char writable;
80 unsigned char readable;
81 unsigned char executable;
83 unsigned char symbolic_link;
84 unsigned char regular;
85 unsigned char directory;
87 OS_Time timestamp;
88 long file_length;
90 /* WARNING: changing the size here might require changing the constant
91 * File_Attributes_Size in osint.ads (which should be big enough to
92 * fit the above struct on any system)
95 extern int __gnat_max_path_len;
96 extern OS_Time __gnat_current_time (void);
97 extern void __gnat_current_time_string (char *);
98 extern void __gnat_to_gm_time (OS_Time *, int *, int *,
99 int *, int *,
100 int *, int *);
101 extern int __gnat_get_maximum_file_name_length (void);
102 extern int __gnat_get_switches_case_sensitive (void);
103 extern int __gnat_get_file_names_case_sensitive (void);
104 extern int __gnat_get_env_vars_case_sensitive (void);
105 extern char __gnat_get_default_identifier_character_set (void);
106 extern void __gnat_get_current_dir (char *, int *);
107 extern void __gnat_get_object_suffix_ptr (int *,
108 const char **);
109 extern void __gnat_get_executable_suffix_ptr (int *,
110 const char **);
111 extern void __gnat_get_debuggable_suffix_ptr (int *,
112 const char **);
113 extern int __gnat_readlink (char *, char *,
114 size_t);
115 extern int __gnat_symlink (char *, char *);
116 extern int __gnat_try_lock (char *, char *);
117 extern int __gnat_open_new (char *, int);
118 extern int __gnat_open_new_temp (char *, int);
119 extern int __gnat_mkdir (char *);
120 extern int __gnat_stat (char *,
121 GNAT_STRUCT_STAT *);
122 extern int __gnat_unlink (char *);
123 extern int __gnat_rename (char *, char *);
124 extern int __gnat_chdir (char *);
125 extern int __gnat_rmdir (char *);
127 extern FILE *__gnat_fopen (char *, char *, int);
128 extern FILE *__gnat_freopen (char *, char *, FILE *,
129 int);
130 extern int __gnat_open_read (char *, int);
131 extern int __gnat_open_rw (char *, int);
132 extern int __gnat_open_create (char *, int);
133 extern int __gnat_create_output_file (char *);
134 extern int __gnat_create_output_file_new (char *);
136 extern int __gnat_open_append (char *, int);
137 extern long __gnat_file_length (int);
138 extern long __gnat_named_file_length (char *);
139 extern void __gnat_tmp_name (char *);
140 extern DIR *__gnat_opendir (char *);
141 extern char *__gnat_readdir (DIR *, char *, int *);
142 extern int __gnat_closedir (DIR *);
143 extern int __gnat_readdir_is_thread_safe (void);
145 extern OS_Time __gnat_file_time_name (char *);
146 extern OS_Time __gnat_file_time_fd (int);
147 /* return -1 in case of error */
149 extern void __gnat_set_file_time_name (char *, time_t);
151 extern int __gnat_dup (int);
152 extern int __gnat_dup2 (int, int);
153 extern int __gnat_file_exists (char *);
154 extern int __gnat_is_regular_file (char *);
155 extern int __gnat_is_absolute_path (char *,int);
156 extern int __gnat_is_directory (char *);
157 extern int __gnat_is_writable_file (char *);
158 extern int __gnat_is_readable_file (char *name);
159 extern int __gnat_is_executable_file (char *name);
161 extern void __gnat_reset_attributes (struct file_attributes* attr);
162 extern long __gnat_file_length_attr (int, char *, struct file_attributes *);
163 extern OS_Time __gnat_file_time_name_attr (char *, struct file_attributes *);
164 extern OS_Time __gnat_file_time_fd_attr (int, struct file_attributes *);
165 extern int __gnat_file_exists_attr (char *, struct file_attributes *);
166 extern int __gnat_is_regular_file_attr (char *, struct file_attributes *);
167 extern int __gnat_is_directory_attr (char *, struct file_attributes *);
168 extern int __gnat_is_readable_file_attr (char *, struct file_attributes *);
169 extern int __gnat_is_writable_file_attr (char *, struct file_attributes *);
170 extern int __gnat_is_executable_file_attr (char *, struct file_attributes *);
171 extern int __gnat_is_symbolic_link_attr (char *, struct file_attributes *);
173 extern void __gnat_set_non_writable (char *name);
174 extern void __gnat_set_writable (char *name);
175 extern void __gnat_set_executable (char *name);
176 extern void __gnat_set_readable (char *name);
177 extern void __gnat_set_non_readable (char *name);
178 extern int __gnat_is_symbolic_link (char *name);
179 extern int __gnat_portable_spawn (char *[]);
180 extern int __gnat_portable_no_block_spawn (char *[]);
181 extern int __gnat_portable_wait (int *);
182 extern char *__gnat_locate_exec (char *, char *);
183 extern char *__gnat_locate_exec_on_path (char *);
184 extern char *__gnat_locate_regular_file (char *, char *);
185 extern void __gnat_maybe_glob_args (int *, char ***);
186 extern void __gnat_os_exit (int);
187 extern char *__gnat_get_libraries_from_registry (void);
188 extern int __gnat_to_canonical_file_list_init (char *, int);
189 extern char *__gnat_to_canonical_file_list_next (void);
190 extern void __gnat_to_canonical_file_list_free (void);
191 extern char *__gnat_to_canonical_dir_spec (char *, int);
192 extern char *__gnat_to_canonical_file_spec (char *);
193 extern char *__gnat_to_host_dir_spec (char *, int);
194 extern char *__gnat_to_host_file_spec (char *);
195 extern char *__gnat_to_canonical_path_spec (char *);
196 extern void __gnat_adjust_os_resource_limits (void);
197 extern void convert_addresses (const char *, void *, int,
198 void *, int *);
199 extern int __gnat_copy_attribs (char *, char *, int);
200 extern int __gnat_feof (FILE *);
201 extern int __gnat_ferror (FILE *);
202 extern int __gnat_fileno (FILE *);
203 extern int __gnat_is_regular_file_fd (int);
204 extern FILE *__gnat_constant_stderr (void);
205 extern FILE *__gnat_constant_stdin (void);
206 extern FILE *__gnat_constant_stdout (void);
207 extern char *__gnat_full_name (char *, char *);
209 extern int __gnat_arg_count (void);
210 extern int __gnat_len_arg (int);
211 extern void __gnat_fill_arg (char *, int);
212 extern int __gnat_env_count (void);
213 extern int __gnat_len_env (int);
214 extern void __gnat_fill_env (char *, int);
216 /* Routines for interface to scanf and printf functions for integer values */
218 extern int get_int (void);
219 extern void put_int (int);
220 extern void put_int_stderr (int);
221 extern int get_char (void);
222 extern void put_char (int);
223 extern void put_char_stderr (int);
224 extern char *mktemp (char *);
226 extern void __gnat_set_exit_status (int);
228 extern int __gnat_expect_fork (void);
229 extern void __gnat_expect_portable_execvp (char *, char *[]);
230 extern int __gnat_pipe (int *);
231 extern int __gnat_expect_poll (int *, int, int, int *);
232 extern void __gnat_set_binary_mode (int);
233 extern void __gnat_set_text_mode (int);
234 extern char *__gnat_ttyname (int);
235 extern int __gnat_lseek (int, long, int);
236 extern int __gnat_set_close_on_exec (int, int);
237 extern int __gnat_dup (int);
238 extern int __gnat_dup2 (int, int);
240 extern int __gnat_number_of_cpus (void);
242 extern void __gnat_os_filename (char *, char *, char *,
243 int *, char *, int *);
244 #if defined (linux)
245 extern void *__gnat_lwp_self (void);
246 #endif
248 #if defined (_WIN32)
249 /* Interface to delete a handle from internally maintained list of child
250 process handles on Windows */
251 extern void
252 __gnat_win32_remove_handle (HANDLE h, int pid);
253 #endif
255 #ifdef IN_RTS
256 /* Portable definition of strdup, which is not available on all systems. */
257 #define xstrdup(S) strcpy ((char *) malloc (strlen (S) + 1), S)
258 #endif
260 /* This function returns the version of GCC being used. Here it's GCC 3. */
261 extern int get_gcc_version (void);
263 extern int __gnat_binder_supports_auto_init (void);
264 extern int __gnat_sals_init_using_constructors (void);