1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S P A R K _ X R E F S --
9 -- Copyright (C) 2011-2016, Free Software Foundation, Inc. --
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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Output
; use Output
;
29 package body SPARK_Xrefs
is
37 -- Dump SPARK cross-reference file table
39 Write_Line
("SPARK Xrefs File Table");
40 Write_Line
("----------------------");
42 for Index
in 1 .. SPARK_File_Table
.Last
loop
44 AFR
: SPARK_File_Record
renames SPARK_File_Table
.Table
(Index
);
48 Write_Int
(Int
(Index
));
49 Write_Str
(". File_Num = ");
50 Write_Int
(Int
(AFR
.File_Num
));
51 Write_Str
(" File_Name = """);
53 if AFR
.File_Name
/= null then
54 Write_Str
(AFR
.File_Name
.all);
58 Write_Str
(" From = ");
59 Write_Int
(Int
(AFR
.From_Scope
));
61 Write_Int
(Int
(AFR
.To_Scope
));
66 -- Dump SPARK cross-reference scope table
69 Write_Line
("SPARK Xrefs Scope Table");
70 Write_Line
("-----------------------");
72 for Index
in 1 .. SPARK_Scope_Table
.Last
loop
74 ASR
: SPARK_Scope_Record
renames SPARK_Scope_Table
.Table
(Index
);
78 Write_Int
(Int
(Index
));
79 Write_Str
(". File_Num = ");
80 Write_Int
(Int
(ASR
.File_Num
));
81 Write_Str
(" Scope_Num = ");
82 Write_Int
(Int
(ASR
.Scope_Num
));
83 Write_Str
(" Scope_Name = """);
85 if ASR
.Scope_Name
/= null then
86 Write_Str
(ASR
.Scope_Name
.all);
90 Write_Str
(" Line = ");
91 Write_Int
(Int
(ASR
.Line
));
92 Write_Str
(" Col = ");
93 Write_Int
(Int
(ASR
.Col
));
94 Write_Str
(" Type = ");
95 Write_Char
(ASR
.Stype
);
96 Write_Str
(" From = ");
97 Write_Int
(Int
(ASR
.From_Xref
));
99 Write_Int
(Int
(ASR
.To_Xref
));
100 Write_Str
(" Scope_Entity = ");
101 Write_Int
(Int
(ASR
.Scope_Entity
));
106 -- Dump SPARK cross-reference table
109 Write_Line
("SPARK Xref Table");
110 Write_Line
("----------------");
112 for Index
in 1 .. SPARK_Xref_Table
.Last
loop
114 AXR
: SPARK_Xref_Record
renames SPARK_Xref_Table
.Table
(Index
);
118 Write_Int
(Int
(Index
));
119 Write_Str
(". Entity_Name = """);
121 if AXR
.Entity_Name
/= null then
122 Write_Str
(AXR
.Entity_Name
.all);
126 Write_Str
(" Entity_Line = ");
127 Write_Int
(Int
(AXR
.Entity_Line
));
128 Write_Str
(" Entity_Col = ");
129 Write_Int
(Int
(AXR
.Entity_Col
));
130 Write_Str
(" File_Num = ");
131 Write_Int
(Int
(AXR
.File_Num
));
132 Write_Str
(" Scope_Num = ");
133 Write_Int
(Int
(AXR
.Scope_Num
));
134 Write_Str
(" Line = ");
135 Write_Int
(Int
(AXR
.Line
));
136 Write_Str
(" Col = ");
137 Write_Int
(Int
(AXR
.Col
));
138 Write_Str
(" Type = ");
139 Write_Char
(AXR
.Rtype
);
149 procedure Initialize_SPARK_Tables
is
151 SPARK_File_Table
.Init
;
152 SPARK_Scope_Table
.Init
;
153 SPARK_Xref_Table
.Init
;
154 end Initialize_SPARK_Tables
;
162 procedure Write_Info_Char
(C
: Character) renames Write_Char
;
163 -- Write one character
165 procedure Write_Info_Str
(Val
: String) renames Write_Str
;
168 function Write_Info_Col
return Positive;
169 -- Return next column for writing
171 procedure Write_Info_Initiate
(Key
: Character) renames Write_Char
;
172 -- Start new one and write one character;
174 procedure Write_Info_Nat
(N
: Nat
);
177 procedure Write_Info_Terminate
renames Write_Eol
;
178 -- Terminate current line
184 function Write_Info_Col
return Positive is
186 return Positive (Column
);
193 procedure Write_Info_Nat
(N
: Nat
) is
198 procedure Debug_Put_SPARK_Xrefs
is new Put_SPARK_Xrefs
;
200 -- Start of processing for pspark
203 Debug_Put_SPARK_Xrefs
;