19 #define COLOUR_NOTE eColourGreen
20 #define COLOUR_PATH eColourBlue
40 for (
size_t i = 0; i < note_count; i++)
43 io_printf(simple->
io,
" %s note: %s\n", star, note);
48 static int entry_cmp(
const void *lhs,
const void *rhs)
61 const char *path_lhs =
scan_path(scan_lhs);
62 const char *path_rhs =
scan_path(scan_rhs);
67 static void print_segment(
simple_t *simple,
const segment_t *segment,
size_t scan_idx,
size_t segment_idx)
74 .heading_style = eHeadingGeneric,
80 const char *msg = segment->
message;
82 io_printf(simple->
io,
" (%zu.%zu) %s: %s\n", scan_idx + 1, segment_idx + 1, path, msg);
85 static void print_segment_list(
simple_t *simple,
const typevec_t *segments,
size_t scan_idx)
90 for (
size_t i = 0; i < len; i++)
93 print_segment(simple, segment, scan_idx, i);
114 for (
size_t i = 0; i < len; i++)
132 if (segments == NULL)
135 map_set(scans, scan, segments);
141 print_segment_list(simple, primary, 0);
147 for (
size_t i = 0; i < entry_count; i++)
155 print_segment_list(simple, segments, i + 1);
158 print_segment_list(simple, none, entry_count + 1);
193 .heading_style = eHeadingGeneric,
202 print_segments(&simple, event);
204 print_simple_notes(&simple, event->
notes);
STA_DECL char * colour_format(format_context_t context, colour_t idx, const char *fmt,...)
CT_NODISCARD CT_PUREFN CT_SCAN_API const char * scan_path(const scan_t *scan)
get the path of a scanner
#define STA_DECL
sal2 annotation on function implementations to copy annotations from the declaration
CT_NODISCARD CT_PUREFN CT_BASE_API int ctu_strcmp(const char *lhs, const char *rhs)
compare two strings equivalent to strcmp but with safety checks
STA_RET_STRING CT_FORMAT_API char * colour_text(format_context_t context, colour_t idx, const char *text)
add colour to a string
CT_MEMORY_API arena_t * get_global_arena(void)
get the global memory arena
CT_NODISCARD CT_STD_API typevec_t * map_entries(map_t *map)
collect all key-value pairs in a map into a vector returns a typevec_t<map_entry_t>
CT_NODISCARD CT_STD_API map_t * map_optimal(size_t size, hash_info_t info, arena_t *arena)
create a new map with an optimal size
CT_STD_API void map_set(map_t *map, const void *key, void *value)
set a key-value pair in a map
CT_NODISCARD CT_PUREFN CT_STD_API void * map_get(const map_t *map, const void *key)
get a value from a map
CT_IO_API size_t io_printf(io_t *io, STA_FORMAT_STRING const char *fmt,...)
printf to an io object
CT_NODISCARD CT_PUREFN CT_SCAN_API const scan_t * node_get_scan(const node_t *node)
get the associated source file of a node
severity_t
the default severity of a diagnostic
#define CTASSERT(expr)
assert a condition, prints the condition as a message
CT_NODISCARD STA_FORMAT_STRING const char * fmt
CT_STD_API const hash_info_t kTypeInfoPtr
type information for a generic pointer this operates on the pointer itself and not the data it points...
CT_STD_API void typevec_sort(typevec_t *vec, int(*cmp)(const void *, const void *))
sort a vector
CT_STD_API void * typevec_push(typevec_t *vec, const void *src)
push a value onto the vector
CT_NODISCARD CT_PUREFN CT_STD_API size_t typevec_len(const typevec_t *vec)
get the length of a vector
CT_NODISCARD CT_STD_API typevec_t * typevec_new(size_t width, size_t len, arena_t *arena)
create a new typed vector on the heap
CT_NODISCARD CT_PUREFN CT_STD_API void * typevec_offset(const typevec_t *vec, size_t index)
get a pointer to the value at the given index
CT_NODISCARD CT_PUREFN CT_STD_API void * vector_get(const vector_t *vector, size_t index)
get a value from a vector
CT_NODISCARD CT_PUREFN CT_STD_API size_t vector_len(const vector_t *vector)
get the length of a vector
const char * id
the id of the diagnostic should be in the format [A-Z]{2,3}[0-9]{4} e.g. CLI0001 this is not enforced...
an event handle TODO: make this and segment_t opaque
node_t node
the primary node that this event is attached to
vector_t * notes
extra notes that this event is attached to
STA_FIELD_STRING char * message
the primary message
typevec_t * segments
extra segments that this event is attached to
the configuration for a file
bool override_fatal
if true all warnings are treated as fatal
bool zeroth_line
the zeroth line of a file is the first line
a formatting context when using colours
arena_t * arena
the arena this object was allocated from
a key-value pair in a map
const void * key
the key of this entry
void * value
the value of this entry
a segment inside an event
node_t node
the related node
STA_FIELD_STRING char * message
the message associated with this segment
const colour_pallete_t * colours
A vector with a fixed type size.
a generic vector of pointers
STA_DECL void text_report_simple(text_config_t config, const event_t *event)