* pretty-print.h: Define more macros.
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Jul 2002 08:26:45 +0000 (08:26 +0000)
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Jul 2002 08:26:45 +0000 (08:26 +0000)
* diagnostic.h (output_formatted_integer): Moved from...
* diagnostic.c: ... here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55833 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/diagnostic.c
gcc/diagnostic.h
gcc/pretty-print.h

index 16f7018..6130bad 100644 (file)
@@ -1,3 +1,9 @@
+2002-07-29  Gabriel Dos Reis  <gdr@nerim.net>
+
+       * pretty-print.h: Define more macros.
+       * diagnostic.h (output_formatted_integer): Moved from...
+       * diagnostic.c: ... here.
+
 2002-07-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * stormy16.h (ASM_OUTPUT_SYMBOL_REF): Use ASM_OUTPUT_LABEL_REF.
index 89130cc..2343d24 100644 (file)
@@ -37,14 +37,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "langhooks.h"
 #include "langhooks-def.h"
 
-#define output_formatted_integer(BUFFER, FORMAT, INTEGER)      \
-  do                                                           \
-    {                                                          \
-      sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER);       \
-      output_add_string (BUFFER, (BUFFER)->digit_buffer);      \
-    }                                                          \
-  while (0)
-
 #define output_text_length(BUFFER) (BUFFER)->line_length
 #define is_starting_newline(BUFFER) (output_text_length (BUFFER) == 0)
 #define line_wrap_cutoff(BUFFER) (BUFFER)->state.maximum_length
index c4238df..52d749a 100644 (file)
@@ -160,6 +160,14 @@ struct output_buffer
 /* True if BUFFER is in line-wrapping mode.  */
 #define output_is_line_wrapping(BUFFER) (output_line_cutoff (BUFFER) > 0)
 
+#define output_formatted_integer(BUFFER, FORMAT, INTEGER)      \
+  do                                                           \
+    {                                                          \
+      sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER);       \
+      output_add_string (BUFFER, (BUFFER)->digit_buffer);      \
+    }                                                          \
+  while (0)
+
 /*  Forward declarations.  */
 typedef struct diagnostic_context diagnostic_context;
 typedef void (*diagnostic_starter_fn) PARAMS ((diagnostic_context *,
index a4ae280..d0e52de 100644 (file)
@@ -24,44 +24,63 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "diagnostic.h"
 
-typedef struct pretty_print_info pretty_print_info;
-
 /* The type of pretty-printer flags passed to clients.  */
 typedef unsigned int pp_flags;
 
-enum pp_padding
+typedef enum
 {
   pp_none, pp_before, pp_after
-};
+} pp_padding;
 
 struct pretty_print_info
 {
-  /* The entity to pretty-print.  */
-  tree entity;
-  pp_flags flags;
-  /* Where to put whitespace around the entity being formatted.  */
-  enum pp_padding padding;
   /* Where we print external representation of ENTITY.  */
   output_buffer *buffer;
+  pp_flags flags;
+  /* Where to put whitespace around the entity being formatted.  */
+  pp_padding padding;
 };
 
+#define pp_left_paren(PPI)      output_add_character (pp_buffer (PPI), '(')
+#define pp_right_paren(PPI)     output_add_character (pp_buffer (PPI), ')')
+#define pp_left_bracket(PPI)    output_add_character (pp_buffer (PPI), '[')
+#define pp_right_bracket(PPI)   output_add_character (pp_buffer (PPI), ']')
+#define pp_left_brace(PPI)      output_add_character (pp_buffer (PPI), '{')
+#define pp_right_brace(PPI)     output_add_character (pp_buffer (PPI), '}')
+#define pp_semicolon(PPI)       output_add_character (pp_buffer (PPI), ';')
+#define pp_comma(PPI)           output_add_string (pp_buffer (PPI), ", ")
+#define pp_dot(PPI)             output_add_character (pp_buffer (PPI), '.')
+#define pp_colon(PPI)           output_add_character (pp_buffer (PPI), ':')
+#define pp_colon_colon(PPI)     output_add_string (pp_buffer (PPI), "::")
+#define pp_arrow(PPI)           output_add_string (pp_buffer (PPI), "->")
+#define pp_star(PPI)            output_add_character (pp_buffer (PPI), '*')
+#define pp_quote(PPI)           output_add_character (pp_buffer (PPI), '\'')
+#define pp_backquote(PPI)       output_add_character (pp_buffer (PPI), '`')
+#define pp_doublequote(PPI)     output_add_character (pp_buffer (PPI), '"')
+#define pp_newline(PPI)         output_add_newline (pp_buffer (PPI))
+#define pp_character(PPI, C)    output_add_character (pp_buffer (PPI), C)
+#define pp_whitespace(PPI)      output_add_space (pp_buffer (PPI))
+#define pp_indentation(PPI)     output_indentation (pp_buffer (PPI))
+#define pp_newline_and_indent(PPI, N) \
+  do {                                \
+    pp_indentation (PPI) += N;        \
+    pp_newline (PPI);                 \
+  } while (0)
+#define pp_separate_with(PPI, C) \
+   do {                          \
+     pp_character (PPI, C);      \
+     pp_whitespace (PPI);        \
+   } while (0)
+#define pp_format_integer(PPI, F, I) \
+   output_formatted_integer (pp_buffer (PPI), F, I)
+#define pp_wide_integer(PPI, I) \
+   pp_format_integer (PPI, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
 
-#define pp_sorry_for_unsupported_tree(PPI, T) \
-  output_verbatim ((PPI)->buffer, "\nsorry: `%s' not supported by %s\n",\
-                   tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
-
-#define pp_left_paren(PPI)    output_add_character ((PPI)->buffer, '(')
-#define pp_right_paren(PPI)   output_add_character ((PPI)->buffer, ')')
-#define pp_left_bracket(PPI)  output_add_character ((PPI)->buffer, '[')
-#define pp_right_bracket(PPI) output_add_character ((PPI)->buffer, '[')
-#define pp_semi_colon(PPI)    output_add_character ((PPI)->buffer, ';')
-#define pp_comma(PPI)         output_add_string ((PPI)->buffer, ", ")
-#define pp_dot(PPI)           output_add_character ((PPI)->buffer, '.')
-#define pp_colon(PPI)         output_add_character ((PPI)->buffer, ':')
-#define pp_colon_colon(PPI)   output_add_string ((PPI)->buffer, "::")
-#define pp_quote(PPI)         output_add_character ((PPI)->buffer, '\'')
-#define pp_backquote(PPI)     output_add_character ((PPI)->buffer, '`')
-#define pp_doublequote(PPI)   output_add_character ((PPI)->buffer, '"')
+#define pp_identifier(PPI, ID)  output_add_string (pp_buffer (PPI), ID)
+#define pp_tree_identifier(PPI, T) pp_identifier(PPI, IDENTIFIER_POINTER (T))
 
+#define pp_unsupported_tree(PPI, T) \
+  output_verbatim (pp_buffer((PPI), "#`%s' not supported by %s#",\
+                   tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
 
 #endif /* GCC_PRETTY_PRINT_H */