Text output

type diagnostic_text_sink
diagnostic_text_sink *diagnostic_manager_add_text_sink(diagnostic_manager *diag_mgr, FILE *dst_stream, enum diagnostic_colorize colorize)

Add a new output sink to diag_mgr, which writes GCC-style diagnostics to dst_stream. Return a borrowed pointer to the sink, which is cleaned up when diag_mgr is released.

diag_mgr must be non-NULL.

dst_stream must be non-NULL. It is borrowed and must outlive DIAG_MGR.

The output for each diagnostic is written and flushed as each diagnostic is finished.

enum diagnostic_colorize

An enum for determining if we should colorize a text output sink.

DIAGNOSTIC_COLORIZE_IF_TTY

Diagnostics should be colorized if the destination stream is directly connected to a tty.

DIAGNOSTIC_COLORIZE_NO

Diagnostics should not be colorized.

DIAGNOSTIC_COLORIZE_YES

Diagnostics should be colorized.

void diagnostic_text_sink_set_source_printing_enabled(diagnostic_text_sink *text_sink, int value)

Enable or disable printing of source text in the text sink.

text_sink must be non-NULL.

Default: enabled.

void diagnostic_text_sink_set_colorize(diagnostic_text_sink *text_sink, enum diagnostic_colorize colorize)

Update colorization of text sink.

text_sink must be non-NULL.

void diagnostic_text_sink_set_labelled_source_colorization_enabled(diagnostic_text_sink *text_sink, int value)

text_sink must be non-NULL.

Enable or disable colorization of the characters of source text that are underlined.

This should be true for clients that generate range information (so that the ranges of code are colorized), and false for clients that merely specify points within the source code (to avoid e.g. colorizing just the first character in a token, which would look strange).

Default: enabled.