Cthulhu  0.2.10
Cthulhu compiler collection
common.c File Reference
#include "common.h"
#include "base/util.h"
#include "base/panic.h"
#include "arena/arena.h"
#include "std/str.h"
Include dependency graph for common.c:

Go to the source code of this file.

Macros

#define SCAN_BUILTIN_NAME   "<builtin>"
 

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

◆ SCAN_BUILTIN_NAME

#define SCAN_BUILTIN_NAME   "<builtin>"

Definition at line 82 of file common.c.

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.