1*0bfacb9bSmrg /* Helper code for graphviz output. 2*0bfacb9bSmrg Copyright (C) 2019-2020 Free Software Foundation, Inc. 3*0bfacb9bSmrg Contributed by David Malcolm <dmalcolm@redhat.com>. 4*0bfacb9bSmrg 5*0bfacb9bSmrg This file is part of GCC. 6*0bfacb9bSmrg 7*0bfacb9bSmrg GCC is free software; you can redistribute it and/or modify it 8*0bfacb9bSmrg under the terms of the GNU General Public License as published by 9*0bfacb9bSmrg the Free Software Foundation; either version 3, or (at your option) 10*0bfacb9bSmrg any later version. 11*0bfacb9bSmrg 12*0bfacb9bSmrg GCC is distributed in the hope that it will be useful, but 13*0bfacb9bSmrg WITHOUT ANY WARRANTY; without even the implied warranty of 14*0bfacb9bSmrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15*0bfacb9bSmrg General Public License for more details. 16*0bfacb9bSmrg 17*0bfacb9bSmrg You should have received a copy of the GNU General Public License 18*0bfacb9bSmrg along with GCC; see the file COPYING3. If not see 19*0bfacb9bSmrg <http://www.gnu.org/licenses/>. */ 20*0bfacb9bSmrg 21*0bfacb9bSmrg #ifndef GCC_GRAPHVIZ_H 22*0bfacb9bSmrg #define GCC_GRAPHVIZ_H 23*0bfacb9bSmrg 24*0bfacb9bSmrg #include "pretty-print.h" /* for ATTRIBUTE_GCC_PPDIAG. */ 25*0bfacb9bSmrg 26*0bfacb9bSmrg /* A class for writing .dot output to a pretty_printer with 27*0bfacb9bSmrg indentation to show nesting. */ 28*0bfacb9bSmrg 29*0bfacb9bSmrg class graphviz_out { 30*0bfacb9bSmrg public: 31*0bfacb9bSmrg graphviz_out (pretty_printer *pp); 32*0bfacb9bSmrg 33*0bfacb9bSmrg void print (const char *fmt, ...) 34*0bfacb9bSmrg ATTRIBUTE_GCC_PPDIAG(2,3); 35*0bfacb9bSmrg void println (const char *fmt, ...) 36*0bfacb9bSmrg ATTRIBUTE_GCC_PPDIAG(2,3); 37*0bfacb9bSmrg indent()38*0bfacb9bSmrg void indent () { m_indent++; } outdent()39*0bfacb9bSmrg void outdent () { m_indent--; } 40*0bfacb9bSmrg 41*0bfacb9bSmrg void write_indent (); 42*0bfacb9bSmrg 43*0bfacb9bSmrg void begin_tr (); 44*0bfacb9bSmrg void end_tr (); 45*0bfacb9bSmrg 46*0bfacb9bSmrg void begin_td (); 47*0bfacb9bSmrg void end_td (); 48*0bfacb9bSmrg 49*0bfacb9bSmrg void begin_trtd (); 50*0bfacb9bSmrg void end_tdtr (); 51*0bfacb9bSmrg get_pp()52*0bfacb9bSmrg pretty_printer *get_pp () const { return m_pp; } 53*0bfacb9bSmrg 54*0bfacb9bSmrg private: 55*0bfacb9bSmrg pretty_printer *m_pp; 56*0bfacb9bSmrg int m_indent; 57*0bfacb9bSmrg }; 58*0bfacb9bSmrg 59*0bfacb9bSmrg #endif /* GCC_GRAPHVIZ_H */ 60