Commit Graph

148 Commits (1f3666915bc31a1133f2d53d0f81c03df7241bad)

Author SHA1 Message Date
Jasper St. Pierre 938a2c379b makekeys: Move all of the table generation to Python
This makes it easier to run the Python script manually.
2014-01-01 13:01:18 -05:00
Ran Benita b246edc688 test/atom: add test for atom table
Mostly a random test.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-12-02 15:13:59 +02:00
Ran Benita 13da6da0e7 parser: drop %name-prefix, use -p yacc argument instead
Even though the %name-prefix is more sensible, byacc doesn't support it,
but both bison and byacc support the -p argument.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-09-29 00:24:50 +03:00
Ran Benita 0dbe20ae96 Makefile.am: drop AM_LFLAGS
We don't use a lex/flex anymore so this is not used.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-09-29 00:16:39 +03:00
Ran Benita 5d2b268dc1 build: distribute makekeys.py and keywords.gperf
This was an oversight: even though we ship the pre-built files, it is
still good behavior to include the original generators / source files in
the tarball.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-08-29 19:07:25 +03:00
Ran Benita 5b7f766898 build: build libtest.la only on 'make check'
For those just running 'make', compiling libtest is wasted heat.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-08-15 09:36:12 +03:00
Ran Benita 9bb1d0bc1d build: make all symbols in libtest visible
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-08-02 12:37:45 +03:00
Ran Benita c25bdc3fca build: use AM_LDFLAGS for general flags
We want -no-undefined for every library so do it implictly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-08-02 12:37:36 +03:00
Ran Benita a392d2682b Replace flex scanner with a hand-written one
The scanner is very similar in structure to the one in xkbcomp/rules.c.
It avoids copying and has nicer error reporting.

It uses gperf to generate a hashtable for the keywords, which gives a
nice speed boost (compared to the naive strcasecmp method at least). But
since there's hardly a reason to regenerate it every time and require
people to install gperf, the output (keywords.c) is added here as well.

Here are some stats from test/rulescomp:

Before:
compiled 1000 keymaps in 4.052939625s
==22063==   total heap usage: 101,101 allocs, 101,101 frees, 11,840,834 bytes allocated

After:
compiled 1000 keymaps in 3.519665434s
==26505==   total heap usage: 99,945 allocs, 99,945 frees, 7,033,608 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-04-01 18:20:57 +01:00
Ran Benita e4bceec880 utils: add {un,}map_file to read an entire file
This wraps the current mmap call and adds a fallback implementation for
systems which do not have mmap (e.g. mingw).

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-04-01 18:20:56 +01:00
Ran Benita 99f6e6fc28 Add scanner-utils.h for common scanner functions
We want to share the same functions for another scanner.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-04-01 18:20:54 +01:00
David Herrmann 36f55c494e keymap: add xkb_keymap_new_from_buffer()
The current API doesn't allow the caller to create keymaps from mmap()'ed
files. The problem is, xkb_keymap_new_from_string() requires a terminating
0 byte. However, there is no way to guarantee that when using mmap() so a
user currently has to copy the whole file just to get the terminating zero
byte (assuming they cannot use xkb_keymap_new_from_file()).

This adds a new entry xkb_keymap_new_from_buffer() which takes a memory
location and the buffer size in bytes.

Internally, we depend on yy_scan_{string,byte}() helpers. According to
flex documentation these already copy the input string because they are
wrappers around yy_scan_buffer().
yy_scan_buffer() on the other hand has some insane requirements. The
buffer must be writeable and the last two bytes must be ASCII-NUL. But the
buffer may contain other 0 bytes just fine.

Because we don't want these constraints in our public API,
xkb_keymap_new_from_buffer() needs to create a copy of the input memory.
But it then calls yy_scan_buffer() directly. Hence, we have the same
number of buffer-copies as with *_from_string() but without the
terminating 0 requirement.
The explicit yy_scan_buffer() call is preferred over yy_scan_byte() so the
buffer-copy operation is not hidden somewhere in flex.

