Commit 8f7ace48 by Gabriel Dos Reis

pretty-print.h: Adjust macro definitions.

	* pretty-print.h:   Adjust macro definitions.
	* pretty-print.c (pp_newline): Rename to pp_base_newline.
	(pp_character): Rename to pp_base_character.
	(pp_string): Rename to pp_base_string.
	* c-pretty-print.c (pp_buffer): Move to pretty-print.h
	(pp_newline):  Likewise.  Adjust.
	(pp_c_char): Adjust.

From-SVN: r70128
parent 3f2fa484
...@@ -74,8 +74,6 @@ static void pp_c_type_id (c_pretty_printer, tree); ...@@ -74,8 +74,6 @@ static void pp_c_type_id (c_pretty_printer, tree);
static void pp_c_storage_class_specifier (c_pretty_printer, tree); static void pp_c_storage_class_specifier (c_pretty_printer, tree);
static void pp_c_function_specifier (c_pretty_printer, tree); static void pp_c_function_specifier (c_pretty_printer, tree);
#define pp_buffer(PP) pp_base (PP)->buffer
#define pp_newline(PP) (pp_newline) (pp_base (PP))
/* Declarations. */ /* Declarations. */
...@@ -339,7 +337,7 @@ pp_c_char (c_pretty_printer ppi, int c) ...@@ -339,7 +337,7 @@ pp_c_char (c_pretty_printer ppi, int c)
break; break;
default: default:
if (ISPRINT (c)) if (ISPRINT (c))
pp_character (&ppi->base, c); pp_character (ppi, c);
else else
pp_scalar (ppi, "\\%03o", (unsigned) c); pp_scalar (ppi, "\\%03o", (unsigned) c);
break; break;
......
...@@ -515,7 +515,7 @@ pp_verbatim (pretty_printer *pp, const char *msg, ...) ...@@ -515,7 +515,7 @@ pp_verbatim (pretty_printer *pp, const char *msg, ...)
/* Have PRETTY-PRINTER start a new line. */ /* Have PRETTY-PRINTER start a new line. */
void void
pp_newline (pretty_printer *pp) pp_base_newline (pretty_printer *pp)
{ {
obstack_1grow (&pp->buffer->obstack, '\n'); obstack_1grow (&pp->buffer->obstack, '\n');
pp->buffer->line_length = 0; pp->buffer->line_length = 0;
...@@ -523,7 +523,7 @@ pp_newline (pretty_printer *pp) ...@@ -523,7 +523,7 @@ pp_newline (pretty_printer *pp)
/* Have PRETTY-PRINTER add a CHARACTER. */ /* Have PRETTY-PRINTER add a CHARACTER. */
void void
pp_character (pretty_printer *pp, int c) pp_base_character (pretty_printer *pp, int c)
{ {
if (pp_is_wrapping_line (pp) if (pp_is_wrapping_line (pp)
&& pp_remaining_character_count_for_line (pp) <= 0) && pp_remaining_character_count_for_line (pp) <= 0)
...@@ -539,7 +539,7 @@ pp_character (pretty_printer *pp, int c) ...@@ -539,7 +539,7 @@ pp_character (pretty_printer *pp, int c)
/* Append a STRING to the output area of PRETTY-PRINTER; the STRING may /* Append a STRING to the output area of PRETTY-PRINTER; the STRING may
be line-wrapped if in appropriate mode. */ be line-wrapped if in appropriate mode. */
void void
pp_string (pretty_printer *pp, const char *str) pp_base_string (pretty_printer *pp, const char *str)
{ {
pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0)); pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0));
} }
......
...@@ -145,36 +145,39 @@ struct pretty_print_info ...@@ -145,36 +145,39 @@ struct pretty_print_info
bool need_newline; bool need_newline;
}; };
#define pp_space(PP) pp_character (pp_base (PP), ' ') #define pp_character(PP, C) pp_base_character (pp_base (PP), C)
#define pp_left_paren(PP) pp_character (pp_base (PP), '(') #define pp_string(PP, S) pp_base_string (pp_base (PP), S)
#define pp_right_paren(PP) pp_character (pp_base (PP), ')') #define pp_newline(PP) pp_base_newline (pp_base (PP))
#define pp_left_bracket(PP) pp_character (pp_base (PP), '[') #define pp_space(PP) pp_character (PP, ' ')
#define pp_right_bracket(PP) pp_character (pp_base (PP), ']') #define pp_left_paren(PP) pp_character (PP, '(')
#define pp_left_brace(PP) pp_character (pp_base (PP), '{') #define pp_right_paren(PP) pp_character (PP, ')')
#define pp_right_brace(PP) pp_character (pp_base (PP), '}') #define pp_left_bracket(PP) pp_character (PP, '[')
#define pp_semicolon(PP) pp_character (pp_base (PP), ';') #define pp_right_bracket(PP) pp_character (PP, ']')
#define pp_comma(PP) pp_string (pp_base (PP), ", ") #define pp_left_brace(PP) pp_character (PP, '{')
#define pp_dot(PP) pp_character (pp_base (PP), '.') #define pp_right_brace(PP) pp_character (PP, '}')
#define pp_colon(PP) pp_character (pp_base (PP), ':') #define pp_semicolon(PP) pp_character (PP, ';')
#define pp_colon_colon(PP) pp_string (pp_base (PP), "::") #define pp_comma(PP) pp_string (PP, ", ")
#define pp_arrow(PP) pp_string (pp_base (PP), "->") #define pp_dot(PP) pp_character (PP, '.')
#define pp_equal(PP) pp_character (pp_base (PP), '=') #define pp_colon(PP) pp_character (PP, ':')
#define pp_question(PP) pp_character (pp_base (PP), '?') #define pp_colon_colon(PP) pp_string (PP, "::")
#define pp_bar(PP) pp_character (pp_base (PP), '|') #define pp_arrow(PP) pp_string (PP, "->")
#define pp_carret(PP) pp_character (pp_base (PP), '^') #define pp_equal(PP) pp_character (PP, '=')
#define pp_ampersand(PP) pp_character (pp_base (PP), '&') #define pp_question(PP) pp_character (PP, '?')
#define pp_less(PP) pp_character (pp_base (PP), '<') #define pp_bar(PP) pp_character (PP, '|')
#define pp_greater(PP) pp_character (pp_base (PP), '>') #define pp_carret(PP) pp_character (PP, '^')
#define pp_plus(PP) pp_character (pp_base (PP), '+') #define pp_ampersand(PP) pp_character (PP, '&')
#define pp_minus(PP) pp_character (pp_base (PP), '-') #define pp_less(PP) pp_character (PP, '<')
#define pp_star(PP) pp_character (pp_base (PP), '*') #define pp_greater(PP) pp_character (PP, '>')
#define pp_slash(PP) pp_character (pp_base (PP), '/') #define pp_plus(PP) pp_character (PP, '+')
#define pp_modulo(PP) pp_character (pp_base (PP), '%') #define pp_minus(PP) pp_character (PP, '-')
#define pp_exclamation(PP) pp_character (pp_base (PP), '!') #define pp_star(PP) pp_character (PP, '*')
#define pp_complement(PP) pp_character (pp_base (PP), '~') #define pp_slash(PP) pp_character (PP, '/')
#define pp_quote(PP) pp_character (pp_base (PP), '\'') #define pp_modulo(PP) pp_character (PP, '%')
#define pp_backquote(PP) pp_character (pp_base (PP), '`') #define pp_exclamation(PP) pp_character (PP, '!')
#define pp_doublequote(PP) pp_character (pp_base (PP), '"') #define pp_complement(PP) pp_character (PP, '~')
#define pp_quote(PP) pp_character (PP, '\'')
#define pp_backquote(PP) pp_character (PP, '`')
#define pp_doublequote(PP) pp_character (PP, '"')
#define pp_newline_and_indent(PP, N) \ #define pp_newline_and_indent(PP, N) \
do { \ do { \
pp_indentation (PP) += N; \ pp_indentation (PP) += N; \
...@@ -182,14 +185,14 @@ struct pretty_print_info ...@@ -182,14 +185,14 @@ struct pretty_print_info
} while (0) } while (0)
#define pp_separate_with(PP, C) \ #define pp_separate_with(PP, C) \
do { \ do { \
pp_character (pp_base (PP), C);\ pp_character (PP, C); \
pp_space (PP); \ pp_space (PP); \
} while (0) } while (0)
#define pp_scalar(PP, FORMAT, SCALAR) \ #define pp_scalar(PP, FORMAT, SCALAR) \
do \ do \
{ \ { \
sprintf (pp_base (PP)->buffer->digit_buffer, FORMAT, SCALAR); \ sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
pp_string (pp_base (PP), pp_base (PP)->buffer->digit_buffer); \ pp_string (PP, pp_buffer (PP)->digit_buffer); \
} \ } \
while (0) while (0)
#define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I) #define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I)
...@@ -197,16 +200,17 @@ struct pretty_print_info ...@@ -197,16 +200,17 @@ struct pretty_print_info
pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
#define pp_pointer(PP, P) pp_scalar (PP, "%p", P) #define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
#define pp_identifier(PP, ID) pp_string (pp_base (PP), ID) #define pp_identifier(PP, ID) pp_string (PP, ID)
#define pp_tree_identifier(PP, T) \ #define pp_tree_identifier(PP, T) \
pp_append_text(pp_base (PP), IDENTIFIER_POINTER (T), \ pp_append_text(pp_base (PP), IDENTIFIER_POINTER (T), \
IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T)) IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
#define pp_unsupported_tree(PP, T) \ #define pp_unsupported_tree(PP, T) \
pp_verbatim (pp_base (PP), "#`%s' not supported by %s#",\ pp_verbatim (pp_base (PP), "#`%s' not supported by %s#", \
tree_code_name[(int) TREE_CODE (T)], __FUNCTION__) tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
#define pp_buffer(PP) pp_base (PP)->buffer
/* Clients that directly derive from pretty_printer need to override /* Clients that directly derive from pretty_printer need to override
this macro to return a pointer to the base pretty_printer structrure. */ this macro to return a pointer to the base pretty_printer structrure. */
#define pp_base(PP) (PP) #define pp_base(PP) (PP)
...@@ -227,8 +231,8 @@ extern void pp_flush (pretty_printer *); ...@@ -227,8 +231,8 @@ extern void pp_flush (pretty_printer *);
extern void pp_format_text (pretty_printer *, text_info *); extern void pp_format_text (pretty_printer *, text_info *);
extern void pp_format_verbatim (pretty_printer *, text_info *); extern void pp_format_verbatim (pretty_printer *, text_info *);
extern void pp_newline (pretty_printer *); extern void pp_base_newline (pretty_printer *);
extern void pp_character (pretty_printer *, int); extern void pp_base_character (pretty_printer *, int);
extern void pp_string (pretty_printer *, const char *); extern void pp_base_string (pretty_printer *, const char *);
#endif /* GCC_PRETTY_PRINT_H */ #endif /* GCC_PRETTY_PRINT_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment