gensupport.c: Include hashtab.h.
[gcc.git] / gcc / pretty-print.h
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>
4
5 This file is part of GCC.
6
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.
11
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.
16
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. */
21
22 #ifndef GCC_PRETTY_PRINT_H
23 #define GCC_PRETTY_PRINT_H
24
25 #include "diagnostic.h"
26
27 /* The type of pretty-printer flags passed to clients. */
28 typedef unsigned int pp_flags;
29
30 typedef enum
31 {
32 pp_none, pp_before, pp_after
33 } pp_padding;
34
35 struct pretty_print_info
36 {
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;
42 };
43
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_star(PPI) output_add_character (pp_buffer (PPI), '*')
57 #define pp_quote(PPI) output_add_character (pp_buffer (PPI), '\'')
58 #define pp_backquote(PPI) output_add_character (pp_buffer (PPI), '`')
59 #define pp_doublequote(PPI) output_add_character (pp_buffer (PPI), '"')
60 #define pp_newline(PPI) output_add_newline (pp_buffer (PPI))
61 #define pp_character(PPI, C) output_add_character (pp_buffer (PPI), C)
62 #define pp_whitespace(PPI) output_add_space (pp_buffer (PPI))
63 #define pp_indentation(PPI) output_indentation (pp_buffer (PPI))
64 #define pp_newline_and_indent(PPI, N) \
65 do { \
66 pp_indentation (PPI) += N; \
67 pp_newline (PPI); \
68 } while (0)
69 #define pp_separate_with(PPI, C) \
70 do { \
71 pp_character (PPI, C); \
72 pp_whitespace (PPI); \
73 } while (0)
74 #define pp_format_integer(PPI, F, I) \
75 output_formatted_integer (pp_buffer (PPI), F, I)
76 #define pp_wide_integer(PPI, I) \
77 pp_format_integer (PPI, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
78
79 #define pp_identifier(PPI, ID) output_add_string (pp_buffer (PPI), ID)
80 #define pp_tree_identifier(PPI, T) pp_identifier(PPI, IDENTIFIER_POINTER (T))
81
82 #define pp_unsupported_tree(PPI, T) \
83 output_verbatim (pp_buffer((PPI), "#`%s' not supported by %s#",\
84 tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
85
86 #endif /* GCC_PRETTY_PRINT_H */