Cthulhu
0.2.10
Cthulhu compiler collection
common_extra.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-only
2
3
#pragma once
4
5
#include "
common.h
"
6
7
#include "
core/text.h
"
8
#include "
format/notify.h
"
9
#include "
notify/notify.h
"
10
11
#include <stddef.h>
12
14
15
typedef
struct
map_t
map_t
;
16
typedef
struct
scan_t
scan_t
;
17
18
severity_t
get_severity
(
const
diagnostic_t
*diag,
bool
override_fatal);
19
20
const
char
*
get_severity_name
(
severity_t
severity);
21
colour_t
get_severity_colour
(
severity_t
severity);
22
23
typevec_t
*
all_segments_in_scan
(
const
typevec_t
*segments,
const
node_t
*node,
arena_t
*
arena
);
24
void
segments_sort
(
typevec_t
*segments);
25
26
size_t
get_line_number
(
file_config_t
config,
const
node_t
*node);
27
28
bool
node_has_line
(
const
node_t
*node);
29
30
cache_map_t
*
cache_map_new
(
size_t
size
,
arena_t
*
arena
);
31
void
cache_map_delete
(
cache_map_t
*map);
32
33
text_cache_t
*
cache_emplace_file
(
cache_map_t
*map,
const
char
*
path
);
34
text_cache_t
*
cache_emplace_scan
(
cache_map_t
*map,
const
scan_t
*scan);
35
36
text_view_t
cache_get_line
(
text_cache_t
*cache,
size_t
line);
37
size_t
cache_count_lines
(
text_cache_t
*cache);
38
39
// extract a line of text, converting non-printable characters to their escape codes
40
// and highlighting the escaped characters
41
text_t
cache_escape_line
(
text_cache_t
*cache,
size_t
line,
const
colour_pallete_t
*colours,
size_t
column_limit);
42
46
47
char
*
fmt_node_location
(
source_config_t
config,
const
node_t
*node);
text.h
notify.h
size
CT_NODISCARD size_t size
Definition:
scan.h:128
get_severity_colour
colour_t get_severity_colour(severity_t severity)
Definition:
common_extra.c:52
cache_emplace_file
text_cache_t * cache_emplace_file(cache_map_t *map, const char *path)
Definition:
common_extra.c:275
node_has_line
bool node_has_line(const node_t *node)
Definition:
common_extra.c:129
cache_map_delete
void cache_map_delete(cache_map_t *map)
Definition:
common_extra.c:262
get_severity_name
const char * get_severity_name(severity_t severity)
Definition:
common_extra.c:38
segments_sort
void segments_sort(typevec_t *segments)
Definition:
common_extra.c:90
all_segments_in_scan
typevec_t * all_segments_in_scan(const typevec_t *segments, const node_t *node, arena_t *arena)
Definition:
common_extra.c:95
cache_emplace_scan
text_cache_t * cache_emplace_scan(cache_map_t *map, const scan_t *scan)
Definition:
common_extra.c:295
get_line_number
size_t get_line_number(file_config_t config, const node_t *node)
Definition:
common_extra.c:121
cache_count_lines
size_t cache_count_lines(text_cache_t *cache)
Definition:
common_extra.c:327
get_severity
severity_t get_severity(const diagnostic_t *diag, bool override_fatal)
Definition:
common_extra.c:30
fmt_node_location
char * fmt_node_location(source_config_t config, const node_t *node)
Definition:
common_extra.c:530
cache_escape_line
text_t cache_escape_line(text_cache_t *cache, size_t line, const colour_pallete_t *colours, size_t column_limit)
Definition:
common_extra.c:355
cache_get_line
text_view_t cache_get_line(text_cache_t *cache, size_t line)
Definition:
common_extra.c:310
cache_map_new
cache_map_t * cache_map_new(size_t size, arena_t *arena)
Definition:
common_extra.c:251
colour_t
colour_t
a colour code
Definition:
colour.h:23
severity_t
severity_t
the default severity of a diagnostic
Definition:
diagnostic.h:18
arena_t
an allocator object
Definition:
arena.h:86
cache_map_t
Definition:
common_extra.c:135
colour_pallete_t
a colour pallete
Definition:
colour.h:39
diagnostic_t
a diagnostic
Definition:
diagnostic.h:27
file_config_t
the configuration for a file
Definition:
notify.h:49
map_t
an unordered hash map
Definition:
map.h:38
node_t
a position in a source file
Definition:
node.h:23
scan_t
a source file scanner
Definition:
scan.h:24
scan_t::path
STA_FIELD_STRING const char * path
the path to this file
Definition:
scan.h:39
scan_t::arena
arena_t * arena
the allocator to use
Definition:
scan.h:30
source_config_t
Definition:
common.h:30
text_cache_t
Definition:
common_extra.c:147
text_t
a range of text
Definition:
text.h:14
text_view_t
a non-owning view of text
Definition:
text.h:24
typevec_t
A vector with a fixed type size.
Definition:
vector.h:24
notify.h
common.h
support
format
src
common_extra.h
Generated by
1.9.1