OSDN Git Service

* 1aexcept.adb, 1aexcept.ads, 1ic.ads, 1ssecsta.adb,
[pf3gnuchains/gcc-fork.git] / gcc / ada / ali.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                                  A L I                                   --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2002 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 package defines the internal data structures used for representation
28 --  of Ada Library Information (ALI) acquired from the ALI files generated
29 --  by the front end.
30
31 with Casing;  use Casing;
32 with Gnatvsn; use Gnatvsn;
33 with Rident;  use Rident;
34 with Table;
35 with Types;   use Types;
36
37 with GNAT.HTable; use GNAT.HTable;
38
39 package ALI is
40
41    --------------
42    -- Id Types --
43    --------------
44
45    --  The various entries are stored in tables with distinct subscript
46    --  ranges. The following type definitions indicate the ranges used
47    --  for the subscripts (Id values) for the various tables.
48
49    type ALI_Id is range 0 .. 999_999;
50    --  Id values used for ALIs table entries
51
52    type Unit_Id is range 1_000_000 .. 1_999_999;
53    --  Id values used for Unit table entries
54
55    type With_Id is range 2_000_000 .. 2_999_999;
56    --  Id values used for Withs table entries
57
58    type Arg_Id is range 3_000_000 .. 3_999_999;
59    --  Id values used for argument table entries
60
61    type Sdep_Id is range 4_000_000 .. 4_999_999;
62    --  Id values used for Sdep table entries
63
64    type Source_Id is range 5_000_000 .. 5_999_999;
65    --  Id values used for Source table entries
66
67    --------------------
68    -- ALI File Table --
69    --------------------
70
71    --  Each ALI file read generates an entry in the ALIs table
72
73    No_ALI_Id : constant ALI_Id := ALI_Id'First;
74    --  Special value indicating no ALI entry
75
76    First_ALI_Entry : constant ALI_Id := No_ALI_Id + 1;
77    --  Id of first actual entry in table
78
79    type Main_Program_Type is (None, Proc, Func);
80    --  Indicator of whether unit can be used as main program
81
82    type Restrictions_String is array (All_Restrictions) of Character;
83    --  Type used to hold string from R line
84
85    type ALIs_Record is record
86
87       Afile : File_Name_Type;
88       --  Name of ALI file
89
90       Ofile_Full_Name : Name_Id;
91       --  Full name of object file corresponding to the ALI file
92
93       Sfile : File_Name_Type;
94       --  Name of source file that generates this ALI file (which is equal
95       --  to the name of the source file in the first unit table entry for
96       --  this ALI file, since the body if present is always first).
97
98       Ver : String (1 .. Ver_Len_Max);
99       --  Value of library version (V line in ALI file)
100
101       Ver_Len : Natural;
102       --  Length of characters stored in Ver
103
104       First_Unit : Unit_Id;
105       --  Id of first Unit table entry for this file
106
107       Last_Unit : Unit_Id;
108       --  Id of last Unit table entry for this file
109
110       First_Sdep : Sdep_Id;
111       --  Id of first Sdep table entry for this file
112
113       Last_Sdep : Sdep_Id;
114       --  Id of last Sdep table entry for this file
115
116       Main_Program : Main_Program_Type;
117       --  Indicator of whether first unit can be used as main program
118
119       Main_Priority : Int;
120       --  Indicates priority value if Main_Program field indicates that
121       --  this can be a main program. A value of -1 (No_Main_Priority)
122       --  indicates that no parameter was found, or no M line was present.
123
124       Time_Slice_Value : Int;
125       --  Indicates value of time slice parameter from T=xxx on main program
126       --  line. A value of -1 indicates that no T=xxx parameter was found,
127       --  or no M line was present.
128
129       WC_Encoding : Character;
130       --  Wide character encoding if main procedure. Otherwise not relevant.
131
132       Locking_Policy : Character;
133       --  Indicates locking policy for units in this file. Space means
134       --  tasking was not used, or that no Locking_Policy pragma was
135       --  present or that this is a language defined unit. Otherwise set
136       --  to first character (upper case) of policy name.
137
138       Queuing_Policy : Character;
139       --  Indicates queuing policy for units in this file. Space means
140       --  tasking was not used, or that no Queuing_Policy pragma was
141       --  present or that this is a language defined unit. Otherwise set
142       --  to first character (upper case) of policy name.
143
144       Task_Dispatching_Policy : Character;
145       --  Indicates task dispatching policy for units in this file. Space
146       --  means tasking was not used, or that no Task_Dispatching_Policy
147       --  pragma was present or that this is a language defined unit.
148       --  Otherwise set to first character (upper case) of policy name.
149
150       Compile_Errors : Boolean;
151       --  Set to True if compile errors for unit. Note that No_Object
152       --  will always be set as well in this case.
153
154       Float_Format : Character;
155       --  Set to float format (set to I if no float-format given)
156
157       No_Object : Boolean;
158       --  Set to True if no object file generated
159
160       No_Run_Time : Boolean;
161       --  Set to True if file was compiled with pragma No_Run_Time
162
163       Normalize_Scalars : Boolean;
164       --  Set to True if file was compiled with Normalize_Scalars
165
166       Unit_Exception_Table : Boolean;
167       --  Set to True if unit exception table pointer generated
168
169       Zero_Cost_Exceptions : Boolean;
170       --  Set to True if file was compiled with zero cost exceptions
171
172       Restrictions : Restrictions_String;
173       --  Copy of restrictions letters from R line
174
175    end record;
176
177    No_Main_Priority : constant Int := -1;
178    --  Code for no main priority set
179
180    package ALIs is new Table.Table (
181      Table_Component_Type => ALIs_Record,
182      Table_Index_Type     => ALI_Id,
183      Table_Low_Bound      => First_ALI_Entry,
184      Table_Initial        => 500,
185      Table_Increment      => 200,
186      Table_Name           => "ALIs");
187
188    ----------------
189    -- Unit Table --
190    ----------------
191
192    --  Each unit within an ALI file generates an entry in the unit table
193
194    No_Unit_Id : constant Unit_Id := Unit_Id'First;
195    --  Special value indicating no unit table entry
196
197    First_Unit_Entry : constant Unit_Id := No_Unit_Id + 1;
198    --  Id of first actual entry in table
199
200    type Unit_Type is (Is_Spec, Is_Body, Is_Spec_Only, Is_Body_Only);
201    --  Indicates type of entry, if both body and spec appear in the ALI file,
202    --  then the first unit is marked Is_Body, and the second is marked Is_Spec.
203    --  If only a spec appears, then it is marked as Is_Spec_Only, and if only
204    --  a body appears, then it is marked Is_Body_Only).
205
206    subtype Version_String is String (1 .. 8);
207    --  Version string, taken from unit record
208
209    type Unit_Record is record
210
211       My_ALI : ALI_Id;
212       --  Corresponding ALI entry
213
214       Uname : Unit_Name_Type;
215       --  Name of Unit
216
217       Sfile : File_Name_Type;
218       --  Name of source file
219
220       Preelab : Boolean;
221       --  Indicates presence of PR parameter for a preelaborated package
222
223       No_Elab : Boolean;
224       --  Indicates presence of NE parameter for a unit that has does not
225       --  have an elaboration routine (since it has no elaboration code).
226
227       Pure : Boolean;
228       --  Indicates presence of PU parameter for a pure package
229
230       Dynamic_Elab : Boolean;
231       --  Set to True if the unit was compiled with dynamic elaboration
232       --  checks (i.e. either -gnatE or pragma Elaboration_Checks (Static)
233       --  was used to compile the unit).
234
235       Elaborate_Body : Boolean;
236       --  Indicates presence of EB parameter for a package which has a
237       --  pragma Preelaborate_Body.
238
239       Set_Elab_Entity : Boolean;
240       --  Indicates presence of EE parameter for a unit which has an
241       --  elaboration entity which must be set true as part of the
242       --  elaboration of the entity.
243
244       Has_RACW : Boolean;
245       --  Indicates presence of RA parameter for a package that declares
246       --  at least one Remote Access to Class_Wide (RACW) object.
247
248       Remote_Types : Boolean;
249       --  Indicates presence of RT parameter for a package which has a
250       --  pragma Remote_Types.
251
252       Shared_Passive : Boolean;
253       --  Indicates presence of SP parameter for a package which has a
254       --  pragma Shared_Passive.
255
256       RCI : Boolean;
257       --  Indicates presence of RC parameter for a package which has a
258       --  pragma Remote_Call_Interface.
259
260       Predefined : Boolean;
261       --  Indicates if unit is language predefined (or a child of such a unit)
262
263       Internal : Boolean;
264       --  Indicates if unit is an internal unit (or a child of such a unit)
265
266       First_With : With_Id;
267       --  Id of first withs table entry for this file
268
269       Last_With : With_Id;
270       --  Id of last withs table entry for this file
271
272       First_Arg : Arg_Id;
273       --  Id of first args table entry for this file
274
275       Last_Arg : Arg_Id;
276       --  Id of last args table entry for this file
277
278       Utype : Unit_Type;
279       --  Type of entry
280
281       Is_Generic : Boolean;
282       --  True for generic unit (i.e. a generic declaration, or a generic
283       --  body). False for a non-generic unit.
284
285       Unit_Kind : Character;
286       --  Indicates the nature of the unit. 'p' for Packages and 's' for
287       --  subprograms.
288
289       Version : Version_String;
290       --  Version of unit
291
292       Icasing : Casing_Type;
293       --  Indicates casing of identifiers in source file for this unit. This
294       --  is used for informational output, and also for constructing the
295       --  main unit if it is being built in Ada.
296
297       Kcasing : Casing_Type;
298       --  Indicates casing of keyowords in source file for this unit. This
299       --  is used for informational output, and also for constructing the
300       --  main unit if it is being built in Ada.
301
302       Elab_Position : aliased Natural;
303       --  Initialized to zero. Set non-zero when a unit is chosen and
304       --  placed in the elaboration order. The value represents the
305       --  ordinal position in the elaboration order.
306
307       Init_Scalars : Boolean;
308       --  Set True if IS qualifier appears in ALI file, indicating that
309       --  an Initialize_Scalars pragma applies to the unit.
310
311    end record;
312
313    package Units is new Table.Table (
314      Table_Component_Type => Unit_Record,
315      Table_Index_Type     => Unit_Id,
316      Table_Low_Bound      => First_Unit_Entry,
317      Table_Initial        => 100,
318      Table_Increment      => 200,
319      Table_Name           => "Unit");
320
321    --------------
322    -- Switches --
323    --------------
324
325    --  These switches record status information about ali files that
326    --  have been read, for quick reference without searching tables.
327
328    Dynamic_Elaboration_Checks_Specified : Boolean := False;
329    --  Set to False by Initialize_ALI. Set to True if Read_ALI reads
330    --  a unit for which dynamic elaboration checking is enabled.
331
332    Float_Format_Specified : Character := ' ';
333    --  Set to blank by Initialize_ALI. Set to appropriate float format
334    --  character (V or I, see Opt.Float_Format) if an an ali file that
335    --  is read contains an F line setting the floating point format.
336
337    Initialize_Scalars_Used : Boolean := False;
338    --  Set True if an ali file contains the Initialize_Scalars flag
339
340    Locking_Policy_Specified : Character := ' ';
341    --  Set to blank by Initialize_ALI. Set to the appropriate locking policy
342    --  character if an ali file contains a P line setting the locking policy.
343
344    No_Normalize_Scalars_Specified : Boolean := False;
345    --  Set to False by Initialize_ALI. Set to True if an ali file indicates
346    --  that the file was compiled without normalize scalars.
347
348    No_Object_Specified : Boolean := False;
349    --  Set to False by Initialize_ALI. Set to True if an ali file contains
350    --  the No_Object flag.
351
352    Normalize_Scalars_Specified : Boolean := False;
353    --  Set to False by Initialize_ALI. Set to True if an ali file indicates
354    --  that the file was compiled in Normalize_Scalars mode.
355
356    No_Run_Time_Specified : Boolean := False;
357    --  Set to False by Initialize_ALI, Set to True if an ali file indicates
358    --  that the file was compiled in No_Run_Time mode.
359
360    Queuing_Policy_Specified : Character := ' ';
361    --  Set to blank by Initialize_ALI. Set to the appropriate queuing policy
362    --  character if an ali file contains a P line setting the queuing policy.
363
364    Restrictions : Restrictions_String := (others => 'n');
365    --  This array records the cumulative contributions of R lines in all
366    --  ali files. An entry is changed will be set to v if any ali file
367    --  indicates that the restriction is violated, and otherwise will be
368    --  set to r if the restriction is specified by some unit.
369
370    Static_Elaboration_Model_Used : Boolean := False;
371    --  Set to False by Initialize_ALI. Set to True if any ALI file for a
372    --  non-internal unit compiled with the static elaboration model is
373    --  encountered.
374
375    Task_Dispatching_Policy_Specified : Character := ' ';
376    --  Set to blank by Initialize_ALI. Set to the appropriate task dispatching
377    --  policy character if an ali file contains a P line setting the
378    --  task dispatching policy.
379
380    Unreserve_All_Interrupts_Specified : Boolean := False;
381    --  Set to False by Initialize_ALI. Set to True if an ali file is read that
382    --  has  P line specifying unreserve all interrupts mode.
383
384    Zero_Cost_Exceptions_Specified : Boolean := False;
385    --  Set to False by Initialize_ALI. Set to True if an ali file is read that
386    --  has a P line specifying the generation of zero cost exceptions.
387
388    -----------------
389    -- Withs Table --
390    -----------------
391
392    --  Each With line (W line) in an ALI file generates a Withs table entry
393
394    No_With_Id : constant With_Id := With_Id'First;
395    --  Special value indicating no withs table entry
396
397    First_With_Entry : constant With_Id := No_With_Id + 1;
398    --  Id of first actual entry in table
399
400    type With_Record is record
401
402       Uname : Unit_Name_Type;
403       --  Name of Unit
404
405       Sfile : File_Name_Type;
406       --  Name of source file, set to No_File in generic case
407
408       Afile : File_Name_Type;
409       --  Name of ALI file, set to No_File in generic case
410
411       Elaborate : Boolean;
412       --  Indicates presence of E parameter
413
414       Elaborate_All : Boolean;
415       --  Indicates presence of EA parameter
416
417       Elab_All_Desirable : Boolean;
418       --  Indicates presence of ED parameter
419
420    end record;
421
422    package Withs is new Table.Table (
423      Table_Component_Type => With_Record,
424      Table_Index_Type     => With_Id,
425      Table_Low_Bound      => First_With_Entry,
426      Table_Initial        => 5000,
427      Table_Increment      => 200,
428      Table_Name           => "Withs");
429
430    ---------------------
431    -- Arguments Table --
432    ---------------------
433
434    --  Each Arg line (A line) in an ALI file generates an Args table entry
435
436    No_Arg_Id : constant Arg_Id := Arg_Id'First;
437    --  Special value indicating no args table entry
438
439    First_Arg_Entry : constant Arg_Id := No_Arg_Id + 1;
440    --  Id of first actual entry in table
441
442    package Args is new Table.Table (
443      Table_Component_Type => String_Ptr,
444      Table_Index_Type     => Arg_Id,
445      Table_Low_Bound      => First_Arg_Entry,
446      Table_Initial        => 1000,
447      Table_Increment      => 100,
448      Table_Name           => "Args");
449
450    --------------------------
451    -- Linker_Options Table --
452    --------------------------
453
454    --  If an ALI file has one of more Linker_Options lines, then a single
455    --  entry is made in this table. If more than one Linker_Options lines
456    --  appears in a given ALI file, then the arguments are concatenated
457    --  to form the entry in this table, using a NUL character as the
458    --  separator, and a final NUL character is appended to the end.
459
460    type Linker_Option_Record is record
461       Name : Name_Id;
462       --  Name entry containing concatenated list of Linker_Options
463       --  arguments separated by NUL and ended by NUL as described above.
464
465       Unit : Unit_Id;
466       --  Unit_Id for the entry
467
468       Internal_File : Boolean;
469       --  Set True if the linker options are from an internal file. This is
470       --  used to insert certain standard entries after all the user entries
471       --  but before the entries from the run-time.
472
473       Original_Pos : Positive;
474       --  Keep track of original position in the linker options table. This
475       --  is used to implement a stable sort when we sort the linker options
476       --  table.
477    end record;
478
479    --  Declare the Linker_Options Table
480
481    --  The indexes of active entries in this table range from 1 to the
482    --  value of Linker_Options.Last. The zero'th element is for sort call.
483
484    package Linker_Options is new Table.Table (
485      Table_Component_Type => Linker_Option_Record,
486      Table_Index_Type     => Integer,
487      Table_Low_Bound      => 0,
488      Table_Initial        => 200,
489      Table_Increment      => 400,
490      Table_Name           => "Linker_Options");
491
492    -------------------------------------------
493    -- External Version Reference Hash Table --
494    -------------------------------------------
495
496    --  This hash table keeps track of external version reference strings
497    --  as read from E lines in the ali file. The stored values do not
498    --  include the terminating quote characters.
499
500    type Vindex is range 0 .. 98;
501    --  Type to define range of headers
502
503    function SHash (S : String_Ptr) return Vindex;
504    --  Hash function for this table
505
506    function SEq (F1, F2 : String_Ptr) return Boolean;
507    --  Equality function for this table
508
509    package Version_Ref is new Simple_HTable (
510      Header_Num => Vindex,
511      Element    => Boolean,
512      No_Element => False,
513      Key        => String_Ptr,
514      Hash       => SHash,
515      Equal      => SEq);
516
517    ------------------------------------
518    -- Sdep (Source Dependency) Table --
519    ------------------------------------
520
521    --  Each source dependency (D line) in an ALI file generates an
522    --  entry in the Sdep table.
523
524    No_Sdep_Id : constant Sdep_Id := Sdep_Id'First;
525    --  Special value indicating no Sdep table entry
526
527    First_Sdep_Entry : constant Sdep_Id := No_Sdep_Id + 1;
528    --  Id of first actual entry in table
529
530    type Sdep_Record is record
531
532       Sfile : File_Name_Type;
533       --  Name of source file
534
535       Stamp : Time_Stamp_Type;
536       --  Time stamp value. Note that this will be all zero characters
537       --  for the dummy entries for missing or non-dependent files.
538
539       Checksum : Word;
540       --  Checksum value. Note that this will be all zero characters
541       --  for the dummy entries for missing or non-dependent files
542
543       Dummy_Entry : Boolean;
544       --  Set True for dummy entries that correspond to missing files
545       --  or files where no dependency relationship exists.
546
547       Subunit_Name : Name_Id;
548       --  Name_Id for subunit name if present, else No_Name
549
550       Rfile : File_Name_Type;
551       --  Reference file name. Same as Sfile unless a Source_Reference
552       --  pragma was used, in which case it reflects the name used in
553       --  the pragma.
554
555       Start_Line : Nat;
556       --  Starting line number in file. Always 1, unless a Source_Reference
557       --  pragma was used, in which case it reflects the line number value
558       --  given in the pragma.
559
560    end record;
561
562    package Sdep is new Table.Table (
563      Table_Component_Type => Sdep_Record,
564      Table_Index_Type     => Sdep_Id,
565      Table_Low_Bound      => First_Sdep_Entry,
566      Table_Initial        => 5000,
567      Table_Increment      => 200,
568      Table_Name           => "Sdep");
569
570    ----------------------------
571    -- Use of Name Table Info --
572    ----------------------------
573
574    --  All unit names and file names are entered into the Names table. The
575    --  Info fields of these entries are used as follows:
576
577    --    Unit name           Info field has Unit_Id of unit table entry
578    --    ALI file name       Info field has ALI_Id of ALI table entry
579    --    Source file name    Info field has Source_Id of source table entry
580
581    --------------------------
582    -- Cross-Reference Data --
583    --------------------------
584
585    --  The following table records cross-reference sections, there is one
586    --  entry for each X header line in the ALI file for an xref section.
587    --  Note that there will be no entries in this table if the Read_Xref
588    --  parameter to Scan_ALI was set to False.
589
590    type Xref_Section_Record is record
591       File_Num : Sdep_Id;
592       --  Dependency number for file (entry in Sdep.Table)
593
594       File_Name : Name_Id;
595       --  Name of file
596
597       First_Entity : Nat;
598       --  First entry in Xref_Entity table
599
600       Last_Entity : Nat;
601       --  Last entry in Xref_Entity table
602
603    end record;
604
605    package Xref_Section is new Table.Table (
606      Table_Component_Type => Xref_Section_Record,
607      Table_Index_Type     => Nat,
608      Table_Low_Bound      => 1,
609      Table_Initial        => 50,
610      Table_Increment      => 300,
611      Table_Name           => "Xref_Section");
612
613    --  The following is used to indicate whether a typeref field is present
614    --  for the entity, and if so what kind of typeref field.
615
616    type Tref_Kind is (
617      Tref_None,    --  No typeref present
618      Tref_Access,  --  Access type typeref (points to designated type)
619      Tref_Derived, --  Derived type typeref (points to parent type)
620      Tref_Type);   --  All other cases
621
622    --  The following table records entities for which xrefs are recorded
623
624    type Xref_Entity_Record is record
625       Line : Pos;
626       --  Line number of definition
627
628       Etype : Character;
629       --  Set to the identification character for the entity. See section
630       --  "Cross-Reference Entity Identifiers in lib-xref.ads for details.
631
632       Col : Pos;
633       --  Column number of definition
634
635       Lib : Boolean;
636       --  True if entity is library level entity
637
638       Entity : Name_Id;
639       --  Name of entity
640
641       Rref_Line : Nat;
642       --  This field is set to the line number of a renaming reference if
643       --  one is present, or to zero if no renaming reference is present
644
645       Rref_Col : Nat;
646       --  This field is set to the column number of a renaming reference
647       --  if one is present, or to zero if no renaming reference is present.
648
649       Tref : Tref_Kind;
650       --  Indicates if a typeref is present, and if so what kind. Set to
651       --  Tref_None if no typeref field is present.
652
653       Tref_File_Num : Sdep_Id;
654       --  This field is set to No_Sdep_Id if no typeref is present, or
655       --  if the typeref refers to an entity in standard. Otherwise it
656       --  it is the dependency reference for the file containing the
657       --  declaration of the typeref entity.
658
659       Tref_Line : Nat;
660       --  This field is set to zero if no typeref is present, or if the
661       --  typeref refers to an entity in standard. Otherwise it contains
662       --  the line number of the declaration of the typeref entity.
663
664       Tref_Type : Character;
665       --  This field is set to blank if no typeref is present, or if the
666       --  typeref refers to an entity in standard. Otherwise it contains
667       --  the identification character for the typeref entity. See section
668       --  "Cross-Reference Entity Identifiers in lib-xref.ads for details.
669
670       Tref_Col : Nat;
671       --  This field is set to zero if no typeref is present, or if the
672       --  typeref refers to an entity in standard. Otherwise it contains
673       --  the column number of the declaration of the parent type.
674
675       Tref_Standard_Entity : Name_Id;
676       --  This field is set to No_Name if no typeref is present or if the
677       --  typeref refers to a declared entity rather than an entity in
678       --  package Standard. If there is a typeref that references an
679       --  entity in package Standard, then this field is a Name_Id
680       --  reference for the entity name.
681
682       First_Xref : Nat;
683       --  Index into Xref table of first cross-reference
684
685       Last_Xref : Nat;
686       --  Index into Xref table of last cross-reference. The value in
687       --  Last_Xref can be less than the First_Xref value to indicate
688       --  that no entries are present in the Xref Table.
689    end record;
690
691    package Xref_Entity is new Table.Table (
692      Table_Component_Type => Xref_Entity_Record,
693      Table_Index_Type     => Nat,
694      Table_Low_Bound      => 1,
695      Table_Initial        => 500,
696      Table_Increment      => 300,
697      Table_Name           => "Xref_Entity");
698
699    --  The following table records actual cross-references
700
701    type Xref_Record is record
702       File_Num : Sdep_Id;
703       --  Set to the file dependency number for the cross-reference. Note
704       --  that if no file entry is present explicitly, this is just a copy
705       --  of the reference for the current cross-reference section.
706
707       Line : Pos;
708       --  Line number for the reference
709
710       Rtype : Character;
711       --  Indicates type of reference, using code used in ALI file:
712       --    r = reference
713       --    m = modification
714       --    b = body entity
715       --    c = completion of private or incomplete type
716       --    x = type extension
717       --    i = implicit reference
718       --  See description in lib-xref.ads for further details
719
720       Col : Nat;
721       --  Column number for the reference
722
723       --  Note: for instantiation references, Rtype is set to ' ', and Col is
724       --  set to zero. One or more such entries can follow any other reference.
725    end record;
726
727    package Xref is new Table.Table (
728      Table_Component_Type => Xref_Record,
729      Table_Index_Type     => Nat,
730      Table_Low_Bound      => 1,
731      Table_Initial        => 2000,
732      Table_Increment      => 300,
733      Table_Name           => "Xref");
734
735    --------------------------------------
736    -- Subprograms for Reading ALI File --
737    --------------------------------------
738
739    procedure Initialize_ALI;
740    --  Initialize the ALI tables. Also resets all switch values to defaults.
741
742    function Scan_ALI
743      (F         : File_Name_Type;
744       T         : Text_Buffer_Ptr;
745       Ignore_ED : Boolean;
746       Err       : Boolean;
747       Read_Xref : Boolean := False)
748       return      ALI_Id;
749    --  Given the text, T, of an ALI file, F, scan and store the information
750    --  from the file, and return the Id of the resulting entry in the ALI
751    --  table. Switch settings may be modified as described above in the
752    --  switch description settings.
753    --
754    --    Ignore_ED is normally False. If set to True, it indicates that
755    --    all ED (elaboration desirable) indications in the ALI file are
756    --    to be ignored.
757    --
758    --    Err determines the action taken on an incorrectly formatted file.
759    --    If Err is False, then an error message is output, and the program
760    --    is terminated. If Err is True, then no error message is output,
761    --    and No_ALI_Id is returned.
762    --
763    --    Read_XREF is set True to read and acquire the cross-reference
764    --    information, otherwise the scan is terminated when a cross-
765    --    reference line is encountered.
766
767 end ALI;