1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- P R J . P P --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 2001-2008, 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 |
|
|
-- This package is the Project File Pretty Printer
|
27 |
|
|
|
28 |
|
|
-- Used to output a project file from a project file tree.
|
29 |
|
|
-- Used by gnatname to update or create project files.
|
30 |
|
|
-- Also used GPS to display project file trees.
|
31 |
|
|
-- Also be used for debugging tools that create project file trees.
|
32 |
|
|
|
33 |
|
|
with Prj.Tree;
|
34 |
|
|
|
35 |
|
|
package Prj.PP is
|
36 |
|
|
|
37 |
|
|
-- The following access to procedure types are used to redirect output when
|
38 |
|
|
-- calling Pretty_Print.
|
39 |
|
|
|
40 |
|
|
type Write_Char_Ap is access procedure (C : Character);
|
41 |
|
|
|
42 |
|
|
type Write_Eol_Ap is access procedure;
|
43 |
|
|
|
44 |
|
|
type Write_Str_Ap is access procedure (S : String);
|
45 |
|
|
|
46 |
|
|
procedure Pretty_Print
|
47 |
|
|
(Project : Prj.Tree.Project_Node_Id;
|
48 |
|
|
In_Tree : Prj.Tree.Project_Node_Tree_Ref;
|
49 |
|
|
Increment : Positive := 3;
|
50 |
|
|
Eliminate_Empty_Case_Constructions : Boolean := False;
|
51 |
|
|
Minimize_Empty_Lines : Boolean := False;
|
52 |
|
|
W_Char : Write_Char_Ap := null;
|
53 |
|
|
W_Eol : Write_Eol_Ap := null;
|
54 |
|
|
W_Str : Write_Str_Ap := null;
|
55 |
|
|
Backward_Compatibility : Boolean;
|
56 |
|
|
Id : Prj.Project_Id := Prj.No_Project);
|
57 |
|
|
-- Output a project file, using either the default output routines, or the
|
58 |
|
|
-- ones specified by W_Char, W_Eol and W_Str.
|
59 |
|
|
--
|
60 |
|
|
-- Increment is the number of spaces for each indentation level.
|
61 |
|
|
--
|
62 |
|
|
-- W_Char, W_Eol and W_Str can be used to change the default output
|
63 |
|
|
-- procedures. The default values force the output to Standard_Output.
|
64 |
|
|
--
|
65 |
|
|
-- If Eliminate_Empty_Case_Constructions is True, then case constructions
|
66 |
|
|
-- and case items that do not include any declarations will not be output.
|
67 |
|
|
--
|
68 |
|
|
-- If Minimize_Empty_Lines is True, empty lines will be output only after
|
69 |
|
|
-- the last with clause, after the line declaring the project name, after
|
70 |
|
|
-- the last declarative item of the project and before each package
|
71 |
|
|
-- declaration. Otherwise, more empty lines are output.
|
72 |
|
|
--
|
73 |
|
|
-- If Backward_Compatibility is True, then new attributes (Spec,
|
74 |
|
|
-- Spec_Suffix, Body, Body_Suffix) will be replaced by obsolete ones
|
75 |
|
|
-- (Specification, Specification_Suffix, Implementation,
|
76 |
|
|
-- Implementation_Suffix).
|
77 |
|
|
--
|
78 |
|
|
-- Id is used to compute the display name of the project including its
|
79 |
|
|
-- proper casing.
|
80 |
|
|
|
81 |
|
|
private
|
82 |
|
|
|
83 |
|
|
procedure Output_Statistics;
|
84 |
|
|
-- This procedure can be used after one or more calls to Pretty_Print to
|
85 |
|
|
-- display what Project_Node_Kinds have not been exercised by the call(s)
|
86 |
|
|
-- to Pretty_Print. It is used only for testing purposes.
|
87 |
|
|
|
88 |
|
|
end Prj.PP;
|