Commit Graph

562 Commits (93ef256063eb4cf6e79275e2113fd388aaf08a51)

Author SHA1 Message Date
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
Daniel Stone 6433d72e7c Merge remote-tracking branch 'krh/keysyms'
Conflicts:
	src/keysym.c
	src/misc.c
	src/text.h
	src/xkbcomp/expr.c
	src/xkbcomp/parser.y
	src/xkbcomp/parseutils.c
	src/xkbcomp/symbols.c

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 20:15:46 +01:00
Kristian Høgsberg ace1e5df6d Use our own keysyms 2012-05-09 14:21:15 -04:00
Kristian Høgsberg c6897d2698 Add XKB version of X11 keysyms
With this we're now completely standalone.

add vendor keysyms
2012-05-09 14:21:15 -04:00
Ran Benita 5e59ef3f47 Remove support for xkb_layout and xkb_semantics file types
These are two aggregate file types which are not used anywhere. We
maintain useful-enough backward compatibility in the parser, by treating
them as xkb_keymap. The keymap type allows for all types of components,
so they will still compile fine if they ever come up.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-09 17:53:15 +01:00
Ran Benita e7bb1e5fd9 Shorten context to ctx
(This breaks the API.)

"context" is really annoying to type all the time (and we're going to
type it a lot more :). "ctx" is clear, concise and common in many other
libraries. Use it!

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

[daniels: Fix for xkb -> keymap change.]
2012-05-09 17:52:26 +01:00
Ran Benita 699a0b841c Contextualize the atom table
Each context gets its own table, i.e. interning a string in one context
does not affect any other context.

The existing xkb_atom_* functions are turned into wrappers around a new
standalone atom_table object.

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

[daniels: Updated for xkb -> keymap.]
2012-05-09 15:56:25 +01:00
Ran Benita cdd2906de3 Make the context available for XkbcAtomText
And rename the function to xkb_atom_text.

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

[daniels: Updated for xkb -> keymap.]
2012-05-09 15:55:40 +01:00
Ran Benita 8d680e808a Make the context available for XkbcAtomGetString
In preparation of contextualizing atom handling.
Since we touch every function call, we also rename the function to
xkb_atom_strdup to match xkb_atom_intern, and be more descriptive.

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

[daniels: Updated for xkb -> keymap.]
2012-05-09 15:43:47 +01:00
Ran Benita c117318ff1 Make the context available to xkb_intern_atom
In preparation of contextualizing the atom table.
Since we touch every function call, also rename the function to
xkb_atom_intern, to match better with the rest (which will also be
renamed).

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

[daniels: Fixed for 'xkb' -> 'keymap'.]
2012-05-09 15:31:43 +01:00
Ran Benita 4aef083e46 Contextualize XkbFile IDs
Currently the IDs are assigned from a static variable inside
CreateXKBFile. This can lead to some unpleasantness with threads, so
maintain the counter in the context instead.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-09 15:30:49 +01:00
Ran Benita 64aa5c95ed Make the context available to the parser
We will need the context to remove some global state.
Also make the Parse* function just return bool while wer'e at it.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-09 15:30:48 +01:00
Pekka Paalanen bdbb3ac455 makekeys: fix cross-compilation
makekeys must be built with the build-native compiler, not with $(CC)
which is the cross-compiler. The only sane way to achieve this seems to
be to use a separate Makefile.am for it.

This patch fixes the problem apparently caused by:

commit b5efe41f19
Author: Ran Benita <ran234@gmail.com>
Date:   Sat Mar 24 04:48:31 2012 +0200

    Make build non-recursive

There is no such thing as makekeys_makekeys_CC in automake.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-09 15:24:50 +01:00