This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[mainline] PATCH to pretty-print.[ch]


This adjusts some macro definitions and does some renamings.

Bootstrapped and tested on an i686-pc-linux-gnu.

-- Gaby
2003-08-03  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* 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.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1135
diff -p -r1.1135 Makefile.in
*** Makefile.in	1 Aug 2003 14:04:00 -0000	1.1135
--- Makefile.in	3 Aug 2003 19:54:28 -0000
*************** stor-layout.o : stor-layout.c $(CONFIG_H
*** 1482,1488 ****
  fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     flags.h real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h
  diagnostic.o : diagnostic.c $(DIAGNOSTIC_H) real.h \
!    $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
     input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H)
  opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
  	coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H) $(GGC_H) $(RTL_H) \
--- 1482,1488 ----
  fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     flags.h real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h
  diagnostic.o : diagnostic.c $(DIAGNOSTIC_H) real.h \
!    $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TM_P_H) flags.h $(GGC_H) \
     input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H)
  opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
  	coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H) $(GGC_H) $(RTL_H) \
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.19
diff -p -r1.19 c-pretty-print.c
*** c-pretty-print.c	25 Jul 2003 09:52:24 -0000	1.19
--- c-pretty-print.c	3 Aug 2003 19:54:28 -0000
*************** static void pp_c_type_id (c_pretty_print
*** 74,81 ****
  static void pp_c_storage_class_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.  */
--- 74,79 ----
*************** pp_c_char (c_pretty_printer ppi, int c)
*** 339,345 ****
        break;
      default:
        if (ISPRINT (c))
! 	pp_character (&ppi->base, c);
        else
  	pp_scalar (ppi, "\\%03o", (unsigned) c);
        break;
--- 337,343 ----
        break;
      default:
        if (ISPRINT (c))
! 	pp_character (ppi, c);
        else
  	pp_scalar (ppi, "\\%03o", (unsigned) c);
        break;
Index: pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.c,v
retrieving revision 2.1
diff -p -r2.1 pretty-print.c
*** pretty-print.c	25 Jul 2003 09:52:25 -0000	2.1
--- pretty-print.c	3 Aug 2003 19:54:28 -0000
*************** pp_verbatim (pretty_printer *pp, const c
*** 515,521 ****
  
  /* Have PRETTY-PRINTER start a new line.  */
  void
! pp_newline (pretty_printer *pp)
  {
    obstack_1grow (&pp->buffer->obstack, '\n');
    pp->buffer->line_length = 0;
--- 515,521 ----
  
  /* Have PRETTY-PRINTER start a new line.  */
  void
! pp_base_newline (pretty_printer *pp)
  {
    obstack_1grow (&pp->buffer->obstack, '\n');
    pp->buffer->line_length = 0;
*************** pp_newline (pretty_printer *pp)
*** 523,529 ****
  
  /* Have PRETTY-PRINTER add a CHARACTER.  */
  void
! pp_character (pretty_printer *pp, int c)
  {
    if (pp_is_wrapping_line (pp)
        && pp_remaining_character_count_for_line (pp) <= 0)
--- 523,529 ----
  
  /* Have PRETTY-PRINTER add a CHARACTER.  */
  void
! pp_base_character (pretty_printer *pp, int c)
  {
    if (pp_is_wrapping_line (pp)
        && pp_remaining_character_count_for_line (pp) <= 0)
*************** pp_character (pretty_printer *pp, int c)
*** 539,545 ****
  /* Append a STRING to the output area of PRETTY-PRINTER; the STRING may
     be line-wrapped if in appropriate mode.  */
  void
! pp_string (pretty_printer *pp, const char *str)
  {
    pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0));
  }
--- 539,545 ----
  /* Append a STRING to the output area of PRETTY-PRINTER; the STRING may
     be line-wrapped if in appropriate mode.  */
  void
! pp_base_string (pretty_printer *pp, const char *str)
  {
    pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0));
  }
Index: pretty-print.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.h,v
retrieving revision 1.6
diff -p -r1.6 pretty-print.h
*** pretty-print.h	25 Jul 2003 09:52:25 -0000	1.6
--- pretty-print.h	3 Aug 2003 19:54:28 -0000
*************** struct pretty_print_info
*** 145,180 ****
    bool need_newline;
  };
  
! #define pp_space(PP)            pp_character (pp_base (PP), ' ')
! #define pp_left_paren(PP)       pp_character (pp_base (PP), '(')
! #define pp_right_paren(PP)      pp_character (pp_base (PP), ')')
! #define pp_left_bracket(PP)     pp_character (pp_base (PP), '[')
! #define pp_right_bracket(PP)    pp_character (pp_base (PP), ']')
! #define pp_left_brace(PP)       pp_character (pp_base (PP), '{')
! #define pp_right_brace(PP)      pp_character (pp_base (PP), '}')
! #define pp_semicolon(PP)        pp_character (pp_base (PP), ';')
! #define pp_comma(PP)            pp_string (pp_base (PP), ", ")
! #define pp_dot(PP)              pp_character (pp_base (PP), '.')
! #define pp_colon(PP)            pp_character (pp_base (PP), ':')
! #define pp_colon_colon(PP)      pp_string (pp_base (PP), "::")
! #define pp_arrow(PP)            pp_string (pp_base (PP), "->")
! #define pp_equal(PP)            pp_character (pp_base (PP), '=')
! #define pp_question(PP)         pp_character (pp_base (PP), '?')
! #define pp_bar(PP)              pp_character (pp_base (PP), '|')
! #define pp_carret(PP)           pp_character (pp_base (PP), '^')
! #define pp_ampersand(PP)        pp_character (pp_base (PP), '&')
! #define pp_less(PP)             pp_character (pp_base (PP), '<')
! #define pp_greater(PP)          pp_character (pp_base (PP), '>')
! #define pp_plus(PP)             pp_character (pp_base (PP), '+')
! #define pp_minus(PP)            pp_character (pp_base (PP), '-')
! #define pp_star(PP)             pp_character (pp_base (PP), '*')
! #define pp_slash(PP)            pp_character (pp_base (PP), '/')
! #define pp_modulo(PP)           pp_character (pp_base (PP), '%')
! #define pp_exclamation(PP)      pp_character (pp_base (PP), '!')
! #define pp_complement(PP)       pp_character (pp_base (PP), '~')
! #define pp_quote(PP)            pp_character (pp_base (PP), '\'')
! #define pp_backquote(PP)        pp_character (pp_base (PP), '`')
! #define pp_doublequote(PP)      pp_character (pp_base (PP), '"')
  #define pp_newline_and_indent(PP, N) \
    do {                               \
      pp_indentation (PP) += N;        \
--- 145,183 ----
    bool need_newline;
  };
  
! #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_newline(PP)          pp_base_newline (pp_base (PP))
! #define pp_space(PP)            pp_character (PP, ' ')
! #define pp_left_paren(PP)       pp_character (PP, '(')
! #define pp_right_paren(PP)      pp_character (PP, ')')
! #define pp_left_bracket(PP)     pp_character (PP, '[')
! #define pp_right_bracket(PP)    pp_character (PP, ']')
! #define pp_left_brace(PP)       pp_character (PP, '{')
! #define pp_right_brace(PP)      pp_character (PP, '}')
! #define pp_semicolon(PP)        pp_character (PP, ';')
! #define pp_comma(PP)            pp_string (PP, ", ")
! #define pp_dot(PP)              pp_character (PP, '.')
! #define pp_colon(PP)            pp_character (PP, ':')
! #define pp_colon_colon(PP)      pp_string (PP, "::")
! #define pp_arrow(PP)            pp_string (PP, "->")
! #define pp_equal(PP)            pp_character (PP, '=')
! #define pp_question(PP)         pp_character (PP, '?')
! #define pp_bar(PP)              pp_character (PP, '|')
! #define pp_carret(PP)           pp_character (PP, '^')
! #define pp_ampersand(PP)        pp_character (PP, '&')
! #define pp_less(PP)             pp_character (PP, '<')
! #define pp_greater(PP)          pp_character (PP, '>')
! #define pp_plus(PP)             pp_character (PP, '+')
! #define pp_minus(PP)            pp_character (PP, '-')
! #define pp_star(PP)             pp_character (PP, '*')
! #define pp_slash(PP)            pp_character (PP, '/')
! #define pp_modulo(PP)           pp_character (PP, '%')
! #define pp_exclamation(PP)      pp_character (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) \
    do {                               \
      pp_indentation (PP) += N;        \
*************** struct pretty_print_info
*** 182,212 ****
    } while (0)
  #define pp_separate_with(PP, C)     \
     do {                             \
!      pp_character (pp_base (PP), C);\
       pp_space (PP);                 \
     } while (0)
! #define pp_scalar(PP, FORMAT, SCALAR)	                            \
!   do								    \
!     {								    \
!       sprintf (pp_base (PP)->buffer->digit_buffer, FORMAT, SCALAR); \
!       pp_string (pp_base (PP), pp_base (PP)->buffer->digit_buffer); \
!     }								    \
    while (0)
  #define pp_decimal_int(PP, I)  pp_scalar (PP, "%d", I)
  #define pp_wide_integer(PP, 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_identifier(PP, ID)  pp_string (pp_base (PP), ID)
  #define pp_tree_identifier(PP, T)                      \
    pp_append_text(pp_base (PP), IDENTIFIER_POINTER (T), \
                   IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
  
! #define pp_unsupported_tree(PP, T) \
!   pp_verbatim (pp_base (PP), "#`%s' not supported by %s#",\
!                    tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
  
  
  /* Clients that directly derive from pretty_printer need to override
     this macro to return a pointer to the base pretty_printer structrure.  */
  #define pp_base(PP) (PP)
--- 185,216 ----
    } while (0)
  #define pp_separate_with(PP, C)     \
     do {                             \
!      pp_character (PP, C);          \
       pp_space (PP);                 \
     } while (0)
! #define pp_scalar(PP, FORMAT, SCALAR)	                      \
!   do					        	      \
!     {			         			      \
!       sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
!       pp_string (PP, pp_buffer (PP)->digit_buffer);           \
!     }						              \
    while (0)
  #define pp_decimal_int(PP, I)  pp_scalar (PP, "%d", I)
  #define pp_wide_integer(PP, 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_identifier(PP, ID)  pp_string (PP, ID)
  #define pp_tree_identifier(PP, T)                      \
    pp_append_text(pp_base (PP), IDENTIFIER_POINTER (T), \
                   IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
  
! #define pp_unsupported_tree(PP, T)                         \
!   pp_verbatim (pp_base (PP), "#`%s' not supported by %s#", \
!                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
     this macro to return a pointer to the base pretty_printer structrure.  */
  #define pp_base(PP) (PP)
*************** extern void pp_flush (pretty_printer *);
*** 227,234 ****
  extern void pp_format_text (pretty_printer *, text_info *);
  extern void pp_format_verbatim (pretty_printer *, text_info *);
  
! extern void pp_newline (pretty_printer *);
! extern void pp_character (pretty_printer *, int);
! extern void pp_string (pretty_printer *, const char *);
  
  #endif /* GCC_PRETTY_PRINT_H */
--- 231,238 ----
  extern void pp_format_text (pretty_printer *, text_info *);
  extern void pp_format_verbatim (pretty_printer *, text_info *);
  
! extern void pp_base_newline (pretty_printer *);
! extern void pp_base_character (pretty_printer *, int);
! extern void pp_base_string (pretty_printer *, const char *);
  
  #endif /* GCC_PRETTY_PRINT_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]