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 <stdbool.h>
12#include <stdio.h>
13
15
16#ifndef __debug_print_h
17#define __debug_print_h
18
19/**
20 * @brief Print messages debugging memory allocation.
21 *
22 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
23 */
24#define DEBUG_ALLOC 1
25
26/**
27 * @brief Print messages debugging arithmetic operations.
28 *
29 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
30 */
31#define DEBUG_ARITH 2
32
33/**
34 * @brief Print messages debugging symbol binding.
35 *
36 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
37 */
38#define DEBUG_BIND 4
39
40/**
41 * @brief Print messages debugging bootstrapping and teardown.
42 *
43 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
44 */
45#define DEBUG_BOOTSTRAP 8
46
47/**
48 * @brief Print messages debugging evaluation.
49 *
50 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
51 */
52#define DEBUG_EVAL 16
53
54/**
55 * @brief Print messages debugging input/output operations.
56 *
57 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
58 */
59#define DEBUG_IO 32
60
61/**
62 * @brief Print messages debugging lambda functions (interpretation).
63 *
64 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
65 */
66#define DEBUG_LAMBDA 64
67
68/**
69 * @brief Print messages debugging the read eval print loop.
70 *
71 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
72 */
73#define DEBUG_REPL 128
74
75/**
76 * @brief Print messages debugging stack operations.
77 *
78 * Flag interpretation for the value of `verbosity`, defined in `debug.c`, q.v.
79 */
80#define DEBUG_STACK 256
81
82extern int verbosity;
83
84void debug_print( wchar_t *message, int level );
85void debug_print_128bit( __int128_t n, int level );
86void debug_println( int level );
87void debug_printf( int level, wchar_t *format, ... );
88void debug_print_object( struct cons_pointer pointer, int level );
89void debug_dump_object( struct cons_pointer pointer, int level );
90void debug_print_binding( struct cons_pointer key, struct cons_pointer val,
91 bool deep, int level );
92
93#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_binding(struct cons_pointer key, struct cons_pointer val, bool deep, int level)
Standardise printing of binding trace messages.
Definition debug.c:150
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