Cthulhu  0.2.10
Cthulhu compiler collection
common_extra.c File Reference
#include "common_extra.h"
#include "base/util.h"
#include "core/macros.h"
#include "io/io.h"
#include "memory/memory.h"
#include "base/panic.h"
#include "scan/node.h"
#include "std/map.h"
#include "std/set.h"
#include "std/str.h"
#include "arena/arena.h"
#include "std/typed/vector.h"
#include "std/vector.h"
#include <ctype.h>
Include dependency graph for common_extra.c:

Go to the source code of this file.

Data Structures

struct  cache_map_t
 
struct  lineinfo_t
 
struct  text_cache_t
 

Macros

#define COLOUR_UNKNOWN   eColourMagenta
 
#define COLOUR_SORRY   eColourMagenta
 
#define COLOUR_INTERNAL   eColourCyan
 
#define COLOUR_FATAL   eColourRed
 
#define COLOUR_WARN   eColourYellow
 
#define COLOUR_INFO   eColourGreen
 
#define COLOUR_DEBUG   eColourGreen
 

Functions

severity_t get_severity (const diagnostic_t *diag, bool override_fatal)
 
const char * get_severity_name (severity_t severity)
 
colour_t get_severity_colour (severity_t severity)
 
void segments_sort (typevec_t *segments)
 
typevec_tall_segments_in_scan (const typevec_t *segments, const node_t *node, arena_t *arena)
 
size_t get_line_number (file_config_t config, const node_t *node)
 
bool node_has_line (const node_t *node)
 
cache_map_tcache_map_new (size_t size, arena_t *arena)
 
void cache_map_delete (cache_map_t *map)
 
text_cache_tcache_emplace_file (cache_map_t *map, const char *path)
 
text_cache_tcache_emplace_scan (cache_map_t *map, const scan_t *scan)
 
text_view_t cache_get_line (text_cache_t *cache, size_t line)
 
size_t cache_count_lines (text_cache_t *cache)
 
text_t cache_escape_line (text_cache_t *cache, size_t line, const colour_pallete_t *colours, size_t column_limit)
 
STA_DECL int text_report (typevec_t *events, report_config_t config, const char *title)
 
char * fmt_node_location (source_config_t config, const node_t *node)
 

Macro Definition Documentation

◆ COLOUR_DEBUG

#define COLOUR_DEBUG   eColourGreen

Definition at line 28 of file common_extra.c.

◆ COLOUR_FATAL

#define COLOUR_FATAL   eColourRed

Definition at line 25 of file common_extra.c.

◆ COLOUR_INFO

#define COLOUR_INFO   eColourGreen

Definition at line 27 of file common_extra.c.

◆ COLOUR_INTERNAL

#define COLOUR_INTERNAL   eColourCyan

Definition at line 24 of file common_extra.c.

◆ COLOUR_SORRY

#define COLOUR_SORRY   eColourMagenta

Definition at line 23 of file common_extra.c.

◆ COLOUR_UNKNOWN

#define COLOUR_UNKNOWN   eColourMagenta

Definition at line 22 of file common_extra.c.

◆ COLOUR_WARN

#define COLOUR_WARN   eColourYellow

Definition at line 26 of file common_extra.c.

Function Documentation

◆ all_segments_in_scan()

typevec_t* all_segments_in_scan ( const typevec_t segments,
const node_t node,
arena_t arena 
)

Definition at line 95 of file common_extra.c.

◆ cache_count_lines()

size_t cache_count_lines ( text_cache_t cache)

Definition at line 327 of file common_extra.c.

◆ cache_emplace_file()

text_cache_t* cache_emplace_file ( cache_map_t map,
const char *  path 
)

Definition at line 275 of file common_extra.c.

◆ cache_emplace_scan()

text_cache_t* cache_emplace_scan ( cache_map_t map,
const scan_t scan 
)

Definition at line 295 of file common_extra.c.

◆ 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 at line 355 of file common_extra.c.

◆ cache_get_line()

text_view_t cache_get_line ( text_cache_t cache,
size_t  line 
)

Definition at line 310 of file common_extra.c.

◆ cache_map_delete()

void cache_map_delete ( cache_map_t map)

Definition at line 262 of file common_extra.c.

◆ cache_map_new()

cache_map_t* cache_map_new ( size_t  size,
arena_t arena 
)

Definition at line 251 of file common_extra.c.

◆ fmt_node_location()

char* fmt_node_location ( source_config_t  config,
const node_t node 
)

version 2 of the common stuff

Definition at line 530 of file common_extra.c.

◆ get_line_number()

size_t get_line_number ( file_config_t  config,
const node_t node 
)

Definition at line 121 of file common_extra.c.

◆ get_severity()

severity_t get_severity ( const diagnostic_t diag,
bool  override_fatal 
)

Definition at line 30 of file common_extra.c.

◆ get_severity_colour()

colour_t get_severity_colour ( severity_t  severity)

Definition at line 52 of file common_extra.c.

◆ get_severity_name()

const char* get_severity_name ( severity_t  severity)

Definition at line 38 of file common_extra.c.

◆ node_has_line()

bool node_has_line ( const node_t node)

Definition at line 129 of file common_extra.c.

◆ segments_sort()

void segments_sort ( typevec_t segments)

Definition at line 90 of file common_extra.c.

◆ text_report()

STA_DECL int text_report ( typevec_t events,
report_config_t  config,
const char *  title 
)

Definition at line 416 of file common_extra.c.