aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/bindo-writers.ads
blob: db8a1d9a1b131392b3f598e6d251def65bf1a799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT COMPILER COMPONENTS                         --
--                                                                          --
--                        B I N D O . W R I T E R S                         --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--             Copyright (C) 2019-2024, Free Software Foundation, Inc.      --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license.          --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
--                                                                          --
------------------------------------------------------------------------------

--  For full architecture, see unit Bindo.

--  The following unit contains facilities to output the various graphs used in
--  determining the elaboration order, as well as the elaboration order itself
--  to standard output.

with Types; use Types;

with Bindo.Graphs;
use  Bindo.Graphs;
use  Bindo.Graphs.Invocation_Graphs;
use  Bindo.Graphs.Library_Graphs;

package Bindo.Writers is

   -----------------
   -- Indentation --
   -----------------

   --  The following type defines the level of indentation used in various
   --  output routines.

   type Indentation_Level is new Natural;
   No_Indentation : constant Indentation_Level := Indentation_Level'First;

   Nested_Indentation : constant Indentation_Level := 2;
   --  The level of indentation for a nested new line

   Number_Column : constant Indentation_Level := 6;
   --  The level of right justification of numbers

   Step_Column : constant Indentation_Level := 4;
   --  The level of right justification of the elaboration order step

   procedure Indent_By (Indent : Indentation_Level);
   pragma Inline (Indent_By);
   --  Indent the current line by Indent spaces

   procedure Write_Num
     (Val        : Int;
      Val_Indent : Indentation_Level := Number_Column);
   pragma Inline (Write_Num);
   --  Output integer value Val in a right-justified form based on the value of
   --  Val_Col.

   -----------------
   -- ALI_Writers --
   -----------------

   package ALI_Writers is
      procedure Write_ALI_Tables;
      --  Write the contents of the following tables to standard output:
      --
      --    * ALI.Invocation_Constructs
      --    * ALI.Invocation_Relations

   end ALI_Writers;

   -------------------
   -- Cycle_Writers --
   -------------------

   package Cycle_Writers is
      procedure Write_Cycles (G : Library_Graph);
      --  Write all cycles of library graph G to standard output

   end Cycle_Writers;

   ------------------------
   -- Dependency_Writers --
   ------------------------

   package Dependency_Writers is
      procedure Write_Dependencies (G : Library_Graph);
      --  Write all elaboration dependencies of the units represented by
      --  vertices of library graph G.

   end Dependency_Writers;

   -------------------------------
   -- Elaboration_Order_Writers --
   -------------------------------

   package Elaboration_Order_Writers is
      procedure Write_Elaboration_Order (Order : Unit_Id_Table);
      --  Write elaboration order Order to standard output

   end Elaboration_Order_Writers;

   ------------------------------
   -- Invocation_Graph_Writers --
   ------------------------------

   package Invocation_Graph_Writers is
      procedure Write_Invocation_Graph (G : Invocation_Graph);
      --  Write invocation graph G to standard output

   end Invocation_Graph_Writers;

   ---------------------------
   -- Library_Graph_Writers --
   ---------------------------

   package Library_Graph_Writers is
      procedure Write_Library_Graph (G : Library_Graph);
      --  Write library graph G to standard output

   end Library_Graph_Writers;

   -------------------
   -- Phase_Writers --
   -------------------

   package Phase_Writers is
      procedure End_Phase (Phase : Elaboration_Phase);
      pragma Inline (End_Phase);
      --  Write the end message associated with elaboration phase Phase to
      --  standard output.

      procedure Start_Phase (Phase : Elaboration_Phase);
      pragma Inline (Start_Phase);
      --  Write the start message associated with elaboration phase Phase to
      --  standard output.

   end Phase_Writers;

   --------------------------
   -- Unit_Closure_Writers --
   --------------------------

   package Unit_Closure_Writers is
      procedure Write_Unit_Closure (Order : Unit_Id_Table);
      --  Write all sources in the closure of the main unit as enumerated in
      --  elaboration order Order.

   end Unit_Closure_Writers;

end Bindo.Writers;