index.html: Correct link to libg++ information.
[official-gcc.git] / gcc / pretty-print.h
blob5efb9e73078a10e268afb0aff1e826c55ef15004
1 /* Various declarations for language-independent pretty-print subroutines.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef GCC_PRETTY_PRINT_H
23 #define GCC_PRETTY_PRINT_H
25 #include "diagnostic.h"
27 /* The type of pretty-printer flags passed to clients. */
28 typedef unsigned int pp_flags;
30 typedef enum
32 pp_none, pp_before, pp_after
33 } pp_padding;
35 struct pretty_print_info
37 /* Where we print external representation of ENTITY. */
38 output_buffer *buffer;
39 pp_flags flags;
40 /* Where to put whitespace around the entity being formatted. */
41 pp_padding padding;
44 #define pp_left_paren(PPI) output_add_character (pp_buffer (PPI), '(')
45 #define pp_right_paren(PPI) output_add_character (pp_buffer (PPI), ')')
46 #define pp_left_bracket(PPI) output_add_character (pp_buffer (PPI), '[')
47 #define pp_right_bracket(PPI) output_add_character (pp_buffer (PPI), ']')
48 #define pp_left_brace(PPI) output_add_character (pp_buffer (PPI), '{')
49 #define pp_right_brace(PPI) output_add_character (pp_buffer (PPI), '}')
50 #define pp_semicolon(PPI) output_add_character (pp_buffer (PPI), ';')
51 #define pp_comma(PPI) output_add_string (pp_buffer (PPI), ", ")
52 #define pp_dot(PPI) output_add_character (pp_buffer (PPI), '.')
53 #define pp_colon(PPI) output_add_character (pp_buffer (PPI), ':')
54 #define pp_colon_colon(PPI) output_add_string (pp_buffer (PPI), "::")
55 #define pp_arrow(PPI) output_add_string (pp_buffer (PPI), "->")
56 #define pp_equal(PPI) output_add_character (pp_buffer (PPI), '=')
57 #define pp_question(PPI) output_add_character (pp_buffer (PPI), '?')
58 #define pp_bar(PPI) output_add_character (pp_buffer (PPI), '|')
59 #define pp_carret(PPI) output_add_character (pp_buffer (PPI), '^')
60 #define pp_ampersand(PPI) output_add_character (pp_buffer (PPI), '&')
61 #define pp_less(PPI) output_add_character (pp_buffer (PPI), '<')
62 #define pp_greater(PPI) output_add_character (pp_buffer (PPI), '>')
63 #define pp_plus(PPI) output_add_character (pp_buffer (PPI), '+')
64 #define pp_minus(PPI) output_add_character (pp_buffer (PPI), '-')
65 #define pp_star(PPI) output_add_character (pp_buffer (PPI), '*')
66 #define pp_slash(PPI) output_add_character (pp_buffer (PPI), '/')
67 #define pp_modulo(PPI) output_add_character (pp_buffer (PPI), '%')
68 #define pp_exclamation(PPI) output_add_character (pp_buffer (PPI), '!')
69 #define pp_complement(PPI) output_add_character (pp_buffer (PPI), '~')
70 #define pp_quote(PPI) output_add_character (pp_buffer (PPI), '\'')
71 #define pp_backquote(PPI) output_add_character (pp_buffer (PPI), '`')
72 #define pp_doublequote(PPI) output_add_character (pp_buffer (PPI), '"')
73 #define pp_newline(PPI) output_add_newline (pp_buffer (PPI))
74 #define pp_character(PPI, C) output_add_character (pp_buffer (PPI), C)
75 #define pp_whitespace(PPI) output_add_space (pp_buffer (PPI))
76 #define pp_indentation(PPI) output_indentation (pp_buffer (PPI))
77 #define pp_newline_and_indent(PPI, N) \
78 do { \
79 pp_indentation (PPI) += N; \
80 pp_newline (PPI); \
81 } while (0)
82 #define pp_separate_with(PPI, C) \
83 do { \
84 pp_character (PPI, C); \
85 pp_whitespace (PPI); \
86 } while (0)
87 #define pp_format_scalar(PPI, F, S) \
88 output_formatted_scalar (pp_buffer (PPI), F, S)
89 #define pp_wide_integer(PPI, I) \
90 pp_format_scalar (PPI, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
91 #define pp_pointer(PPI, P) pp_format_scalar (PPI, "%p", p)
93 #define pp_identifier(PPI, ID) output_add_string (pp_buffer (PPI), ID)
94 #define pp_tree_identifier(PPI, T) pp_identifier(PPI, IDENTIFIER_POINTER (T))
96 #define pp_unsupported_tree(PPI, T) \
97 output_verbatim (pp_buffer(PPI), "#`%s' not supported by %s#",\
98 tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
100 #endif /* GCC_PRETTY_PRINT_H */