pretty-print.h (pp_set_line_maximum_length): Make macro.

* pretty-print.h (pp_set_line_maximum_length): Make macro.
	(pp_set_prefix): Likewise.
	(pp_destroy_prefix): Likewise.
	(pp_remaining_character_count_for_line): Likewise.
	(pp_clear_output_area): Likewise.
	(pp_formatted_text): Likewise.
	(pp_last_position_in_text): Likewise.
	(pp_emit_prefix): Likewise.
	(pp_append_text): Likewise.
	(pp_flush): Likewise.
	(pp_format_text): Likewise.
	(pp_format_verbatim): Likewise.
	(pp_tree_identifier): Tidy.
	* pretty-print.c (pp_base_format_text): Rename from pp_format_text.
	(pp_base_format_verbatim): Rename from pp_format_verbatim.
	(pp_base_flush): Rename from pp_flush.
	(pp_base_set_line_maximum_length): Rename from
	pp_set_line_maximum_length.
	(pp_base_clear_output_area): Rename from pp_clear_output_area.
	(pp_base_set_prefix): Rename from pp_set_prefix.
	(pp_base_destroy_prefix): Rename from pp_destroy_prefix.
	(pp_base_emit_prefix): Rename from pp_emit_prefix.
	(pp_base_append_text): Rename from pp_append_text.
	(pp_base_formatted_text): Rename from pp_formatted_text.
	(pp_base_last_position_in_text): Rename from pp_last_position_in_text.
	(pp_base_remaining_character_count_for_line): Rename from
	pp_remaining_character_count_for_line.
	* diagnostic.h (diagnostic_format_decoder): Tidy.
	(diagnostic_flush_buffer): Likewise.
	* c-pretty-print.h: (pp_c_string_literal): Declare.
	(pp_c_real_literal): Likewise.
	(pp_c_integer_literal): Likewise.
	* c-pretty-print.c (pp_c_char): Use pp_string in lieu of
	pp_identifier.
	(pp_c_character_literal): Tidy.
	(pp_c_string_literal): Make public.
	(pp_c_bool_literal): Likewise.
	(pp_c_integer_literal): Likewise.
	(pp_c_real_literal): Likewise.

	* Makefile.in (C_PRETTY_PRINT_H): New variable.
	(c-pretty-print.o): Update dependence.

cp/
	* cxx-pretty-print.h: New file.
	* cxx-pretty-print.c: Likewise.
	* error.c (scratch_pretty_printer): Change type.
	(init_error): Tidy.
	(dump_aggr_type): Likewise.
	(dump_global_iord): Likewise.
	(dump_expr): Likewise.
	(dump_char): Remove.
	* cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define.
	(cxx_initialize_diagnostics): New function.
	* Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o
	(CXX_PRETTY_PRINT_H): New variable.
	(cp/cxx-pretty-print.o): New rule.
	(cp/cp-lang.o): Update dependence.
	(cp/error.o): Likewise.

From-SVN: r70182
This commit is contained in:
Gabriel Dos Reis 2003-08-05 19:23:14 +00:00 committed by Gabriel Dos Reis
parent 90281aecd9
commit e1a4dd13eb
13 changed files with 387 additions and 166 deletions

View File

@ -1,3 +1,48 @@
2003-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
* pretty-print.h (pp_set_line_maximum_length): Make macro.
(pp_set_prefix): Likewise.
(pp_destroy_prefix): Likewise.
(pp_remaining_character_count_for_line): Likewise.
(pp_clear_output_area): Likewise.
(pp_formatted_text): Likewise.
(pp_last_position_in_text): Likewise.
(pp_emit_prefix): Likewise.
(pp_append_text): Likewise.
(pp_flush): Likewise.
(pp_format_text): Likewise.
(pp_format_verbatim): Likewise.
(pp_tree_identifier): Tidy.
* pretty-print.c (pp_base_format_text): Rename from pp_format_text.
(pp_base_format_verbatim): Rename from pp_format_verbatim.
(pp_base_flush): Rename from pp_flush.
(pp_base_set_line_maximum_length): Rename from
pp_set_line_maximum_length.
(pp_base_clear_output_area): Rename from pp_clear_output_area.
(pp_base_set_prefix): Rename from pp_set_prefix.
(pp_base_destroy_prefix): Rename from pp_destroy_prefix.
(pp_base_emit_prefix): Rename from pp_emit_prefix.
(pp_base_append_text): Rename from pp_append_text.
(pp_base_formatted_text): Rename from pp_formatted_text.
(pp_base_last_position_in_text): Rename from pp_last_position_in_text.
(pp_base_remaining_character_count_for_line): Rename from
pp_remaining_character_count_for_line.
* diagnostic.h (diagnostic_format_decoder): Tidy.
(diagnostic_flush_buffer): Likewise.
* c-pretty-print.h: (pp_c_string_literal): Declare.
(pp_c_real_literal): Likewise.
(pp_c_integer_literal): Likewise.
* c-pretty-print.c (pp_c_char): Use pp_string in lieu of
pp_identifier.
(pp_c_character_literal): Tidy.
(pp_c_string_literal): Make public.
(pp_c_bool_literal): Likewise.
(pp_c_integer_literal): Likewise.
(pp_c_real_literal): Likewise.
* Makefile.in (C_PRETTY_PRINT_H): New variable.
(c-pretty-print.o): Update dependence.
2003-08-05 Chris Demetriou <cgd@broadcom.com> 2003-08-05 Chris Demetriou <cgd@broadcom.com>
* config/mips/mips.md (fix_truncdfsi2_macro): Properly restore * config/mips/mips.md (fix_truncdfsi2_macro): Properly restore

