110d565efSmrg /* Various declarations for language-independent pretty-print subroutines.
2*ec02198aSmrg    Copyright (C) 2002-2020 Free Software Foundation, Inc.
310d565efSmrg    Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
410d565efSmrg 
510d565efSmrg This file is part of GCC.
610d565efSmrg 
710d565efSmrg GCC is free software; you can redistribute it and/or modify it under
810d565efSmrg the terms of the GNU General Public License as published by the Free
910d565efSmrg Software Foundation; either version 3, or (at your option) any later
1010d565efSmrg version.
1110d565efSmrg 
1210d565efSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1310d565efSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
1410d565efSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1510d565efSmrg for more details.
1610d565efSmrg 
1710d565efSmrg You should have received a copy of the GNU General Public License
1810d565efSmrg along with GCC; see the file COPYING3.  If not see
1910d565efSmrg <http://www.gnu.org/licenses/>.  */
2010d565efSmrg 
2110d565efSmrg #ifndef GCC_PRETTY_PRINT_H
2210d565efSmrg #define GCC_PRETTY_PRINT_H
2310d565efSmrg 
2410d565efSmrg #include "obstack.h"
25*ec02198aSmrg #include "diagnostic-url.h"
2610d565efSmrg 
2710d565efSmrg /* Maximum number of format string arguments.  */
2810d565efSmrg #define PP_NL_ARGMAX   30
2910d565efSmrg 
3010d565efSmrg /* The type of a text to be formatted according a format specification
3110d565efSmrg    along with a list of things.  */
3210d565efSmrg struct text_info
3310d565efSmrg {
3410d565efSmrg   const char *format_spec;
3510d565efSmrg   va_list *args_ptr;
3610d565efSmrg   int err_no;  /* for %m */
3710d565efSmrg   void **x_data;
3810d565efSmrg   rich_location *m_richloc;
3910d565efSmrg 
400fc04c29Smrg   void set_location (unsigned int idx, location_t loc,
410fc04c29Smrg 		     enum range_display_kind range_display_kind);
4210d565efSmrg   location_t get_location (unsigned int index_of_location) const;
4310d565efSmrg };
4410d565efSmrg 
4510d565efSmrg /* How often diagnostics are prefixed by their locations:
4610d565efSmrg    o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported;
4710d565efSmrg    o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once;
4810d565efSmrg    o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical
4910d565efSmrg    line is started.  */
5010d565efSmrg enum diagnostic_prefixing_rule_t
5110d565efSmrg {
5210d565efSmrg   DIAGNOSTICS_SHOW_PREFIX_ONCE       = 0x0,
5310d565efSmrg   DIAGNOSTICS_SHOW_PREFIX_NEVER      = 0x1,
5410d565efSmrg   DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2
5510d565efSmrg };
5610d565efSmrg 
5710d565efSmrg /* The chunk_info data structure forms a stack of the results from the
5810d565efSmrg    first phase of formatting (pp_format) which have not yet been
5910d565efSmrg    output (pp_output_formatted_text).  A stack is necessary because
6010d565efSmrg    the diagnostic starter may decide to generate its own output by way
6110d565efSmrg    of the formatter.  */
6210d565efSmrg struct chunk_info
6310d565efSmrg {
6410d565efSmrg   /* Pointer to previous chunk on the stack.  */
6510d565efSmrg   struct chunk_info *prev;
6610d565efSmrg 
6710d565efSmrg   /* Array of chunks to output.  Each chunk is a NUL-terminated string.
6810d565efSmrg      In the first phase of formatting, even-numbered chunks are
6910d565efSmrg      to be output verbatim, odd-numbered chunks are format specifiers.
7010d565efSmrg      The second phase replaces all odd-numbered chunks with formatted
7110d565efSmrg      text, and the third phase simply emits all the chunks in sequence
7210d565efSmrg      with appropriate line-wrapping.  */
7310d565efSmrg   const char *args[PP_NL_ARGMAX * 2];
7410d565efSmrg };
7510d565efSmrg 
7610d565efSmrg /* The output buffer datatype.  This is best seen as an abstract datatype
7710d565efSmrg    whose fields should not be accessed directly by clients.  */
78*ec02198aSmrg class output_buffer
7910d565efSmrg {
80*ec02198aSmrg public:
8110d565efSmrg   output_buffer ();
8210d565efSmrg   ~output_buffer ();
8310d565efSmrg 
8410d565efSmrg   /* Obstack where the text is built up.  */
8510d565efSmrg   struct obstack formatted_obstack;
8610d565efSmrg 
8710d565efSmrg   /* Obstack containing a chunked representation of the format
8810d565efSmrg      specification plus arguments.  */
8910d565efSmrg   struct obstack chunk_obstack;
9010d565efSmrg 
9110d565efSmrg   /* Currently active obstack: one of the above two.  This is used so
9210d565efSmrg      that the text formatters don't need to know which phase we're in.  */
9310d565efSmrg   struct obstack *obstack;
9410d565efSmrg 
9510d565efSmrg   /* Stack of chunk arrays.  These come from the chunk_obstack.  */
9610d565efSmrg   struct chunk_info *cur_chunk_array;
9710d565efSmrg 
9810d565efSmrg   /* Where to output formatted text.  */
9910d565efSmrg   FILE *stream;
10010d565efSmrg 
10110d565efSmrg   /* The amount of characters output so far.  */
10210d565efSmrg   int line_length;
10310d565efSmrg 
10410d565efSmrg   /* This must be large enough to hold any printed integer or
10510d565efSmrg      floating-point value.  */
10610d565efSmrg   char digit_buffer[128];
10710d565efSmrg 
10810d565efSmrg   /* Nonzero means that text should be flushed when
10910d565efSmrg      appropriate. Otherwise, text is buffered until either
11010d565efSmrg      pp_really_flush or pp_clear_output_area are called.  */
11110d565efSmrg   bool flush_p;
11210d565efSmrg };
11310d565efSmrg 
11410d565efSmrg /* Finishes constructing a NULL-terminated character string representing
11510d565efSmrg    the buffered text.  */
11610d565efSmrg static inline const char *
output_buffer_formatted_text(output_buffer * buff)11710d565efSmrg output_buffer_formatted_text (output_buffer *buff)
11810d565efSmrg {
11910d565efSmrg   obstack_1grow (buff->obstack, '\0');
12010d565efSmrg   return (const char *) obstack_base (buff->obstack);
12110d565efSmrg }
12210d565efSmrg 
12310d565efSmrg /* Append to the output buffer a string specified by its
12410d565efSmrg    STARTing character and LENGTH.  */
12510d565efSmrg static inline void
output_buffer_append_r(output_buffer * buff,const char * start,int length)12610d565efSmrg output_buffer_append_r (output_buffer *buff, const char *start, int length)
12710d565efSmrg {
12810d565efSmrg   gcc_checking_assert (start);
12910d565efSmrg   obstack_grow (buff->obstack, start, length);
13010d565efSmrg   for (int i = 0; i < length; i++)
13110d565efSmrg     if (start[i] == '\n')
13210d565efSmrg       buff->line_length = 0;
13310d565efSmrg     else
13410d565efSmrg       buff->line_length++;
13510d565efSmrg }
13610d565efSmrg 
13710d565efSmrg /*  Return a pointer to the last character emitted in the
13810d565efSmrg     output_buffer.  A NULL pointer means no character available.  */
13910d565efSmrg static inline const char *
output_buffer_last_position_in_text(const output_buffer * buff)14010d565efSmrg output_buffer_last_position_in_text (const output_buffer *buff)
14110d565efSmrg {
14210d565efSmrg   const char *p = NULL;
14310d565efSmrg   struct obstack *text = buff->obstack;
14410d565efSmrg 
14510d565efSmrg   if (obstack_base (text) != obstack_next_free (text))
14610d565efSmrg     p = ((const char *) obstack_next_free (text)) - 1;
14710d565efSmrg   return p;
14810d565efSmrg }
14910d565efSmrg 
15010d565efSmrg 
15110d565efSmrg /* The type of pretty-printer flags passed to clients.  */
15210d565efSmrg typedef unsigned int pp_flags;
15310d565efSmrg 
15410d565efSmrg enum pp_padding
15510d565efSmrg {
15610d565efSmrg   pp_none, pp_before, pp_after
15710d565efSmrg };
15810d565efSmrg 
15910d565efSmrg /* Structure for switching in and out of verbatim mode in a convenient
16010d565efSmrg    manner.  */
16110d565efSmrg struct pp_wrapping_mode_t
16210d565efSmrg {
16310d565efSmrg   /* Current prefixing rule.  */
16410d565efSmrg   diagnostic_prefixing_rule_t rule;
16510d565efSmrg 
16610d565efSmrg   /* The ideal upper bound of number of characters per line, as suggested
16710d565efSmrg      by front-end.  */
16810d565efSmrg   int line_cutoff;
16910d565efSmrg };
17010d565efSmrg 
17110d565efSmrg /* Maximum characters per line in automatic line wrapping mode.
17210d565efSmrg    Zero means don't wrap lines.  */
17310d565efSmrg #define pp_line_cutoff(PP)  (PP)->wrapping.line_cutoff
17410d565efSmrg 
17510d565efSmrg /* Prefixing rule used in formatting a diagnostic message.  */
17610d565efSmrg #define pp_prefixing_rule(PP)  (PP)->wrapping.rule
17710d565efSmrg 
17810d565efSmrg /* Get or set the wrapping mode as a single entity.  */
17910d565efSmrg #define pp_wrapping_mode(PP) (PP)->wrapping
18010d565efSmrg 
18110d565efSmrg /* The type of a hook that formats client-specific data onto a pretty_printer.
18210d565efSmrg    A client-supplied formatter returns true if everything goes well,
18310d565efSmrg    otherwise it returns false.  */
18410d565efSmrg typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *,
185c7a68eb7Smrg 			    int, bool, bool, bool, bool *, const char **);
18610d565efSmrg 
18710d565efSmrg /* Client supplied function used to decode formats.  */
18810d565efSmrg #define pp_format_decoder(PP) (PP)->format_decoder
18910d565efSmrg 
190c7a68eb7Smrg /* Base class for an optional client-supplied object for doing additional
191c7a68eb7Smrg    processing between stages 2 and 3 of formatted printing.  */
192c7a68eb7Smrg class format_postprocessor
193c7a68eb7Smrg {
194c7a68eb7Smrg  public:
~format_postprocessor()195c7a68eb7Smrg   virtual ~format_postprocessor () {}
196*ec02198aSmrg   virtual format_postprocessor *clone() const = 0;
197c7a68eb7Smrg   virtual void handle (pretty_printer *) = 0;
198c7a68eb7Smrg };
199c7a68eb7Smrg 
20010d565efSmrg /* TRUE if a newline character needs to be added before further
20110d565efSmrg    formatting.  */
20210d565efSmrg #define pp_needs_newline(PP)  (PP)->need_newline
20310d565efSmrg 
20410d565efSmrg /* True if PRETTY-PRINTER is in line-wrapping mode.  */
20510d565efSmrg #define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
20610d565efSmrg 
20710d565efSmrg /* The amount of whitespace to be emitted when starting a new line.  */
20810d565efSmrg #define pp_indentation(PP) (PP)->indent_skip
20910d565efSmrg 
21010d565efSmrg /* True if identifiers are translated to the locale character set on
21110d565efSmrg    output.  */
21210d565efSmrg #define pp_translate_identifiers(PP) (PP)->translate_identifiers
21310d565efSmrg 
21410d565efSmrg /* True if colors should be shown.  */
21510d565efSmrg #define pp_show_color(PP) (PP)->show_color
21610d565efSmrg 
21710d565efSmrg /* The data structure that contains the bare minimum required to do
21810d565efSmrg    proper pretty-printing.  Clients may derived from this structure
21910d565efSmrg    and add additional fields they need.  */
220*ec02198aSmrg class pretty_printer
22110d565efSmrg {
222*ec02198aSmrg public:
223c7a68eb7Smrg   /* Default construct a pretty printer with specified
224c7a68eb7Smrg      maximum line length cut off limit.  */
225c7a68eb7Smrg   explicit pretty_printer (int = 0);
226*ec02198aSmrg   explicit pretty_printer (const pretty_printer &other);
22710d565efSmrg 
22810d565efSmrg   virtual ~pretty_printer ();
22910d565efSmrg 
230*ec02198aSmrg   virtual pretty_printer *clone () const;
231*ec02198aSmrg 
23210d565efSmrg   /* Where we print external representation of ENTITY.  */
23310d565efSmrg   output_buffer *buffer;
23410d565efSmrg 
235c7a68eb7Smrg   /* The prefix for each new line.  If non-NULL, this is "owned" by the
236c7a68eb7Smrg      pretty_printer, and will eventually be free-ed.  */
237c7a68eb7Smrg   char *prefix;
23810d565efSmrg 
23910d565efSmrg   /* Where to put whitespace around the entity being formatted.  */
24010d565efSmrg   pp_padding padding;
24110d565efSmrg 
24210d565efSmrg   /* The real upper bound of number of characters per line, taking into
24310d565efSmrg      account the case of a very very looong prefix.  */
24410d565efSmrg   int maximum_length;
24510d565efSmrg 
24610d565efSmrg   /* Indentation count.  */
24710d565efSmrg   int indent_skip;
24810d565efSmrg 
24910d565efSmrg   /* Current wrapping mode.  */
25010d565efSmrg   pp_wrapping_mode_t wrapping;
25110d565efSmrg 
25210d565efSmrg   /* If non-NULL, this function formats a TEXT into the BUFFER.  When called,
25310d565efSmrg      TEXT->format_spec points to a format code.  FORMAT_DECODER should call
25410d565efSmrg      pp_string (and related functions) to add data to the BUFFER.
25510d565efSmrg      FORMAT_DECODER can read arguments from *TEXT->args_pts using VA_ARG.
25610d565efSmrg      If the BUFFER needs additional characters from the format string, it
25710d565efSmrg      should advance the TEXT->format_spec as it goes.  When FORMAT_DECODER
25810d565efSmrg      returns, TEXT->format_spec should point to the last character processed.
259c7a68eb7Smrg      The QUOTE and BUFFER_PTR are passed in, to allow for deferring-handling
260c7a68eb7Smrg      of format codes (e.g. %H and %I in the C++ frontend).  */
26110d565efSmrg   printer_fn format_decoder;
26210d565efSmrg 
263c7a68eb7Smrg   /* If non-NULL, this is called by pp_format once after all format codes
264c7a68eb7Smrg      have been processed, to allow for client-specific postprocessing.
265c7a68eb7Smrg      This is used by the C++ frontend for handling the %H and %I
266c7a68eb7Smrg      format codes (which interract with each other).  */
267c7a68eb7Smrg   format_postprocessor *m_format_postprocessor;
268c7a68eb7Smrg 
26910d565efSmrg   /* Nonzero if current PREFIX was emitted at least once.  */
27010d565efSmrg   bool emitted_prefix;
27110d565efSmrg 
27210d565efSmrg   /* Nonzero means one should emit a newline before outputting anything.  */
27310d565efSmrg   bool need_newline;
27410d565efSmrg 
27510d565efSmrg   /* Nonzero means identifiers are translated to the locale character
27610d565efSmrg      set on output.  */
27710d565efSmrg   bool translate_identifiers;
27810d565efSmrg 
27910d565efSmrg   /* Nonzero means that text should be colorized.  */
28010d565efSmrg   bool show_color;
281*ec02198aSmrg 
282*ec02198aSmrg   /* Whether URLs should be emitted, and which terminator to use.  */
283*ec02198aSmrg   diagnostic_url_format url_format;
28410d565efSmrg };
28510d565efSmrg 
28610d565efSmrg static inline const char *
pp_get_prefix(const pretty_printer * pp)28710d565efSmrg pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
28810d565efSmrg 
28910d565efSmrg #define pp_space(PP)            pp_character (PP, ' ')
29010d565efSmrg #define pp_left_paren(PP)       pp_character (PP, '(')
29110d565efSmrg #define pp_right_paren(PP)      pp_character (PP, ')')
29210d565efSmrg #define pp_left_bracket(PP)     pp_character (PP, '[')
29310d565efSmrg #define pp_right_bracket(PP)    pp_character (PP, ']')
29410d565efSmrg #define pp_left_brace(PP)       pp_character (PP, '{')
29510d565efSmrg #define pp_right_brace(PP)      pp_character (PP, '}')
29610d565efSmrg #define pp_semicolon(PP)        pp_character (PP, ';')
29710d565efSmrg #define pp_comma(PP)            pp_character (PP, ',')
29810d565efSmrg #define pp_dot(PP)              pp_character (PP, '.')
29910d565efSmrg #define pp_colon(PP)            pp_character (PP, ':')
30010d565efSmrg #define pp_colon_colon(PP)      pp_string (PP, "::")
30110d565efSmrg #define pp_arrow(PP)            pp_string (PP, "->")
30210d565efSmrg #define pp_equal(PP)            pp_character (PP, '=')
30310d565efSmrg #define pp_question(PP)         pp_character (PP, '?')
30410d565efSmrg #define pp_bar(PP)              pp_character (PP, '|')
30510d565efSmrg #define pp_bar_bar(PP)          pp_string (PP, "||")
30610d565efSmrg #define pp_carret(PP)           pp_character (PP, '^')
30710d565efSmrg #define pp_ampersand(PP)        pp_character (PP, '&')
30810d565efSmrg #define pp_ampersand_ampersand(PP) pp_string (PP, "&&")
30910d565efSmrg #define pp_less(PP)             pp_character (PP, '<')
31010d565efSmrg #define pp_less_equal(PP)       pp_string (PP, "<=")
31110d565efSmrg #define pp_greater(PP)          pp_character (PP, '>')
31210d565efSmrg #define pp_greater_equal(PP)    pp_string (PP, ">=")
31310d565efSmrg #define pp_plus(PP)             pp_character (PP, '+')
31410d565efSmrg #define pp_minus(PP)            pp_character (PP, '-')
31510d565efSmrg #define pp_star(PP)             pp_character (PP, '*')
31610d565efSmrg #define pp_slash(PP)            pp_character (PP, '/')
31710d565efSmrg #define pp_modulo(PP)           pp_character (PP, '%')
31810d565efSmrg #define pp_exclamation(PP)      pp_character (PP, '!')
31910d565efSmrg #define pp_complement(PP)       pp_character (PP, '~')
32010d565efSmrg #define pp_quote(PP)            pp_character (PP, '\'')
32110d565efSmrg #define pp_backquote(PP)        pp_character (PP, '`')
32210d565efSmrg #define pp_doublequote(PP)      pp_character (PP, '"')
32310d565efSmrg #define pp_underscore(PP)       pp_character (PP, '_')
32410d565efSmrg #define pp_maybe_newline_and_indent(PP, N) \
32510d565efSmrg   if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
32610d565efSmrg #define pp_scalar(PP, FORMAT, SCALAR)	                      \
32710d565efSmrg   do					        	      \
32810d565efSmrg     {			         			      \
32910d565efSmrg       sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
33010d565efSmrg       pp_string (PP, pp_buffer (PP)->digit_buffer);           \
33110d565efSmrg     }						              \
33210d565efSmrg   while (0)
33310d565efSmrg #define pp_decimal_int(PP, I)  pp_scalar (PP, "%d", I)
33410d565efSmrg #define pp_unsigned_wide_integer(PP, I) \
33510d565efSmrg    pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
33610d565efSmrg #define pp_wide_int(PP, W, SGN)					\
33710d565efSmrg   do								\
33810d565efSmrg     {								\
33910d565efSmrg       print_dec (W, pp_buffer (PP)->digit_buffer, SGN);		\
34010d565efSmrg       pp_string (PP, pp_buffer (PP)->digit_buffer);		\
34110d565efSmrg     }								\
34210d565efSmrg   while (0)
3430fc04c29Smrg #define pp_double(PP, F)       pp_scalar (PP, "%f", F)
34410d565efSmrg #define pp_pointer(PP, P)      pp_scalar (PP, "%p", P)
34510d565efSmrg 
34610d565efSmrg #define pp_identifier(PP, ID)  pp_string (PP, (pp_translate_identifiers (PP) \
34710d565efSmrg 					  ? identifier_to_locale (ID)	\
34810d565efSmrg 					  : (ID)))
34910d565efSmrg 
35010d565efSmrg 
35110d565efSmrg #define pp_buffer(PP) (PP)->buffer
35210d565efSmrg 
35310d565efSmrg extern void pp_set_line_maximum_length (pretty_printer *, int);
354c7a68eb7Smrg extern void pp_set_prefix (pretty_printer *, char *);
355c7a68eb7Smrg extern char *pp_take_prefix (pretty_printer *);
35610d565efSmrg extern void pp_destroy_prefix (pretty_printer *);
35710d565efSmrg extern int pp_remaining_character_count_for_line (pretty_printer *);
35810d565efSmrg extern void pp_clear_output_area (pretty_printer *);
35910d565efSmrg extern const char *pp_formatted_text (pretty_printer *);
36010d565efSmrg extern const char *pp_last_position_in_text (const pretty_printer *);
36110d565efSmrg extern void pp_emit_prefix (pretty_printer *);
36210d565efSmrg extern void pp_append_text (pretty_printer *, const char *, const char *);
36310d565efSmrg extern void pp_newline_and_flush (pretty_printer *);
36410d565efSmrg extern void pp_newline_and_indent (pretty_printer *, int);
36510d565efSmrg extern void pp_separate_with (pretty_printer *, char);
36610d565efSmrg 
36710d565efSmrg /* If we haven't already defined a front-end-specific diagnostics
36810d565efSmrg    style, use the generic one.  */
36910d565efSmrg #ifdef GCC_DIAG_STYLE
37010d565efSmrg #define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
37110d565efSmrg #else
37210d565efSmrg #define GCC_PPDIAG_STYLE __gcc_diag__
37310d565efSmrg #endif
37410d565efSmrg 
37510d565efSmrg /* This header may be included before diagnostics-core.h, hence the duplicate
37610d565efSmrg    definitions to allow for GCC-specific formats.  */
37710d565efSmrg #if GCC_VERSION >= 3005
37810d565efSmrg #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
37910d565efSmrg #else
38010d565efSmrg #define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
38110d565efSmrg #endif
38210d565efSmrg extern void pp_printf (pretty_printer *, const char *, ...)
38310d565efSmrg      ATTRIBUTE_GCC_PPDIAG(2,3);
38410d565efSmrg 
38510d565efSmrg extern void pp_verbatim (pretty_printer *, const char *, ...)
38610d565efSmrg      ATTRIBUTE_GCC_PPDIAG(2,3);
38710d565efSmrg extern void pp_flush (pretty_printer *);
38810d565efSmrg extern void pp_really_flush (pretty_printer *);
38910d565efSmrg extern void pp_format (pretty_printer *, text_info *);
39010d565efSmrg extern void pp_output_formatted_text (pretty_printer *);
39110d565efSmrg extern void pp_format_verbatim (pretty_printer *, text_info *);
39210d565efSmrg 
39310d565efSmrg extern void pp_indent (pretty_printer *);
39410d565efSmrg extern void pp_newline (pretty_printer *);
39510d565efSmrg extern void pp_character (pretty_printer *, int);
39610d565efSmrg extern void pp_string (pretty_printer *, const char *);
397*ec02198aSmrg 
39810d565efSmrg extern void pp_write_text_to_stream (pretty_printer *);
39910d565efSmrg extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool);
400*ec02198aSmrg extern void pp_write_text_as_html_like_dot_to_stream (pretty_printer *pp);
401*ec02198aSmrg 
40210d565efSmrg extern void pp_maybe_space (pretty_printer *);
40310d565efSmrg 
404c7a68eb7Smrg extern void pp_begin_quote (pretty_printer *, bool);
405c7a68eb7Smrg extern void pp_end_quote (pretty_printer *, bool);
406c7a68eb7Smrg 
407*ec02198aSmrg extern void pp_begin_url (pretty_printer *pp, const char *url);
408*ec02198aSmrg extern void pp_end_url (pretty_printer *pp);
409*ec02198aSmrg 
41010d565efSmrg /* Switch into verbatim mode and return the old mode.  */
41110d565efSmrg static inline pp_wrapping_mode_t
pp_set_verbatim_wrapping_(pretty_printer * pp)41210d565efSmrg pp_set_verbatim_wrapping_ (pretty_printer *pp)
41310d565efSmrg {
41410d565efSmrg   pp_wrapping_mode_t oldmode = pp_wrapping_mode (pp);
41510d565efSmrg   pp_line_cutoff (pp) = 0;
41610d565efSmrg   pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
41710d565efSmrg   return oldmode;
41810d565efSmrg }
41910d565efSmrg #define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (PP)
42010d565efSmrg 
42110d565efSmrg extern const char *identifier_to_locale (const char *);
42210d565efSmrg extern void *(*identifier_to_locale_alloc) (size_t);
42310d565efSmrg extern void (*identifier_to_locale_free) (void *);
42410d565efSmrg 
425c7a68eb7Smrg /* Print I to PP in decimal.  */
426c7a68eb7Smrg 
427c7a68eb7Smrg inline void
pp_wide_integer(pretty_printer * pp,HOST_WIDE_INT i)428c7a68eb7Smrg pp_wide_integer (pretty_printer *pp, HOST_WIDE_INT i)
429c7a68eb7Smrg {
430c7a68eb7Smrg   pp_scalar (pp, HOST_WIDE_INT_PRINT_DEC, i);
431c7a68eb7Smrg }
432c7a68eb7Smrg 
433c7a68eb7Smrg template<unsigned int N, typename T>
434c7a68eb7Smrg void pp_wide_integer (pretty_printer *pp, const poly_int_pod<N, T> &);
435c7a68eb7Smrg 
43610d565efSmrg #endif /* GCC_PRETTY_PRINT_H */
437