Commit 406a65d0 by Gabriel Dos Reis Committed by Gabriel Dos Reis

diagnostic.c (save_output_state): Remove.

2000-07-12  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.c (save_output_state): Remove.
	(restore_output_state): Likewise.
	(clear_text_info): New function.
	(clear_diagnostic_info): Likewise.
	(output_text_length, is_starting_newline, output_prefix,
	line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
	prefixing_policy, output_buffer_ptr_to_format_args): New macros
	(set_real_maximum_length, output_set_maximum_length,
	output_set_prefix, output_get_prefix, output_set_maximum_length,
	output_destroy_prefix, init_output_buffer,
	reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
	output_add_newline, output_add_character, output_add_space,
	output_append_r, output_append, wrap_text, output_format,
	output_do_printf, output_printf, output_do_verbatim,
	output_verbatim, verbatim): Use them.
	(output_clear): Split into cleat_text_info and
	clear_diagnostic_info.
	(struct output_state): Move to...

	* diagnostic.h: ...Here
	(struct output_buffer): Adjust.

From-SVN: r34975
parent 7bb41c5a
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
2000-07-11 Zack Weinberg <zack@wolery.cumb.org>
* cpplex.c (parse_name): No longer inline (premature optimization).
......
......@@ -36,18 +36,11 @@ typedef struct output_buffer output_buffer;
everything goes well. */
typedef int (*printer_fn) PARAMS ((output_buffer *));
/* The output buffer datatype. This is best seen as an abstract datatype. */
struct output_buffer
/* This data structure encapulates an output_buffer's state. */
typedef struct
{
/* Internal data. These fields should not be accessed directly by
front-ends. */
/* The obstack where the text is built up. */
struct obstack obstack;
/* The prefix for each new line. */
const char *prefix;
/* The amount of characters output so far. */
int line_length;
/* The real upper bound of number of characters per line, taking into
accompt the case of a very very looong prefix. */
int maximum_length;
......@@ -62,25 +55,39 @@ struct output_buffer
o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit current PREFIX each time
a physical line is started. */
int prefixing_rule;
/* Public fields. These are used by front-ends to extract formats and
arguments from the variable argument-list passed to output_format. */
/* The current char to output. Updated by front-end (*format_map) when
it is called to report front-end printer for a specified format. */
const char *cursor;
/* Variable argument-list for formatting. */
va_list format_args;
/* A pointer to the variable argument-list for formatting. */
va_list *format_args;
} output_state;
/* The output buffer datatype. This is best seen as an abstract datatype. */
struct output_buffer
{
/* Internal data. These fields should not be accessed directly by
front-ends. */
/* The obstack where the text is built up. */
struct obstack obstack;
/* The amount of characters output so far. */
int line_length;
/* The current state of the buffer. */
output_state state;
};
/* If non-NULL, this function formats data in the BUFFER.
BUFFER->CURSOR points to a format code. LANG_PRINTER should
call output_add_string (and related functions) to add data to
#define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor
#define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args)
/* If non-NULL, this function formats data in the BUFFER. When called,
output_buffer_text_cursor (BUFFER) points to a format code. LANG_PRINTER
should call output_add_string (and related functions) to add data to
the BUFFER. LANG_PRINTER can read arguments from
BUFFER->FORMAT_ARGS using VA_ARG. If the BUFFER needs
output_buffer_format_args (BUFFER) using VA_ARG. If the BUFFER needs
additional characters from the format string, it should advance
the BUFFER->CURSOR as it goes. When LANG_PRINTER returns,
BUFFER->CURSOR should point to the last character processed. */
the output_buffer_text_cursor (BUFFER) as it goes. When LANG_PRINTER
returns, output_buffer_text_cursor (BUFFER) should point to the last
character processed. */
extern printer_fn lang_printer;
......
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