Commit Graph

693 Commits (c6279b8baeae7dd9ff486bc0fb60ff0bef0587af)

Author SHA1 Message Date
Ran Benita c6279b8bae expr: don't divide by zero
Calculator parser 101.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26 23:15:54 +03:00
Ran Benita 7662397fd4 types: fix canonical types copying
Without the re-initialization, the copying fails. This wasn't noticed
because this code practically never gets executed with ordinary keymaps.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26 22:55:41 +03:00
Ran Benita 3c58072172 keycodes: fix valgrind warnings
==7071== Conditional jump or move depends on uninitialised value(s)
==7071==    at 0x40B6CB: AddIndicatorName (keycodes.c:148)
==7071==    by 0x40C34F: MergeIncludedKeycodes (keycodes.c:420)
==7071==    by 0x40C613: HandleIncludeKeycodes (keycodes.c:480)
==7071==    by 0x40D022: HandleKeycodesFile (keycodes.c:733)
==7071==    by 0x40D79F: CompileKeycodes (keycodes.c:881)
==7071==    by 0x401E22: compile_keymap (xkbcomp.c:157)
==7071==    by 0x402091: xkb_map_new_from_kccgst (xkbcomp.c:229)
==7071==    by 0x40216A: xkb_map_new_from_names (xkbcomp.c:254)
==7071==    by 0x4046F5: test_compile_rules (common.c:164)
==7071==    by 0x4015C1: test_rmlvo (rulescomp.c:44)
==7071==    by 0x40180D: main (rulescomp.c:98)

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26 22:55:34 +03:00
Ran Benita d4eee86160 parse: remove unused #define
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26 22:55:28 +03:00
Ran Benita 2e245a9a41 expr: Remove ExprResolveFloat
Remnant from geometry.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26 22:55:17 +03:00
Daniel Stone 9bd55b55f8 makekeys: Add top_srcdir to include path
Fixes distcheck with no /usr/include/xkbcommon.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-23 23:10:07 +01: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 2c30fa7a60 Remove old logging leftovers
Everything has been converted.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 70e3e7e5c3 xkbcomp: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita f48ee2d2af parse: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 8e3958032c path: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 885f6c8cb6 misc: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 544a83e6d7 vmod: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 3bb3e9c3a9 rules: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita d659f2b46b expr: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita e037f51862 action: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 87444fb969 types: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:35 +03:00
Ran Benita 36df40c3cd types: add keymap to KeyTypesInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 8e62b368a7 compat: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 270ff8ad83 compat: add keymap to CompatInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 7dc51ea84a symbols: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 7ef648134d symbols: add keymap to SymbolsInfo
and use it. Also make sure info is the first argument to the functions
in this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 0ae1199a5a keycodes: use new log functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 37579ce9a5 keycodes: add keymap to KeyNamesInfo
and let the info always be the first argument to the various functions,
just for consistency (and it acting as the contex for this file).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +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 71c2f2e0e2 utils: replace FATAL by malloc_or_die
"Out of memory" is enough in this case. If we want to be OOM-safe this
makes it clear where to begin.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 58f8d2c151 utils: remove Xfuncproto.h and use our own macros
Add XKB_EXPORT to replace _X_EXPORT, and copy the definitions of
_X_ATTRIBUTE_FOO as ATTR_FOO.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23 00:45:34 +03:00
Ran Benita 8b0e9f929c utils: remove uTypedAlloc/Calloc
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 2fc0ad5001 Fix bison 2.6 and clang warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-20 12:48:13 +03:00
Ran Benita db98696d0b Remove CommonInfo
Not used by anything anymore.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 21:06:07 +03:00
Ran Benita 250c925ce4 types: use list instead of CommonInfo for KeyTypeInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 21:06:07 +03:00
Ran Benita 85826c3c13 Simplify HandleInclude functions
Instead of special casing the first include, process it inside the loop
as well. It works perfectly fine.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 21:06:07 +03:00
Ran Benita 861e6a1751 Remove haveSelf include feature
When including a file from another file, its possible to do something
like this:
    include "+some(other)+files"
with the "+" or "|" in the beginning. What will happen then is that
instead of processing the include files separately and then merging into
the existing info, we instead start with the existing info and merge
into it as we go, as if it was written explicitly before the first "+".

It's not particulary clear what this may be useful for. Since it's not
used by xkeyboard-config, not documented anywhere (and google doesn't
bring up anything), completely untested and kind of ugly, remove this
"feature". It most likely never been used.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 20:40:33 +03:00
Ran Benita 730c2bc34f types: use list instead of CommonInfo in PreserveInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 85abd36bf4 types: move global static tok_ atoms into KeyTypesInfo
The atoms are context-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 119c952b82 compat: use list instead of CommonInfo in LEDInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:41 +03:00
Ran Benita 50b25a1210 Use xkb_group_index_t for group variables throughout
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 15:25:37 +03:00
Ran Benita 8237e9c77a Remove _X_EXPORT from xkb_key_get_group/level
We should add them to xkbcommon.h if they need to.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita e21fc886ca compat: use list instead of CommonInfo in SymInterpInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +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 3fbf4ce315 keycodes: use list instead of CommonInfo in IndicatorNameInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita 4bf987e5f7 keycodes: use list instead of CommonInfo in AliasInfo
Always pass around the KeyNamesInfo which contains the list head.

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 cf4f170bdd symbols: don't use CommonInfo in KeyInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 14:07:02 +03:00
Ran Benita ebb4d59c58 symbols: use list for ModMapEntry's
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 0a6f9ccde2 symbols: remove alias info
It's never used - all of the aliases are added in the keycodes section.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:56:05 +03:00
Ran Benita d0097f4e60 Pass around xkb_key's instead of keycodes
This way we don't need to look up the key every time. We now only deal
with keycodes in the public API and in keycodes.c.

Also adds an xkb_foreach_key macro, which is used a lot.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:47:29 +03:00