1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 with Casing; use Casing;
30 with Fname; use Fname;
31 with Fname.UF; use Fname.UF;
32 with SFN_Scan; use SFN_Scan;
33 with Namet; use Namet;
34 with Osint; use Osint;
35 with Types; use Types;
37 with Unchecked_Conversion;
39 package body Fname.SF is
41 subtype Big_String is String (Positive);
42 type Big_String_Ptr is access all Big_String;
44 function To_Big_String_Ptr is new Unchecked_Conversion
45 (Source_Buffer_Ptr, Big_String_Ptr);
47 ----------------------
48 -- Local Procedures --
49 ----------------------
51 procedure Set_File_Name (Typ : Character; U : String; F : String);
52 -- This is a transfer function that is called from Scan_SFN_Pragmas,
53 -- and reformats its parameters appropriately for the version of
54 -- Set_File_Name found in Fname.SF.
56 procedure Set_File_Name_Pattern
61 -- This is a transfer function that is called from Scan_SFN_Pragmas,
62 -- and reformats its parameters appropriately for the version of
63 -- Set_File_Name_Pattern found in Fname.SF.
65 -----------------------------------
66 -- Read_Source_File_Name_Pragmas --
67 -----------------------------------
69 procedure Read_Source_File_Name_Pragmas is
70 Src : Source_Buffer_Ptr;
76 Name_Buffer (1 .. 8) := "gnat.adc";
78 Read_Source_File (Name_Enter, 0, Hi, Src);
81 BS := To_Big_String_Ptr (Src);
82 SP := BS (1 .. Natural (Hi))'Unrestricted_Access;
86 Set_File_Name_Pattern'Access);
88 end Read_Source_File_Name_Pragmas;
94 procedure Set_File_Name (Typ : Character; U : String; F : String) is
99 Name_Buffer (1 .. U'Length) := U;
100 Name_Len := U'Length;
101 Set_Casing (All_Lower_Case);
102 Name_Buffer (Name_Len + 1) := '%';
103 Name_Buffer (Name_Len + 2) := Typ;
104 Name_Len := Name_Len + 2;
106 Name_Buffer (1 .. F'Length) := F;
107 Name_Len := F'Length;
109 Fname.UF.Set_File_Name (Unm, Fnm);
112 ---------------------------
113 -- Set_File_Name_Pattern --
114 ---------------------------
116 procedure Set_File_Name_Pattern
123 Patp : constant String_Ptr := new String'(Pat);
124 Dotp : constant String_Ptr := new String'(Dot);
128 Ctyp := All_Lower_Case;
130 Ctyp := All_Upper_Case;
135 Fname.UF.Set_File_Name_Pattern (Patp, Typ, Dotp, Ctyp);
136 end Set_File_Name_Pattern;