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
|
/*
* The Rin Library – diagnostics module
*
* Copyright (C) 2015-2019 Gediminas Jakutis
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef LIBRIN_DIAGNOSTIC_INCLUDED
#define LIBRIN_DIAGNOSTIC_INCLUDED
#include "rin/definitions.h"
#include <stdio.h>
enum rin_diag_outstream {
rin_diag_err,
rin_diag_warn,
rin_diag_fixme,
rin_diag_info
};
void rin_diag_init(void);
int rin_diag_format(const enum rin_diag_outstream, const char * const format);
int rin_diag_set_outstream(const enum rin_diag_outstream channel, FILE * const stream);
int rin_diag_channel_set_enabled_state(const enum rin_diag_outstream channel, const unsigned int enable);
void __rin_err(const char * const func_name, int line_num, const char * const file_name, const char *format, ...) FORMAT_STRING(4, 5);
void __rin_warn(const char * const func_name, int line_num, const char * const file_name, const char *format, ...) FORMAT_STRING(4, 5);
void __rin_fixme(const char * const func_name, int line_num, const char * const file_name, const char *format, ...) FORMAT_STRING(4, 5);
void __rin_info(const char * const func_name, int line_num, const char * const file_name, const char *format, ...) FORMAT_STRING(4, 5);
#define rin_err(a,...) do {__rin_err(__func__, __LINE__, __FILE__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
#define rin_warn(a,...) do {__rin_warn(__func__, __LINE__, __FILE__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
#define rin_fixme(a,...) do {__rin_fixme(__func__, __LINE__, __FILE__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
#define rin_info(a,...) do {__rin_info(__func__, __LINE__, __FILE__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
#endif /* LIBRIN_DIAGNOSTIC_INCLUDED */
|