| 1 |
.. Copyright (C) 2024-2025 Free Software Foundation, Inc. |
| 2 |
Originally contributed by David Malcolm <[email protected]> |
| 3 |
|
| 4 |
This is free software: you can redistribute it and/or modify it |
| 5 |
under the terms of the GNU General Public License as published by |
| 6 |
the Free Software Foundation, either version 3 of the License, or |
| 7 |
(at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, but |
| 10 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program. If not, see |
| 16 |
<https://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
.. default-domain:: c |
| 19 |
|
| 20 |
Text output |
| 21 |
=========== |
| 22 |
|
| 23 |
.. type:: diagnostic_text_sink |
| 24 |
|
| 25 |
.. function:: diagnostic_text_sink * diagnostic_manager_add_text_sink (diagnostic_manager *diag_mgr,\ |
| 26 |
FILE *dst_stream, \ |
| 27 |
enum diagnostic_colorize colorize) |
| 28 |
|
| 29 |
Add a new output sink to ``diag_mgr``, which writes GCC-style diagnostics |
| 30 |
to ``dst_stream``. |
| 31 |
Return a borrowed pointer to the sink, which is cleaned up when ``diag_mgr`` |
| 32 |
is released. |
| 33 |
|
| 34 |
``diag_mgr`` must be non-NULL. |
| 35 |
|
| 36 |
``dst_stream`` must be non-NULL. It is borrowed and must outlive ``DIAG_MGR``. |
| 37 |
|
| 38 |
The output for each diagnostic is written and flushed as each |
| 39 |
:type:`diagnostic` is finished. |
| 40 |
|
| 41 |
.. enum:: diagnostic_colorize |
| 42 |
|
| 43 |
An enum for determining if we should colorize a text output sink. |
| 44 |
|
| 45 |
.. macro:: DIAGNOSTIC_COLORIZE_IF_TTY |
| 46 |
|
| 47 |
Diagnostics should be colorized if the destination stream is |
| 48 |
directly connected to a tty. |
| 49 |
|
| 50 |
.. macro:: DIAGNOSTIC_COLORIZE_NO |
| 51 |
|
| 52 |
Diagnostics should not be colorized. |
| 53 |
|
| 54 |
.. macro:: DIAGNOSTIC_COLORIZE_YES |
| 55 |
|
| 56 |
Diagnostics should be colorized. |
| 57 |
|
| 58 |
.. function:: void diagnostic_text_sink_set_source_printing_enabled (diagnostic_text_sink *text_sink, \ |
| 59 |
int value) |
| 60 |
|
| 61 |
Enable or disable printing of source text in the text sink. |
| 62 |
|
| 63 |
``text_sink`` must be non-NULL. |
| 64 |
|
| 65 |
Default: enabled. |
| 66 |
|
| 67 |
.. function:: void diagnostic_text_sink_set_colorize (diagnostic_text_sink *text_sink, \ |
| 68 |
enum diagnostic_colorize colorize) |
| 69 |
|
| 70 |
Update colorization of text sink. |
| 71 |
|
| 72 |
``text_sink`` must be non-NULL. |
| 73 |
|
| 74 |
.. function:: void diagnostic_text_sink_set_labelled_source_colorization_enabled (diagnostic_text_sink *text_sink, \ |
| 75 |
int value) |
| 76 |
|
| 77 |
``text_sink`` must be non-NULL. |
| 78 |
|
| 79 |
Enable or disable colorization of the characters of source text |
| 80 |
that are underlined. |
| 81 |
|
| 82 |
This should be true for clients that generate range information |
| 83 |
(so that the ranges of code are colorized), and false for clients that |
| 84 |
merely specify points within the source code (to avoid e.g. colorizing |
| 85 |
just the first character in a token, which would look strange). |
| 86 |
|
| 87 |
Default: enabled. |