/* * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are documented in doc/pod/gplicense.pod. * * Compile-time configuration and some sysconf #defines. * dbg, the ermyth debug output, also lives in this file. * * $Id: svsconfig.h,v 1.2 2007/08/28 17:08:07 pippijn Exp $ */ #ifndef CONFIG_H #define CONFIG_H #include /* Compile-time configuration */ #define PURE_ISO 1 #define DEBUG 1 /* End configuration */ #define E extern #if __GNUC__ >= 3 # define expect(expr,value) __builtin_expect ((expr),(value)) # define is_const(expr) __builtin_constant_p ((expr)) #else # define expect(expr,value) (expr) # define is_const(expr) 0 #endif #define expect_false(expr) expect ((expr) != 0, 0) #define expect_true(expr) expect ((expr) != 0, 1) #if SIZEOF_TIME_T == SIZEOF_LONG #define TTP "%ld" #elif SIZEOF_TIME_T == SIZEOF_INT #define TTP "%d" #else #error Size of time_t not known #endif #if SIZEOF_SIZE_T == SIZEOF_INT #define STP "%u" #elif SIZEOF_SIZE_T == SIZEOF_LONG #define STP "%lu" #else #error Size of size_t not known #endif /** * Debug stuff... */ #ifndef DEBUG # define DEBUG 0 #else # define DEBUG 1 #endif #ifndef CALLBACK_DEBUG # define CALLBACK_DEBUG 0 #else # define CALLBACK_DEBUG 1 #endif #include // even needed when DEBUG is 0 #if DEBUG #ifdef __GNUC__ # define dbg std::cerr << __PRETTY_FUNCTION__ << ": " << std::dec << "#" << __LINE__ << ": " #else # define dbg std::cerr << __FILE__ << ": " << std::dec << "#" << __LINE__ << ": " #endif #else # define dbg if (0) std::cerr #endif #if CALLBACK_DEBUG # ifdef __GNUC__ # define dout std::cerr << __PRETTY_FUNCTION__ << ": " << std::dec << "#" << __LINE__ << ": " # else # define dout std::cerr << __LINE__ << ": " << std::dec << "#" << __LINE__ << ": " # endif #else # define dout if (0) std::cerr #endif #endif // CONFIG_H