View File

@ -658,6 +658,7 @@ PREDICT_H = predict.h predict.def
CPPLIB_H = cpplib.h line-map.h CPPLIB_H = cpplib.h line-map.h
PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H) PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H)
DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H) DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
# sed inserts variable overrides after the following line. # sed inserts variable overrides after the following line.
####target overrides ####target overrides
@ -1326,7 +1327,7 @@ c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \ $(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \
$(DIAGNOSTIC_H) gt-c-common.h langhooks.h varray.h $(RTL_H) \ $(DIAGNOSTIC_H) gt-c-common.h langhooks.h varray.h $(RTL_H) \
$(TARGET_H) $(C_TREE_H) $(TARGET_H) $(C_TREE_H)
c-pretty-print.o : c-pretty-print.c c-pretty-print.h pretty-print.h \ c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
$(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) real.h $(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) real.h
c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \

View File

@ -39,9 +39,6 @@ static void pp_c_char (c_pretty_printer, int);
static void pp_c_character_literal (c_pretty_printer, tree); static void pp_c_character_literal (c_pretty_printer, tree);
static void pp_c_bool_literal (c_pretty_printer, tree); static void pp_c_bool_literal (c_pretty_printer, tree);
static bool pp_c_enumerator (c_pretty_printer, tree); static bool pp_c_enumerator (c_pretty_printer, tree);
static void pp_c_integer_literal (c_pretty_printer, tree);
static void pp_c_real_literal (c_pretty_printer, tree);
static void pp_c_string_literal (c_pretty_printer, tree);
static void pp_c_primary_expression (c_pretty_printer, tree); static void pp_c_primary_expression (c_pretty_printer, tree);
@ -306,34 +303,34 @@ pp_c_char (c_pretty_printer ppi, int c)
switch (c) switch (c)
{ {
case TARGET_NEWLINE: case TARGET_NEWLINE:
pp_identifier (ppi, "\\n"); pp_string (ppi, "\\n");
break; break;
case TARGET_TAB: case TARGET_TAB:
pp_identifier (ppi, "\\t"); pp_string (ppi, "\\t");
break; break;
case TARGET_VT: case TARGET_VT:
pp_identifier (ppi, "\\v"); pp_string (ppi, "\\v");
break; break;
case TARGET_BS: case TARGET_BS:
pp_identifier (ppi, "\\b"); pp_string (ppi, "\\b");
break; break;
case TARGET_CR: case TARGET_CR:
pp_identifier (ppi, "\\r"); pp_string (ppi, "\\r");
break; break;
case TARGET_FF: case TARGET_FF:
pp_identifier (ppi, "\\f"); pp_string (ppi, "\\f");
break; break;
case TARGET_BELL: case TARGET_BELL:
pp_identifier (ppi, "\\a"); pp_string (ppi, "\\a");
break; break;
case '\\': case '\\':
pp_identifier (ppi, "\\\\"); pp_string (ppi, "\\\\");
break; break;
case '\'': case '\'':
pp_identifier (ppi, "\\'"); pp_string (ppi, "\\'");
break; break;
case '\"': case '\"':
pp_identifier (ppi, "\\\""); pp_string (ppi, "\\\"");
break; break;
default: default:
if (ISPRINT (c)) if (ISPRINT (c))
@ -345,7 +342,7 @@ pp_c_char (c_pretty_printer ppi, int c)
} }
/* Print out a STRING literal. */ /* Print out a STRING literal. */
static inline void void
pp_c_string_literal (c_pretty_printer ppi, tree s) pp_c_string_literal (c_pretty_printer ppi, tree s)
{ {
const char *p = TREE_STRING_POINTER (s); const char *p = TREE_STRING_POINTER (s);
@ -361,13 +358,17 @@ pp_c_string_literal (c_pretty_printer ppi, tree s)
static inline void static inline void
pp_c_character_literal (c_pretty_printer ppi, tree c) pp_c_character_literal (c_pretty_printer ppi, tree c)
{ {
tree type = TREE_TYPE (c);
pp_quote (ppi); pp_quote (ppi);
pp_c_char (ppi, tree_low_cst (c, 0)); if (host_integerp (c, TREE_UNSIGNED (type)))
pp_c_char (ppi, tree_low_cst (c, TREE_UNSIGNED (type)));
else
pp_scalar (ppi, "\\x%x", (unsigned) TREE_INT_CST_LOW (c));
pp_quote (ppi); pp_quote (ppi);
} }
/* Print out a BOOLEAN literal. */ /* Print out a BOOLEAN literal. */
static inline void void
pp_c_bool_literal (c_pretty_printer ppi, tree b) pp_c_bool_literal (c_pretty_printer ppi, tree b)
{ {
if (b == boolean_false_node || integer_zerop (b)) if (b == boolean_false_node || integer_zerop (b))
@ -423,7 +424,7 @@ pp_c_enumerator (c_pretty_printer ppi, tree e)
} }
/* Print out an INTEGER constant value. */ /* Print out an INTEGER constant value. */
static void void
pp_c_integer_literal (c_pretty_printer ppi, tree i) pp_c_integer_literal (c_pretty_printer ppi, tree i)
{ {
tree type = TREE_TYPE (i); tree type = TREE_TYPE (i);
@ -449,20 +450,19 @@ pp_c_integer_literal (c_pretty_printer ppi, tree i)
sprintf (pp_buffer (ppi)->digit_buffer, sprintf (pp_buffer (ppi)->digit_buffer,
HOST_WIDE_INT_PRINT_DOUBLE_HEX, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
TREE_INT_CST_HIGH (i), TREE_INT_CST_LOW (i)); TREE_INT_CST_HIGH (i), TREE_INT_CST_LOW (i));
pp_identifier (ppi, pp_buffer (ppi)->digit_buffer); pp_string (ppi, pp_buffer (ppi)->digit_buffer);
} }
} }
} }
} }
/* Print out a REAL value. */ /* Print out a REAL value. */
static inline void void
pp_c_real_literal (c_pretty_printer ppi, tree r) pp_c_real_literal (c_pretty_printer ppi, tree r)
{ {
real_to_decimal (pp_buffer (ppi)->digit_buffer, &TREE_REAL_CST (r), real_to_decimal (pp_buffer (ppi)->digit_buffer, &TREE_REAL_CST (r),
sizeof (pp_buffer (ppi)->digit_buffer), 0, 1); sizeof (pp_buffer (ppi)->digit_buffer), 0, 1);
pp_identifier (ppi, pp_buffer(ppi)->digit_buffer); pp_string (ppi, pp_buffer(ppi)->digit_buffer);
} }

