Commit Graph

574 Commits (fe89d031548b815e57aaef462354e6c400287de5)

Author SHA1 Message Date
Ran Benita 28bbb7dc51 rules: use darray for rules and groups
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita c815ff96d9 Import darray.h for common dynamic array code
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita cb047bb0fc Constify a static variable
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita 9e72a6a7af Fix incorrect indexing while freeing
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 08:50:25 +03:00
Ran Benita 869c687190 rules: add test
Add a non-extensive test to check that some basic things (e.g. rule
matching, var substitution, indexes and groups) work as expected.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 68edd5f0df rules: allow wildcard match against "" layout/varaint
Currently, if you pass in an rmlvo with an empty string for layout or
variant, it would not match layout and variant rules even with
wildcards. But if the rules file had set an appropriate default, and someone
passes in the empty string, than he should get the default.

NULL in this case signifies not wanting to match against the layout or
variant at all, and so the rule should still fail to match NULLs.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita c900c41760 rules: remove struct var_defs
We can just use struct xkb_rule_names which we already receive as an
argument.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 3d28b6d116 rules: reformat components_from_rules
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 7895eeb8ce rules: reformat LoadRules and XkbRF_Free
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita d18cf31595 rules: remove unused struct describe_vars
It's not actually used for anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 56b125fcc7 rules: reformat AddRule and AddGroup
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita f790257fa7 rules: reformat GetComponents
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 52939d4bea rules: reformat SubstituteVars
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita a9477b5754 rules: reformat CheckApplyRules and ApplyPartialMatches
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita a47dd25219 rules: reformat CheckGroup and CheckApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 18d331b86b rules: rewrite MatchOneOf
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita c02c9ab2f2 rules: reformat ApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 06205717c3 rules: reformat MakeMultiDefs
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita f7de62861f rules: use asprintf instead of _Concat function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 5f54764d0d rules: reformat CheckLine and break into several functions
And remove struct file_spec which is really unneeded. Should be
slightly more clear now.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 2df35895b5 rules: reformat SetUpRemap and struct remap_spec
Rename to more descriptive names and reformat.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita b8ae68c2a3 rules: rewrite get_index to use sscanf
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita ef76ba97b3 rules: don't typedef the structs and rename them
The long prefix is unnecessary now that they are all private.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 478a6a31d5 rules: reformat input line handling
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 72d1f2edef rules: don't use custom logging functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita b73bd67615 rules: only export a single function
Really all we need from this file is a way to get xkb_component_names
from an xkb_rule_names, which is now the only thing being exposed. This
should allow for some much needed refactoring of this code.

Since this is only used by xkbcomp.c and uses xkbcomp functions, also
move rules.{c,h} under the xkbcomp dir.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 0c25ebf341 rules: remove unused struct fields and use size_t
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita beccc37509 Don't run the benchmark by default
For people running 'make check' on every compilation, this can be
a nuisance.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:19 +03:00
Ran Benita db3e8f2c08 Create path.h for the path.c functions
No need to stash them in xkbcomp-priv.h; files which need the functions
should explicitly include them.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-19 02:21:26 +03:00
Ran Benita b89b8e7023 Change xkb_map_new_from_fd to use FILE*
i.e. xkb_map_new_from_file. The reason is that flex only works with
FILE's, so we must use fdopen on the file descriptor; but to avoid a
memory leak, we must also fclose() it, which, in turn, closes the file
descriptor itself.

Either way is not acceptable, so we can either:
* dup() the fd and use fdopen on that, or
* have the user call fdopen on his own, and accept a FILE* instead of an
  fd.

The second one seems better, and is standard C, so why not. We must add
stdio.h to xkbcommon.h though, which is regrettable, but not a big deal.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita d15fa57a4b Remove FileHandler callback argument
It's unneeded; the same function is always passed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita e82bb5c043 Remove unused allowNone from KeyInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita 5200132f4d Revert "Fix KeyInfo's syms array size calculation"
This partly reverts commit 8feba630fa.

