Cthulhu  0.2.10
Cthulhu compiler collection
notify.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include <ctu_format_api.h>
6 
7 #include "core/analyze.h"
8 #include "core/compiler.h"
9 
10 #include <stdbool.h>
11 #include <stddef.h>
12 
17 
24 
34 
35 typedef struct io_t io_t;
36 typedef struct event_t event_t;
37 typedef struct typevec_t typevec_t;
38 typedef struct arena_t arena_t;
39 
40 typedef struct colour_pallete_t colour_pallete_t;
41 typedef struct cache_map_t cache_map_t;
42 typedef struct set_t set_t;
43 typedef struct text_cache_t text_cache_t;
44 
46 
48 typedef struct file_config_t
49 {
52 
55  size_t max_columns;
56 
60 
61 typedef enum text_format_t
62 {
65 
68 
69 typedef struct text_config_t
70 {
73 
74  // is the first line of a source file the zeroth line or the first line
76 
77  // colour configuration
79 
80  // the io object to write to
81  io_t *io;
83 
84 typedef struct report_config_t
85 {
86  size_t max_errors;
87  size_t max_warnings;
88 
91 
95 
96 CT_FORMAT_API int text_report(
97  IN_NOTNULL typevec_t *events,
98  report_config_t config,
99  IN_STRING const char *title);
100 
101 // complex reporting
102 CT_FORMAT_API void text_report_rich(
103  text_config_t config,
104  IN_NOTNULL const event_t *event);
105 
106 // simple reporting like msvc
107 // path(line): severity id: main message
108 
109 CT_FORMAT_API void text_report_simple(
110  text_config_t config,
111  IN_NOTNULL const event_t *event);
112 
#define IN_NOTNULL
annotate a parameter as not being null
#define IN_STRING
annotate a parameter as being a null terminated string
#define CT_BEGIN_API
Definition: compiler.h:129
#define CT_END_API
Definition: compiler.h:130
an allocator object
Definition: arena.h:86
a colour pallete
Definition: colour.h:39
an event handle TODO: make this and segment_t opaque
Definition: notify.h:36
the configuration for a file
Definition: notify.h:49
bool override_fatal
if true all warnings are treated as fatal
Definition: notify.h:58
size_t max_columns
the maximum number of columns to print set to 0 to use default
Definition: notify.h:55
bool zeroth_line
the zeroth line of a file is the first line
Definition: notify.h:51
io object implementation
Definition: impl.h:122
size_t max_errors
Definition: notify.h:86
size_t max_warnings
Definition: notify.h:87
text_config_t text_config
Definition: notify.h:93
set_t * ignore_warnings
Definition: notify.h:89
set_t * error_warnings
Definition: notify.h:90
text_format_t report_format
Definition: notify.h:92
an unordered hash set
Definition: set.c:19
io_t * io
Definition: notify.h:81
const colour_pallete_t * colours
Definition: notify.h:78
file_config_t config
Definition: notify.h:75
cache_map_t * cache
a shared cache between all reports, set to NULL to disable caching
Definition: notify.h:72
A vector with a fixed type size.
Definition: vector.h:24
CT_FORMAT_API int text_report(typevec_t *events, report_config_t config, const char *title)
Definition: common_extra.c:416
text_format_t
Definition: notify.h:62
@ eTextSimple
simple text reporting
Definition: notify.h:63
@ eTextComplex
complex text reporting
Definition: notify.h:64
@ eTextTotal
Definition: notify.h:66
CT_FORMAT_API void text_report_simple(text_config_t config, const event_t *event)
Definition: text_simple.c:162
CT_FORMAT_API void text_report_rich(text_config_t config, const event_t *event)
Definition: text_rich.c:528