Files
our_dick/include/config.hpp

80 lines
2.6 KiB
C++

/**
This file is a part of our_dick
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUR_DICK_CONFIG_HPP
#define OUR_DICK_CONFIG_HPP
//multiple levels just so i can stop alsa errors without stopping everything else
#define OUR_DICK_ENABLE_COLOR_DEBUG
#ifdef OUR_DICK_DEBUG
#define OUR_DICK_ENABLE_DEBUG_OUTPUT_LEVEL OUR_DICK_DEBUG
#if OUR_DICK_DEBUG > 1
#define OUR_DICK_ENABLE_DEBUG_CONTEXT
#endif
#else
#define OUR_DICK_ENABLE_DEBUG_OUTPUT_LEVEL 0
#endif
//Debug output section
#if OUR_DICK_ENABLE_DEBUG_OUTPUT_LEVEL > 0
#define OUR_DICK_ENABLE_DEBUG_OUTPUT
#endif
#if OUR_DICK_ENABLE_DEBUG_OUTPUT_LEVEL > 2
#define OUR_DICK_ENABLE_DEBUG_VERBOSE_OUTPUT
#endif
#ifdef OUR_DICK_ENABLE_DEBUG_OUTPUT
#include <cstdio>
#define debug_print(...) do{fprintf(stderr, __FILE__ ":%s:%d: ", __func__, __LINE__); fprintf(stderr, __VA_ARGS__);}while(0)
#ifdef OUR_DICK_ENABLE_DEBUG_VERBOSE_OUTPUT
#define debug_print_verbose(...) debug_print(__VA_ARGS__)
#else
#define debug_print_verbose(...)
#endif
#ifdef OUR_DICK_ENABLE_COLOR_DEBUG
#define OUR_DICK_DEBUG_PRINT_RED "\033[38;5;9m"
#define OUR_DICK_DEBUG_PRINT_YELLOW "\033[38;5;11m"
#define OUR_DICK_DEBUG_PRINT_GREEN "\033[38;5;2m"
#define OUR_DICK_DEBUG_PRINT_CLEAR "\033[0m"
#define debug_print_color_base(color, ...) do{fprintf(stderr, color); debug_print(__VA_ARGS__); fprintf(stderr, OUR_DICK_DEBUG_PRINT_CLEAR);}while(0)
#define debug_print_warn(...) debug_print_color_base(OUR_DICK_DEBUG_PRINT_YELLOW, __VA_ARGS__)
#define debug_print_error(...) debug_print_color_base(OUR_DICK_DEBUG_PRINT_RED, __VA_ARGS__)
#define debug_print_succ(...) debug_print_color_base(OUR_DICK_DEBUG_PRINT_GREEN, __VA_ARGS__)
#else
#define debug_print_error(...) debug_print(__VA_ARGS__)
#define debug_print_warn(...) debug_print(__VA_ARGS__)
#define debug_print_succ(...) debug_print(__VA_ARGS__)
#endif
#else
#define debug_print(...)
#define debug_print_error(...)
#define debug_print_warn(...)
#define debug_print_succ(...)
#define debug_print_verbose(...)
#endif
#endif