Makefile.am | 72 README | 17 configure.ac | 45 debian/changelog | 21 debian/libxkbcommon0.symbols | 5 debian/rules | 5 debian/watch | 2 doc/Doxyfile.in | 126 - src/context.c | 85 src/context.h | 28 src/darray.h | 6 src/keymap-dump.c | 688 ------ src/keymap.c | 248 ++ src/keymap.h | 55 src/keysym-utf.c | 39 src/keysym.c | 8 src/list.h | 489 ---- src/state.c | 302 +- src/text.c | 238 +- src/text.h | 2 src/utils.c | 107 + src/utils.h | 20 src/xkbcomp/.gitignore | 1 src/xkbcomp/action.c | 34 src/xkbcomp/ast-build.c | 242 +- src/xkbcomp/ast-build.h | 8 src/xkbcomp/ast.h | 9 src/xkbcomp/compat.c | 308 +- src/xkbcomp/include.c | 48 src/xkbcomp/include.h | 5 src/xkbcomp/keycodes.c | 531 ++--- src/xkbcomp/keycodes.h | 37 src/xkbcomp/keymap-dump.c | 669 ++++++ src/xkbcomp/keymap.c | 16 src/xkbcomp/keywords.c | 349 +++ src/xkbcomp/keywords.gperf | 79 src/xkbcomp/parser-priv.h | 14 src/xkbcomp/parser.y | 34 src/xkbcomp/rules.c | 138 - src/xkbcomp/scanner-utils.h | 148 + src/xkbcomp/scanner.c | 205 + src/xkbcomp/scanner.l | 291 -- src/xkbcomp/symbols.c | 145 - src/xkbcomp/types.c | 153 - src/xkbcomp/xkbcomp-priv.h | 22 src/xkbcomp/xkbcomp.c | 144 - test/.gitignore | 2 test/bench-key-proc.c | 95 test/buffercomp.c | 90 test/common.c | 149 + test/context.c | 2 test/data/compat/default | 12 test/data/compat/iso9995 | 4 test/data/keymaps/stringcomp.data | 3817 ++++++++++++++++++------------------- test/data/keymaps/unbound-vmod.xkb | 1533 ++++++++++++++ test/data/rules/base | 75 test/data/rules/evdev | 81 test/data/symbols/altwin | 13 test/data/symbols/ca | 5 test/data/symbols/de | 36 test/data/symbols/il | 80 test/data/symbols/in | 75 test/data/symbols/inet | 2 test/data/symbols/keypad | 11 test/data/symbols/latin | 2 test/data/symbols/level3 | 42 test/data/symbols/level5 | 26 test/data/symbols/pc | 2 test/data/symbols/ru | 13 test/data/symbols/rupeesign | 5 test/data/symbols/us | 163 + test/data/sync.sh | 63 test/data/types/level5 | 1 test/data/types/pc | 8 test/filecomp.c | 11 test/interactive.c | 24 test/keyseq.c | 196 - test/keysym.c | 21 test/log.c | 2 test/print-compiled-keymap.c | 2 test/rmlvo-to-kccgst.c | 15 test/rules-file.c | 2 test/rulescomp.c | 170 + test/state.c | 30 test/stringcomp.c | 12 test/test.h | 31 xkbcommon/xkbcommon.h | 261 +- 87 files changed, 8115 insertions(+), 5307 deletions(-)
New commits: commit 6ba35f172e2049d87063fb8956a5384480a7c7e1 Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:51:16 2013 +0200 Release to unstable diff --git a/debian/changelog b/debian/changelog index f247e53..3767050 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,6 @@ -libxkbcommon (0.3.1-1) UNRELEASED; urgency=low +libxkbcommon (0.3.1-1) unstable; urgency=low + + * Team upload. [ Timo Aaltonen ] * New upstream release 0.2.0. (Closes: #691699) @@ -30,7 +32,7 @@ libxkbcommon (0.3.1-1) UNRELEASED; urgency=low new or missing symbols. + Make the build verbose. - -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 + -- Emilio Pozuelo Monfort <[email protected]> Sun, 09 Jun 2013 01:50:50 +0200 libxkbcommon (0.1.0~1-1) experimental; urgency=low commit a5633ce0e19f8117bc922ebc7c1cbee3431045cd Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:50:33 2013 +0200 Make the build verbose diff --git a/debian/changelog b/debian/changelog index f3bbd0c..f247e53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,7 @@ libxkbcommon (0.3.1-1) UNRELEASED; urgency=low * debian/rules: + Pass -c4 to dpkg-gensymbols to abort the build if there are any new or missing symbols. + + Make the build verbose. -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 diff --git a/debian/rules b/debian/rules index 7e6ce71..1614f3c 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) # We need to point to xkb-data's files. The default should be OK but # let's be cautious: override_dh_auto_configure: - dh_auto_configure -- --with-xkb-config-root=/usr/share/X11/xkb + dh_auto_configure -- --disable-silent-rules --with-xkb-config-root=/usr/share/X11/xkb # Kill *.la files, and forget no-one: override_dh_install: commit 155400eed22235a6edad4f667ca6c307c557bc9e Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:43:10 2013 +0200 Add new symbols diff --git a/debian/changelog b/debian/changelog index ba4a737..f3bbd0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,7 @@ libxkbcommon (0.3.1-1) UNRELEASED; urgency=low * New upstream release 0.3.1. * debian/libxkbcommon0.symbols: + Add Build-Depends-Package field. + + Add new symbols. * debian/rules: + Pass -c4 to dpkg-gensymbols to abort the build if there are any new or missing symbols. diff --git a/debian/libxkbcommon0.symbols b/debian/libxkbcommon0.symbols index a2a021b..62a8316 100644 --- a/debian/libxkbcommon0.symbols +++ b/debian/libxkbcommon0.symbols @@ -22,14 +22,18 @@ libxkbcommon.so.0 libxkbcommon0 #MINVER# xkb_key_num_groups@Base 0.2.0 xkb_key_repeats@Base 0.2.0 xkb_keymap_get_as_string@Base 0.2.0 + xkb_keymap_key_for_each@Base 0.3.1 xkb_keymap_key_get_syms_by_level@Base 0.2.0 xkb_keymap_key_repeats@Base 0.2.0 xkb_keymap_layout_get_index@Base 0.2.0 xkb_keymap_layout_get_name@Base 0.2.0 xkb_keymap_led_get_index@Base 0.2.0 xkb_keymap_led_get_name@Base 0.2.0 + xkb_keymap_max_keycode@Base 0.3.1 + xkb_keymap_min_keycode@Base 0.3.1 xkb_keymap_mod_get_index@Base 0.2.0 xkb_keymap_mod_get_name@Base 0.2.0 + xkb_keymap_new_from_buffer@Base 0.3.1 xkb_keymap_new_from_file@Base 0.2.0 xkb_keymap_new_from_names@Base 0.2.0 xkb_keymap_new_from_string@Base 0.2.0 commit 357f1991e483861a8f77e98c9169417ff7bf3b15 Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:25:45 2013 +0200 Pass -c4 to dpkg-gensymbols diff --git a/debian/changelog b/debian/changelog index 32e5034..ba4a737 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,9 @@ libxkbcommon (0.3.1-1) UNRELEASED; urgency=low * New upstream release 0.3.1. * debian/libxkbcommon0.symbols: + Add Build-Depends-Package field. + * debian/rules: + + Pass -c4 to dpkg-gensymbols to abort the build if there are any + new or missing symbols. -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 diff --git a/debian/rules b/debian/rules index 7fc8ca3..7e6ce71 100755 --- a/debian/rules +++ b/debian/rules @@ -12,6 +12,9 @@ override_dh_install: find debian/tmp -name '*.la' -delete dh_install --fail-missing +override_dh_makeshlibs: + dh_makeshlibs -- -c4 + ifneq ($(DEB_HOST_ARCH_OS), linux) override_dh_auto_test: endif commit 9d95989bef4e5be1fb9a893c60a3587cba5b7996 Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:24:32 2013 +0200 Add Build-Depends-Package field to symbols file. diff --git a/debian/changelog b/debian/changelog index fe32ae9..32e5034 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,8 @@ libxkbcommon (0.3.1-1) UNRELEASED; urgency=low * debian/watch: + Look for .xz tarballs. * New upstream release 0.3.1. + * debian/libxkbcommon0.symbols: + + Add Build-Depends-Package field. -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 diff --git a/debian/libxkbcommon0.symbols b/debian/libxkbcommon0.symbols index 71b68b3..a2a021b 100644 --- a/debian/libxkbcommon0.symbols +++ b/debian/libxkbcommon0.symbols @@ -1,4 +1,5 @@ libxkbcommon.so.0 libxkbcommon0 #MINVER# +* Build-Depends-Package: libxkbcommon-dev xkb_context_get_log_level@Base 0.2.0 xkb_context_get_log_verbosity@Base 0.2.0 xkb_context_get_user_data@Base 0.2.0 commit 1f0f747033daa43e9b514af748eb43702e4c889c Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:11:20 2013 +0200 New upstream release. diff --git a/debian/changelog b/debian/changelog index 4f370ef..fe32ae9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ -libxkbcommon (0.2.0-1) UNRELEASED; urgency=low +libxkbcommon (0.3.1-1) UNRELEASED; urgency=low [ Timo Aaltonen ] - * New upstream release. (Closes: #691699) + * New upstream release 0.2.0. (Closes: #691699) * libxkbcommon-dev.install: Add new headers, rename existing. * control: Update Standards-Version, no changes. * watch: Updated. @@ -21,6 +21,7 @@ libxkbcommon (0.2.0-1) UNRELEASED; urgency=low [ Emilio Pozuelo Monfort ] * debian/watch: + Look for .xz tarballs. + * New upstream release 0.3.1. -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 commit 44a4eef0e81dea17024ce8f40c4500c143ce3018 Author: Emilio Pozuelo Monfort <[email protected]> Date: Sun Jun 9 01:38:17 2013 +0200 Look for .xz tarballs diff --git a/debian/changelog b/debian/changelog index 8b55d74..4f370ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ libxkbcommon (0.2.0-1) UNRELEASED; urgency=low + [ Timo Aaltonen ] * New upstream release. (Closes: #691699) * libxkbcommon-dev.install: Add new headers, rename existing. * control: Update Standards-Version, no changes. @@ -17,6 +18,10 @@ libxkbcommon (0.2.0-1) UNRELEASED; urgency=low * rules: Replace old tarball target with generic gentarball target. * rules: Don't run tests on !linux. + [ Emilio Pozuelo Monfort ] + * debian/watch: + + Look for .xz tarballs. + -- Timo Aaltonen <[email protected]> Thu, 16 Aug 2012 21:37:51 +0300 libxkbcommon (0.1.0~1-1) experimental; urgency=low diff --git a/debian/watch b/debian/watch index 2814833..1179500 100644 --- a/debian/watch +++ b/debian/watch @@ -1,3 +1,3 @@ #git=git://anongit.freedesktop.org/xorg/lib/libxkbcommon version=3 -http://xkbcommon.org/download/libxkbcommon-(.*)\.tar\.gz +http://xkbcommon.org/download/libxkbcommon-(.*)\.tar\.xz commit 9f01bd1e7281bdc07dec1109384ab1030f72425e Author: Daniel Stone <[email protected]> Date: Mon Jun 3 16:43:43 2013 +0100 Bump version to 0.3.1 Signed-off-by: Daniel Stone <[email protected]> diff --git a/configure.ac b/configure.ac index 2806a2c..bc3f1a0 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.62]) -AC_INIT([libxkbcommon], [0.3.0], +AC_INIT([libxkbcommon], [0.3.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon], [libxkbcommon], [http://xkbcommon.org]) AC_CONFIG_SRCDIR([Makefile.am]) commit b06de3072b46a5108878b8e00f934f01fdb6a0ff Author: Matthias Clasen <[email protected]> Date: Thu May 9 15:31:21 2013 +0100 Add keycode min/max and iteration API Add three new pieces of API: - xkb_keymap_min_keycode does what it says on the tin - xkb_keymap_max_keycode likewise - xkb_keymap_key_for_each calls the provided function once for every valid key in the keymap Signed-off-by: Daniel Stone <[email protected]> diff --git a/src/keymap.c b/src/keymap.c index 55000f4..8205bab 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -484,6 +484,28 @@ err: return 0; } +XKB_EXPORT xkb_keycode_t +xkb_keymap_min_keycode(struct xkb_keymap *keymap) +{ + return keymap->min_key_code; +} + +XKB_EXPORT xkb_keycode_t +xkb_keymap_max_keycode(struct xkb_keymap *keymap) +{ + return keymap->max_key_code; +} + +XKB_EXPORT void +xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, + void *data) +{ + struct xkb_key *key; + + xkb_foreach_key(key, keymap) + iter(keymap, key->keycode, data); +} + /** * Simple boolean specifying whether or not the key should repeat. */ diff --git a/test/state.c b/test/state.c index 34da201..3521d66 100644 --- a/test/state.c +++ b/test/state.c @@ -331,6 +331,28 @@ test_consume(struct xkb_keymap *keymap) xkb_state_unref(state); } +static void +key_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) +{ + int *counter = (int *) data; + + assert(*counter == key); + (*counter)++; +} + +static void +test_range(struct xkb_keymap *keymap) +{ + int counter; + + assert(xkb_keymap_min_keycode(keymap) == 9); + assert(xkb_keymap_max_keycode(keymap) == 253); + + counter = xkb_keymap_min_keycode(keymap); + xkb_keymap_key_for_each(keymap, key_iter, &counter); + assert(counter == xkb_keymap_max_keycode(keymap) + 1); +} + int main(void) { @@ -351,6 +373,7 @@ main(void) test_serialisation(keymap); test_repeat(keymap); test_consume(keymap); + test_range(keymap); xkb_keymap_unref(keymap); xkb_context_unref(context); diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h index a2aecfb..ff2ce68 100644 --- a/xkbcommon/xkbcommon.h +++ b/xkbcommon/xkbcommon.h @@ -812,6 +812,46 @@ xkb_keymap_get_as_string(struct xkb_keymap *keymap, */ /** + * Get the minimum keycode in the keymap. + * + * @sa xkb_keycode_t + * @memberof xkb_keymap + */ +xkb_keycode_t +xkb_keymap_min_keycode(struct xkb_keymap *keymap); + +/** + * Get the maximum keycode in the keymap. + * + * @sa xkb_keycode_t + * @memberof xkb_keymap + */ +xkb_keycode_t +xkb_keymap_max_keycode(struct xkb_keymap *keymap); + +/** + * The iterator used by xkb_keymap_key_for_each(). + * + * @sa xkb_keymap_key_for_each + * @memberof xkb_keymap + */ +typedef void +(*xkb_keymap_key_iter_t)(struct xkb_keymap *keymap, xkb_keycode_t key, + void *data); + +/** + * Run a specified function for every valid keycode in the keymap. If a + * keymap is sparse, this function may be called fewer than + * (max_keycode - min_keycode + 1) times. + * + * @sa xkb_keymap_min_keycode() xkb_keymap_max_keycode() xkb_keycode_t + * @memberof xkb_keymap + */ +void +xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, + void *data); + +/** * Get the number of modifiers in the keymap. * * @sa xkb_mod_index_t commit 17a956d80781846903c90b7bd4beaf8ac7aac40c Author: Daniel Stone <[email protected]> Date: Thu May 9 14:47:09 2013 +0100 Widen keycode range to 8/255 if possible (bug #63390) If the keycode range is smaller than 8 → 255, artifically widen it when dumping the keymap as not to displease X. Signed-off-by: Daniel Stone <[email protected]> diff --git a/src/utils.h b/src/utils.h index 160bc42..eca6368 100644 --- a/src/utils.h +++ b/src/utils.h @@ -93,6 +93,18 @@ memdup(const void *mem, size_t nmemb, size_t size) return p; } +static inline int +min(int misc, int other) +{ + return (misc < other) ? misc : other; +} + +static inline int +max(int misc, int other) +{ + return (misc > other) ? misc : other; +} + bool map_file(FILE *file, const char **string_out, size_t *size_out); diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c index 034a8c1..0933873 100644 --- a/src/xkbcomp/keymap-dump.c +++ b/src/xkbcomp/keymap-dump.c @@ -157,6 +157,13 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf) else write_buf(buf, "xkb_keycodes {\n"); + /* xkbcomp and X11 really want to see keymaps with a minimum of 8, and + * a maximum of at least 255, else XWayland really starts hating life. + * If this is a problem and people really need strictly bounded keymaps, + * we should probably control this with a flag. */ + write_buf(buf, "\tminimum = %d;\n", min(keymap->min_key_code, 8)); + write_buf(buf, "\tmaximum = %d;\n", max(keymap->max_key_code, 255)); + xkb_foreach_key(key, keymap) { if (key->name == XKB_ATOM_NONE) continue; diff --git a/test/data/keymaps/stringcomp.data b/test/data/keymaps/stringcomp.data index 7d21eb5..8f80fcc 100644 --- a/test/data/keymaps/stringcomp.data +++ b/test/data/keymaps/stringcomp.data @@ -1,5 +1,7 @@ xkb_keymap { xkb_keycodes "evdev_aliases(qwerty)" { + minimum = 8; + maximum = 255; <ESC> = 9; <AE01> = 10; <AE02> = 11; commit a392d2682bfbf5ce6c3ee153c6a08bb456da0660 Author: Ran Benita <[email protected]> Date: Sun Aug 12 11:40:02 2012 +0300 Replace flex scanner with a hand-written one The scanner is very similar in structure to the one in xkbcomp/rules.c. It avoids copying and has nicer error reporting. It uses gperf to generate a hashtable for the keywords, which gives a nice speed boost (compared to the naive strcasecmp method at least). But since there's hardly a reason to regenerate it every time and require people to install gperf, the output (keywords.c) is added here as well. Here are some stats from test/rulescomp: Before: compiled 1000 keymaps in 4.052939625s ==22063== total heap usage: 101,101 allocs, 101,101 frees, 11,840,834 bytes allocated After: compiled 1000 keymaps in 3.519665434s ==26505== total heap usage: 99,945 allocs, 99,945 frees, 7,033,608 bytes allocated Signed-off-by: Ran Benita <[email protected]> diff --git a/Makefile.am b/Makefile.am index 0d43f39..98cabc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,11 +38,12 @@ libxkbcommon_la_SOURCES = \ src/xkbcomp/keycodes.c \ src/xkbcomp/keymap.c \ src/xkbcomp/keymap-dump.c \ + src/xkbcomp/keywords.c \ src/xkbcomp/parser.y \ src/xkbcomp/parser-priv.h \ src/xkbcomp/rules.c \ src/xkbcomp/rules.h \ - src/xkbcomp/scanner.l \ + src/xkbcomp/scanner.c \ src/xkbcomp/scanner-utils.h \ src/xkbcomp/symbols.c \ src/xkbcomp/types.c \ @@ -70,13 +71,11 @@ libxkbcommon_la_SOURCES = \ BUILT_SOURCES = \ src/xkbcomp/parser.c \ - src/xkbcomp/parser.h \ - src/xkbcomp/scanner.c + src/xkbcomp/parser.h CLEANFILES = $(BUILT_SOURCES) src/xkbcomp/parser.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp) src/xkbcomp/parser.h: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp) -src/xkbcomp/scanner.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp) # Documentation @@ -171,7 +170,6 @@ EXTRA_DIST = \ # removes #define _OSF_Keysyms and such. The XK_Ydiaeresis case is to # handle a duplicate definition in HPkeysyms.h which kicks in if it's # not already defined. - X11_INCLUDEDIR = /usr/include/X11 KEYSYMDEFS = \ $(X11_INCLUDEDIR)/keysymdef.h \ @@ -191,6 +189,11 @@ update-keysyms: echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' > $(top_srcdir)/src/ks_tables.h LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h >> $(top_srcdir)/src/ks_tables.h +# Run this if you add/remove a new keyword to the xkbcomp scanner, +# or just want to regenerate the gperf file. +update-keywords: + $(AM_V_GEN)gperf < $(top_srcdir)/src/xkbcomp/keywords.gperf > $(top_srcdir)/src/xkbcomp/keywords.c + # Android stuff Android_build.mk: Makefile $(BUILT_SOURCES) diff --git a/configure.ac b/configure.ac index ec829cd..2806a2c 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,7 @@ AC_C_INLINE # Check for programs AC_PROG_MKDIR_P PKG_PROG_PKG_CONFIG -AC_PROG_LEX + AC_PROG_YACC AC_PATH_PROG([YACC_INST], $YACC) if test ! -f "src/xkbcomp/parser.c"; then diff --git a/src/keymap.c b/src/keymap.c index 3df183a..55000f4 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -190,35 +190,7 @@ xkb_keymap_new_from_string(struct xkb_context *ctx, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags) { - struct xkb_keymap *keymap; - const struct xkb_keymap_format_ops *ops; - - ops = get_keymap_format_ops(format); - if (!ops || !ops->keymap_new_from_string) { - log_err_func(ctx, "unsupported keymap format: %d\n", format); - return NULL; - } - - if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) { - log_err_func(ctx, "unrecognized flags: %#x\n", flags); - return NULL; - } - - if (!string) { - log_err_func1(ctx, "no string specified\n"); - return NULL; - } - - keymap = xkb_keymap_new(ctx, format, flags); - if (!keymap) - return NULL; - - if (!ops->keymap_new_from_string(keymap, string)) { - xkb_keymap_unref(keymap); - return NULL; - } - - return keymap; + return xkb_keymap_new_from_buffer(ctx, string, SIZE_MAX, format, flags); } XKB_EXPORT struct xkb_keymap * @@ -250,7 +222,7 @@ xkb_keymap_new_from_buffer(struct xkb_context *ctx, if (!keymap) return NULL; - if (!ops->keymap_new_from_buffer(keymap, buffer, length)) { + if (!ops->keymap_new_from_string(keymap, buffer, length)) { xkb_keymap_unref(keymap); return NULL; } diff --git a/src/keymap.h b/src/keymap.h index c6b884d..7d51184 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -439,9 +439,7 @@ struct xkb_keymap_format_ops { bool (*keymap_new_from_names)(struct xkb_keymap *keymap, const struct xkb_rule_names *names); bool (*keymap_new_from_string)(struct xkb_keymap *keymap, - const char *string); - bool (*keymap_new_from_buffer)(struct xkb_keymap *keymap, - const char *buffer, size_t length); + const char *string, size_t length); bool (*keymap_new_from_file)(struct xkb_keymap *keymap, FILE *file); char *(*keymap_get_as_string)(struct xkb_keymap *keymap); }; diff --git a/src/xkbcomp/.gitignore b/src/xkbcomp/.gitignore index 2081535..d7814e4 100644 --- a/src/xkbcomp/.gitignore +++ b/src/xkbcomp/.gitignore @@ -1,3 +1,2 @@ parser.c parser.h -scanner.c diff --git a/src/xkbcomp/keywords.c b/src/xkbcomp/keywords.c new file mode 100644 index 0000000..dba7086 --- /dev/null +++ b/src/xkbcomp/keywords.c @@ -0,0 +1,349 @@ +/* ANSI-C code produced by gperf version 3.0.4 */ +/* Command-line: gperf */ +/* Computed positions: -k'1-2,5' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>." +#endif + + +#include "xkbcomp-priv.h" +#include "parser-priv.h" + +static unsigned int +keyword_gperf_hash(const char *str, unsigned int len); + +static const struct keyword_tok * +keyword_gperf_lookup(const char *str, unsigned int len); +struct keyword_tok { int name; enum yytokentype tok; }; +#include <string.h> +/* maximum key range = 70, duplicates = 0 */ + +#ifndef GPERF_DOWNCASE +#define GPERF_DOWNCASE 1 +static unsigned char gperf_downcase[256] = + { + 0, 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, 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, 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, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255 + }; +#endif + +#ifndef GPERF_CASE_STRCMP +#define GPERF_CASE_STRCMP 1 +static int +gperf_case_strcmp (register const char *s1, register const char *s2) +{ + for (;;) + { + unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; + unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; + if (c1 != 0 && c1 == c2) + continue; + return (int)c1 - (int)c2; + } +} +#endif + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +keyword_gperf_hash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 0, 73, 5, 36, 0, + 10, 1, 15, 15, 73, 0, 10, 20, 35, 20, + 50, 73, 10, 10, 5, 0, 15, 73, 0, 15, + 73, 73, 73, 73, 73, 73, 73, 0, 73, 5, + 36, 0, 10, 1, 15, 15, 73, 0, 10, 20, + 35, 20, 50, 73, 10, 10, 5, 0, 15, 73, + 0, 15, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ + case 4: + case 3: + case 2: + hval += asso_values[(unsigned char)str[1]]; + /*FALLTHROUGH*/ + case 1: + hval += asso_values[(unsigned char)str[0]]; + break; + } + return hval; +} + +struct stringpool_t + { + char stringpool_str3[sizeof("key")]; + char stringpool_str4[sizeof("keys")]; + char stringpool_str7[sizeof("augment")]; + char stringpool_str9[sizeof("text")]; + char stringpool_str10[sizeof("xkb_keymap")]; + char stringpool_str11[sizeof("keypad_keys")]; + char stringpool_str12[sizeof("xkb_keycodes")]; + char stringpool_str13[sizeof("xkb_geometry")]; + char stringpool_str14[sizeof("xkb_types")]; + char stringpool_str15[sizeof("xkb_compat")]; + char stringpool_str17[sizeof("replace")]; + char stringpool_str19[sizeof("xkb_compat_map")]; + char stringpool_str20[sizeof("xkb_layout")]; + char stringpool_str21[sizeof("xkb_symbols")]; + char stringpool_str22[sizeof("xkb_compatibility")]; + char stringpool_str23[sizeof("xkb_semantics")]; + char stringpool_str24[sizeof("type")]; + char stringpool_str25[sizeof("alias")]; + char stringpool_str26[sizeof("xkb_compatibility_map")]; + char stringpool_str27[sizeof("alphanumeric_keys")]; + char stringpool_str28[sizeof("function_keys")]; + char stringpool_str29[sizeof("alternate")]; + char stringpool_str30[sizeof("shape")]; + char stringpool_str31[sizeof("action")]; + char stringpool_str32[sizeof("section")]; + char stringpool_str33[sizeof("row")]; + char stringpool_str34[sizeof("logo")]; + char stringpool_str35[sizeof("alternate_group")]; + char stringpool_str36[sizeof("hidden")]; + char stringpool_str37[sizeof("virtual")]; + char stringpool_str42[sizeof("outline")]; + char stringpool_str43[sizeof("default")]; + char stringpool_str46[sizeof("modmap")]; + char stringpool_str47[sizeof("virtual_modifiers")]; + char stringpool_str52[sizeof("overlay")]; + char stringpool_str53[sizeof("override")]; + char stringpool_str57[sizeof("include")]; + char stringpool_str62[sizeof("modifier_map")]; + char stringpool_str63[sizeof("modifier_keys")]; + char stringpool_str64[sizeof("indicator")]; + char stringpool_str66[sizeof("group")]; + char stringpool_str67[sizeof("mod_map")]; + char stringpool_str69[sizeof("interpret")]; + char stringpool_str71[sizeof("solid")]; + char stringpool_str72[sizeof("partial")]; + }; +static const struct stringpool_t stringpool_contents = + { + "key", + "keys", + "augment", + "text", + "xkb_keymap", + "keypad_keys", + "xkb_keycodes", + "xkb_geometry", + "xkb_types", + "xkb_compat", + "replace", + "xkb_compat_map", + "xkb_layout", + "xkb_symbols", + "xkb_compatibility", + "xkb_semantics", + "type", + "alias", + "xkb_compatibility_map", + "alphanumeric_keys", + "function_keys", + "alternate", + "shape", + "action", + "section", + "row", + "logo", + "alternate_group", + "hidden", + "virtual", + "outline", + "default", + "modmap", + "virtual_modifiers", + "overlay", + "override", + "include", + "modifier_map", + "modifier_keys", + "indicator", + "group", + "mod_map", + "interpret", + "solid", + "partial" + }; +#define stringpool ((const char *) &stringpool_contents) +#ifdef __GNUC__ +__inline +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +const struct keyword_tok * +keyword_gperf_lookup (register const char *str, register unsigned int len) +{ + enum + { + TOTAL_KEYWORDS = 45, + MIN_WORD_LENGTH = 3, + MAX_WORD_LENGTH = 21, + MIN_HASH_VALUE = 3, + MAX_HASH_VALUE = 72 + }; + + static const struct keyword_tok wordlist[] = + { + {-1}, {-1}, {-1}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str3, KEY}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str4, KEYS}, + {-1}, {-1}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str7, AUGMENT}, + {-1}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str9, TEXT}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, XKB_KEYMAP}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, KEYPAD_KEYS}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, XKB_KEYCODES}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, XKB_GEOMETRY}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, XKB_TYPES}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, XKB_COMPATMAP}, + {-1}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, REPLACE}, + {-1}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, XKB_COMPATMAP}, + {(int)(long)&((struct stringpool_t *)0)->stringpool_str20, XKB_LAYOUT}, -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

