Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
debug.h File Reference
#include <ctype.h>
#include <stdio.h>
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_ALLOC   1
 Print messages debugging memory allocation.
 
#define DEBUG_ARITH   2
 Print messages debugging arithmetic operations.
 
#define DEBUG_BIND   4
 Print messages debugging symbol binding.
 
#define DEBUG_BOOTSTRAP   8
 Print messages debugging bootstrapping and teardown.
 
#define DEBUG_EVAL   16
 Print messages debugging evaluation.
 
#define DEBUG_IO   32
 Print messages debugging input/output operations.
 
#define DEBUG_LAMBDA   64
 Print messages debugging lambda functions (interpretation).
 
#define DEBUG_REPL   128
 Print messages debugging the read eval print loop.
 
#define DEBUG_STACK   256
 Print messages debugging stack operations.
 

Functions

void debug_dump_object (struct cons_pointer pointer, int level)
 Like dump_object, q.v., but protected by the verbosity mechanism.
 
void debug_print (wchar_t *message, int level)
 print this debug message to stderr, if verbosity matches level.
 
void debug_print_128bit (__int128_t n, int level)
 print a 128 bit integer value to stderr, if verbosity matches level.
 
void debug_print_object (struct cons_pointer pointer, int level)
 print the object indicated by this pointer to stderr, if verbosity matches level.
 
void debug_printf (int level, wchar_t *format,...)
 wprintf adapted for the debug logging system.
 
void debug_println (int level)
 print a line feed to stderr, if verbosity matches level.
 

Variables

int verbosity
 the controlling flags for debug_print; set in init.c, q.v.
 

Macro Definition Documentation

◆ DEBUG_ALLOC

#define DEBUG_ALLOC   1

Print messages debugging memory allocation.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 21 of file debug.h.

◆ DEBUG_ARITH

#define DEBUG_ARITH   2

Print messages debugging arithmetic operations.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 28 of file debug.h.

◆ DEBUG_BIND

#define DEBUG_BIND   4

Print messages debugging symbol binding.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 35 of file debug.h.

◆ DEBUG_BOOTSTRAP

#define DEBUG_BOOTSTRAP   8

Print messages debugging bootstrapping and teardown.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 42 of file debug.h.

◆ DEBUG_EVAL

#define DEBUG_EVAL   16

Print messages debugging evaluation.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 49 of file debug.h.

◆ DEBUG_IO

#define DEBUG_IO   32

Print messages debugging input/output operations.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 56 of file debug.h.

◆ DEBUG_LAMBDA

#define DEBUG_LAMBDA   64

Print messages debugging lambda functions (interpretation).

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 63 of file debug.h.

◆ DEBUG_REPL

#define DEBUG_REPL   128

Print messages debugging the read eval print loop.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 70 of file debug.h.

◆ DEBUG_STACK

#define DEBUG_STACK   256

Print messages debugging stack operations.

Flag interpretation for the value of verbosity, defined in debug.c, q.v.

Definition at line 77 of file debug.h.

Function Documentation

◆ debug_dump_object()

void debug_dump_object ( struct cons_pointer  pointer,
int  level 
)

Like dump_object, q.v., but protected by the verbosity mechanism.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

Definition at line 136 of file debug.c.

References dump_object(), file_to_url_file(), and verbosity.

Referenced by add_2(), add_integers(), compose_body(), free_cell(), lisp_apply(), lisp_cond(), lisp_eval(), lisp_inspect(), lisp_mapcar(), lisp_metadata(), lisp_print(), lisp_read(), lisp_slurp(), log_binding(), main(), make_empty_frame(), make_integer(), make_real(), make_special_frame(), make_stack_frame(), make_vec_pointer(), make_vso(), read_continuation(), read_number(), read_symbol_or_key(), set(), throw_exception(), and zerop().

◆ debug_print()

◆ debug_print_128bit()

void debug_print_128bit ( __int128_t  n,
int  level 
)

print a 128 bit integer value to stderr, if verbosity matches level.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc

Definition at line 58 of file debug.c.

References verbosity.

Referenced by add_integers(), cell_value(), and integer_to_string().

◆ debug_print_object()

◆ debug_printf()

◆ debug_println()

void debug_println ( int  level)

print a line feed to stderr, if verbosity matches level.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

Definition at line 85 of file debug.c.

References verbosity.

Referenced by add_integers(), c_apply(), c_assoc(), cell_value(), deep_bind(), eval_form(), eval_lambda(), integer_to_string(), integer_to_string_add_digit(), lisp_mapcar(), lisp_multiply(), lisp_repl(), lisp_slurp(), make_ratio(), multiply_integers(), set(), and set_reg().

Variable Documentation

◆ verbosity

int verbosity
extern

the controlling flags for debug_print; set in init.c, q.v.

Interpreted as a set o binary flags. The values are controlled by macros with names 'DEBUG_[A_Z]*' in debug.h, q.v.

Definition at line 33 of file debug.c.

Referenced by debug_dump_object(), debug_print(), debug_print_128bit(), debug_print_object(), debug_printf(), debug_println(), and main().