scanner-utils: add helper for hex string escape

Like the already existing oct.

Signed-off-by: Ran Benita <ran234@gmail.com>
scanner-utils: add helper for appending an entire string

Signed-off-by: Ran Benita <ran234@gmail.com>
keysym: add function to test if a keysym is for a modifier

Needed for compose.

Signed-off-by: Ran Benita <ran234@gmail.com>
darray: add darray_shrink()

If we have a big array which can be finalized, on average we can give
back 1/4 of its size, which the allocator might be able to use.

Signed-off-by: Ran Benita <ran234@gmail.com>
scanner-utils: add priv member

For when a user of the scanner wants to pass something along with it.

Signed-off-by: Ran Benita <ran234@gmail.com>
compose: add xkbcommon-compose - API

xkbcommon-compose is a Compose implementation for xkbcommon. It mostly
behaves like libX11's Compose, but the support is somewhat low-level and
is not transparent like in libX11. The user must add some supporting code
in order to utilize it.

The intended audience are users who use xkbcommon but not a full-blown
input method. With this they can add Compose support in a straightforward
manner, so they have a fairly complete keyboard input for Latin-like
languages at least.

See the header documentation for details.

Signed-off-by: Ran Benita <ran234@gmail.com>
compose: add xkbcommon-compose - implementation

Signed-off-by: Ran Benita <ran234@gmail.com>
test/compose: add new test

Some results from the benchmark (compilation of en_US.UTF-8/Compose):

$ grep 'model name' /proc/cpuinfo
model name  : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
model name  : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz

$ uname -a
Linux ran 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux

$ ./test/compose bench
compiled 1000 compose tables in 7.776488331s

So according to the above benchmark and valgrind --tool=massif, an
xkb_compose_table adds an overhead of about ~8ms time and ~130KB
resident memory.
For contrast, a plain US keymap adds an overhead of ~3ms time and 90KB
resident memory.

Signed-off-by: Ran Benita <ran234@gmail.com>
test/interactive-evdev: add compose support

To try, do e.g.:
sudo ./test/interactive-evdev -l us -v intl -o compose:ralt -d

Signed-off-by: Ran Benita <ran234@gmail.com>
bench/compose: add new benchmark

Signed-off-by: Ran Benita <ran234@gmail.com>