2 * Copyright © 2012 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 * Author: Daniel Stone <daniel@fooishbar.org>
32 xkb_context_num_failed_include_paths(struct xkb_context *ctx);
35 xkb_context_failed_include_path_get(struct xkb_context *ctx,
39 * Returns XKB_ATOM_NONE if @string was not previously interned,
40 * otherwise returns the atom.
43 xkb_atom_lookup(struct xkb_context *ctx, const char *string);
46 xkb_atom_intern(struct xkb_context *ctx, const char *string, size_t len);
48 #define xkb_atom_intern_literal(ctx, literal) \
49 xkb_atom_intern((ctx), (literal), sizeof(literal) - 1)
52 * If @string is dynamically allocated, NUL-terminated, free'd immediately
53 * after being interned, and not used afterwards, use this function
54 * instead of xkb_atom_intern to avoid some unnecessary allocations.
55 * The caller should not use or free the passed in string afterwards.
58 xkb_atom_steal(struct xkb_context *ctx, char *string);
61 xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
64 xkb_context_get_buffer(struct xkb_context *ctx, size_t size);
66 ATTR_PRINTF(4, 5) void
67 xkb_log(struct xkb_context *ctx, enum xkb_log_level level, int verbosity,
68 const char *fmt, ...);
71 xkb_context_get_default_rules(struct xkb_context *ctx);
74 xkb_context_get_default_model(struct xkb_context *ctx);
77 xkb_context_get_default_layout(struct xkb_context *ctx);
80 xkb_context_get_default_variant(struct xkb_context *ctx);
83 xkb_context_get_default_options(struct xkb_context *ctx);
86 * The format is not part of the argument list in order to avoid the
87 * "ISO C99 requires rest arguments to be used" warning when only the
88 * format is supplied without arguments. Not supplying it would still
89 * result in an error, though.
91 #define log_dbg(ctx, ...) \
92 xkb_log((ctx), XKB_LOG_LEVEL_DEBUG, 0, __VA_ARGS__)
93 #define log_info(ctx, ...) \
94 xkb_log((ctx), XKB_LOG_LEVEL_INFO, 0, __VA_ARGS__)
95 #define log_warn(ctx, ...) \
96 xkb_log((ctx), XKB_LOG_LEVEL_WARNING, 0, __VA_ARGS__)
97 #define log_err(ctx, ...) \
98 xkb_log((ctx), XKB_LOG_LEVEL_ERROR, 0, __VA_ARGS__)
99 #define log_wsgo(ctx, ...) \
100 xkb_log((ctx), XKB_LOG_LEVEL_CRITICAL, 0, __VA_ARGS__)
101 #define log_vrb(ctx, vrb, ...) \
102 xkb_log((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__)
105 * Variants which are prefixed by the name of the function they're
107 * Here we must have the silly 1 variant.
109 #define log_err_func(ctx, fmt, ...) \
110 log_err(ctx, "%s: " fmt, __func__, __VA_ARGS__)
111 #define log_err_func1(ctx, fmt) \
112 log_err(ctx, "%s: " fmt, __func__)