1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
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. 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Casing
; use Casing
;
27 with Fname
; use Fname
;
28 with Fname
.UF
; use Fname
.UF
;
29 with SFN_Scan
; use SFN_Scan
;
30 with Osint
; use Osint
;
31 with Types
; use Types
;
33 with Unchecked_Conversion
;
35 package body Fname
.SF
is
37 ----------------------
38 -- Local Procedures --
39 ----------------------
41 procedure Set_File_Name
46 -- This is a transfer function that is called from Scan_SFN_Pragmas,
47 -- and reformats its parameters appropriately for the version of
48 -- Set_File_Name found in Fname.SF.
50 procedure Set_File_Name_Pattern
55 -- This is a transfer function that is called from Scan_SFN_Pragmas,
56 -- and reformats its parameters appropriately for the version of
57 -- Set_File_Name_Pattern found in Fname.SF.
59 -----------------------------------
60 -- Read_Source_File_Name_Pragmas --
61 -----------------------------------
63 procedure Read_Source_File_Name_Pragmas
is
64 Src
: Source_Buffer_Ptr
;
68 Read_Source_File
(Name_Enter
("gnat.adc"), 1, Hi
, Src
);
70 if not Null_Source_Buffer_Ptr
(Src
) then
71 -- We need to strip off the trailing EOF that was added by
72 -- Read_Source_File, because there might be another EOF in
73 -- the file, and two in a row causes Scan_SFN_Pragmas to give
76 pragma Assert
(Src
(Hi
) = EOF
);
78 (String (Src
(1 .. Hi
- 1)),
80 Set_File_Name_Pattern
'Access);
82 end Read_Source_File_Name_Pragmas
;
88 procedure Set_File_Name
97 Name_Buffer
(1 .. U
'Length) := U
;
99 Set_Casing
(All_Lower_Case
);
100 Name_Buffer
(Name_Len
+ 1) := '%';
101 Name_Buffer
(Name_Len
+ 2) := Typ
;
102 Name_Len
:= Name_Len
+ 2;
104 Name_Buffer
(1 .. F
'Length) := F
;
105 Name_Len
:= F
'Length;
107 Fname
.UF
.Set_File_Name
(Unm
, Fnm
, Nat
(Index
));
110 ---------------------------
111 -- Set_File_Name_Pattern --
112 ---------------------------
114 procedure Set_File_Name_Pattern
121 Patp
: constant String_Ptr
:= new String'(Pat);
122 Dotp : constant String_Ptr := new String'(Dot
);
126 Ctyp
:= All_Lower_Case
;
128 Ctyp
:= All_Upper_Case
;
133 Fname
.UF
.Set_File_Name_Pattern
(Patp
, Typ
, Dotp
, Ctyp
);
134 end Set_File_Name_Pattern
;