OSDN Git Service

* rtl.h (mem_attrs): Rename decl to expr; adjust all users.
[pf3gnuchains/gcc-fork.git] / gcc / ada / sprint.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                               S P R I N T                                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision: 1.44 $
10 --                                                                          --
11 --          Copyright (C) 1992-1999, Free Software Foundation, Inc.         --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- GNAT was originally developed  by the GNAT team at  New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 --  This package (source print) contains routines for printing the source
30 --  program corresponding to a specified syntax tree. These routines are
31 --  intended for debugging use in the compiler (not as a user level pretty
32 --  print tool). Only information present in the tree is output (e.g. no
33 --  comments are present in the output), and as far as possible we avoid
34 --  making any assumptions about the correctness of the tree, so a bad
35 --  tree may either blow up on a debugging check, or list incorrect source.
36
37 with Types; use Types;
38 package Sprint is
39
40    -----------------------
41    -- Syntax Extensions --
42    -----------------------
43
44    --  When the generated tree is printed, it contains constructs that are not
45    --  pure Ada. For convenience, syntactic extensions to Ada have been defined
46    --  purely for the purposes of this printout (they are not recognized by the
47    --  parser)
48
49    --    Allocator                           new xxx [storage_pool = xxx]
50    --    Cleanup action                      at end procedure name;
51    --    Conditional expression              (if expr then expr else expr)
52    --    Conversion wi Float_Truncate        target^(source)
53    --    Convert wi Conversion_OK            target?(source)
54    --    Convert wi Rounded_Result           target@(source)
55    --    Divide wi Treat_Fixed_As_Integer    x #/ y
56    --    Divide wi Rounded_Result            x @/ y
57    --    Expression with range check         {expression}
58    --    Operator with range check           {operator} (e.g. {+})
59    --    Free statement                      free expr [storage_pool = xxx]
60    --    Freeze entity with freeze actions   freeze entityname [ actions ]
61    --    Interpretation                      interpretation type [, entity]
62    --    Intrinsic calls                     function-name!(arg, arg, arg)
63    --    Itype reference                     reference itype
64    --    Label declaration                   labelname : label
65    --    Mod wi Treat_Fixed_As_Integer       x #mod y
66    --    Multiple concatenation              expr && expr && expr ... && expr
67    --    Multiply wi Treat_Fixed_As_Integer  x #* y
68    --    Multiply wi Rounded_Result          x @* y
69    --    Others choice for cleanup           when all others
70    --    Raise xxx error                     [xxx_error [when condition]]
71    --    Rational literal                    See UR_Write for details
72    --    Rem wi Treat_Fixed_As_Integer       x #rem y
73    --    Reference                           expression'reference
74    --    Shift nodes                         shift_name!(expr, count)
75    --    Subprogram_Info                     subprog'Subprogram_Info
76    --    Unchecked conversion                target_type!(source_expression)
77    --    Unchecked expression                `(expression)
78    --    Validate_Unchecked_Conversion       validate unchecked_conversion
79    --                                                  (src-type, target-typ);
80
81    --  Note: the storage_pool parameters for allocators and the free node
82    --  are omitted if the Storage_Pool field is Empty, indicating use of
83    --  the standard default pool.
84
85    -----------------
86    -- Subprograms --
87    -----------------
88
89    procedure Source_Dump;
90    --  This routine is called from the GNAT main program to dump source as
91    --  requested by debug options. The relevant debug options are:
92    --    -ds  print source from tree, both original and generated code
93    --    -dg  print source from tree, including only the generated code
94    --    -do  print source from tree, including only the original code
95    --    -df  modify the above to include all units, not just the main unit
96    --    -sz  print source from tree for package Standard
97
98    procedure Sprint_Comma_List (List : List_Id);
99    --  Prints the nodes in a list, with separating commas. If the list
100    --  is empty then no output is generated.
101
102    procedure Sprint_Paren_Comma_List (List : List_Id);
103    --  Prints the nodes in a list, surrounded by parentheses, and separated
104    --  by comas. If the list is empty, then no output is generated. A blank
105    --  is output before the initial left parenthesis.
106
107    procedure Sprint_Opt_Paren_Comma_List (List : List_Id);
108    --  Same as normal Sprint_Paren_Comma_List procedure, except that
109    --  an extra blank is output if List is non-empty, and nothing at all is
110    --  printed it the argument is No_List.
111
112    procedure Sprint_Node_List (List : List_Id);
113    --  Prints the nodes in a list with no separating characters. This is used
114    --  in the case of lists of items which are printed on separate lines using
115    --  the current indentation amount. Note that Sprint_Node_List itself
116    --  does not generate any New_Line calls.
117
118    procedure Sprint_Opt_Node_List (List : List_Id);
119    --  Like Sprint_Node_List, but prints nothing if List = No_List.
120
121    procedure Sprint_Indented_List (List : List_Id);
122    --  Like Sprint_Line_List, except that the indentation level is
123    --  increased before outputting the list of items, and then decremented
124    --  (back to its original level) before returning to the caller.
125
126    procedure Sprint_Node (Node : Node_Id);
127    --  Prints a single node. No new lines are output, except as required for
128    --  splitting lines that are too long to fit on a single physical line.
129    --  No output is generated at all if Node is Empty. No trailing or leading
130    --  blank characters are generated.
131
132    procedure Sprint_Opt_Node (Node : Node_Id);
133    --  Same as normal Sprint_Node procedure, except that one leading
134    --  blank is output before the node if it is non-empty.
135
136    procedure PG (Node : Node_Id);
137    --  Print generated source for node N (like -gnatdg output). This is
138    --  intended only for use from gdb for debugging purposes.
139
140    procedure PO (Node : Node_Id);
141    --  Print original source for node N (like -gnatdo output). This is
142    --  intended only for use from gdb for debugging purposes.
143
144    procedure PS (Node : Node_Id);
145    --  Print generated and original source for node N (like -gnatds output).
146    --  This is intended only for use from gdb for debugging purposes.
147
148 end Sprint;