OSDN Git Service

* config/arm/crti.asm: Give _init and _fini function type.
[pf3gnuchains/gcc-fork.git] / gcc / ada / sinput-l.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             S I N P U T . L                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2004, 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 used to actually load a source
28 --  file and create entries in the source file table. It also contains the
29 --  routines to create virtual entries for instantiations. This is separated
30 --  off into a child package to avoid a dependence of Sinput on Osint which
31 --  would cause trouble in the tree read/write routines.
32
33 with Types; use Types;
34
35 package Sinput.L is
36
37    ------------------------------------------
38    -- Subprograms for Loading Source Files --
39    ------------------------------------------
40
41    function Load_Source_File (N : File_Name_Type) return Source_File_Index;
42    --  Given a source file name, returns the index of the corresponding entry
43    --  in the source file table. If the file is not currently loaded, then
44    --  this is the call that causes the source file to be read and an entry
45    --  made in the table. A new entry in the table has the file name and time
46    --  stamp entries set and the Casing entries set to Unknown. Version is set
47    --  to all blanks, and the lines table is initialized but only the first
48    --  entry is set (and Last_Line is set to 1). If the given source file
49    --  cannot be opened, then the value returned is No_Source_File.
50
51    function Load_Config_File (N : File_Name_Type) return Source_File_Index;
52    --  Similar to Load_Source_File, except that the file name is always
53    --  interpreted in the context of the current working directory.
54    --  The file is never preprocessed.
55
56    function Load_Definition_File
57      (N : File_Name_Type) return Source_File_Index;
58    --  Loads preprocessing definition file. Similar to Load_Source_File
59    --  except that this file is not itself preprocessed.
60
61    function Load_Preprocessing_Data_File
62      (N : File_Name_Type) return Source_File_Index;
63    --  Loads preprocessing data file. Similar to Load_Source_File except
64    --  that this file is not itself preprocessed.
65
66    procedure Complete_Source_File_Entry;
67    --  Called on completing the parsing of a source file. This call completes
68    --  the source file table entry for the current source file.
69
70    function Source_File_Is_Subunit (X : Source_File_Index) return Boolean;
71    --  This function determines if a source file represents a subunit. It
72    --  works by scanning for the first compilation unit token, and returning
73    --  True if it is the token SEPARATE. It will return False otherwise,
74    --  meaning that the file cannot possibly be a legal subunit. This
75    --  function does NOT do a complete parse of the file, or build a
76    --  tree. It is used in the main driver in the check for bad bodies.
77
78    -------------------------------------------------
79    -- Subprograms for Dealing With Instantiations --
80    -------------------------------------------------
81
82    type Sloc_Adjustment is private;
83    --  Type returned by Create_Instantiation_Source for use in subsequent
84    --  calls to Adjust_Instantiation_Sloc.
85
86    procedure Create_Instantiation_Source
87      (Inst_Node    : Entity_Id;
88       Template_Id  : Entity_Id;
89       Inlined_Body : Boolean;
90       A            : out Sloc_Adjustment);
91    --  This procedure creates the source table entry for an instantiation.
92    --  Inst_Node is the instantiation node, and Template_Id is the defining
93    --  identifier of the generic declaration or body unit as appropriate.
94    --  A is set to an adjustment factor to be used in subsequent calls to
95    --  Adjust_Instantiation_Sloc. The instantiation mechnaism is also used
96    --  for inlined function and procedure calls. The parameter Inlined_Body
97    --  is set to True in such cases, and False for a generic instantiation.
98    --  This is used for generating error messages that distinguish these
99    --  two cases, otherwise the two cases are handled identically.
100
101    procedure Adjust_Instantiation_Sloc (N : Node_Id; A : Sloc_Adjustment);
102    --  The instantiation tree is created by copying the tree of the generic
103    --  template (including the original Sloc values), and then applying
104    --  Adjust_Instantiation_Sloc to each copied node to adjust the Sloc
105    --  to reference the source entry for the instantiation.
106
107 private
108
109    type Sloc_Adjustment is record
110       Adjust : Source_Ptr;
111       --  Adjustment factor. To be added to source location values in the
112       --  source table entry for the template to get corresponding sloc
113       --  values for the instantiation image of the template. This is not
114       --  really a Source_Ptr value, but rather an offset, but it is more
115       --  convenient to represent it as a Source_Ptr value and this is a
116       --  private type anyway.
117
118       Lo, Hi : Source_Ptr;
119       --  Lo and hi values to which adjustment factor can legitimately
120       --  be applied, used to ensure that no incorrect adjustments are
121       --  made. Really it is a bug if anyone ever tries to adjust outside
122       --  this range, but since we are only doing this anyway for getting
123       --  better error messages, it is not critical
124
125    end record;
126
127 end Sinput.L;