1285SN/A------------------------------------------------------------------------------ 2461SN/A-- -- 3285SN/A-- GNAT COMPILER COMPONENTS -- 4285SN/A-- -- 5285SN/A-- T R E E P R -- 6285SN/A-- -- 7285SN/A-- S p e c -- 8285SN/A-- -- 9285SN/A-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- 10285SN/A-- -- 11285SN/A-- GNAT is free software; you can redistribute it and/or modify it under -- 12285SN/A-- terms of the GNU General Public License as published by the Free Soft- -- 13285SN/A-- ware Foundation; either version 3, or (at your option) any later ver- -- 14285SN/A-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15285SN/A-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16285SN/A-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 17285SN/A-- for more details. You should have received a copy of the GNU General -- 18285SN/A-- Public License distributed with GNAT; see file COPYING3. If not, go to -- 19285SN/A-- http://www.gnu.org/licenses for a complete copy of the license. -- 20285SN/A-- -- 21285SN/A-- GNAT was originally developed by the GNAT team at New York University. -- 22285SN/A-- Extensive contributions were provided by Ada Core Technologies Inc. -- 23285SN/A-- -- 24285SN/A------------------------------------------------------------------------------ 25285SN/A 26285SN/Awith Types; use Types; 27285SN/Apackage Treepr is 28285SN/A 29285SN/A-- This package provides printing routines for the abstract syntax tree 30521SN/A-- These routines are intended only for debugging use. 31521SN/A 32521SN/A procedure Tree_Dump; 33285SN/A -- This routine is called from the GNAT main program to dump trees as 34285SN/A -- requested by debug options (including tree of Standard if requested). 35285SN/A 36285SN/A procedure Print_Tree_Node (N : Node_Id; Label : String := ""); 37285SN/A -- Prints a single tree node, without printing descendants. The Label 38285SN/A -- string is used to preface each line of the printed output. 39285SN/A 40285SN/A procedure Print_Node_Briefly (N : Node_Id); 41285SN/A -- Terse version of Print_Tree_Node 42285SN/A 43285SN/A procedure Print_Tree_List (L : List_Id); 44285SN/A -- Prints a single node list, without printing the descendants of any 45285SN/A -- of the nodes in the list 46285SN/A 47285SN/A procedure Print_Tree_Elist (E : Elist_Id); 48285SN/A -- Prints a single node list, without printing the descendants of any 49285SN/A -- of the nodes in the list 50285SN/A 51285SN/A procedure Print_Node_Subtree (N : Node_Id); 52285SN/A -- Prints the subtree routed at a specified tree node, including all 53285SN/A -- referenced descendants. 54285SN/A 55285SN/A procedure Print_List_Subtree (L : List_Id); 56 -- Prints the subtree consisting of the given node list and all its 57 -- referenced descendants. 58 59 procedure Print_Elist_Subtree (E : Elist_Id); 60 -- Prints the subtree consisting of the given element list and all its 61 -- referenced descendants. 62 63 -- The following debugging procedures are intended to be called from gdb. 64 -- Note that in several cases there are synonyms which represent historical 65 -- development, and we keep them because some people are used to them! 66 67 function p (N : Union_Id) return Node_Or_Entity_Id; 68 function par (N : Union_Id) return Node_Or_Entity_Id; 69 pragma Export (Ada, p); 70 pragma Export (Ada, par); 71 -- Return parent of a list or node (depending on the value of N). If N 72 -- is neither a list nor a node id, then prints a message to that effect 73 -- and returns Empty. 74 75 procedure pn (N : Union_Id); 76 procedure pp (N : Union_Id); 77 procedure pe (N : Union_Id); 78 pragma Export (Ada, pn); 79 pragma Export (Ada, pp); 80 pragma Export (Ada, pe); 81 -- Print a node, node list, uint, or anything else that falls under 82 -- the definition of Union_Id. Historically this was only for printing 83 -- nodes, hence the name. 84 85 procedure pt (N : Union_Id); 86 procedure ppp (N : Union_Id); 87 pragma Export (Ada, pt); 88 pragma Export (Ada, ppp); 89 -- Same as pn/pp, except prints subtrees. For Nodes, it is exactly the same 90 -- as Print_Node_Subtree. For Elists it is the same as Print_Elist_Subtree. 91 -- For Lists, it is the same as Print_Tree_List. If given anything other 92 -- than a Node, List, or Elist, same effect as pn. 93 94 procedure pl (L : Int); 95 pragma Export (Ada, pl); 96 -- Same as Print_Tree_List, except that you can use e.g. 66 instead of 97 -- -99999966. In other words for the positive case we fill out to 8 digits 98 -- on the left and add a minus sign. This just saves some typing in the 99 -- debugger. 100 101end Treepr; 102