comparison gcc/pretty-print.h @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
69 const char *args[PP_NL_ARGMAX * 2]; 69 const char *args[PP_NL_ARGMAX * 2];
70 }; 70 };
71 71
72 /* The output buffer datatype. This is best seen as an abstract datatype 72 /* The output buffer datatype. This is best seen as an abstract datatype
73 whose fields should not be accessed directly by clients. */ 73 whose fields should not be accessed directly by clients. */
74 typedef struct 74 typedef struct
75 { 75 {
76 /* Obstack where the text is built up. */ 76 /* Obstack where the text is built up. */
77 struct obstack formatted_obstack; 77 struct obstack formatted_obstack;
78 78
79 /* Obstack containing a chunked representation of the format 79 /* Obstack containing a chunked representation of the format
80 specification plus arguments. */ 80 specification plus arguments. */
81 struct obstack chunk_obstack; 81 struct obstack chunk_obstack;
88 struct chunk_info *cur_chunk_array; 88 struct chunk_info *cur_chunk_array;
89 89
90 /* Where to output formatted text. */ 90 /* Where to output formatted text. */
91 FILE *stream; 91 FILE *stream;
92 92
93 /* The amount of characters output so far. */ 93 /* The amount of characters output so far. */
94 int line_length; 94 int line_length;
95 95
96 /* This must be large enough to hold any printed integer or 96 /* This must be large enough to hold any printed integer or
97 floating-point value. */ 97 floating-point value. */
98 char digit_buffer[128]; 98 char digit_buffer[128];
112 { 112 {
113 /* Current prefixing rule. */ 113 /* Current prefixing rule. */
114 diagnostic_prefixing_rule_t rule; 114 diagnostic_prefixing_rule_t rule;
115 115
116 /* The ideal upper bound of number of characters per line, as suggested 116 /* The ideal upper bound of number of characters per line, as suggested
117 by front-end. */ 117 by front-end. */
118 int line_cutoff; 118 int line_cutoff;
119 } pp_wrapping_mode_t; 119 } pp_wrapping_mode_t;
120 120
121 /* Maximum characters per line in automatic line wrapping mode. 121 /* Maximum characters per line in automatic line wrapping mode.
122 Zero means don't wrap lines. */ 122 Zero means don't wrap lines. */
138 /* Client supplied function used to decode formats. */ 138 /* Client supplied function used to decode formats. */
139 #define pp_format_decoder(PP) pp_base (PP)->format_decoder 139 #define pp_format_decoder(PP) pp_base (PP)->format_decoder
140 140
141 /* TRUE if a newline character needs to be added before further 141 /* TRUE if a newline character needs to be added before further
142 formatting. */ 142 formatting. */
143 #define pp_needs_newline(PP) pp_base (PP)->need_newline 143 #define pp_needs_newline(PP) pp_base (PP)->need_newline
144 144
145 /* True if PRETTY-PRINTER is in line-wrapping mode. */ 145 /* True if PRETTY-PRINTER is in line-wrapping mode. */
146 #define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0) 146 #define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0)
147 147
148 /* The amount of whitespace to be emitted when starting a new line. */ 148 /* The amount of whitespace to be emitted when starting a new line. */
149 #define pp_indentation(PP) pp_base (PP)->indent_skip 149 #define pp_indentation(PP) pp_base (PP)->indent_skip
150
151 /* True if identifiers are translated to the locale character set on
152 output. */
153 #define pp_translate_identifiers(PP) pp_base (PP)->translate_identifiers
150 154
151 /* The data structure that contains the bare minimum required to do 155 /* The data structure that contains the bare minimum required to do
152 proper pretty-printing. Clients may derived from this structure 156 proper pretty-printing. Clients may derived from this structure
153 and add additional fields they need. */ 157 and add additional fields they need. */
154 struct pretty_print_info 158 struct pretty_print_info
156 /* Where we print external representation of ENTITY. */ 160 /* Where we print external representation of ENTITY. */
157 output_buffer *buffer; 161 output_buffer *buffer;
158 162
159 /* The prefix for each new line. */ 163 /* The prefix for each new line. */
160 const char *prefix; 164 const char *prefix;
161 165
162 /* Where to put whitespace around the entity being formatted. */ 166 /* Where to put whitespace around the entity being formatted. */
163 pp_padding padding; 167 pp_padding padding;
164 168
165 /* The real upper bound of number of characters per line, taking into 169 /* The real upper bound of number of characters per line, taking into
166 account the case of a very very looong prefix. */ 170 account the case of a very very looong prefix. */
167 int maximum_length; 171 int maximum_length;
168 172
169 /* Indentation count. */ 173 /* Indentation count. */
170 int indent_skip; 174 int indent_skip;
171 175
185 /* Nonzero if current PREFIX was emitted at least once. */ 189 /* Nonzero if current PREFIX was emitted at least once. */
186 bool emitted_prefix; 190 bool emitted_prefix;
187 191
188 /* Nonzero means one should emit a newline before outputting anything. */ 192 /* Nonzero means one should emit a newline before outputting anything. */
189 bool need_newline; 193 bool need_newline;
194
195 /* Nonzero means identifiers are translated to the locale character
196 set on output. */
197 bool translate_identifiers;
190 }; 198 };
191 199
192 #define pp_set_line_maximum_length(PP, L) \ 200 #define pp_set_line_maximum_length(PP, L) \
193 pp_base_set_line_maximum_length (pp_base (PP), L) 201 pp_base_set_line_maximum_length (pp_base (PP), L)
194 #define pp_set_prefix(PP, P) pp_base_set_prefix (pp_base (PP), P) 202 #define pp_set_prefix(PP, P) pp_base_set_prefix (pp_base (PP), P)
271 pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) 279 pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
272 #define pp_widest_integer(PP, I) \ 280 #define pp_widest_integer(PP, I) \
273 pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I) 281 pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I)
274 #define pp_pointer(PP, P) pp_scalar (PP, "%p", P) 282 #define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
275 283
276 #define pp_identifier(PP, ID) pp_string (PP, ID) 284 #define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \
285 ? identifier_to_locale (ID) \
286 : (ID)))
277 #define pp_tree_identifier(PP, T) \ 287 #define pp_tree_identifier(PP, T) \
278 pp_append_text(PP, IDENTIFIER_POINTER (T), \ 288 pp_base_tree_identifier (pp_base (PP), T)
279 IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
280 289
281 #define pp_unsupported_tree(PP, T) \ 290 #define pp_unsupported_tree(PP, T) \
282 pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \ 291 pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \
283 tree_code_name[(int) TREE_CODE (T)], __FUNCTION__) 292 tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
284 293
320 extern void pp_base_newline (pretty_printer *); 329 extern void pp_base_newline (pretty_printer *);
321 extern void pp_base_character (pretty_printer *, int); 330 extern void pp_base_character (pretty_printer *, int);
322 extern void pp_base_string (pretty_printer *, const char *); 331 extern void pp_base_string (pretty_printer *, const char *);
323 extern void pp_write_text_to_stream (pretty_printer *pp); 332 extern void pp_write_text_to_stream (pretty_printer *pp);
324 extern void pp_base_maybe_space (pretty_printer *); 333 extern void pp_base_maybe_space (pretty_printer *);
334 extern void pp_base_tree_identifier (pretty_printer *, tree);
325 335
326 /* Switch into verbatim mode and return the old mode. */ 336 /* Switch into verbatim mode and return the old mode. */
327 static inline pp_wrapping_mode_t 337 static inline pp_wrapping_mode_t
328 pp_set_verbatim_wrapping_ (pretty_printer *pp) 338 pp_set_verbatim_wrapping_ (pretty_printer *pp)
329 { 339 {
332 pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER; 342 pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
333 return oldmode; 343 return oldmode;
334 } 344 }
335 #define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP)) 345 #define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP))
336 346
347 extern const char *identifier_to_locale (const char *);
348
337 #endif /* GCC_PRETTY_PRINT_H */ 349 #endif /* GCC_PRETTY_PRINT_H */