1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 ------------------------------------------------------------------------------
28 with Casing; use Casing;
29 with Fname; use Fname;
30 with Fname.UF; use Fname.UF;
31 with SFN_Scan; use SFN_Scan;
32 with Namet; use Namet;
33 with Osint; use Osint;
34 with Types; use Types;
36 with Unchecked_Conversion;
38 package body Fname.SF is
40 subtype Big_String is String (Positive);
41 type Big_String_Ptr is access all Big_String;
43 function To_Big_String_Ptr is new Unchecked_Conversion
44 (Source_Buffer_Ptr, Big_String_Ptr);
46 ----------------------
47 -- Local Procedures --
48 ----------------------
50 procedure Set_File_Name (Typ : Character; U : String; F : String);
51 -- This is a transfer function that is called from Scan_SFN_Pragmas,
52 -- and reformats its parameters appropriately for the version of
53 -- Set_File_Name found in Fname.SF.
55 procedure Set_File_Name_Pattern
60 -- This is a transfer function that is called from Scan_SFN_Pragmas,
61 -- and reformats its parameters appropriately for the version of
62 -- Set_File_Name_Pattern found in Fname.SF.
64 -----------------------------------
65 -- Read_Source_File_Name_Pragmas --
66 -----------------------------------
68 procedure Read_Source_File_Name_Pragmas is
69 Src : Source_Buffer_Ptr;
75 Name_Buffer (1 .. 8) := "gnat.adc";
77 Read_Source_File (Name_Enter, 0, Hi, Src);
80 BS := To_Big_String_Ptr (Src);
81 SP := BS (1 .. Natural (Hi))'Unrestricted_Access;
85 Set_File_Name_Pattern'Access);
87 end Read_Source_File_Name_Pragmas;
93 procedure Set_File_Name (Typ : Character; U : String; F : String) is
98 Name_Buffer (1 .. U'Length) := U;
100 Set_Casing (All_Lower_Case);
101 Name_Buffer (Name_Len + 1) := '%';
102 Name_Buffer (Name_Len + 2) := Typ;
103 Name_Len := Name_Len + 2;
105 Name_Buffer (1 .. F'Length) := F;
106 Name_Len := F'Length;
108 Fname.UF.Set_File_Name (Unm, Fnm);
111 ---------------------------
112 -- Set_File_Name_Pattern --
113 ---------------------------
115 procedure Set_File_Name_Pattern
122 Patp : constant String_Ptr := new String'(Pat);
123 Dotp : constant String_Ptr := new String'(Dot);
127 Ctyp := All_Lower_Case;
129 Ctyp := All_Upper_Case;
134 Fname.UF.Set_File_Name_Pattern (Patp, Typ, Dotp, Ctyp);
135 end Set_File_Name_Pattern;