View File

@ -160,5 +160,8 @@ void pp_c_cast_expression (c_pretty_printer, tree);
void pp_c_postfix_expression (c_pretty_printer, tree); void pp_c_postfix_expression (c_pretty_printer, tree);
void pp_c_initializer (c_pretty_printer, tree); void pp_c_initializer (c_pretty_printer, tree);
void pp_c_literal (c_pretty_printer, tree); void pp_c_literal (c_pretty_printer, tree);
void pp_c_string_literal (c_pretty_printer, tree);
void pp_c_real_literal (c_pretty_printer, tree);
void pp_c_integer_literal (c_pretty_printer, tree);
#endif /* GCC_C_PRETTY_PRINTER */ #endif /* GCC_C_PRETTY_PRINTER */

View File

@ -1,3 +1,21 @@
2003-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cxx-pretty-print.h: New file.
* cxx-pretty-print.c: Likewise.
* error.c (scratch_pretty_printer): Change type.
(init_error): Tidy.
(dump_aggr_type): Likewise.
(dump_global_iord): Likewise.
(dump_expr): Likewise.
(dump_char): Remove.
* cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define.
(cxx_initialize_diagnostics): New function.
* Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o
(CXX_PRETTY_PRINT_H): New variable.
(cp/cxx-pretty-print.o): New rule.
(cp/cp-lang.o): Update dependence.
(cp/error.o): Likewise.
2003-08-05 Steven Bosscher <steven@gcc.gnu.org> 2003-08-05 Steven Bosscher <steven@gcc.gnu.org>
* cp-tree.h (struct lang_decl): Don't include c_lang_decl. * cp-tree.h (struct lang_decl): Don't include c_lang_decl.

View File

