Commit Graph

1231 Commits (1651e5af465f45f9b6fff7e65ab958425ccda00b)

Author SHA1 Message Date
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
Ran Benita 35a93b8e64 map: verifiy that the keycode is legal
In case someone passes in a bad keycode.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 091a0542ac Remove redundant keymap->keys resizes
The size (i.e. max_keycode) is determined in the keycodes section, which
gets compiled first.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita ad8875c526 Remove GroupsWidth macro
Use key->width directly instead.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita c705a82d60 Remove unused 'groupInfo' in KeyTypeInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 4ccb0ef5cc Get rid of group_info
This is 8 bits which hold how many groups the key has, what to do the
key group is out of bound and the group to redirect to if want to. This
may save a few bytes, but is really annoying. So instead, just lay out
the fields separately. We can optimize later in a sane way, with pahole,
bitfields, etc. if we want.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:29 +03:00
Ran Benita 4066fcc9b5 Get rid of struct xkb_sym_map
Past its usefulness; put the stuff directly in xkb_key.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:46:28 +03:00
Ran Benita 7d9f031341 Get rid of struct xkb_key_name
Just embed it directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:45:28 +03:00
Ran Benita e8a6a5f09a Add common xkb_key struct
Instead of having a million arrays from the keycode to various
key-specific info in the keymap, add a single struct xkb_key to hold all
of the data for the key in one object. This way we can pass it around,
do some refactoring and make the code simpler. It's also nice to see
everything in one place.

The keys array is still indexed by keycode, which is suboptimal because
there may be a lot of holes (i.e. unused keycodes between min_key_code
and max_key_code). By the end of this series it would be abstracted
enough to replace it by a hash table or similar if there's ever a need.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:45:22 +03:00
Ran Benita e668d00956 Replace KeyInfo 'key' variable name by 'keyi'
We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:39:37 +03:00
Ran Benita 81d029f563 Replace xkb_keycode_t 'key' variable name by 'kc'
We want to reserve the name 'key' for something else.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:35:48 +03:00
Ran Benita a52fb7e21c Convert indecipherable macros to inline functions
This was fun.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:29 +03:00
Ran Benita c064b95c7c symbols: split initialization code from CompileSymbols
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18 12:25:29 +03:00