| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-12-23 15:44:19 +0100 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-12-23 15:44:19 +0100 |
| commit | 390576c3839ee7abb845e27b7267de45495e6b2f (patch) | |
| tree | c481c37c868ccc65a3476f60b17369b21a90b79b /src/error.h | |
| parent | 4355548f79375a62bb5e3bb5695190d48e4c0bc3 (diff) | |
Starting to turn relabsd into a proper daemon...
Diffstat (limited to 'src/error.h')
| -rw-r--r-- | src/error.h | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/src/error.h b/src/error.h deleted file mode 100644 index 863a1bb..0000000 --- a/src/error.h +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef RELABSD_ERROR_H -#define RELABSD_ERROR_H - -#include <stdio.h> - -#include "config.h" -#include "pervasive.h" - -#ifndef RELABSD_DEBUG_PROGRAM_FLOW - #define RELABSD_DEBUG_PROGRAM_FLOW 0 -#endif - -#ifndef RELABSD_DEBUG_CONFIG - #define RELABSD_DEBUG_CONFIG 0 -#endif - -#ifndef RELABSD_DEBUG_REAL_EVENTS - #define RELABSD_DEBUG_REAL_EVENTS 0 -#endif - -#ifndef RELABSD_DEBUG_VIRTUAL_EVENTS - #define RELABSD_DEBUG_VIRTUAL_EVENTS 0 -#endif - -#define RELABSD_ENABLE_WARNINGS_OUTPUT 1 -#define RELABSD_ENABLE_RUNTIME_ERRORS_OUTPUT 1 -#define RELABSD_ENABLE_PROGRAMMING_ERRORS_OUTPUT 1 -#define RELABSD_ENABLE_FATAL_ERROR_OUTPUT 1 - -#ifdef RELABSD_ENABLE_ERROR_LOCATION - #define RELABSD_LOCATION "[" __FILE__ "][" RELABSD_TO_STRING(__LINE__) "]" -#else - #define RELABSD_LOCATION "" -#endif - -#define RELABSD_PRINT_STDERR(symbol, str, ...)\ - fprintf(stderr, "[" symbol "]" RELABSD_LOCATION " " str "\n", __VA_ARGS__); - -/* - * Given that we use preprocessor contants as flags, we can expect the compilers - * to remove the test condition for disabled flags. No need to be shy about - * allowing many debug options. - */ - -#define RELABSD_DEBUG(flag, str, ...)\ - RELABSD_ISOLATE\ - (\ - if (flag)\ - {\ - RELABSD_PRINT_STDERR("D", str, __VA_ARGS__);\ - }\ - ) - - -#define RELABSD_WARNING(str, ...)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_WARNINGS_OUTPUT)\ - {\ - RELABSD_PRINT_STDERR("W", str, __VA_ARGS__);\ - }\ - ) - -#define RELABSD_ERROR(str, ...)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_RUNTIME_ERRORS_OUTPUT)\ - {\ - RELABSD_PRINT_STDERR("E", str, __VA_ARGS__);\ - }\ - ) - -#define RELABSD_PROG_ERROR(str, ...)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_PROGRAMMING_ERRORS_OUTPUT)\ - {\ - RELABSD_PRINT_STDERR("P", str, __VA_ARGS__);\ - }\ - ) - -#define RELABSD_FATAL(str, ...)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_FATAL_ERROR_OUTPUT)\ - {\ - RELABSD_PRINT_STDERR("F", str, __VA_ARGS__);\ - }\ - ) - -/* For outputs without dynamic content (static). ******************************/ - -#define RELABSD_PRINT_S_STDERR(symbol, str)\ - fprintf(stderr, "[" symbol "]" RELABSD_LOCATION " " str "\n"); - -#define RELABSD_S_DEBUG(flag, str)\ - RELABSD_ISOLATE\ - (\ - if (flag)\ - {\ - RELABSD_PRINT_S_STDERR("D", str);\ - }\ - ) - -#define RELABSD_S_WARNING(str)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_WARNINGS_OUTPUT)\ - {\ - RELABSD_PRINT_S_STDERR("W", str);\ - }\ - ) - -#define RELABSD_S_ERROR(str)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_RUNTIME_ERRORS_OUTPUT)\ - {\ - RELABSD_PRINT_S_STDERR("E", str);\ - }\ - ) - -#define RELABSD_S_PROG_ERROR(str)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_PROGRAMMING_ERRORS_OUTPUT)\ - {\ - RELABSD_PRINT_S_STDERR("P", str);\ - }\ - ) - -#define RELABSD_S_FATAL(str)\ - RELABSD_ISOLATE\ - (\ - if (RELABSD_ENABLE_FATAL_ERROR_OUTPUT)\ - {\ - RELABSD_PRINT_S_STDERR("F", str);\ - }\ - ) - -#endif |


