1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2000 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 with Casing; use Casing;
28 with Fname; use Fname;
29 with Fname.UF; use Fname.UF;
30 with SFN_Scan; use SFN_Scan;
31 with Namet; use Namet;
32 with Osint; use Osint;
33 with Types; use Types;
35 with Unchecked_Conversion;
37 package body Fname.SF is
39 subtype Big_String is String (Positive);
40 type Big_String_Ptr is access all Big_String;
42 function To_Big_String_Ptr is new Unchecked_Conversion
43 (Source_Buffer_Ptr, Big_String_Ptr);
45 ----------------------
46 -- Local Procedures --
47 ----------------------
49 procedure Set_File_Name (Typ : Character; U : String; F : String);
50 -- This is a transfer function that is called from Scan_SFN_Pragmas,
51 -- and reformats its parameters appropriately for the version of
52 -- Set_File_Name found in Fname.SF.
54 procedure Set_File_Name_Pattern
59 -- This is a transfer function that is called from Scan_SFN_Pragmas,
60 -- and reformats its parameters appropriately for the version of
61 -- Set_File_Name_Pattern found in Fname.SF.
63 -----------------------------------
64 -- Read_Source_File_Name_Pragmas --
65 -----------------------------------
67 procedure Read_Source_File_Name_Pragmas is
68 Src : Source_Buffer_Ptr;
74 Name_Buffer (1 .. 8) := "gnat.adc";
76 Read_Source_File (Name_Enter, 0, Hi, Src);
79 BS := To_Big_String_Ptr (Src);
80 SP := BS (1 .. Natural (Hi))'Unrestricted_Access;
84 Set_File_Name_Pattern'Access);
86 end Read_Source_File_Name_Pragmas;
92 procedure Set_File_Name (Typ : Character; U : String; F : String) is
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);
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;