src/atom.c \
src/atom.h \
src/context.c \
+ src/context.h \
src/darray.h \
src/keymap-dump.c \
src/keysym.c \
+ src/keysym.h \
src/keysym-utf.c \
src/list.h \
src/map.c \
+ src/map.h \
src/state.c \
src/text.c \
src/text.h \
- src/utils.h \
- src/xkb-priv.h
+ src/utils.h
BUILT_SOURCES = \
src/xkbcomp/parser.c \
*
********************************************************/
+#include "utils.h"
#include "atom.h"
struct atom_node {
#ifndef ATOM_H
#define ATOM_H
-#include "xkb-priv.h"
+typedef uint32_t xkb_atom_t;
+
+#define XKB_ATOM_NONE 0
struct atom_table;
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
#include <unistd.h>
-#include "xkb-priv.h"
-#include "atom.h"
+#include "xkbcommon/xkbcommon.h"
+#include "utils.h"
+#include "context.h"
+
+struct xkb_context {
+ int refcnt;
+
+ ATTR_PRINTF(3, 0) void (*log_fn)(struct xkb_context *ctx,
+ enum xkb_log_level level,
+ const char *fmt, va_list args);
+ enum xkb_log_level log_level;
+ int log_verbosity;
+ void *user_data;
+
+ darray(char *) includes;
+ darray(char *) failed_includes;
+
+ /* xkbcomp needs to assign sequential IDs to XkbFile's it creates. */
+ unsigned file_id;
+
+ struct atom_table *atom_table;
+};
/**
* Append one directory to the context's include path.
--- /dev/null
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+#include "atom.h"
+
+unsigned
+xkb_context_take_file_id(struct xkb_context *ctx);
+
+unsigned int
+xkb_context_num_failed_include_paths(struct xkb_context *ctx);
+
+const char *
+xkb_context_failed_include_path_get(struct xkb_context *ctx,
+ unsigned int idx);
+
+/*
+ * Returns XKB_ATOM_NONE if @string was not previously interned,
+ * otherwise returns the atom.
+ */
+xkb_atom_t
+xkb_atom_lookup(struct xkb_context *ctx, const char *string);
+
+xkb_atom_t
+xkb_atom_intern(struct xkb_context *ctx, const char *string);
+
+/**
+ * If @string is dynamically allocated, free'd immediately after
+ * being interned, and not used afterwards, use this function
+ * instead of xkb_atom_intern to avoid some unnecessary allocations.
+ * The caller should not use or free the passed in string afterwards.
+ */
+xkb_atom_t
+xkb_atom_steal(struct xkb_context *ctx, char *string);
+
+char *
+xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom);
+
+const char *
+xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
+
+ATTR_PRINTF(3, 4) void
+xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
+ const char *fmt, ...);
+
+#define xkb_log_cond_level(ctx, level, ...) do { \
+ if (xkb_get_log_level(ctx) >= (level)) \
+ xkb_log((ctx), (level), __VA_ARGS__); \
+} while (0)
+
+#define xkb_log_cond_verbosity(ctx, level, vrb, ...) do { \
+ if (xkb_get_log_verbosity(ctx) >= (vrb)) \
+ xkb_log_cond_level((ctx), (level), __VA_ARGS__); \
+} while (0)
+
+/*
+ * The format is not part of the argument list in order to avoid the
+ * "ISO C99 requires rest arguments to be used" warning when only the
+ * format is supplied without arguments. Not supplying it would still
+ * result in an error, though.
+ */
+#define log_dbg(ctx, ...) \
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#define log_info(ctx, ...) \
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_INFO, __VA_ARGS__)
+#define log_warn(ctx, ...) \
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_WARNING, __VA_ARGS__)
+#define log_err(ctx, ...) \
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_ERROR, __VA_ARGS__)
+#define log_wsgo(ctx, ...) \
+ xkb_log_cond_level((ctx), XKB_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define log_vrb(ctx, vrb, ...) \
+ xkb_log_cond_verbosity((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__)
+
+#endif
* Author: Daniel Stone <daniel@fooishbar.org>
*/
-#include <stdarg.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "xkb-priv.h"
+#include "map.h"
#include "text.h"
#define VMOD_HIDE_VALUE 0
* This software is in the public domain. Share and enjoy!
*
*/
-#include <stdint.h>
+
#include "xkbcommon/xkbcommon.h"
#include "utils.h"
* DEALINGS IN THE SOFTWARE.
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "xkb-priv.h"
+#include "xkbcommon/xkbcommon.h"
+#include "utils.h"
#include "ks_tables.h"
+#include "keysym.h"
XKB_EXPORT void
xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
--- /dev/null
+/*
+ * Copyright 1985, 1987, 1990, 1998 The Open Group
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the authors or their
+ * institutions shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the authors.
+ */
+
+/*
+ * Copyright © 2009 Dan Nicholson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef KEYSYM_H
+#define KEYSYM_H
+
+bool
+xkb_keysym_is_lower(xkb_keysym_t keysym);
+
+bool
+xkb_keysym_is_upper(xkb_keysym_t keysym);
+
+bool
+xkb_keysym_is_keypad(xkb_keysym_t keysym);
+
+#endif
*
* ********************************************************/
-#include "xkb-priv.h"
+#include "map.h"
#include "text.h"
struct xkb_keymap *
* Dan Nicholson <dbn.lists@gmail.com>
*/
-#ifndef XKB_PRIV_H
-#define XKB_PRIV_H
-
-#include <stdbool.h>
-#include <string.h>
-#include <strings.h>
+#ifndef MAP_H
+#define MAP_H
#include "xkbcommon/xkbcommon.h"
#include "utils.h"
-#include "darray.h"
+#include "context.h"
typedef uint32_t xkb_level_index_t;
-typedef uint32_t xkb_atom_t;
-#define XKB_ATOM_NONE 0
#define XKB_LEVEL_INVALID 0xffffffff
#define XKB_KEY_NAME_LENGTH 4
#define XKB_NUM_VIRTUAL_MODS 16
#define XKB_NUM_CORE_MODS 8
-struct xkb_context {
- int refcnt;
-
- ATTR_PRINTF(3, 0) void (*log_fn)(struct xkb_context *ctx,
- enum xkb_log_level level,
- const char *fmt, va_list args);
- enum xkb_log_level log_level;
- int log_verbosity;
- void *user_data;
-
- darray(char *) includes;
- darray(char *) failed_includes;
-
- /* xkbcomp needs to assign sequential IDs to XkbFile's it creates. */
- unsigned file_id;
-
- struct atom_table *atom_table;
-};
-
-/**
- * Legacy names for the components of an XKB keymap, also known as KcCGST.
- */
-struct xkb_component_names {
- char *keycodes;
- char *types;
- char *compat;
- char *symbols;
-};
-
enum xkb_action_type {
ACTION_TYPE_NONE = 0,
ACTION_TYPE_MOD_SET,
struct xkb_keymap *
xkb_map_new(struct xkb_context *ctx);
-/*
- * Returns XKB_ATOM_NONE if @string was not previously interned,
- * otherwise returns the atom.
- */
-xkb_atom_t
-xkb_atom_lookup(struct xkb_context *ctx, const char *string);
-
-xkb_atom_t
-xkb_atom_intern(struct xkb_context *ctx, const char *string);
-
-/**
- * If @string is dynamically allocated, free'd immediately after
- * being interned, and not used afterwards, use this function
- * instead of xkb_atom_intern to avoid some unnecessary allocations.
- * The caller should not use or free the passed in string afterwards.
- */
-xkb_atom_t
-xkb_atom_steal(struct xkb_context *ctx, char *string);
-
-char *
-xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom);
-
-const char *
-xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
-
xkb_group_index_t
xkb_key_get_group(struct xkb_state *state, const struct xkb_key *key);
xkb_key_get_level(struct xkb_state *state, const struct xkb_key *key,
xkb_group_index_t group);
-extern int
+int
xkb_key_get_syms_by_level(struct xkb_keymap *keymap,
const struct xkb_key *key,
xkb_group_index_t group, xkb_level_index_t level,
const xkb_keysym_t **syms_out);
-extern unsigned
-xkb_context_take_file_id(struct xkb_context *ctx);
-
-unsigned int
-xkb_context_num_failed_include_paths(struct xkb_context *ctx);
-
-const char *
-xkb_context_failed_include_path_get(struct xkb_context *ctx,
- unsigned int idx);
-
-bool
-xkb_keysym_is_lower(xkb_keysym_t keysym);
-
-bool
-xkb_keysym_is_upper(xkb_keysym_t keysym);
-
-bool
-xkb_keysym_is_keypad(xkb_keysym_t keysym);
-
-ATTR_PRINTF(3, 4) void
-xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
- const char *fmt, ...);
-
-#define xkb_log_cond_level(ctx, level, ...) do { \
- if (xkb_get_log_level(ctx) >= (level)) \
- xkb_log((ctx), (level), __VA_ARGS__); \
-} while (0)
-
-#define xkb_log_cond_verbosity(ctx, level, vrb, ...) do { \
- if (xkb_get_log_verbosity(ctx) >= (vrb)) \
- xkb_log_cond_level((ctx), (level), __VA_ARGS__); \
-} while (0)
-
-/*
- * The format is not part of the argument list in order to avoid the
- * "ISO C99 requires rest arguments to be used" warning when only the
- * format is supplied without arguments. Not supplying it would still
- * result in an error, though.
- */
-#define log_dbg(ctx, ...) \
- xkb_log_cond_level((ctx), XKB_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#define log_info(ctx, ...) \
- xkb_log_cond_level((ctx), XKB_LOG_LEVEL_INFO, __VA_ARGS__)
-#define log_warn(ctx, ...) \
- xkb_log_cond_level((ctx), XKB_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define log_err(ctx, ...) \
- xkb_log_cond_level((ctx), XKB_LOG_LEVEL_ERROR, __VA_ARGS__)
-#define log_wsgo(ctx, ...) \
- xkb_log_cond_level((ctx), XKB_LOG_LEVEL_CRITICAL, __VA_ARGS__)
-#define log_vrb(ctx, vrb, ...) \
- xkb_log_cond_verbosity((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__)
-
-#endif /* XKB_PRIV_H */
+#endif
* - messages (very unlikely)
*/
-#include <assert.h>
-#include <stdarg.h>
-
-#include "xkb-priv.h"
+#include "map.h"
struct xkb_filter {
union xkb_action action;
*
********************************************************/
+#include "map.h"
#include "text.h"
bool
#ifndef TEXT_H
#define TEXT_H
-#include "xkb-priv.h"
-
typedef struct {
const char *name;
unsigned int value;
#ifndef UTILS_H
#define UTILS_H 1
+#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
+#include <strings.h>
+
+#include "darray.h"
/*
* We sometimes malloc strings and then expose them as const char*'s. This
* DEALINGS IN THE SOFTWARE.
*/
-#include <stdarg.h>
-#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include "vmod.h"
#include "keycodes.h"
#include "include.h"
+#include "keysym.h"
enum key_repeat {
KEY_REPEAT_UNDEFINED = 0,
#ifndef XKBCOMP_PRIV_H
#define XKBCOMP_PRIV_H
-#include "xkb-priv.h"
+#include "map.h"
#include "ast.h"
+struct xkb_component_names {
+ char *keycodes;
+ char *types;
+ char *compat;
+ char *symbols;
+};
+
bool
XkbParseFile(struct xkb_context *ctx, FILE *file, const char *file_name,
XkbFile **out);
* Ran Benita <ran234@gmail.com>
*/
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
const char *
* Author: Daniel Stone <daniel@fooishbar.org>
*/
-#include <assert.h>
-
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
+#include "context.h"
int
main(void)
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
static int
#include <limits.h>
#include <locale.h>
#include <signal.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <linux/input.h>
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
struct keyboard {
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-
#include <linux/input.h>
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
enum {
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
#include "test.h"
static int
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
#include "test.h"
-#include "xkb-priv.h"
+#include "context.h"
#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
#include <unistd.h>
#include "test.h"
-#include "xkb-priv.h"
+#include "xkbcomp-priv.h"
#include "rules.h"
int
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
#include <time.h>
#include "test.h"
-#include "xkb-priv.h"
+#include "xkbcomp-priv.h"
#include "rules.h"
#define BENCHMARK_ITERATIONS 20000
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdio.h>
#include <time.h>
-#include "xkbcommon/xkbcommon.h"
#include "test.h"
#define BENCHMARK_ITERATIONS 1000
* Author: Daniel Stone <daniel@fooishbar.org>
*/
+#include <assert.h>
+
#include "xkbcommon/xkbcommon.h"
#include "utils.h"
#ifndef _XKBCOMMON_H_
#define _XKBCOMMON_H_
-#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>