Commit Graph

999 Commits (471ebad62311e6a36936bed7e04aa634d385d661)

Author SHA1 Message Date
Daniel Stone 0f09c3073c Make xkb_map_get_as_string test more comprehensive
Add a test/dump.data file which contains the result we're expecting from
xkb_map_get_as_string run on a particularly complex set of keymaps, and
assert that the string representations are the same.  This means that
any updates to xkb_map_get_as_string will also need to update the test
data, but should also ensure that we don't have any more parser
regressions.

Compared with diff to the output of setxkbmap + xkbcomp for the same
keymap; seems completely solid.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-04 13:27:41 +01:00
Daniel Stone 64c277d9f2 Revert "dump"
(Ahem.)

This reverts commit f43f75fb83.
2012-06-04 13:08:01 +01:00
Ran Benita dd1ae1e42f Remove fake support for global group range settings
A symbols file may contain a global, non key specific setting for
the group out-of-range handling method (wrap, clamp, redirect). Only
that:

* Its parsed and kept in the SymbolsInfo, but is not otherwise used in
  any way (it's the same in the real xkbcomp).
* It's not used in any of xkeyboard-config files.
* It's not mentioned in the xkb specs (only the per-key ones).
* It doesn't make much sense anyway.

So remove the struct field, and emit an "unsupported, ignored" warning.
We don't increment the error count because of it, just continue (the
radio group warning just below is changed to do the same - there's no
reason to possibly abort the entire thing for it).

Signed-off-by: Ran Benita <ran234@gmail.com>

Conflicts:

	src/xkbcomp/symbols.c
2012-06-04 13:05:24 +01:00
Daniel Stone 98b155c80a Symbols: Don't include NoSymbols in the map
Instead of using NoSymbol in the map, we use num_syms == 0 to signify
the non-presence of a symbol.  So instead of adding NoSymbol mappings
to the list regardless, detect them and set num_syms == 0.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-04 13:01:33 +01:00
Daniel Stone 28e66a703a Fix multiple errors when merging symbol definitions
We were getting the size calculation wrong, as well as inconsistently
picking a merge strategy.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-04 12:54:54 +01:00
Daniel Stone f43f75fb83 dump 2012-06-02 15:29:21 +01:00
Daniel Stone f531d1e16d keymap-dump: Print NoAction actions too
The failure mode here is a little irritating:
    - server loads map with ISO_Lock action
    - server dumps keymap to string, including:
      interpret ISO_Lock+AnyOfOrAll(None) {
          action= NoAction();
      };
      as we don't (yet) print ISO_Lock actions
    - client parses keymap from string
    - client dumps keymap to string, including:
      interpret ISO_Lock+AnyOfOrAll(None) {
      };
    - this results in a syntax error

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-02 15:25:36 +01:00
Daniel Stone c87468e926 stringcomp: NULL-terminate string
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-29 16:19:24 +01:00
Daniel Stone a3ae0e84e4 Pass merge down through indicator creation
To avoid using potentially undefined memory.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-29 16:19:17 +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
Daniel Stone 208d957806 Fix signed vs. unsigned confusion in actions
Some actions could also take relative rather than absolute parameters,
so they really needed to be signed instead of explicitly unsigned.
Oops.

Fixes, e.g., action= MovePtr(x=-1,y=+1), which was reported as
(x=+65535,y=+1).

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-25 18:02:19 +01:00
Ran Benita ccc047c4e0 compat: use darray for acts and key_acts in the server map
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 18:02:40 +03:00
Ran Benita 89c5e88603 keycodes: use darray in KeyNamesInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 15:45:42 +03:00
Ran Benita 07c88b551b symbols: use darray for xkb_sym_map
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 15:20:47 +03:00
Ran Benita 4daa34b5a3 keytypes: use darray for level names
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:24 +03:00
Ran Benita ee990d53a5 symbols: use darray for KeyInfo
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:24 +03:00
Ran Benita dcdbd14925 parser: use darray for keysym list
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:24 +03:00
Ran Benita c65a3596ae keytypes: use darray for xkb_kt_map_entry's
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:24 +03:00
Ran Benita 374b0c9814 alloc: use darray in xkb_key_names
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:24 +03:00
Ran Benita c2ac3a2b20 keytypes: use darray for key types in the client map
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita 561504162f compat: use darray for sym_interprets
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita d0288bb288 context: use darray for include paths
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita ef51b572aa atom: use darray for the node_table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita 0c271e093a rules: use darray for input line
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita 28bbb7dc51 rules: use darray for rules and groups
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03: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 cb047bb0fc Constify a static variable
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 14:19:23 +03:00
Ran Benita 9e72a6a7af Fix incorrect indexing while freeing
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-22 08:50:25 +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 68edd5f0df rules: allow wildcard match against "" layout/varaint
Currently, if you pass in an rmlvo with an empty string for layout or
variant, it would not match layout and variant rules even with
wildcards. But if the rules file had set an appropriate default, and someone
passes in the empty string, than he should get the default.

NULL in this case signifies not wanting to match against the layout or
variant at all, and so the rule should still fail to match NULLs.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita c900c41760 rules: remove struct var_defs
We can just use struct xkb_rule_names which we already receive as an
argument.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 3d28b6d116 rules: reformat components_from_rules
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 7895eeb8ce rules: reformat LoadRules and XkbRF_Free
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita d18cf31595 rules: remove unused struct describe_vars
It's not actually used for anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 56b125fcc7 rules: reformat AddRule and AddGroup
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita f790257fa7 rules: reformat GetComponents
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:49 +03:00
Ran Benita 52939d4bea rules: reformat SubstituteVars
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita a9477b5754 rules: reformat CheckApplyRules and ApplyPartialMatches
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita a47dd25219 rules: reformat CheckGroup and CheckApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 18d331b86b rules: rewrite MatchOneOf
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita c02c9ab2f2 rules: reformat ApplyRule
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 06205717c3 rules: reformat MakeMultiDefs
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita f7de62861f rules: use asprintf instead of _Concat function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 5f54764d0d rules: reformat CheckLine and break into several functions
And remove struct file_spec which is really unneeded. Should be
slightly more clear now.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 2df35895b5 rules: reformat SetUpRemap and struct remap_spec
Rename to more descriptive names and reformat.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita b8ae68c2a3 rules: rewrite get_index to use sscanf
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita ef76ba97b3 rules: don't typedef the structs and rename them
The long prefix is unnecessary now that they are all private.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 478a6a31d5 rules: reformat input line handling
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00
Ran Benita 72d1f2edef rules: don't use custom logging functions
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-20 20:31:48 +03:00