This seems to fix valgrind errors:
==9581== Invalid read of size 4
==9581==    at 0x4E50928: MergeKeyGroups (symbols.c:544)
==9581==    by 0x4E510F3: MergeKeys (symbols.c:644)
==9581==    by 0x4E514C6: AddKeySymbols (symbols.c:722)
==9581==    by 0x4E51A3F: MergeIncludedSymbols (symbols.c:854)
==9581==    by 0x4E51E97: HandleIncludeSymbols (symbols.c:952)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)
==9581==    by 0x4E55A0B: CompileSymbols (symbols.c:2187)
==9581==    by 0x4E4056C: CompileKeymap (keymap.c:160)
==9581==    by 0x4E56953: compile_keymap (xkbcomp.c:149)
==9581==    by 0x4E56AC5: xkb_map_new_from_kccgst (xkbcomp.c:195)
==9581==    by 0x4009D7: test_names (namescomp.c:56)
==9581==    by 0x400A55: main (namescomp.c:75)
==9581==  Address 0x5729b04 is 0 bytes after a block of size 4 alloc'd
==9581==    at 0x4C29024: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9581==    by 0x4E5C37B: recalloc (utils.c:41)
==9581==    by 0x4E4FF50: ResizeKeyGroup (symbols.c:356)
==9581==    by 0x4E5229E: AddSymbolsToKey (symbols.c:1058)
==9581==    by 0x4E52ABB: SetSymbolsField (symbols.c:1214)
==9581==    by 0x4E536C7: HandleSymbolsBody (symbols.c:1481)
==9581==    by 0x4E53A63: HandleSymbolsDef (symbols.c:1543)
==9581==    by 0x4E53DAD: HandleSymbolsFile (symbols.c:1623)
==9581==    by 0x4E51CA4: HandleIncludeSymbols (symbols.c:909)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)
==9581==    by 0x4E51E74: HandleIncludeSymbols (symbols.c:951)
==9581==    by 0x4E53D75: HandleSymbolsFile (symbols.c:1619)

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita 75ff2cefda Various static analyzer fixes
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita b571b83459 Fix a memleak
Introduced in 38cb639082.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Ran Benita ab82e0ebc3 Fix configure check for xkbparse.c instead of parser.c
This obscure test is easy to miss.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:32 +03:00
Pekka Paalanen 8ca8f05aab Add xkbcommon-uninstalled.pc 2012-05-18 01:05:14 +01:00
Pekka Paalanen 8bdef139a6 Use eaccess() only if available
Fixes build on Android.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-18 01:05:14 +01:00
Pekka Paalanen cb804a9d4e Fix out-of-tree build for config.h
config.h appreas in the build dir, not src dir.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-18 01:05:14 +01:00
Daniel Stone 661cb84051 Add benchmarking test to rulescomp
Apparently it only takes us 8ms to build keymaps.  Nice!

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-18 01:04:35 +01:00
Kristian Høgsberg 3fbc277bb8 Use $(AM_V_GEN) to prettyfi makekeys step 2012-05-11 16:14:27 +01:00
Daniel Stone 7b00485a6b Rename 'ctx' back to 'context' in external API
Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.

This partially reverts e7bb1e5f.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11 15:03:43 +01:00
Daniel Stone f95b41131d Add xkbcommon-keysyms.h to Makefile.am
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11 14:28:54 +01:00
Daniel Stone 471e112208 Document that xkb_state_get_map doesn't take a ref
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:52:33 +01:00
Daniel Stone 7a1201bdf2 Change xkb_key_get_syms to just return a bare int
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:51:37 +01:00
Daniel Stone 46441b1184 Move KcCGST API to internal-only
And don't export it.  We don't need it for X11 support, let alone
anything else.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:49:04 +01:00
Daniel Stone 2761b1a332 Rename serialise to serialize
Yes, British English is correct, but unfortunately we've lost that
battle.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:49:01 +01:00
Daniel Stone 5a3771d149 Add common LED names to xkbcommon-names.h
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:18:30 +01:00
Daniel Stone 693d0578f2 Include xkbcommon-names.h from xkbcommon.h
So clients only have one file to include.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:17:13 +01:00
Daniel Stone 3e3ddd43e9 Remove keycode_range_is_legal
It was a pretty pointless check.  Also sanitise the _x11 variant to
actually do what it says on the box.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:16:51 +01:00