Maybe some day we no longer depend on flex and can have a zero-copy API. A
user could mmap() a file and it would get parsed right from this buffer.
But until then, we shouldn't expose this limitation in the API but instead
provide an API that some day can work with zero-copy.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

[ran: rebased on top of my branch]
Conflicts:
	Makefile.am
	src/xkbcomp/xkbcomp.c
2013-04-01 18:04:06 +01:00
Daniel Stone 38654f5e74 Add key-sequence checking to rulescomp
Make sure we're actually getting the keymaps we're hoping to
compile.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-04-01 17:50:08 +01:00
Ran Benita 71eb033eef Move a couple of general keymap functions from keycodes.c
To get a key by name and resolve an alias - this makes sense for
everyone.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 79329e1022 Don't try to build linux-specific tests on non-linux
Some tests use linux/input.h (and epoll), but we're building on some
other kernels (e.g. debian freebsd). We could just copy the file but
it's GPL. We could also skip the tests (exit code 77) but it doesn't
really matter.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 14842d6dc9 keymap: abstract a bit over the keymap format
Make it a bit easier to experiment with other formats.

Add a struct xkb_keymap_format_operations, which currently contains the
keymap compilation and _get_as_string functions. Each format can
implement whatever it wants from these.

The current public entry points become wrappers which do some error
reporting, allocation etc., and calling to the specific format. The
wrappers are all moved to src/keymap.c, so there are no XKB_EXPORT's
under src/xkbcomp/ anymore.

The only format available now is normal text_v1.

This is all not very KISS, and adds some indirection, but it is helpful
and somewhat cleaner.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 958b27284f Remove list.h
We don't use it anymore and it's easy to add back if needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 2b352c11dd Makefile.am: don't create INSTALL and ChangeLog
It may be xorg standard but it's completely useless and clutter the
directory.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Damien Lespiau 2f7385d0e0 build: Make autoreconf honour ACLOCAL_FLAGS
When running autoreconf, it's possible to give flags to the underlying
aclocal by declaring a ACLOCAL_AMFLAGS variable in the top level
Makefile.am.

Putting ${ACLOCAL_FLAGS} there allows the user to set an environment
variable up before running autogen.sh and pull in the right directories
to look for m4 macros, say an up-to-date version of the xorg-util macros.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Cc: Daniel Stone <daniel@fooishbar.org>
2012-10-30 15:08:14 +02:00
Ran Benita 92360016fe Makefile.am: move test.h to libtest_la_SOURCES
Rather than EXTRA_DIST, where it doesn't belong.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 15:09:57 +02:00
Ran Benita 22b868fd75 Makefile.am: split sed script into multiple lines
To make it visible on one screen.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 15:09:54 +02:00
Ran Benita c1c1b720b0 test: add key processing benchmark
This runs a bunch of random keys against xkb_state_update_key() and
xkb_state_key_get_one_sym(), in a fairly unintelligent way.

It might be nice to check when modifying this code path, or changing it,
to see things haven't slowed down considerably. However, given the
numbers this benchmark gives, it is pretty clear that we are not going
to be the bottleneck for anything. So this can more-or-less be ignored.

Incidentally, this also turned out to be a poor man's fuzzer, because it
turned up the fix in the previous commit. Maybe we should consider
beefing it up with an actual 'break stuff' intention and running it as
part of 'make check'.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-24 23:27:40 +02:00
Ran Benita 5d9a5cb003 Commit and distribute ks_tables.h
The ks_tables.h file is generated by makekeys.py from
xkbcommon-keysyms.h, which in turn is generated initially by 'make
update-keysyms'. The xkbcommon-keysyms.h file is commited to git and
distributed in the tarball. Since ks_tables.h should only ever change
when xkbcommon-keysyms.h changes, it is more sensible to update them
together and treat them the same, instead of generating ks_tables.h
every time for every builder with 'make', as we do now.

