#if (defined(DEBUG_BUILD) || defined(TEST_BUILD)) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct statement; struct tokenizer; struct istream; struct cmdln_flags; struct istream_inheritance; struct token; struct position; struct environment; struct number; struct mpq; struct booleans; #include /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ /*#include */ #endif #ifdef DEBUG_BUILD extern int debug_depth; #define HERE \ printf("%*s" "HERE at %s:%i\n", debug_depth, "", __PRETTY_FUNCTION__, __LINE__); #define ENTER \ printf("%*s" "%s\n", debug_depth++, "", __PRETTY_FUNCTION__); #define EXIT \ assert(debug_depth), printf("%*s" "return; // from %s\n", debug_depth--, "", __FUNCTION__); #define TODO \ { \ printf("TODO hit at %s:%i!\n", __FILE__, __LINE__); \ \ pid_t __child = fork(); \ \ if (__child < 0) \ {\ perror("fork");\ }\ else if (__child)\ {\ int wstatus = 0;\ \ if (waitpid(__child, &wstatus, 0) < 0)\ perror("waitpid");\ else if (wstatus)\ fprintf(stderr, "child failed!");\ }\ else\ {\ char __buffer[100]; \ snprintf(__buffer, 100, "+%u", __LINE__); \ execlp("gedit", "gedit", __FILE__, __buffer, NULL); \ }\ \ exit(1); \ } #define CHECK \ { \ printf("CHECK hit at %s:%i!\n", __FILE__, __LINE__); \ \ pid_t child = fork(); \ \ if (child < 0) \ {\ perror("fork");\ }\ else if (child)\ {\ int wstatus = 0;\ \ if (waitpid(child, &wstatus, 0) < 0)\ perror("waitpid");\ else if (wstatus)\ fprintf(stderr, "child failed!");\ }\ else\ {\ char __buffer[100]; \ snprintf(__buffer, 100, "+%u", __LINE__); \ execlp("gedit", "gedit", __FILE__, __buffer, NULL); \ }\ \ exit(1); \ } #define NOPE \ { \ printf("NOPE hit at %s:%i!\n", __FILE__, __LINE__); \ \ pid_t child = fork(); \ \ if (child < 0) \ {\ perror("fork");\ }\ else if (child)\ {\ int wstatus = 0;\ \ if (waitpid(child, &wstatus, 0) < 0)\ perror("waitpid");\ else if (wstatus)\ fprintf(stderr, "child failed!");\ }\ else\ {\ char buffer[100]; \ snprintf(buffer, 100, "+%u", __LINE__); \ execlp("gedit", "gedit", __FILE__, buffer, NULL); \ }\ \ exit(1); \ } extern void dpvs_implementation( const char*, char quote, const unsigned char*, size_t); #define dpvs(str) \ dpvs_implementation(#str, '\"', (const unsigned char*) str, (size_t) -1); #define dpvsn(str, len) \ dpvs_implementation(#str, '\"', (const unsigned char*) str, (size_t) (len)); #define dpvss(str) \ dpvs_implementation(#str, str->data, str->len); #define dpvb(b) \ printf("%*s" "%s = %s\n", debug_depth, "", #b, (b) ? "true" : "false"); #define dputs(s) \ printf("%*s" "%s\n", debug_depth, "", s); #define dpvc(c) \ dpvs_implementation(#c, '\'', (const unsigned char[1]) {(unsigned char) (c)}, (size_t) 1); #define dpvwc(c) \ printf("%*s" "%s = '%lc'\n", debug_depth, "", #c, c); #define dpvws(s) \ printf("%*s" "%s = \"%ls\"\n", debug_depth, "", #s, s); #define dpvp(p) \ printf("%*s" "%s = %p\n", debug_depth, "", #p, p); #define dpvf(f) \ printf("%*s" "%s = %f\n", debug_depth, "", #f, f); #define dpvlf(f) \ printf("%*s" "%s = %lf\n", debug_depth, "", #f, f); #define dpvi(x) \ printf("%*s" "%s = %i\n", debug_depth, "", #x, (x)); #define dpvhhu(x) \ printf("%*s" "%s = %hhu\n", debug_depth, "", #x, (x)); #define dpvhhx(x) \ printf("%*s" "%s = 0x%hhX\n", debug_depth, "", #x, (x)); #define dpvu(x) \ printf("%*s" "%s = %u\n", debug_depth, "", #x, (x)); #define dpvlu(x) \ printf("%*s" "%s = %lu\n", debug_depth, "", #x, (x)); #else #define ENTER ; #define EXIT ; #define HERE ; #define TODO assert(!"TODO"); #define CHECK assert(!"CHECK"); #define NOPE assert(!"NOPE"); #define dpvp(_) ; #define dpvs(_) ; #define dpvss(_) ; #define dpvsn(str, len) ; #define dpvb(_) ; #define dputs(_) ; #define dpvc(_) ; #define dpvi(_) ; #define dpvf(_) ; #define dpvlf(_) ; #define dpvhhu(_) ; #define dpvhhx(_) ; #define dpvws(_) ; #define dpvwc(_) ; #define dpvlu(_) ; #define dpvu(_) ; #endif