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