Cthulhu  0.2.10
Cthulhu compiler collection
common.h File Reference
#include "format/format.h"
#include "format/colour.h"
#include "core/where.h"
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  source_config_t
 

Macros

#define FMT_BASE10_MAX_WIDTH   20
 

Functions

size_t get_offset_line (bool zero_indexed_lines, size_t line)
 colour defines More...
 
int get_num_width (size_t num)
 get the width of a number if it were printed as base10 More...
 
char * fmt_left_align (arena_t *arena, size_t width, const char *fmt,...)
 
char * fmt_right_align (arena_t *arena, size_t width, const char *fmt,...)
 
format_context_t format_context_make (print_options_t options)
 
char * fmt_source_location (source_config_t config, const char *path, where_t where)
 

Macro Definition Documentation

◆ FMT_BASE10_MAX_WIDTH

#define FMT_BASE10_MAX_WIDTH   20

Definition at line 20 of file common.h.

Function Documentation

◆ fmt_left_align()

char* fmt_left_align ( arena_t arena,
size_t  width,
const char *  fmt,
  ... 
)

Definition at line 36 of file common.c.

◆ fmt_right_align()

char* fmt_right_align ( arena_t arena,
size_t  width,
const char *  fmt,
  ... 
)

Definition at line 59 of file common.c.

◆ fmt_source_location()

char* fmt_source_location ( source_config_t  config,
const char *  path,
where_t  where 
)

Definition at line 124 of file common.c.

◆ format_context_make()

format_context_t format_context_make ( print_options_t  options)

Definition at line 114 of file common.c.

◆ get_num_width()

int get_num_width ( size_t  num)

get the width of a number if it were printed as base10

Definition at line 21 of file common.c.

◆ get_offset_line()

size_t get_offset_line ( bool  zero_indexed_lines,
size_t  line 
)

colour defines

Definition at line 12 of file common.c.