Blame src/debug.hpp

Packit Service 7770af
#ifndef SASS_DEBUG_H
Packit Service 7770af
#define SASS_DEBUG_H
Packit Service 7770af
Packit Service 7770af
#include <stdint.h>
Packit Service 7770af
Packit Service 7770af
#ifndef UINT32_MAX
Packit Service 7770af
  #define UINT32_MAX 0xffffffffU
Packit Service 7770af
#endif
Packit Service 7770af
Packit Service 7770af
enum dbg_lvl_t : uint32_t {
Packit Service 7770af
  NONE = 0,
Packit Service 7770af
  TRIM = 1,
Packit Service 7770af
  CHUNKS = 2,
Packit Service 7770af
  SUBWEAVE = 4,
Packit Service 7770af
  WEAVE = 8,
Packit Service 7770af
  EXTEND_COMPOUND = 16,
Packit Service 7770af
  EXTEND_COMPLEX = 32,
Packit Service 7770af
  LCS = 64,
Packit Service 7770af
  EXTEND_OBJECT = 128,
Packit Service 7770af
  ALL = UINT32_MAX
Packit Service 7770af
};
Packit Service 7770af
Packit Service 7770af
#ifdef DEBUG
Packit Service 7770af
Packit Service 7770af
#ifndef DEBUG_LVL
Packit Service 7770af
const uint32_t debug_lvl = UINT32_MAX;
Packit Service 7770af
#else
Packit Service 7770af
const uint32_t debug_lvl = (DEBUG_LVL);
Packit Service 7770af
#endif // DEBUG_LVL
Packit Service 7770af
Packit Service 7770af
#define DEBUG_PRINT(lvl, x) if((lvl) & debug_lvl) { std::cerr << x; }
Packit Service 7770af
#define DEBUG_PRINTLN(lvl, x) if((lvl) & debug_lvl) { std::cerr << x << std::endl; }
Packit Service 7770af
#define DEBUG_EXEC(lvl, x) if((lvl) & debug_lvl) { x; }
Packit Service 7770af
Packit Service 7770af
#else // DEBUG
Packit Service 7770af
Packit Service 7770af
#define DEBUG_PRINT(lvl, x)
Packit Service 7770af
#define DEBUG_PRINTLN(lvl, x)
Packit Service 7770af
#define DEBUG_EXEC(lvl, x)
Packit Service 7770af
Packit Service 7770af
#endif // DEBUG
Packit Service 7770af
Packit Service 7770af
#endif // SASS_DEBUG