Add API for getting unicode representation of a keysym

This code uses a table and code derived from
http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c

The added API calls are:

xkb_keysym_to_utf32
xkb_keysym_to_utf8

[daniels: Changed API to be more in line with keysym_get_name, added
          test, changed formatting to 4-space.]
Add keypad sequences to UTF-8 keysym printing

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Update .gitignore

Signed-off-by: Ran Benita <ran234@gmail.com>
Move XKB_KEY_NoSymbol to xkbcommon-keysyms.h

This avoids a couple of special cases in the code, and is more
consistent. Since anyone who includes xkbcommon.h also gets
xkbcommon-keysyms.h, and anyone who include xkbcommon-keysyms.h would
want NoSymbol anyway, there's no down side.

Signed-off-by: Ran Benita <ran234@gmail.com>
Remove configure check for X11 keysym files

Since every user building the library, even from git, doesn't need these
files anymore, there's no need to check for them (this goes for makekeys
as well).

The only remaining user is the update-keysyms target, but whoever will
run it again (if ever) will probably know what he's doing (at least
enough to run git diff before git commit). And the defaults should be
fine too.

Signed-off-by: Ran Benita <ran234@gmail.com>
test/dump: allow to run manually

Without the srcdir envvar (and a couple trivial changes).

Signed-off-by: Ran Benita <ran234@gmail.com>
Unconstify a few string struct fields

These were made const when the structs were exposed in the API. Now they
are private and we shouldn't mess around with the UNCONSTIFY business.

Signed-off-by: Ran Benita <ran234@gmail.com>
Comment out unused fields in xkb_controls

Until (if) we implement/use them the should take up any (mental) space.

Signed-off-by: Ran Benita <ran234@gmail.com>
darray: tweak parameters a bit for better memory usage

Here are some quick numbers from valgrind, running rulescomp only with a
simple, common "us,de" rule set:

before darray: cb047bb
total heap usage: 44,924 allocs, 44,924 frees, 3,162,342 bytes allocated

after darray: c87468e
total heap usage: 52,670 allocs, 52,670 frees, 2,844,517 bytes allocated

tweaking specific inital allocation sizes:
total heap usage: 52,652 allocs, 52,652 frees, 2,841,814 bytes allocated

changing initial alloc = 2 globally
total heap usage: 47,802 allocs, 47,802 frees, 2,833,614 bytes allocated

changing initial alloc = 3 globally
total heap usage: 47,346 allocs, 47,346 frees, 3,307,110 bytes allocated

changing initial alloc = 4 globally
total heap usage: 44,643 allocs, 44,643 frees, 2,853,646 bytes allocated

[ Changing the geometric progression constant from 2 only made things
worse. I tried the golden ratio - not so golden :) ]

The last one is obviously the best, so it was chosen, with the specific
tweaks thrown in as well (these were there before but don't make much
difference). Overall it seems to do better than the previous manual
allocations which is a bit surprising.

Signed-off-by: Ran Benita <ran234@gmail.com>
darray: some changes for convenience

- Make darray_free also initialize the array back to an empty state, and
  stop worrying about it everywhere.

- Add darray_mem, to access the underlying memory, which we do manually
  now using &darray_item(arr, 0). This makes a bit more clear when we
  actually mean to take the address of a specific item.

- Add darray_copy, to make a deep copy of a darray.

- Add darray_same, to test whether two darrays have the same underlying
  memory (e.g. if the struct itself was value copied). This should used
  where previously two arrays were compared for pointer equality.

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: use darray for KeyInfo syms array

The arrays found in KeyInfo are by far the most complicated, so this is
taken one member at a time so as not to break anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: remove sizeSyms array from KeyInfo

This information is kept inside the darray now.

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: use darray for KeyInfo symsMapIndex

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: use darray for KeyInfo symsMapNumEntries

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: use darray for KeyInfo acts

Signed-off-by: Ran Benita <ran234@gmail.com>
symbols: use darray in struct xkb_sym_map

Signed-off-by: Ran Benita <ran234@gmail.com>
state: use darray for filters

For the darray we need to specify the explicit struct xkb_filter type
instead of void*, so we move the definition of struct xkb_state into
state.c thus making it opaque even from the rest of the files. It has
enough getters to get going and is otherwise good style.

Signed-off-by: Ran Benita <ran234@gmail.com>
utils: remove unused recalloc and related macros

Their use is superseded by darray everywhere now.

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