Remove some compile time warnings about duplicate definitions.
[official-gcc.git] / gcc / ada / sinput-l.ads
blobbba983fd00b3027a12c3289a650baf89631c3b1a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S I N P U T . L --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.14 $ --
10 -- --
11 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
12 -- --
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. --
23 -- --
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). --
26 -- --
27 ------------------------------------------------------------------------------
29 -- This child package contains the routines used to actually load a source
30 -- file and create entries in the source file table. It also contains the
31 -- routines to create virtual entries for instantiations. This is separated
32 -- off into a child package to avoid a dependence of Sinput on Osint which
33 -- would cause trouble in the tree read/write routines.
35 with Types; use Types;
37 package Sinput.L is
39 -------------------------------------------
40 -- Subprograms for Loading Source Files --
41 -------------------------------------------
43 function Load_Source_File (N : File_Name_Type) return Source_File_Index;
44 -- Given a source file name, returns the index of the corresponding entry
45 -- in the source file table. If the file is not currently loaded, then
46 -- this is the call that causes the source file to be read and an entry
47 -- made in the table. A new entry in the table has the file name and time
48 -- stamp entries set and the Casing entries set to Unknown. Version is set
49 -- to all blanks, and the lines table is initialized but only the first
50 -- entry is set (and Last_Line is set to 1). If the given source file
51 -- cannot be opened, then the value returned is No_Source_File.
53 function Load_Config_File (N : File_Name_Type) return Source_File_Index;
54 -- Similar to Load_Source_File, except that the file name is always
55 -- interpreted in the context of the current working directory.
57 procedure Complete_Source_File_Entry;
58 -- Called on completing the parsing of a source file. This call completes
59 -- the source file table entry for the current source file.
61 function Source_File_Is_Subunit (X : Source_File_Index) return Boolean;
62 -- This function determines if a source file represents a subunit. It
63 -- works by scanning for the first compilation unit token, and returning
64 -- True if it is the token SEPARATE. It will return False otherwise,
65 -- meaning that the file cannot possibly be a legal subunit. This
66 -- function does NOT do a complete parse of the file, or build a
67 -- tree. It is used in the main driver in the check for bad bodies.
69 -------------------------------------------------
70 -- Subprograms for Dealing With Instantiations --
71 -------------------------------------------------
73 type Sloc_Adjustment is private;
74 -- Type returned by Create_Instantiation_Source for use in subsequent
75 -- calls to Adjust_Instantiation_Sloc.
77 procedure Create_Instantiation_Source
78 (Inst_Node : Entity_Id;
79 Template_Id : Entity_Id;
80 A : out Sloc_Adjustment);
81 -- This procedure creates the source table entry for an instantiation.
82 -- Inst_Node is the instantiation node, and Template_Id is the defining
83 -- identifier of the generic declaration or body unit as appropriate.
84 -- A is set to an adjustment factor to be used in subsequent calls to
85 -- Adjust_Instantiation_Sloc.
87 procedure Adjust_Instantiation_Sloc (N : Node_Id; A : Sloc_Adjustment);
88 -- The instantiation tree is created by copying the tree of the generic
89 -- template (including the original Sloc values), and then applying
90 -- Adjust_Instantiation_Sloc to each copied node to adjust the Sloc
91 -- to reference the source entry for the instantiation.
93 ------------------------------------------------
94 -- Subprograms for Writing Debug Source Files --
95 ------------------------------------------------
97 procedure Create_Debug_Source
98 (Source : Source_File_Index;
99 Loc : out Source_Ptr);
100 -- Given a source file, creates a new source file table entry to be used
101 -- for the debug source file output (Debug_Generated_Code switch set).
102 -- Loc is set to the initial Sloc value for the first line. This call
103 -- also creates the debug source output file (using Create_Debug_File).
105 procedure Write_Debug_Line (Str : String; Loc : in out Source_Ptr);
106 -- This procedure is called to write a line to the debug source file
107 -- previously created by Create_Debug_Source using Write_Debug_Info.
108 -- Str is the source line to be written to the file (it does not include
109 -- an end of line character). On entry Loc is the Sloc value previously
110 -- returned by Create_Debug_Source or Write_Debug_Line, and on exit,
111 -- Sloc is updated to point to the start of the next line to be written,
112 -- taking into account the length of the ternminator that was written by
113 -- Write_Debug_Info.
115 procedure Close_Debug_Source;
116 -- This procedure completes the source table entry for the debug file
117 -- previously created by Create_Debug_Source, and written using the
118 -- Write_Debug_Line procedure. It then calls Close_Debug_File to
119 -- complete the writing of the file itself.
121 private
123 type Sloc_Adjustment is record
124 Adjust : Source_Ptr;
125 -- Adjustment factor. To be added to source location values in the
126 -- source table entry for the template to get corresponding sloc
127 -- values for the instantiation image of the template. This is not
128 -- really a Source_Ptr value, but rather an offset, but it is more
129 -- convenient to represent it as a Source_Ptr value and this is a
130 -- private type anyway.
132 Lo, Hi : Source_Ptr;
133 -- Lo and hi values to which adjustment factor can legitimately
134 -- be applied, used to ensure that no incorrect adjustments are
135 -- made. Really it is a bug if anyone ever tries to adjust outside
136 -- this range, but since we are only doing this anyway for getting
137 -- better error messages, it is not critical
139 end record;
141 end Sinput.L;