/usr/include/cxmessages.h is in libcext-dev 5.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /* $Id: cxmessages.h,v 1.9 2009/12/07 15:48:15 llundin Exp $
*
* This file is part of the ESO C Extension Library
* Copyright (C) 2001-2006 European Southern Observatory
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* $Author: llundin $
* $Date: 2009/12/07 15:48:15 $
* $Revision: 1.9 $
* $Name: cpl-5_3_0-BRANCH $
*/
#ifndef CX_MESSAGES_H
#define CX_MESSAGES_H
#include <stdarg.h>
#include <cxmacros.h>
#include <cxtypes.h>
CX_BEGIN_DECLS
/*
* Message level offset for user defined message levels
* (0 - 7 are used internally).
*/
#define CX_LOG_LEVEL_USER_SHIFT (8)
/*
* Log levels and flags
*/
typedef enum
{
/* flags */
CX_LOG_FLAG_RECURSION = 1 << 0,
CX_LOG_FLAG_FATAL = 1 << 1,
/* levels */
CX_LOG_LEVEL_ERROR = 1 << 2,
CX_LOG_LEVEL_CRITICAL = 1 << 3,
CX_LOG_LEVEL_WARNING = 1 << 4,
CX_LOG_LEVEL_MESSAGE = 1 << 5,
CX_LOG_LEVEL_INFO = 1 << 6,
CX_LOG_LEVEL_DEBUG = 1 << 7,
CX_LOG_LEVEL_MASK = ~(CX_LOG_FLAG_RECURSION | CX_LOG_FLAG_FATAL)
} cx_log_level_flags;
#define CX_LOG_FATAL_MASK (CX_LOG_FLAG_RECURSION | CX_LOG_LEVEL_ERROR)
/*
* Message handlers
*/
typedef void (*cx_log_func) (const cxchar *, cx_log_level_flags,
const cxchar *, cxptr);
typedef void (*cx_print_func) (const cxchar *);
/*
* Messaging mechanisms
*/
void cx_log_default_handler(const cxchar *, cx_log_level_flags,
const cxchar *, cxptr);
cx_log_func cx_log_set_default_handler(cx_log_func);
cxuint cx_log_set_handler(const cxchar *, cx_log_level_flags,
cx_log_func, cxptr);
void cx_log_remove_handler(const cxchar *, cxuint);
cx_log_level_flags cx_log_set_fatal_mask(const cxchar *, cx_log_level_flags);
cx_log_level_flags cx_log_set_always_fatal(cx_log_level_flags);
cxsize cx_log_get_domain_count(void);
const cxchar *cx_log_get_domain_name(cxsize);
void cx_log(const cxchar *, cx_log_level_flags, const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 3, 4)))
#endif
;
void cx_logv(const cxchar *, cx_log_level_flags, const cxchar *, va_list)
#ifdef __GNUC__
__attribute__((format (printf, 3, 0)))
#endif
;
cx_print_func cx_print_set_handler(cx_print_func);
cx_print_func cx_printerr_set_handler(cx_print_func);
void cx_print(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 2)))
#endif
;
void cx_printerr(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 0)))
#endif
;
/*
* Convenience functions
*/
void cx_error(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 2)))
#endif
;
void cx_critical(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 2)))
#endif
;
void cx_warning(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 2)))
#endif
;
void cx_message(const cxchar *, ...)
#ifdef __GNUC__
__attribute__((format (printf, 1, 2)))
#endif
;
#ifndef CX_LOG_DOMAIN
# define CX_LOG_DOMAIN ((cxchar *)0)
#endif
/*
* Macros for error handling.
*/
#ifdef CX_DISABLE_ASSERT
# define cx_assert(expr) /* empty */
#else /* !CX_DISABLE_ASSERT */
# ifdef __GNUC__
# define cx_assert(expr) \
do { \
if (expr) { \
; \
} \
else { \
cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, \
"file %s: line %d (%s): assertion failed: (%s)", \
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
} \
} while (0)
# else /* !__GNUC__ */
# define cx_assert(expr) \
do { \
if (expr) { \
; \
} \
else { \
cx_log(CX_LOG_DOMAIN,CX_LOG_LEVEL_ERROR, \
"file %s: line %d: assertion failed: (%s)", \
__FILE__, __LINE__, #expr); \
} \
} while (0)
# endif /* !__GNUC__ */
#endif /* !CX_DISABLE_ASSERT */
CX_END_DECLS
#endif /* CX_MESSAGES_H */
|