This means we don't need python as a build dependency (only the one
running update-keysyms, i.e. no one, needs this), and we can be
sure exactly the same file is used by everyone. We also don't need to
run makekeys.py on every build.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-17 20:09:09 +02:00
Ran Benita 5fff637e07 makekeys: replace helper with python script and binary search
This removes the complicated and undocumented hash-table creation-helper
and replaces it with an autogenerated sorted array. The search uses simple
bsearch() now.

We also tried using gperf but it turned out to generate way to big
hashtables and when reducing the size it isn't really faster than
bsearch() anymore.

There are no users complaining about the speed of keysym lookups and we
have no benchmarks that tell that we are horribly slow. Hence, we can
safely use the simpler approach and drop all that old code.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-16 21:10:04 +02:00
Ran Benita 523e46f41a Change log env vars to XKB_LOG_LEVEL/VERBOSITY
A bit more consistent and descriptive.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-12 10:17:57 +02:00
Ran Benita 108fa1c793 Add support for building doxygen API documentation
Simple HTML docs generated from the doxygen comments.
After running 'make' or 'make doc', try firefox doc/html/index.html to
see it (if you have doxygen). It's also installed with 'make install'.
You can use --enable-docs or --disable-docs, or specifically
--with-doxygen or --without-doxygen (autodetected, default yes).

The docs are currently not distributed in the tarball, because I
couldn't make it work properly in all cases :/

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24 09:13:32 +10:00
Ran Benita 18a433223e configure.ac: add XORG_MEMORY_CHECK_FLAGS
Adds some memory checking (e.g. MALLOC_PERTURB_) to tests.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24 09:08:54 +10:00
Ran Benita 414007ca67 configure.ac: remove XORG_CHECK_MALLOC_ZERO
We don't use its result.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24 09:08:53 +10:00
Ran Benita bbaa11c6e3 Rename map.{c,h} to keymap.{c,h}
Seeing as we don't like "map" anymore.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24 09:08:53 +10:00
Daniel Stone 005dee2bb6 Add _xkbcommon_ prefix to parser and lexer symbols
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-20 23:30:17 +10:00
Daniel Stone 80e156814d Add xkbcommon-compat.h and compat.c
So we can start renaming stuff while retaining backwards source and
binary compatibility.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-20 23:29:45 +10:00
Ran Benita 2c96828f75 test: add print-compiled-keymap tool
This just prints the compiled keymap string for to the given command
line arguments. This often useful when developing.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-19 16:56:26 +03:00
Ran Benita b21107056e Organize src/ and test/ headers
- Add context.h and move context-related functions from xkb-priv.h to
  it.
- Move xkb_context definition back to context.c.
- Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it.
- Rename xkb-priv.h to map.h since it only contains keymap-related
  definitions and declarations now.
- Remove unnecessary includes and some and some other small cleanups.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16 15:20:18 +03:00
David Herrmann 095a7f4cf0 xkbcommon-keysyms: Add header protection
As there is currently no stable release of xkbcommon, other projects might
want to include a copy of the keysyms so they can be used even though
libxkbcommon may not be available on the machine. However, if xkbcommon.h
is still included, conflicts will occur. Hence, to avoid nasty hacks,
simply include a header protection in xkbcommon upstream.

[daniels: Added protection to Makefile.am's update-keysyms, as well as
          XKB_KEY_NoSymbol, and a comment noting that it shouldn't be
          updated directly.]

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-11 16:49:04 +01:00
Ran Benita 1aa6e2b1e2 test/rules-file: add benchmark
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita 480f919d77 test: add rmlvo-to-kccgst tool
For a quick look at what components result from the rules.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03 10:31:13 +03:00
Ran Benita f3c4032f35 Set log level for tests through env, not directly
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>
2012-09-03 10:31:12 +03:00
Ran Benita 8c1b1b0e9e Add xkbcomp/keymap.c and move some code there
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>
2012-09-02 19:17:09 +03:00
Ran Benita cdc228eaf6 Organize xkbcomp/ header files
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>
2012-09-01 10:58:10 +03:00
Ran Benita 0cc5ae33b5 Remove xkbcomp/misc.c
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>
2012-08-10 13:49:20 +03:00
Pekka Paalanen 3199ea7383 android: add build files
squashed: android: set xkb config path

