comparison gcc/ada/osint.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 -- -- 4 -- --
5 -- O S I N T -- 5 -- O S I N T --
6 -- -- 6 -- --
7 -- S p e c -- 7 -- S p e c --
8 -- -- 8 -- --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- 9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
10 -- -- 10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under -- 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- -- 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- -- 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- -- 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
253 -- In all these subprograms, the requested value is either read from the 253 -- In all these subprograms, the requested value is either read from the
254 -- File_Attributes parameter (resulting in no system call), or computed 254 -- File_Attributes parameter (resulting in no system call), or computed
255 -- from the disk and then cached in the File_Attributes parameter (possibly 255 -- from the disk and then cached in the File_Attributes parameter (possibly
256 -- along with other values). 256 -- along with other values).
257 257
258 type File_Attributes is private; 258 File_Attributes_Size : constant Natural := 32;
259 Unknown_Attributes : constant File_Attributes; 259 -- This should be big enough to fit a "struct file_attributes" on any
260 -- system. It doesn't cause any malfunction if it is too big (which avoids
261 -- the need for either mapping the struct exactly or importing the sizeof
262 -- from C, which would result in dynamic code). However, it does waste
263 -- space (e.g. when a component of this type appears in a record, if it is
264 -- unnecessarily large). Note: for runtime units, use System.OS_Constants.
265 -- SIZEOF_struct_file_attributes instead, which has the exact value.
266
267 type File_Attributes is
268 array (1 .. File_Attributes_Size)
269 of System.Storage_Elements.Storage_Element;
270 for File_Attributes'Alignment use Standard'Maximum_Alignment;
271
272 Unknown_Attributes : File_Attributes;
260 -- A cache for various attributes for a file (length, accessibility,...) 273 -- A cache for various attributes for a file (length, accessibility,...)
261 -- This must be initialized to Unknown_Attributes prior to the first call. 274 -- Will be initialized properly at elaboration (for efficiency later on,
275 -- avoid function calls every time we want to reset the attributes) prior
276 -- to the first usage. We cannot make it constant since the compiler may
277 -- put it in a read-only section.
262 278
263 function Is_Directory 279 function Is_Directory
264 (Name : C_File_Name; 280 (Name : C_File_Name;
265 Attr : access File_Attributes) return Boolean; 281 Attr : access File_Attributes) return Boolean;
266 function Is_Regular_File 282 function Is_Regular_File
752 -- stored in Output_FD, and whose file name is stored as a File_Name_Type 768 -- stored in Output_FD, and whose file name is stored as a File_Name_Type
753 -- in Output_File_Name. A check is made for disk full, and if this is 769 -- in Output_File_Name. A check is made for disk full, and if this is
754 -- detected, the file being written is deleted, and a fatal error is 770 -- detected, the file being written is deleted, and a fatal error is
755 -- signalled. 771 -- signalled.
756 772
757 File_Attributes_Size : constant Natural := 32;
758 -- This should be big enough to fit a "struct file_attributes" on any
759 -- system. It doesn't cause any malfunction if it is too big (which avoids
760 -- the need for either mapping the struct exactly or importing the sizeof
761 -- from C, which would result in dynamic code). However, it does waste
762 -- space (e.g. when a component of this type appears in a record, if it is
763 -- unnecessarily large). Note: for runtime units, use System.OS_Constants.
764 -- SIZEOF_struct_file_attributes instead, which has the exact value.
765
766 type File_Attributes is
767 array (1 .. File_Attributes_Size)
768 of System.Storage_Elements.Storage_Element;
769 for File_Attributes'Alignment use Standard'Maximum_Alignment;
770
771 Unknown_Attributes : constant File_Attributes := (others => 0);
772 -- Will be initialized properly at elaboration (for efficiency later on,
773 -- avoid function calls every time we want to reset the attributes).
774
775 end Osint; 773 end Osint;