Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1/*
2 * debug.h
3 *
4 * Better debug log messages.
5 *
6 * (c) 2017 Simon Brooke <simon@journeyman.cc>
7 * Licensed under GPL version 2.0, or, at your option, any later version.
8 */
9
10#include <ctype.h>
11#include <stdio.h>
12
13#ifndef __debug_print_h
14#define __debug_print_h
15
16/**
17 * @brief Print messages debugging memory allocation.
18 *
19 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
20 */
21#define DEBUG_ALLOC 1
22
23/**
24 * @brief Print messages debugging arithmetic operations.
25 *
26 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
27 */
28#define DEBUG_ARITH 2
29
30/**
31 * @brief Print messages debugging symbol binding.
32 *
33 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
34 */
35#define DEBUG_BIND 4
36
37/**
38 * @brief Print messages debugging bootstrapping and teardown.
39 *
40 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
41 */
42#define DEBUG_BOOTSTRAP 8
43
44/**
45 * @brief Print messages debugging evaluation.
46 *
47 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
48 */
49#define DEBUG_EVAL 16
50
51/**
52 * @brief Print messages debugging input/output operations.
53 *
54 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
55 */
56#define DEBUG_IO 32
57
58/**
59 * @brief Print messages debugging lambda functions (interpretation).
60 *
61 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
62 */
63#define DEBUG_LAMBDA 64
64
65/**
66 * @brief Print messages debugging the read eval print loop.
67 *
68 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
69 */
70#define DEBUG_REPL 128
71
72/**
73 * @brief Print messages debugging stack operations.
74 *
75 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
76 */
77#define DEBUG_STACK 256
78
79extern int verbosity;
80
81void debug_print( wchar_t *message, int level );
82void debug_print_128bit( __int128_t n, int level );
83void debug_println( int level );
84void debug_printf( int level, wchar_t *format, ... );
85void debug_print_object( struct cons_pointer pointer, int level );
86void debug_dump_object( struct cons_pointer pointer, int level );
87
88#endif
An indirect pointer to a cons cell.
int verbosity
the controlling flags for debug_print; set in init.c, q.v.
Definition debug.c:33
void debug_print_128bit(__int128_t n, int level)
print a 128 bit integer value to stderr, if verbosity matches level.
Definition debug.c:58
void debug_println(int level)
print a line feed to stderr, if verbosity matches level.
Definition debug.c:85
void debug_dump_object(struct cons_pointer pointer, int level)
Like dump_object, q.v., but protected by the verbosity mechanism.
Definition debug.c:136
void debug_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
Definition debug.c:101
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
Definition debug.c:41
void debug_print_object(struct cons_pointer pointer, int level)
print the object indicated by this pointer to stderr, if verbosity matches level.
Definition debug.c:119