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
|
/*
* Copyright (C) 2002-2006 Sergey V. Udaltsov <svu@gnome.org>
*
* 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; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __XKLAVIER_H__
#define __XKLAVIER_H__
#include <stdarg.h>
#include <X11/Xlib.h>
#include <glib-object.h>
#include <libxklavier/xkl_engine.h>
#include <libxklavier/xkl_config_rec.h>
#include <libxklavier/xkl_config_item.h>
#include <libxklavier/xkl_config_registry.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xkl_get_last_error:
*
* Returns: the text message (statically allocated) of the last error
*/
extern const gchar *xkl_get_last_error(void);
/**
* _xkl_debug:
* @file: the name of the source file.
* Preprocessor symbol__FILE__ should be used here
* @function: name of the function
* Preprocessor symbol__func__ should be used here
* @level: level of the message
* @format: is a format (like in printf)
*
* Output (optionally) some debug info
*/
extern void _xkl_debug(const gchar file[], const gchar function[],
gint level, const gchar format[], ...);
/**
* XklLogAppender:
* @file: name of the source file.
* Preprocessor symbol__FILE__ should be used here
* @function: name of the function
* Preprocessor symbol__func__ should be used here
* @level: level of the message
* @format: format (like in printf)
* @args: list of parameters
*
* Custom log output method for _xkl_debug. This appender is NOT called if the
* level of the message is greater than currently set debug level.
*/
typedef void (*XklLogAppender) (const gchar file[],
const gchar function[],
gint level,
const gchar format[],
va_list args);
/**
* xkl_default_log_appender:
* @file: name of the source file.
* Preprocessor symbol__FILE__ should be used here
* @function: name of the function
* Preprocessor symbol__func__ should be used here
* @level: level of the message
* @format: format (like in printf)
* @args: list of parameters
*
* Default log output method. Sends everything to stdout.
*/
extern void xkl_default_log_appender(const gchar file[],
const gchar function[],
gint level,
const gchar format[],
va_list args);
/**
* xkl_set_log_appender:
* @fun: new log appender
*
* Installs the custom log appender.function
*/
extern void xkl_set_log_appender(XklLogAppender fun);
/**
* xkl_set_debug_level:
* @level: new debug level
*
* Sets maximum debug level.
* Message of the level more than the one set here - will be ignored
*/
extern void xkl_set_debug_level(gint level);
#ifdef G_HAVE_ISO_VARARGS
/**
* xkl_debug:
* @level: level of the message
*
* Output (optionally) some debug info
*/
#define xkl_debug( level, ... ) \
_xkl_debug( __FILE__, __func__, level, __VA_ARGS__ )
#elif defined(G_HAVE_GNUC_VARARGS)
/**
* xkl_debug:
* @level: level of the message
* @format: format (like in printf)
*
* Output (optionally) some debug info
*/
#define xkl_debug( level, format, args... ) \
_xkl_debug( __FILE__, __func__, level, format, ## args )
#else
#define xkl_debug( level, ... ) \
_xkl_debug( __FILE__, __func__, level, __VA_ARGS__ )
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|