1------------------------------------------------------------------------------ 2-- -- 3-- GNAT COMPILER COMPONENTS -- 4-- -- 5-- F N A M E . U F -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- 10-- -- 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. -- 21-- -- 22-- GNAT was originally developed by the GNAT team at New York University. -- 23-- Extensive contributions were provided by Ada Core Technologies Inc. -- 24-- -- 25------------------------------------------------------------------------------ 26 27-- This child package contains the routines to translate a unit name to 28-- a file name taking into account Source_File_Name pragmas. It also 29-- contains the auxiliary routines used to record data from the pragmas. 30 31-- Note: the reason we split this into a child unit is that the routines 32-- for unit name translation have a significant number of additional 33-- dependencies, including osint, and hence sdefault. There are a number 34-- of tools that use utility subprograms in the Fname parent, but do not 35-- need the functionality in this child package (and certainly do not want 36-- to deal with the extra dependencies). 37 38with Casing; use Casing; 39 40package Fname.UF is 41 42 ----------------- 43 -- Subprograms -- 44 ----------------- 45 46 function Get_File_Name 47 (Uname : Unit_Name_Type; 48 Subunit : Boolean) return File_Name_Type; 49 -- This function returns the file name that corresponds to a given unit 50 -- name, Uname. The Subunit parameter is set True for subunits, and 51 -- false for all other kinds of units. The caller is responsible for 52 -- ensuring that the unit name meets the requirements given in package 53 -- Uname and described above. 54 55 procedure Initialize; 56 -- Initialize internal tables. This is called automatically when the 57 -- package body is elaborated, so an explicit call to Initialize is 58 -- only required if it is necessary to reinitialize the source file 59 -- name pragma tables. 60 61 procedure Lock; 62 -- Lock tables before calling back end 63 64 function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type; 65 -- Returns the file name that corresponds to the spec of a given unit 66 -- name. The unit name here is not encoded as a Unit_Name_Type, but is 67 -- rather just a normal form name in lower case, e.g. "xyz.def". 68 69 function File_Name_Of_Body (Name : Name_Id) return File_Name_Type; 70 -- Returns the file name that corresponds to the body of a given unit 71 -- name. The unit name here is not encoded as a Unit_Name_Type, but is 72 -- rather just a normal form name in lower case, e.g. "xyz.def". 73 74 procedure Set_File_Name (U : Unit_Name_Type; F : File_Name_Type); 75 -- Make association between given unit name, U, and the given file name, 76 -- F. This is the routine called to process a Source_File_Name pragma. 77 78 procedure Set_File_Name_Pattern 79 (Pat : String_Ptr; 80 Typ : Character; 81 Dot : String_Ptr; 82 Cas : Casing_Type); 83 -- This is called to process a Source_File_Name pragma whose first 84 -- argument is a file name pattern string. Pat is this pattern string, 85 -- which contains an asterisk to correspond to the unit. Typ is one of 86 -- 'b'/'s'/'u' for body/spec/subunit, Dot is the separator string 87 -- for child/subunit names, and Cas is one of Lower/Upper/Mixed 88 -- indicating the required case for the file name. 89 90end Fname.UF; 91