Conflicts:
	Makefile.am
2012-08-08 16:23:31 +02:00
Daniel Stone e756e9b532 test/dump: Remove superfluous test
No longer necessary now we have stringcomp doing a full round-trip test
for us.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08 16:23:30 +02:00
Daniel Stone 8fe2a484c0 Rename xkey test to keysym
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08 16:23:30 +02:00
Daniel Stone 5cf4f51044 Staticise xkb_map_new_from_kccgst
We didn't expose this to the outside world, and its only trivial user
was xkb_map_new_from_rules.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08 16:23:30 +02:00
Ran Benita 4c21275301 Add an interactive evdev test
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
2012-07-28 11:43:15 +02:00
Ran Benita 74be17627e Remove alloc.{c,h}
These functions are more appropriate elsewhere now.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27 00:02:59 +03:00
Ran Benita 3dc1252d2d Add test for logging functionality
Just to make sure everything works properly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 70f35cfbc0 Add logging API
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>
2012-07-23 00:45:34 +03:00
Ran Benita 5e164ff1f9 build: drop the include/ directory
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>
2012-07-23 00:45:34 +03:00
Ran Benita ba4320f7b3 Move indicators.c code into compat.c
It is only used there. Allows some refactoring.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita dfa0929c6d Convert macros to inline functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita cc8b06826b Move alias.c functions into keycodes.c
They are only used in this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita b6e2a56dc0 Add common linked list implementation
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>
2012-07-18 12:56:13 +03:00
Ran Benita fe4f990902 Move CompileKeymap into xkbcomp.c
It's nicer to see the code where its used. Removes keymap.c.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-14 00:29:31 +03:00
Ran Benita 57374c3237 Rename KSIsLower/Upper and move to keysym.c
Seems like a more natural place, and allows to remove the src/misc.c
file.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-13 19:11:15 +03:00
Ran Benita 3e65531f13 Move ComputeEffectiveMap code and avoid some duplication
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>
2012-07-13 19:07:03 +03:00
Ran Benita a3378338bd remove unused function xkb_canonicalise_components
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>
2012-07-13 19:07:03 +03:00
Daniel Stone 3e86ebca06 Add a library of common test functions
Including creating a context (will come in useful soon), opening and
reading files, and compiling keymaps.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12 14:48:22 +01:00
Ran Benita 0015604ade Add a test for the results of key sequences
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>
2012-06-18 15:19:24 +01:00
Ran Benita 9baf62f307 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>
2012-06-09 12:34:57 +03:00
Rob Bradford e0524296d2 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.]
2012-06-08 14:04:49 +01:00
Daniel Stone d3dfd7deab Use $(top_builddir) rather than relative paths
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-04 16:14:42 +01:00
Daniel Stone 734be50050 Work around stupid automake dependency-tracking bug
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>
2012-06-04 14:06:01 +01:00
Daniel Stone 243daf80d0 Add test for xkb_map_new_from_string
Using data from xkb_map_get_as_string.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-29 15:08:35 +01:00
Daniel Stone ebd397e184 Add xkb_map_get_as_string
Returns a newly-allocated string representing the specified keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-29 15:07:18 +01: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 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 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 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
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 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 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
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
Daniel Stone f9fa740fd5 Make build directory includes more explicit
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>
2012-05-09 15:23:44 +01:00
Daniel Stone 74a197d271 Add pre-defined names database
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>
2012-05-08 17:59:35 +01:00
Daniel Stone 1928397a21 Reintroduce $(builddir)/src/xkbcomp include
This is required for parser.h, which is autogenerated and thus only in
the build directory.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:47:54 +01:00
Ran Benita b610b2b953 Rename XKBcommonint.h to xkb-priv.h and use it
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>
2012-05-08 17:29:43 +01:00
Ran Benita 33273304f2 Rename xkbcomp/misc.h to xkbcomp-priv.h and use it
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>
2012-05-08 17:29:41 +01:00
Ran Benita 409ec8a12e Merge src/alloc.c and src/malloc.c
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.]
2012-05-01 13:59:23 +01:00
Ran Benita 4b49e0a117 Overhaul test suite
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.]
2012-04-09 14:21:47 +01:00
Ran Benita 8fbd44fde6 Implicitly include config.h in all files
The definitions in config.h should be available in all files an
implementation detail; it can be included through the build system
instead of having each file pull it every time.

