Repository navigation
Expand file tree
/
Copy pathmain.h
More file actions
75 lines (68 loc) · 3.67 KB
/
Copy pathmain.h
File metadata and controls
75 lines (68 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <curl/curl.h>
// Inclusive logging output
// 1: (real) errors
#define DEBUG_ERROR 1
#define debug_error(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_ERROR) \
fprintf(stderr, "\n[ERROR] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 2: warnings about possibly not implemented data fields
#define DEBUG_WARN 2
#define debug_warn(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_WARN) \
fprintf(stderr, "\n[WARNING] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 3: verbose info about parsed fields / configurations that were set
#define DEBUG_INFO 3
#define debug_info(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_INFO) \
fprintf(stderr, "\n[INFO] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 4: iteration numbers and info about current location in nested loops
#define DEBUG_VERBOSE 4
#define debug_verbose(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_VERBOSE) \
fprintf(stderr, "\n[VERBOSE] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 5: full trace of received content
#define DEBUG_FULLDBG 5
#define debug_fulldbg(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_FULLDBG) \
fprintf(stderr, "\n[FULLDBG] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 6: full trace of test execution
#define DEBUG_TEST 6
#define debug_test(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_TEST) \
fprintf(stderr, "\n[TEST] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
// 7: memory allocations
#define DEBUG_ALLOC 7
#define debug_alloc(fmt, ...) \
do { \
if (DEBUG && DEBUG_LEVEL >= DEBUG_ALLOC) \
fprintf(stderr, "\n[ALLOC] %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \
} while (0)
#define DEBUG 1
#ifndef DEBUG_LEVEL
#define DEBUG_LEVEL DEBUG_TEST
#endif
typedef enum {
false = 0,
true
} bool;
#include "mempool.h"
#include "threadpool.h"
#include "gui.h"