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>
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>
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>
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>
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>
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>
(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.]
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.]
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.]
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'.]
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>
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>
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>
We depend on parser.h which is generated by flex during the build, so
use an explicit $(top_builddir) rather than a relative path.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Change them to refer to the string representation of the keysym's name
as a name rather than a string, since we want to add API to get the
Unicode printable representation as well.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Two new calls allow users to test the exact modifier state, including
verifying that no other modifiers but the ones you wanted are down.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
xkbcommon-names.h right now just contains a set of hardcoded modifier
strings that are most commonly used for the usual modifiers. Provide
definitions of these so people don't have to worry about typoing a
string or mixing up Mod1 and Mod4.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Make the files in the src/* directory use their own header or a
consilidated private header. This makes the file dependencies clearer.
Also drop the pointless "xkb" file name prefix, add split a few
declarations to their own files (atom.h and text.h).
Signed-off-by: Ran Benita <ran234@gmail.com>
The include dependencies were quite convoluted, where you change the
order and get a ton of errors. Instead, change one file to act as the
internal interface for the xkbcomp files, and make every file use it.
Also drop the pointless "xkb" prefix to file names.
Signed-off-by: Ran Benita <ran234@gmail.com>