1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                        B I N D O . W R I T E R S                         --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--             Copyright (C) 2019, 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 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.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  For full architecture, see unit Bindo.
27
28--  The following unit contains facilities to output the various graphs used in
29--  determining the elaboration order, as well as the elaboration order itself
30--  to standard output.
31
32with Types; use Types;
33
34with Bindo.Graphs;
35use  Bindo.Graphs;
36use  Bindo.Graphs.Invocation_Graphs;
37use  Bindo.Graphs.Library_Graphs;
38
39package Bindo.Writers is
40
41   -----------------
42   -- Indentation --
43   -----------------
44
45   --  The following type defines the level of indentation used in various
46   --  output routines.
47
48   type Indentation_Level is new Natural;
49   No_Indentation : constant Indentation_Level := Indentation_Level'First;
50
51   Nested_Indentation : constant Indentation_Level := 2;
52   --  The level of indentation for a nested new line
53
54   Number_Column : constant Indentation_Level := 6;
55   --  The level of right justification of numbers
56
57   Step_Column : constant Indentation_Level := 4;
58   --  The level of right justification of the elaboration order step
59
60   procedure Indent_By (Indent : Indentation_Level);
61   pragma Inline (Indent_By);
62   --  Indent the current line by Indent spaces
63
64   procedure Write_Num
65     (Val        : Int;
66      Val_Indent : Indentation_Level := Number_Column);
67   pragma Inline (Write_Num);
68   --  Output integer value Val in a right-justified form based on the value of
69   --  Val_Col.
70
71   -----------------
72   -- ALI_Writers --
73   -----------------
74
75   package ALI_Writers is
76      procedure Write_ALI_Tables;
77      --  Write the contents of the following tables to standard output:
78      --
79      --    * ALI.Invocation_Constructs
80      --    * ALI.Invocation_Relations
81
82   end ALI_Writers;
83
84   -------------------
85   -- Cycle_Writers --
86   -------------------
87
88   package Cycle_Writers is
89      procedure Write_Cycles (G : Library_Graph);
90      --  Write all cycles of library graph G to standard output
91
92   end Cycle_Writers;
93
94   ------------------------
95   -- Dependency_Writers --
96   ------------------------
97
98   package Dependency_Writers is
99      procedure Write_Dependencies (G : Library_Graph);
100      --  Write all elaboration dependencies of the units represented by
101      --  vertices of library graph G.
102
103   end Dependency_Writers;
104
105   -------------------------------
106   -- Elaboration_Order_Writers --
107   -------------------------------
108
109   package Elaboration_Order_Writers is
110      procedure Write_Elaboration_Order (Order : Unit_Id_Table);
111      --  Write elaboration order Order to standard output
112
113   end Elaboration_Order_Writers;
114
115   ------------------------------
116   -- Invocation_Graph_Writers --
117   ------------------------------
118
119   package Invocation_Graph_Writers is
120      procedure Write_Invocation_Graph (G : Invocation_Graph);
121      --  Write invocation graph G to standard output
122
123   end Invocation_Graph_Writers;
124
125   ---------------------------
126   -- Library_Graph_Writers --
127   ---------------------------
128
129   package Library_Graph_Writers is
130      procedure Write_Library_Graph (G : Library_Graph);
131      --  Write library graph G to standard output
132
133   end Library_Graph_Writers;
134
135   -------------------
136   -- Phase_Writers --
137   -------------------
138
139   package Phase_Writers is
140      procedure End_Phase (Phase : Elaboration_Phase);
141      pragma Inline (End_Phase);
142      --  Write the end message associated with elaboration phase Phase to
143      --  standard output.
144
145      procedure Start_Phase (Phase : Elaboration_Phase);
146      pragma Inline (Start_Phase);
147      --  Write the start message associated with elaboration phase Phase to
148      --  standard output.
149
150   end Phase_Writers;
151
152   --------------------------
153   -- Unit_Closure_Writers --
154   --------------------------
155
156   package Unit_Closure_Writers is
157      procedure Write_Unit_Closure (Order : Unit_Id_Table);
158      --  Write all sources in the closure of the main unit as enumerated in
159      --  elaboration order Order.
160
161   end Unit_Closure_Writers;
162
163end Bindo.Writers;
164