@ -86,8 +86,8 @@ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \ cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
cp/optimize.o cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o
# Use strict warnings for this front end. # Use strict warnings for this front end.
cp-warn = $(STRICT_WARN) $(WERROR) cp-warn = $(STRICT_WARN) $(WERROR)
@ -231,10 +231,12 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \
$(GGC_H) \ $(GGC_H) \
$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \
c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H) c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H)
cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \ cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
$(LANGHOOKS_DEF_H) c-common.h $(LANGHOOKS_DEF_H) c-common.h $(CXX_PRETTY_PRINT_H) $(DIAGNOSTIC_H)
cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \ output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
@ -266,7 +268,7 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \ cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \
toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h
cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \ cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
flags.h real.h $(LANGHOOKS_DEF_H) flags.h real.h $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H)
cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \
gt-cp-repo.h gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \ cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \
@ -281,3 +283,6 @@ cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h outpu
cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h $(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h
cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
$(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H)

View File

@ -29,6 +29,8 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "langhooks.h" #include "langhooks.h"
#include "langhooks-def.h" #include "langhooks-def.h"
#include "diagnostic.h"
#include "cxx-pretty-print.h"
enum c_language_kind c_language = clk_cxx; enum c_language_kind c_language = clk_cxx;
@ -38,6 +40,7 @@ static bool cxx_warn_unused_global_decl (tree);
static tree cp_expr_size (tree); static tree cp_expr_size (tree);
static size_t cp_tree_size (enum tree_code); static size_t cp_tree_size (enum tree_code);
static bool cp_var_mod_type_p (tree); static bool cp_var_mod_type_p (tree);
static void cxx_initialize_diagnostics (diagnostic_context *);
#undef LANG_HOOKS_NAME #undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C++" #define LANG_HOOKS_NAME "GNU C++"
@ -51,6 +54,8 @@ static bool cp_var_mod_type_p (tree);
#define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything #define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
#undef LANG_HOOKS_INIT_OPTIONS #undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options #define LANG_HOOKS_INIT_OPTIONS c_common_init_options
#undef LANG_HOOKS_INITIALIZE_DIAGNOSTITCS
#define LANG_HOOKS_INITIALIZE_DIAGNOSTITCS cxx_initialize_diagnostics
#undef LANG_HOOKS_HANDLE_OPTION #undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option #define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
#undef LANG_HOOKS_HANDLE_FILENAME #undef LANG_HOOKS_HANDLE_FILENAME
@ -373,3 +378,18 @@ c_reset_state (void)
{ {
sorry ("inter-module optimisations not implemented yet"); sorry ("inter-module optimisations not implemented yet");
} }
/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed
that CONTEXT->printer is an already constructed basic pretty_printer. */
static void
cxx_initialize_diagnostics (diagnostic_context *context)
{
pretty_printer *base = context->printer;
cxx_pretty_printer *pp = xmalloc (sizeof (cxx_pretty_printer));
memcpy (pp_base (pp), base, sizeof (pretty_printer));
pp_cxx_pretty_printer_init (pp);
context->printer = (pretty_printer *) pp;
/* It is safe to free this object because it was previously malloc()'d. */
free (base);
}

157
gcc/cp/cxx-pretty-print.c Normal file
View File

@ -0,0 +1,157 @@
/* Implementation of subroutines for the GNU C++ pretty-printer.
Copyright (C) 2003 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "real.h"
#include "cxx-pretty-print.h"
#include "cp-tree.h"
/* Declarations. */
void
pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_declaration_specifiers (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_type_specifier (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_declarator (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_parameter_declaration (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
/* Statements. */
void
pp_cxx_statement (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
/* Expressions. */
static void
pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_initializer (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_multiplicatice_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_conditional_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
static void
pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
void
pp_cxx_expression (cxx_pretty_printer *pp, tree t)
{
pp_unsupported_tree (pp, t);
}
typedef c_pretty_print_fn pp_fun;
void
pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
{
pp_c_pretty_printer_init (pp_c_base (pp));
pp->c_base.declaration = (pp_fun) pp_cxx_declaration;
pp->c_base.declaration_specifiers = (pp_fun) pp_cxx_declaration_specifiers;
pp->c_base.type_specifier = (pp_fun) pp_cxx_type_specifier;
pp->c_base.declarator = (pp_fun) pp_cxx_declarator;
pp->c_base.direct_declarator = (pp_fun) pp_cxx_direct_declarator;
pp->c_base.parameter_declaration = (pp_fun) pp_cxx_parameter_declaration;
pp->c_base.type_id = (pp_fun) pp_cxx_type_id;
pp->c_base.statement = (pp_fun) pp_cxx_statement;
pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
pp->c_base.unary_expression = (pp_fun) pp_cxx_unary_expression;
pp->c_base.initializer = (pp_fun) pp_cxx_initializer;
pp->c_base.multiplicative_expression = (pp_fun) pp_cxx_multiplicatice_expression;
pp->c_base.conditional_expression = (pp_fun) pp_cxx_conditional_expression;
pp->c_base.assignment_expression = (pp_fun) pp_cxx_assignment_expression;
pp->enclosing_scope = NULL;
}

44
gcc/cp/cxx-pretty-print.h Normal file
View File

@ -0,0 +1,44 @@
/* Interface for the GNU C++ pretty-printer.
Copyright (C) 2003 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GCC_CXX_PRETTY_PRINT_H
#define GCC_CXX_PRETTY_PRINT_H
#include "c-pretty-print.h"
#undef pp_c_base
#define pp_c_base(PP) (&(PP)->c_base)
typedef struct
{
struct c_pretty_print_info c_base;
/* This is the enclosing scope of the entity being pretty-printed. */
tree enclosing_scope;
} cxx_pretty_printer;
void pp_cxx_pretty_printer_init (cxx_pretty_printer *);
void pp_cxx_declaration (cxx_pretty_printer *, tree);
void pp_cxx_statement (cxx_pretty_printer *, tree);
void pp_cxx_expression (cxx_pretty_printer *, tree);
#endif /* GCC_CXX_PRETTY_PRINT_H */

View File

@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */
#include "flags.h" #include "flags.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "langhooks-def.h" #include "langhooks-def.h"
#include "pretty-print.h" #include "cxx-pretty-print.h"
enum pad { none, before, after }; enum pad { none, before, after };
@ -43,7 +43,7 @@ enum pad { none, before, after };
/* The global buffer where we dump everything. It is there only for /* The global buffer where we dump everything. It is there only for
transitional purpose. It is expected, in the near future, to be transitional purpose. It is expected, in the near future, to be
completely removed. */ completely removed. */
static pretty_printer scratch_pretty_printer; static cxx_pretty_printer scratch_pretty_printer;
#define cxx_pp (&scratch_pretty_printer) #define cxx_pp (&scratch_pretty_printer)
# define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T))) # define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T)))
@ -78,7 +78,6 @@ static void dump_function_name (tree, int);
static void dump_expr_list (tree, int); static void dump_expr_list (tree, int);
static void dump_global_iord (tree); static void dump_global_iord (tree);
static enum pad dump_qualifiers (tree, enum pad); static enum pad dump_qualifiers (tree, enum pad);
static void dump_char (int);
static void dump_parameters (tree, int); static void dump_parameters (tree, int);
static void dump_exception_spec (tree, int); static void dump_exception_spec (tree, int);
static const char *class_key_or_enum (tree); static const char *class_key_or_enum (tree);
@ -99,7 +98,7 @@ static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
static void cp_print_error_function (diagnostic_context *, diagnostic_info *); static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
static bool cp_printer (pretty_printer *, text_info *); static bool cp_printer (pretty_printer *, text_info *);
static void pp_non_consecutive_character (pretty_printer *, int); static void pp_non_consecutive_character (cxx_pretty_printer *, int);
static tree locate_error (const char *, va_list); static tree locate_error (const char *, va_list);
static location_t location_of (tree); static location_t location_of (tree);
@ -110,7 +109,8 @@ init_error (void)
diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer; diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = cp_printer; diagnostic_format_decoder (global_dc) = cp_printer;
pp_construct (cxx_pp, NULL, 0); pp_construct (pp_base (cxx_pp), NULL, 0);
pp_cxx_pretty_printer_init (cxx_pp);
} }
/* Dump a scope, if deemed necessary. */ /* Dump a scope, if deemed necessary. */
@ -531,7 +531,7 @@ dump_aggr_type (tree t, int flags)
if (flags & TFF_CLASS_KEY_OR_ENUM) if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_identifier (cxx_pp, "<anonymous>"); pp_identifier (cxx_pp, "<anonymous>");
else else
pp_printf (cxx_pp, "<anonymous %s>", variety); pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
} }
else else
pp_tree_identifier (cxx_pp, name); pp_tree_identifier (cxx_pp, name);
@ -758,7 +758,7 @@ dump_global_iord (tree t)
else else
abort (); abort ();
pp_printf (cxx_pp, "(static %s for %s)", p, input_filename); pp_printf (pp_base (cxx_pp), "(static %s for %s)", p, input_filename);
} }
static void static void
@ -1315,50 +1315,6 @@ dump_template_parms (tree info, int primary, int flags)
pp_template_argument_list_end (cxx_pp); pp_template_argument_list_end (cxx_pp);
} }
static void
dump_char (int c)
{
switch (c)
{
case TARGET_NEWLINE:
pp_string (cxx_pp, "\\n");
break;
case TARGET_TAB:
pp_string (cxx_pp, "\\t");
break;
case TARGET_VT:
pp_string (cxx_pp, "\\v");
break;
case TARGET_BS:
pp_string (cxx_pp, "\\b");
break;
case TARGET_CR:
pp_string (cxx_pp, "\\r");
break;
case TARGET_FF:
pp_string (cxx_pp, "\\f");
break;
case TARGET_BELL:
pp_string (cxx_pp, "\\a");
break;
case '\\':
pp_string (cxx_pp, "\\\\");
break;
case '\'':
pp_string (cxx_pp, "\\'");
break;
case '\"':
pp_string (cxx_pp, "\\\"");
break;
default:
if (ISPRINT (c))
pp_character (cxx_pp, c);
else
pp_scalar (cxx_pp, "\\%03o", (unsigned) c);
break;
}
}
/* Print out a list of initializers (subr of dump_expr) */ /* Print out a list of initializers (subr of dump_expr) */
static void static void
@ -1418,55 +1374,16 @@ dump_expr (tree t, int flags)
pp_left_paren (cxx_pp); pp_left_paren (cxx_pp);
dump_type (type, flags); dump_type (type, flags);
pp_right_paren (cxx_pp); pp_right_paren (cxx_pp);
goto do_int; pp_c_integer_literal (pp_c_base (cxx_pp), t);
} }
} }
else if (type == boolean_type_node) else
{ pp_c_integer_literal (pp_c_base (cxx_pp), t);
if (t == boolean_false_node || integer_zerop (t))
pp_identifier (cxx_pp, "false");
else if (t == boolean_true_node)
pp_identifier (cxx_pp, "true");
}
else if (type == char_type_node)
{
pp_quote (cxx_pp);
if (host_integerp (t, TREE_UNSIGNED (type)))
dump_char (tree_low_cst (t, TREE_UNSIGNED (type)));
else
pp_printf (cxx_pp, "\\x%x",
(unsigned int) TREE_INT_CST_LOW (t));
pp_quote (cxx_pp);
}
else
{
do_int:
if (! host_integerp (t, 0))
{
tree val = t;
if (tree_int_cst_sgn (val) < 0)
{
pp_minus (cxx_pp);
val = build_int_2 (-TREE_INT_CST_LOW (val),
~TREE_INT_CST_HIGH (val)
+ !TREE_INT_CST_LOW (val));
}
sprintf (cxx_pp->buffer->digit_buffer,
HOST_WIDE_INT_PRINT_DOUBLE_HEX,
TREE_INT_CST_HIGH (val), TREE_INT_CST_LOW (val));
pp_string (cxx_pp, cxx_pp->buffer->digit_buffer);
}
else
pp_wide_integer (cxx_pp, TREE_INT_CST_LOW (t));
}
} }
break; break;
case REAL_CST: case REAL_CST:
real_to_decimal (cxx_pp->buffer->digit_buffer, &TREE_REAL_CST (t), pp_c_real_literal (pp_c_base (cxx_pp), t);
sizeof (cxx_pp->buffer->digit_buffer), 0, 1);
pp_string (cxx_pp, cxx_pp->buffer->digit_buffer);
break; break;
case PTRMEM_CST: case PTRMEM_CST:
@ -1477,16 +1394,7 @@ dump_expr (tree t, int flags)
break; break;
case STRING_CST: case STRING_CST:
{ pp_c_string_literal (pp_c_base (cxx_pp), t);
const char *p = TREE_STRING_POINTER (t);
int len = TREE_STRING_LENGTH (t) - 1;
int i;
pp_doublequote (cxx_pp);
for (i = 0; i < len; i++)
dump_char (p[i]);
pp_doublequote (cxx_pp);
}
break; break;
case COMPOUND_EXPR: case COMPOUND_EXPR:
@ -2268,7 +2176,7 @@ void
cxx_print_error_function (diagnostic_context *context, const char *file) cxx_print_error_function (diagnostic_context *context, const char *file)
{ {
lhd_print_error_function (context, file); lhd_print_error_function (context, file);
pp_set_prefix (context->printer, file); pp_base_set_prefix (context->printer, file);
maybe_print_instantiation_context (context); maybe_print_instantiation_context (context);
} }
@ -2279,14 +2187,14 @@ cp_diagnostic_starter (diagnostic_context *context,
diagnostic_report_current_module (context); diagnostic_report_current_module (context);
cp_print_error_function (context, diagnostic); cp_print_error_function (context, diagnostic);
maybe_print_instantiation_context (context); maybe_print_instantiation_context (context);
pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic)); pp_base_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
} }
static void static void
cp_diagnostic_finalizer (diagnostic_context *context, cp_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic ATTRIBUTE_UNUSED) diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
{ {
pp_destroy_prefix (context->printer); pp_base_destroy_prefix (context->printer);
} }
/* Print current function onto BUFFER, in the process of reporting /* Print current function onto BUFFER, in the process of reporting
@ -2302,18 +2210,18 @@ cp_print_error_function (diagnostic_context *context,
? file_name_as_prefix (diagnostic->location.file) ? file_name_as_prefix (diagnostic->location.file)
: NULL; : NULL;
pp_set_prefix (context->printer, new_prefix); pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL) if (current_function_decl == NULL)
pp_string (context->printer, "At global scope:"); pp_base_string (context->printer, "At global scope:");
else else
pp_printf (context->printer, "In %s `%s':", pp_printf (context->printer, "In %s `%s':",
function_category (current_function_decl), function_category (current_function_decl),
cxx_printable_name (current_function_decl, 2)); cxx_printable_name (current_function_decl, 2));
pp_newline (context->printer); pp_base_newline (context->printer);
diagnostic_set_last_function (context); diagnostic_set_last_function (context);
pp_destroy_prefix (context->printer); pp_base_destroy_prefix (context->printer);
context->printer->prefix = old_prefix; context->printer->prefix = old_prefix;
} }
} }
@ -2461,7 +2369,7 @@ cp_printer (pretty_printer *pp, text_info *text)
return false; return false;
} }
pp_string (pp, result); pp_base_string (pp, result);
return true; return true;
#undef next_tree #undef next_tree
#undef next_tcode #undef next_tcode
@ -2470,7 +2378,7 @@ cp_printer (pretty_printer *pp, text_info *text)
} }
static void static void
pp_non_consecutive_character (pretty_printer *pp, int c) pp_non_consecutive_character (cxx_pretty_printer *pp, int c)
{ {
const char *p = pp_last_position_in_text (pp); const char *p = pp_last_position_in_text (pp);

View File

@ -110,7 +110,7 @@ struct diagnostic_context
#define diagnostic_auxiliary_data(DC) (DC)->x_data #define diagnostic_auxiliary_data(DC) (DC)->x_data
/* Same as pp_format_decoder. Works on 'diagnostic_context *'. */ /* Same as pp_format_decoder. Works on 'diagnostic_context *'. */
#define diagnostic_format_decoder(DC) pp_format_decoder ((DC)->printer) #define diagnostic_format_decoder(DC) ((DC)->printer->format_decoder)
/* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */ /* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */
#define diagnostic_prefixing_rule(DC) ((DC)->printer->prefixing_rule) #define diagnostic_prefixing_rule(DC) ((DC)->printer->prefixing_rule)
@ -119,7 +119,7 @@ struct diagnostic_context
Zero means don't wrap lines. */ Zero means don't wrap lines. */
#define diagnostic_line_cutoff(DC) ((DC)->printer->ideal_maximum_length) #define diagnostic_line_cutoff(DC) ((DC)->printer->ideal_maximum_length)
#define diagnostic_flush_buffer(DC) pp_flush ((DC)->printer) #define diagnostic_flush_buffer(DC) pp_base_flush ((DC)->printer)
/* True if the last function in which a diagnostic was reported is /* True if the last function in which a diagnostic was reported is
different from the current one. */ different from the current one. */

