terminology/src/bin/private.h

82 lines
1.8 KiB
C
Raw Normal View History

#ifndef TERMINOLOGY_PRIVATE_H_
#define TERMINOLOGY_PRIVATE_H_ 1
2014-01-06 13:29:18 -08:00
#ifdef HAVE_CONFIG_H
#include "terminology_config.h"
#endif
#if ENABLE_NLS
#include <libintl.h>
2014-07-12 07:15:39 -07:00
#define _(string) gettext (string)
#else
#define _(string) (string)
#endif
2014-07-20 14:04:47 -07:00
#define gettext_noop(String) String
2014-07-12 07:15:39 -07:00
2018-04-04 11:03:59 -07:00
2015-09-26 03:01:42 -07:00
extern int terminology_starting_up;
2017-05-16 15:04:25 -07:00
/* Uncommenting the following enables processing of testing escape codes in
* the normal 'terminology' binary.
* This is only useful to write tests
*/
#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
//#define ENABLE_TEST_UI
#endif
#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST)
2017-05-16 15:04:25 -07:00
#define EINA_LOG_LEVEL_MAXIMUM (-1)
#endif
extern int _log_domain;
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
2014-01-06 13:29:18 -08:00
#ifndef MIN
# define MIN(x, y) (((x) > (y)) ? (y) : (x))
#endif
#ifndef MAX
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef DIV_ROUND_UP
# define DIV_ROUND_UP(_v, _n) \
(((_v) + (_n) - 1) / (_n))
#endif
#ifndef ROUND_UP
# define ROUND_UP(_v, _n) \
(DIV_ROUND_UP((_v), (_n)) * (_n))
#endif
2020-06-23 04:11:09 -07:00
#define casestartswith(str, constref) \
(!strncasecmp(str, constref, sizeof(constref) - 1))
#define startswith(str, constref) \
(!strncmp(str, constref, sizeof(constref) - 1))
2020-09-01 10:00:30 -07:00
#define static_strequal(STR, STATIC_STR) \
(!strncmp(STR, STATIC_STR, strlen(STATIC_STR)))
2020-06-23 04:11:09 -07:00
#if !defined(HAVE_STRCHRNUL)
static inline char *
strchrnul(const char *s, int c)
{
const char *p = s;
while (*p)
{
if (*p == c)
return (char *)p;
++p;
}
return (char *) (p);
}
#endif
2014-01-06 13:29:18 -08:00
#endif