This way the test logs have all the information, but we don't get eye
bleed every time we run them manually. One can always use
TESTS_ENVIRONMENT (we correctly use AM_TESTS_ENVIRONMENT now), or set
the envvars from the shell.
Signed-off-by: Ran Benita <ran234@gmail.com>
Add CompileKeymap to do most of what compile_keymap_file does now, and
move UpdateKeymapFromModifiers along with it from (mostly unrelated)
compat.c.
Also rename UpdateKeymapFromModifiers to UpdateDerivedKeymapFields,
because it does more than update the modifiers.
Signed-off-by: Ran Benita <ran234@gmail.com>
Various non-functional changes:
- Re-add keycodes.h and move some stuff there.
- Add parser-priv.h for internal bison/flex stuff.
- Don't include headers from other headers, such that file dependencies
are immediate in each file.
- Rename xkbcomp.h -> ast.h, parseutils.{c,h} -> ast-build.{c,h}
- Rename path.{c,h} -> include.{c,h}
- Rename keytypes.c -> types.c
- Make the naming of XkbFile-related functions more consistent.
- Move xkb_map_{new,ref,unref} to map.c.
- Remove most extern keyword from function declarations, it's just
noise (XKB_EXPORT is what's important here).
- Append XKBCOMP_ to include guards.
- Shuffle some code around to make all of this work.
Splitting this would be a headache..
Signed-off-by: Ran Benita <ran234@gmail.com>
The KeyName functions are more appropriate in keycodes.c.
The ProcessIncludeFile can go to path.c along with the other functions
dealing with includes.
Signed-off-by: Ran Benita <ran234@gmail.com>
The program reads key events from evdev input devices, puts them through
the library and prints some information about them. It's nice for
experimenting, quick testing and trying to break it with random stuff
(already found some!).
It is called "interactive" for lack of a better name. It's a bit
hackish, but can easily be extended, made more portable etc, in the
future.
Signed-off-by: Ran Benita <ran234@gmail.com>
Conflicts:
Makefile.am
test/.gitignore
Add new public API to provide the library users with some options to
control and customize the logging output from the library. It is based
upon the skeleton from the libabc demo libray:
https://git.kernel.org/?p=linux/kernel/git/kay/libabc.git
which is public domain and works pretty well.
This requires passing in the context object in every logging call, and
thus the conversion is done file by file. We also remove the global
warningLevel variable in favor of a verbosity level in the context,
which can be set by the user and is silent by default.
One issue is the ACTION calls, which, while nice, do not play very well
with line- and priority-based logging, and would require some
line continuation handling or keeping state or some other compromise. So
instead remove these and just inline them with their respective
warning/error. So instead of:
ERROR("Memory allocation failed\n")
ACTION("Removing all files on hardisk\n")
its something like that:
log_err("Memory allocation failed; Removing all files on harddisk\n")
Signed-off-by: Ran Benita <ran234@gmail.com>
The include/ dir is somewhat redundant and makes it just a bit harder to
handle the -I directives from out side of automake; without it the
default $(top_buildir) just works.
Here's also some further justifications I found:
http://smcv.pseudorandom.co.uk/2008/09/pc-uninstalled/
Signed-off-by: Ran Benita <ran234@gmail.com>
Taken from xserver/include/list.h. The changes made are:
* Drop the xorg_ prefix and some typedef from the end.
* Rename _for_each_entry macros to just _foreach (like darray).
* Rename list_is_empty to list_empty (like darray).
* Add a list_replace function which we use later.
Signed-off-by: Ran Benita <ran234@gmail.com>
The ComputeEffectiveMap function is only called from keytypes.c, with
the last argument NULL, so we can move it there and remove some code.
The function XkbcVirtualModsToRealMods, of which the above is the only
user, is already implemented more simply in compat.c, so make this one
non-static and use it. This leaves src/xkb.c empty, so remove it.
Signed-off-by: Ran Benita <ran234@gmail.com>
commit 46441b1184 removed this from the
public API, and we don't need it internally. So send it to the archives.
Signed-off-by: Ran Benita <ran234@gmail.com>
Including creating a context (will come in useful soon), opening and
reading files, and compiling keymaps.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This test verifies the core purpose of this library, which is to
translate the user's keypresses into keysyms according to the keymap and
the XKB specification.
The tests emulate a series of key presses, and checks that the resulting
keysyms are what we expect.
Several of the tests currently fail, and plenty more should be added and
maybe split up.
It also currently uses an RMLVO keymap, which comes from the
xkeyboard-config data set, and whose behaviour may change in the future.
So it should probably be changed to use several files of our own, but
it's OK for now.
Signed-off-by: Ran Benita <ran234@gmail.com>
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>
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.]
bison/flex-generated objects, when being run in a VPATH build with
--disable-dependency-tracking (i.e. Gentoo), would fail to be created
because automake didn't bother creating the destination directories
before trying to create the objects.
Fix this by depending on the destination directory stamp, which
according to the automake mailing list, should hopefully remain fairly
stable.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
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>
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>
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>
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>
The two files do exactly the same sort of things, without any discernible
reason for splitting them.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_desc -> xkb_keymap changes.]
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
pure C file per test. All of the .sh files are removed, but everything
that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
"parallel-test" mechanism. This will create a single log file for each
test with it's stdout+stderr, and a top level "test-suite.log" file
for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
That way we can just put the directory in EXTRA_DIST and forget about
it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
for a completely non-recursive build.
Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.
It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Updated for xkb_keymap changes.]