diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-12-02 07:31:39 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-12-02 07:31:39 +0000 |
commit | 47c16a8cec2c48947e6d85683f5f916777ccc169 (patch) | |
tree | 3a8bf827ae1df7e637a2a4ede4dba5f0421ac0d2 /gcc/ada/osint.ads | |
parent | b27941d363b11d115e30a9676e61c8536a12adf7 (diff) | |
download | gcc-47c16a8cec2c48947e6d85683f5f916777ccc169.tar.gz |
2009-12-02 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 154895
{after more plugin events from ICI folks}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@154896 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/osint.ads')
-rw-r--r-- | gcc/ada/osint.ads | 87 |
1 files changed, 53 insertions, 34 deletions
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads index 34b3f642fee..ae827ba286b 100644 --- a/gcc/ada/osint.ads +++ b/gcc/ada/osint.ads @@ -30,8 +30,8 @@ with Namet; use Namet; with Types; use Types; with System.Storage_Elements; -with System.OS_Lib; use System.OS_Lib; -with System; use System; +with System.OS_Lib; use System.OS_Lib; +with System; use System; pragma Elaborate_All (System.OS_Lib); -- For the call to function Get_Target_Object_Suffix in the private part @@ -147,13 +147,17 @@ package Osint is -- Strips the suffix (the last '.' and whatever comes after it) from Name. -- Returns the stripped name. - function Executable_Name (Name : File_Name_Type) return File_Name_Type; + function Executable_Name + (Name : File_Name_Type; + Only_If_No_Suffix : Boolean := False) return File_Name_Type; -- Given a file name it adds the appropriate suffix at the end so that -- it becomes the name of the executable on the system at end. For -- instance under DOS it adds the ".exe" suffix, whereas under UNIX no -- suffix is added. - function Executable_Name (Name : String) return String; + function Executable_Name + (Name : String; + Only_If_No_Suffix : Boolean := False) return String; -- Same as above, with String parameters function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type; @@ -207,9 +211,9 @@ package Osint is function To_Host_Dir_Spec (Canonical_Dir : String; Prefix_Style : Boolean) return String_Access; - -- Convert a canonical syntax directory specification to host syntax. - -- The Prefix_Style flag is currently ignored but should be set to - -- False. + -- Convert a canonical syntax directory specification to host syntax. The + -- Prefix_Style flag is currently ignored but should be set to False. + -- Note that the caller must free result. function To_Host_File_Spec (Canonical_File : String) return String_Access; @@ -234,10 +238,12 @@ package Osint is --------------------- -- File attributes -- --------------------- + -- The following subprograms offer services similar to those found in -- System.OS_Lib, but with the ability to extra multiple information from -- a single system call, depending on the system. This can result in fewer -- system calls when reused. + -- In all these subprograms, the requested value is either read from the -- File_Attributes parameter (resulting in no system call), or computed -- from the disk and then cached in the File_Attributes parameter (possibly @@ -249,27 +255,38 @@ package Osint is -- This must be initialized to Unknown_Attributes prior to the first call. function Is_Directory - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; function Is_Regular_File - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; function Is_Symbolic_Link - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; -- Return the type of the file, function File_Length - (Name : C_File_Name; Attr : access File_Attributes) return Long_Integer; + (Name : C_File_Name; + Attr : access File_Attributes) return Long_Integer; -- Return the length (number of bytes) of the file function File_Time_Stamp - (Name : C_File_Name; Attr : access File_Attributes) return OS_Time; + (Name : C_File_Name; + Attr : access File_Attributes) return OS_Time; + function File_Time_Stamp + (Name : Path_Name_Type; + Attr : access File_Attributes) return Time_Stamp_Type; -- Return the time stamp of the file function Is_Readable_File - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; function Is_Executable_File - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; function Is_Writable_File - (Name : C_File_Name; Attr : access File_Attributes) return Boolean; + (Name : C_File_Name; + Attr : access File_Attributes) return Boolean; -- Return the access rights for the file ------------------------- @@ -436,6 +453,7 @@ package Osint is -- The source file directory lookup penalty is incurred every single time -- the routines are called unless you have previously called -- Source_File_Data (Cache => True). See below. + -- -- The procedural version also returns some file attributes for the ALI -- file (to save on system calls later on). @@ -468,11 +486,11 @@ package Osint is -- Representation of Library Information -- ------------------------------------------- - -- Associated with each compiled source file is library information, - -- a string of bytes whose exact format is described in the body of - -- Lib.Writ. Compiling a source file generates this library information - -- for the compiled unit, and access the library information for units - -- that were compiled previously on which the unit being compiled depends. + -- Associated with each compiled source file is library information, a + -- string of bytes whose exact format is described in the body of Lib.Writ. + -- Compiling a source file generates this library information for the + -- compiled unit, and access the library information for units that were + -- compiled previously on which the unit being compiled depends. -- How this information is stored is up to the implementation of this -- package. At the interface level, this information is simply associated @@ -524,15 +542,14 @@ package Osint is -- include any directory information. The implementation is responsible -- for searching for the file in appropriate directories. -- - -- If Opt.Check_Object_Consistency is set to True then this routine - -- checks whether the object file corresponding to the Lib_File is - -- consistent with it. The object file is inconsistent if the object - -- does not exist or if it has an older time stamp than Lib_File. - -- This check is not performed when the Lib_File is "locked" (i.e. - -- read/only) because in this case the object file may be buried - -- in a library. In case of inconsistencies Read_Library_Info - -- behaves as if it did not find Lib_File (namely if Fatal_Err is - -- False, null is returned). + -- If Opt.Check_Object_Consistency is set to True then this routine checks + -- whether the object file corresponding to the Lib_File is consistent with + -- it. The object file is inconsistent if the object does not exist or if + -- it has an older time stamp than Lib_File. This check is not performed + -- when the Lib_File is "locked" (i.e. read/only) because in this case the + -- object file may be buried in a library. In case of inconsistencies + -- Read_Library_Info behaves as if it did not find Lib_File (namely if + -- Fatal_Err is False, null is returned). function Read_Library_Info_From_Full (Full_Lib_File : File_Name_Type; @@ -718,15 +735,17 @@ private -- detected, the file being written is deleted, and a fatal error is -- signalled. - File_Attributes_Size : constant Integer := 50; + File_Attributes_Size : constant Natural := 24; -- This should be big enough to fit a "struct file_attributes" on any - -- system. It doesn't matter if it is too big (which avoids the need for - -- either mapping the struct exactly or importing the sizeof from C, which - -- would result in dynamic code) + -- system. It doesn't cause any malfunction if it is too big (which avoids + -- the need for either mapping the struct exactly or importing the sizeof + -- from C, which would result in dynamic code). However, it does waste + -- space (e.g. when a component of this type appears in a record, if it is + -- unnecessarily large. type File_Attributes is array (1 .. File_Attributes_Size) - of System.Storage_Elements.Storage_Element; + of System.Storage_Elements.Storage_Element; for File_Attributes'Alignment use Standard'Maximum_Alignment; Unknown_Attributes : constant File_Attributes := (others => 0); |