X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/aaf2ef477a8130dece4989e33ceb31706cb122de..1017c5419ee314344cc11741052e51eca59b846e:/misc.h?ds=inline diff --git a/misc.h b/misc.h index 84f3ca1..557bed5 100644 --- a/misc.h +++ b/misc.h @@ -1,9 +1,15 @@ #ifndef MISC_H #define MISC_H -#include #include +/* Returns c-string "s" if n > 1, empty string "" otherwise. */ +#define ESSE(n) (misc::str_esse + ((n) <= 1)) + +namespace misc { + extern const char str_esse[]; +} + /* Returns true if the given priority is enabled for the default * category. Priority is xbt_log_priority_SUFFIX, where SUFFIX may * be: trace, debug, verbose, info, warning, error, critical. @@ -11,41 +17,10 @@ #define LOG_ISENABLED(priority) \ (_XBT_LOG_ISENABLEDV((*_XBT_LOGV(default)), (priority))) -/* Defines XCLOGn(...) which behave like CLOGn(...), except that the +/* Defines XBT_XCLOG(...) which behave like XBT_CLOG(...), except that the * given category is not passed through _XBT_LOGV before use. */ -#ifdef XBT_CLOG_ -# define XBT_XCLOG(c, p, ...) XBT_CLOG_((*(c)), p, __VA_ARGS__) -# define XCLOG0(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG1(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG2(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG3(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG4(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG5(...) XBT_XCLOG(__VA_ARGS__) -# define XCLOG6(...) XBT_XCLOG(__VA_ARGS__) -#else -# define XCLOG0(c, p, f) _XBT_LOG_PRE((*(c)),p) ,f _XBT_LOG_POST -# define XCLOG1(c, p, f,a1) _XBT_LOG_PRE((*(c)),p) ,f,a1 _XBT_LOG_POST -# define XCLOG2(c, p, f,a1,a2) _XBT_LOG_PRE((*(c)),p) ,f,a1,a2 _XBT_LOG_POST -# define XCLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE((*(c)),p) ,f,a1,a2,a3 _XBT_LOG_POST -# define XCLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*(c)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST -# define XCLOG5(c, p, f,a1,a2,a3,a4,a5) _XBT_LOG_PRE((*(c)),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST -# define XCLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE((*(c)),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST -#endif - -/* Returns c-string "s" if n > 1, empty string "" otherwise. */ -#define ESSE(n) ((n) > 1 ? misc::str_esse : misc::str_nil) -namespace misc { - - extern const char str_esse[]; - extern const char str_nil[]; - - template - struct address: public std::unary_function { - T* operator()(T& ref) { return &ref; } - }; - -} +#define XBT_XCLOG(c, p, ...) XBT_CLOG_((*(c)), p, __VA_ARGS__) #endif // !MISC_H