This is especially helpful with AC_USE_SYSTEM_EXTENSIONS, as _GNU_SOURCE
and friends can have an effect by merely being defined, which can lead
to some confusion if its effective for only half the files.

And we don't really support a build _without_ config.h; so, one less
thing to worry about.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +01:00
Ran Benita 518debb3bc Set xorg-macros CFLAGS correctly
A previous commit messed up all warning flags. Oops.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:52:38 +01:00
Daniel Stone 3e9dd7512c Add new context API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 16:59:01 +01:00
Daniel Stone 21f1bff4af Fix distcheck with non-recursive Makefiles
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 15:56:06 +01:00
Ran Benita b5efe41f19 Make build non-recursive
Unify all the different Makefile.am into a single short top level one
(the test/Makefile.am file is left intact though).

This makes the build system simpler to look and should encourage
unifying more currently-disparate code.

Some further motivation can be found in this page:
http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:17:34 +01:00
Gaetan Nadon 69e52ad901 config: makekeys prog should stand alone in the makekeys directory
This program is a utility to generated a header file.
The header file it generates should not be located in the
directory where this utility program is compiled.

Move the /makekeys dir as a sibling of /src.
This reduces the number of bi-directional relationships
between directories.

Make corresponding makefiles simplifications.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:56 -05:00
Gaetan Nadon 7ce1a6dca2 config: add the INSTALL target for installation instructions
Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-08 15:24:21 -05:00
Gaetan Nadon f75ff7d921 config: remove m4/.gitignore now that toplevel one handles it all
The -Im4 in Makefile.am will have to wait until the day
there is an m4 macro checked-in git in the m4 directory.
This does not prevent libtool to install its macros in m4.

Acked-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-07 09:47:32 -05:00
Jan Engelhardt 2b36543ab1 build: use AC_CONFIG_MACRO_DIR as per libtoolize warning
libtoolize: Consider adding "AC_CONFIG_MACRO_DIR([m4])" to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding "-I m4" to ACLOCAL_AMFLAGS in Makefile.am.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
2010-11-11 23:21:34 +01:00
Dan Nicholson a9822d8720 Add xkbcommon pkg-config file 2009-04-01 06:22:06 -07:00
Dan Nicholson b2737e9bfb Testing harness for keysym functions
A test program and script have been added for checking the XkbCommon
keysym functions. This has already highlighted an error in handling of
keysyms from XF86keysym.h.
2009-03-19 11:51:09 -07:00
Dan Nicholson 83f198f1ae Initial implementation of keysym handlers
Add the xkbcommon implementations of XKeysymToString and XStringToKeysym.
These symbols have the namespace prefix of Xkbc and are declared in
X11/XkbCommon.h.

The implementation is taken directly from Xlib, but does not include the
XKeysymDB parsing and hashing yet (if it ever will). A couple type
conversions were needed to keep from using Xlib.h. See original files:

libX11/src/KeysymStr.c
libX11/src/StrKeysym.c
2009-03-19 11:51:09 -07:00
Dan Nicholson 27fe8d1657 Add makekeys for creating keysym hash tables
The makekeys utility is used to generate the keysym hash tables during
the build. We try to detect a build machine native compiler so the
tables can be generated when cross compiling.
2009-03-19 10:54:31 -07:00
Dan Nicholson b58a95d037 Initial autotools commit 2009-03-19 10:47:15 -07:00