View File

@ -181,7 +181,7 @@ pp_append_r (pretty_printer *pp, const char *start, int length)
%*.s: a substring the length of which is specified by an integer. %*.s: a substring the length of which is specified by an integer.
%H: location_t. */ %H: location_t. */
void void
pp_format_text (pretty_printer *pp, text_info *text) pp_base_format_text (pretty_printer *pp, text_info *text)
{ {
for (; *text->format_spec; ++text->format_spec) for (; *text->format_spec; ++text->format_spec)
{ {
@ -320,7 +320,7 @@ pp_format_text (pretty_printer *pp, text_info *text)
/* Helper subroutine of output_verbatim and verbatim. Do the appropriate /* Helper subroutine of output_verbatim and verbatim. Do the appropriate
settings needed by BUFFER for a verbatim formatting. */ settings needed by BUFFER for a verbatim formatting. */
void void
pp_format_verbatim (pretty_printer *pp, text_info *text) pp_base_format_verbatim (pretty_printer *pp, text_info *text)
{ {
diagnostic_prefixing_rule_t rule = pp_prefixing_rule (pp); diagnostic_prefixing_rule_t rule = pp_prefixing_rule (pp);
int line_cutoff = pp_line_cutoff (pp); int line_cutoff = pp_line_cutoff (pp);
@ -337,7 +337,7 @@ pp_format_verbatim (pretty_printer *pp, text_info *text)
/* Flush the content of BUFFER onto the attached stream. */ /* Flush the content of BUFFER onto the attached stream. */
void void
pp_flush (pretty_printer *pp) pp_base_flush (pretty_printer *pp)
{ {
pp_write_text_to_stream (pp); pp_write_text_to_stream (pp);
pp_clear_state (pp); pp_clear_state (pp);
@ -349,7 +349,7 @@ pp_flush (pretty_printer *pp)
output in line-wrapping mode. A LENGTH value 0 suppresses output in line-wrapping mode. A LENGTH value 0 suppresses
line-wrapping. */ line-wrapping. */
void void
pp_set_line_maximum_length (pretty_printer *pp, int length) pp_base_set_line_maximum_length (pretty_printer *pp, int length)
{ {
pp_line_cutoff (pp) = length; pp_line_cutoff (pp) = length;
pp_set_real_maximum_length (pp); pp_set_real_maximum_length (pp);
@ -357,7 +357,7 @@ pp_set_line_maximum_length (pretty_printer *pp, int length)
/* Clear PRETTY-PRINTER output area text info. */ /* Clear PRETTY-PRINTER output area text info. */
void void
pp_clear_output_area (pretty_printer *pp) pp_base_clear_output_area (pretty_printer *pp)
{ {
obstack_free (&pp->buffer->obstack, obstack_base (&pp->buffer->obstack)); obstack_free (&pp->buffer->obstack, obstack_base (&pp->buffer->obstack));
pp->buffer->line_length = 0; pp->buffer->line_length = 0;
@ -365,7 +365,7 @@ pp_clear_output_area (pretty_printer *pp)
/* Set PREFIX for PRETTY-PRINTER. */ /* Set PREFIX for PRETTY-PRINTER. */
void void
pp_set_prefix (pretty_printer *pp, const char *prefix) pp_base_set_prefix (pretty_printer *pp, const char *prefix)
{ {
pp->prefix = prefix; pp->prefix = prefix;
pp_set_real_maximum_length (pp); pp_set_real_maximum_length (pp);
@ -375,7 +375,7 @@ pp_set_prefix (pretty_printer *pp, const char *prefix)
/* Free PRETTY-PRINTER's prefix, a previously malloc()'d string. */ /* Free PRETTY-PRINTER's prefix, a previously malloc()'d string. */
void void
pp_destroy_prefix (pretty_printer *pp) pp_base_destroy_prefix (pretty_printer *pp)
{ {
if (pp->prefix != NULL) if (pp->prefix != NULL)
{ {
@ -386,7 +386,7 @@ pp_destroy_prefix (pretty_printer *pp)
/* Write out PRETTY-PRINTER's prefix. */ /* Write out PRETTY-PRINTER's prefix. */
void void
pp_emit_prefix (pretty_printer *pp) pp_base_emit_prefix (pretty_printer *pp)
{ {
if (pp->prefix != NULL) if (pp->prefix != NULL)
{ {
@ -436,7 +436,7 @@ pp_construct (pretty_printer *pp, const char *prefix, int maximum_length)
whitespace if appropriate. The caller must ensure that it is whitespace if appropriate. The caller must ensure that it is
safe to do so. */ safe to do so. */
void void
pp_append_text (pretty_printer *pp, const char *start, const char *end) pp_base_append_text (pretty_printer *pp, const char *start, const char *end)
{ {
/* Emit prefix and skip whitespace if we're starting a new line. */ /* Emit prefix and skip whitespace if we're starting a new line. */
if (pp->buffer->line_length == 0) if (pp->buffer->line_length == 0)
@ -452,7 +452,7 @@ pp_append_text (pretty_printer *pp, const char *start, const char *end)
/* Finishes constructing a NULL-terminated character string representing /* Finishes constructing a NULL-terminated character string representing
the PRETTY-PRINTED text. */ the PRETTY-PRINTED text. */
const char * const char *
pp_formatted_text (pretty_printer *pp) pp_base_formatted_text (pretty_printer *pp)
{ {
obstack_1grow (&pp->buffer->obstack, '\0'); obstack_1grow (&pp->buffer->obstack, '\0');
return pp_formatted_text_data (pp); return pp_formatted_text_data (pp);
@ -461,7 +461,7 @@ pp_formatted_text (pretty_printer *pp)
/* Return a pointer to the last character emitted in PRETTY-PRINTER's /* Return a pointer to the last character emitted in PRETTY-PRINTER's
output area. A NULL pointer means no character available. */ output area. A NULL pointer means no character available. */
const char * const char *
pp_last_position_in_text (const pretty_printer *pp) pp_base_last_position_in_text (const pretty_printer *pp)
{ {
const char *p = NULL; const char *p = NULL;
struct obstack *text = &pp->buffer->obstack; struct obstack *text = &pp->buffer->obstack;
@ -474,7 +474,7 @@ pp_last_position_in_text (const pretty_printer *pp)
/* Return the amount of characters PRETTY-PRINTER can accept to /* Return the amount of characters PRETTY-PRINTER can accept to
make a full line. Meaningfull only in line-wrapping mode. */ make a full line. Meaningfull only in line-wrapping mode. */
int int
pp_remaining_character_count_for_line (pretty_printer *pp) pp_base_remaining_character_count_for_line (pretty_printer *pp)
{ {
return pp->maximum_length - pp->buffer->line_length; return pp->maximum_length - pp->buffer->line_length;
} }

View File

@ -145,9 +145,29 @@ struct pretty_print_info
bool need_newline; bool need_newline;
}; };
#define pp_set_line_maximum_length(PP, L) \
pp_base_set_line_maximum_length (pp_base (PP), L)
#define pp_set_prefix(PP, P) pp_base_set_prefix (pp_base (PP), P)
#define pp_destroy_prefix(PP) pp_base_destroy_prefix (pp_base (PP))
#define pp_remaining_character_count_for_line(PP) \
pp_base_remaining_character_count_for_line (pp_base (PP))
#define pp_clear_output_area(PP) \
pp_base_clear_output_area (pp_base (PP))
#define pp_formatted_text(PP) pp_base_formatted_text (pp_base (PP))
#define pp_last_position_in_text(PP) \
pp_base_last_position_in_text (pp_base (PP))
#define pp_emit_prefix(PP) pp_base_emit_prefix (pp_base (PP))
#define pp_append_text(PP, B, E) \
pp_base_append_text (pp_base (PP), B, E)
#define pp_flush(PP) pp_base_flush (pp_base (PP))
#define pp_format_text(PP, TI) pp_base_format_text (pp_base (PP), TI)
#define pp_format_verbatim(PP, TI) \
pp_base_format_verbatim (pp_base (PP), TI)
#define pp_character(PP, C) pp_base_character (pp_base (PP), C) #define pp_character(PP, C) pp_base_character (pp_base (PP), C)
#define pp_string(PP, S) pp_base_string (pp_base (PP), S) #define pp_string(PP, S) pp_base_string (pp_base (PP), S)
#define pp_newline(PP) pp_base_newline (pp_base (PP)) #define pp_newline(PP) pp_base_newline (pp_base (PP))
#define pp_space(PP) pp_character (PP, ' ') #define pp_space(PP) pp_character (PP, ' ')
#define pp_left_paren(PP) pp_character (PP, '(') #define pp_left_paren(PP) pp_character (PP, '(')
#define pp_right_paren(PP) pp_character (PP, ')') #define pp_right_paren(PP) pp_character (PP, ')')
@ -202,7 +222,7 @@ struct pretty_print_info
#define pp_identifier(PP, ID) pp_string (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, 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) \
@ -216,20 +236,20 @@ struct pretty_print_info
#define pp_base(PP) (PP) #define pp_base(PP) (PP)
extern void pp_construct (pretty_printer *, const char *, int); extern void pp_construct (pretty_printer *, const char *, int);
extern void pp_set_line_maximum_length (pretty_printer *, int); extern void pp_base_set_line_maximum_length (pretty_printer *, int);
extern void pp_set_prefix (pretty_printer *, const char *); extern void pp_base_set_prefix (pretty_printer *, const char *);
extern void pp_destroy_prefix (pretty_printer *); extern void pp_base_destroy_prefix (pretty_printer *);
extern int pp_remaining_character_count_for_line (pretty_printer *); extern int pp_base_remaining_character_count_for_line (pretty_printer *);
extern void pp_clear_output_area (pretty_printer *); extern void pp_base_clear_output_area (pretty_printer *);
extern const char *pp_formatted_text (pretty_printer *); extern const char *pp_base_formatted_text (pretty_printer *);
extern const char *pp_last_position_in_text (const pretty_printer *); extern const char *pp_base_last_position_in_text (const pretty_printer *);
extern void pp_emit_prefix (pretty_printer *); extern void pp_base_emit_prefix (pretty_printer *);
extern void pp_append_text (pretty_printer *, const char *, const char *); extern void pp_base_append_text (pretty_printer *, const char *, const char *);
extern void pp_printf (pretty_printer *, const char *, ...) ATTRIBUTE_PRINTF_2; extern void pp_printf (pretty_printer *, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void pp_verbatim (pretty_printer *, const char *, ...); extern void pp_verbatim (pretty_printer *, const char *, ...);
extern void pp_flush (pretty_printer *); extern void pp_base_flush (pretty_printer *);
extern void pp_format_text (pretty_printer *, text_info *); extern void pp_base_format_text (pretty_printer *, text_info *);
extern void pp_format_verbatim (pretty_printer *, text_info *); extern void pp_base_format_verbatim (pretty_printer *, text_info *);
extern void pp_base_newline (pretty_printer *); extern void pp_base_newline (pretty_printer *);
extern void pp_base_character (pretty_printer *, int); extern void pp_base_character (pretty_printer *, int);