1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2024, 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
.UF
; use Fname
.UF
;
28 with SFN_Scan
; use SFN_Scan
;
29 with Osint
; use Osint
;
30 with Types
; use Types
;
31 with System
.OS_Lib
; use System
.OS_Lib
;
33 package body Fname
.SF
is
35 ----------------------
36 -- Local Procedures --
37 ----------------------
39 procedure Set_File_Name
44 -- This is a transfer function that is called from Scan_SFN_Pragmas,
45 -- and reformats its parameters appropriately for the version of
46 -- Set_File_Name found in Fname.SF.
48 procedure Set_File_Name_Pattern
53 -- This is a transfer function that is called from Scan_SFN_Pragmas,
54 -- and reformats its parameters appropriately for the version of
55 -- Set_File_Name_Pattern found in Fname.SF.
57 -----------------------------------
58 -- Read_Source_File_Name_Pragmas --
59 -----------------------------------
61 procedure Read_Source_File_Name_Pragmas
is
63 Src
: Source_Buffer_Ptr
;
67 Read_Source_File
(Name_Enter
("gnat.adc"), 1, Hi
, Src
, FD
);
69 if not Null_Source_Buffer_Ptr
(Src
) then
70 -- We need to strip off the trailing EOF that was added by
71 -- Read_Source_File, because there might be another EOF in
72 -- the file, and two in a row causes Scan_SFN_Pragmas to give
75 pragma Assert
(Src
(Hi
) = EOF
);
77 (String (Src
(1 .. Hi
- 1)),
79 Set_File_Name_Pattern
'Access);
81 end Read_Source_File_Name_Pragmas
;
87 procedure Set_File_Name
96 Name_Buffer
(1 .. U
'Length) := U
;
98 Set_Casing
(All_Lower_Case
);
99 Name_Buffer
(Name_Len
+ 1) := '%';
100 Name_Buffer
(Name_Len
+ 2) := Typ
;
101 Name_Len
:= Name_Len
+ 2;
103 Name_Buffer
(1 .. F
'Length) := F
;
104 Name_Len
:= F
'Length;
106 Fname
.UF
.Set_File_Name
(Unm
, Fnm
, Nat
(Index
));
109 ---------------------------
110 -- Set_File_Name_Pattern --
111 ---------------------------
113 procedure Set_File_Name_Pattern
120 Patp
: constant String_Ptr
:= new String'(Pat);
121 Dotp : constant String_Ptr := new String'(Dot
);
125 Ctyp
:= All_Lower_Case
;
127 Ctyp
:= All_Upper_Case
;
132 Fname
.UF
.Set_File_Name_Pattern
(Patp
, Typ
, Dotp
, Ctyp
);
133 end Set_File_Name_Pattern
;