15 if (zero_indexed_lines)
return line;
18 return line == 0 ? line : line - 1;
38 CTASSERTF(width >= 1,
"width must be at least 1 (%zu given)", width);
45 if (msg.
length >= width)
return msg.text;
47 size_t size = width - 1;
61 CTASSERTF(width >= 1,
"width must be at least 1 (%zu given)", width);
68 if (msg.
length >= width)
return msg.text;
70 size_t size = width - 1;
82 #define SCAN_BUILTIN_NAME "<builtin>"
84 static const char *
const kFormatBuiltinHeading[
eHeadingCount] = {
91 if (zero_indexed_lines)
return line;
128 return fmt_any_location(config, path, first_line, where.
first_column);
STA_DECL char * colour_format(format_context_t context, colour_t idx, const char *fmt,...)
CT_NOALIAS CT_BASE_API void * ctu_memcpy(STA_WRITES(size) void *CT_RESTRICT dst, STA_READS(size) const void *CT_RESTRICT src, size_t size)
copy memory from one location to another equivalent to memcpy but with safety checks
CT_NOALIAS CT_BASE_API void ctu_memset(STA_WRITES(size) void *dst, int value, size_t size)
set memory to a value equivalent to memset but with safety checks
#define ARENA_MALLOC(size, name, parent, arena)
allocate memory from a custom allocator
CT_ARENA_API void arena_free(STA_RELEASE void *ptr, size_t size, arena_t *arena)
release memory from a custom allocator
#define CTASSERTF(expr,...)
assert a condition with a message and optional format arguments
CT_NODISCARD STA_FORMAT_STRING const char CT_NODISCARD CT_STD_API text_t text_vformat(arena_t *arena, const char *fmt, va_list args)
format a string
CT_NODISCARD STA_FORMAT_STRING const char * fmt
const colour_pallete_t * pallete
colour pallete to use
arena_t * arena
temporary arena
a formatting context when using colours
heading_style_t heading_style
size_t length
the number of characters in the text
a location inside a scanner locations are inclusive and 0-based
ctu_column_t first_column
the first column of the location
ctu_line_t first_line
the first line of the location
#define PRI_LINE
format specifier for ctu_line_t
#define PRI_COLUMN
format specifier for ctu_column_t
uint_fast64_t ctu_column_t
a column number
uint_fast64_t ctu_line_t
a line number