summaryrefslogtreecommitdiff
path: root/src/xkbcomp/expr.h
AgeCommit message (Collapse)AuthorFilesLines
2012-10-06expr: unify the real and virtual modifier functionsRan Benita1-7/+3
This again pushes the mod type annotation to the original call site, to make it easier to grep to see where the real/virtual distinction matters. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-06Keep real and virtual mods in the same table in the keymapRan Benita1-1/+1
We change the keymap->vmods array into keymap->mods, and change it's member type from struct xkb_vmod to struct xkb_mod. This table now includes the real modifiers in the first 8 places. To distinguish between them, we add an enum mod_type to struct xkb_mod. Besides being a more reasonable approach, this enables us to share some code later, remove XKB_NUM_CORE_MODS (though the 0xff mask still appears in a few places), and prepares us to flat out remove the distinction in the future. This commit just does the conversion. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-06expr: don't expose LookupModIndexRan Benita1-4/+0
The Lookup* functions should remain a private implementation detail of the expr.c file. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-06Remove VModInfo for nowRan Benita1-8/+4
VModInfo currently is only used to track which virtual modifiers were declared in the file which owns the VModInfo. This, in turn, is only used in ResolveVirtualModifier, which in turn is only used to resolve the virtualModifier field in an interpret statement (compat.c). In other words, it is used to ensure that interprets can only use a vmod which was declared in the same map. We remove this now, because it doesn't do much and distracts from other changes; we will later re-add it properly. Specificly, we will make it so that virtual modifiers are not the exception in that they modify the keymap directly, instead of keeping the changes in some *Info struct and commiting them to the keymap at the end of the compilation. (This is bad because if a vmod is added to the keymap, and then the compilation of this specific file fails, the change sticks around nonetheless). Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24Don't use xkbcommon-compat names in internal codeRan Benita1-1/+1
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-11Remove unused ExprResolveKeyNameDaniel Stone1-4/+0
The only user was removed in 314965b1. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-10kbproto untanglement: XkbKeyNameLengthDaniel Stone1-1/+1
Define it ourselves as XKB_KEY_NAME_LENGTH and use that, instead of the one from XKB.h. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-03Unify some string tables from xkbcomp, text and keymap-dumpRan Benita1-5/+0
We move the LookupEntry struct from expr.h to text.h, along with most of the lookup tables. This makes them available everywhere. Looking up a value in the LookupEntry format is slower than direct index mapping, but it allows multiple names per value (with the canonical one being first) and "all"- and "none"-type masks. These functions are not used anywhere efficiency matters. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03expr: make ResolveString return an atomRan Benita1-1/+1
Almost all callers do xkb_atom_intern on the currently returned string, while ResolveString converts the atom to the string to begin with... uselss double work. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-02expr: move op_type/value_type_to_string functions to astRan Benita1-3/+0
Generally the enum-to-string function should appear where the enum is defined. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01Organize xkbcomp/ header filesRan Benita1-6/+4
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-08-07Add and use xkb_level_index_tRan Benita1-1/+1
Several types are used over the code for shift levels; better to use just one. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-07expr: constify function argumentsRan Benita1-15/+20
We need this for later. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27Remove ExprResultRan Benita1-12/+7
Convert the IdentLookup typedef away from ExprResult, which drags along everything else. This should also make all of the conversions explicit. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveEnumRan Benita1-3/+3
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveMaskRan Benita1-7/+7
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveIntegerRan Benita1-3/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveButtonRan Benita1-3/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveLevelRan Benita1-2/+3
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveKeyCodeRan Benita1-3/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveGroupRan Benita1-2/+3
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveKeysymRan Benita1-2/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveBooleanRan Benita1-3/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveStringRan Benita1-3/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveLhsRan Benita1-6/+4
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27expr: drop ExprResult from ResolveKeyNameRan Benita1-2/+2
Explicit is better than implicit, and this union makes it hard to follow what's what, particularly the confusion with ival/uval. The other Resolve functions will follow. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27Convert defines to enums in xkbcomp.hRan Benita1-7/+4
For statement / expression types. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-27Some atom related optimizationsRan Benita1-1/+1
We often get a strdup'd string, just to pass it over the atom_intern and then immediately free it. But atom_intern then strdup's it again (if it's not interned already); so instead we can have the interning "steal" the memory instead of allocing a new one and freeing the old one. This is done by a new xkb_atom_steal function. It also turns out, that every time we strdup an atom, we don't actually modify it afterwards. Since we are guaranteed that the atom table will live as long as the context, we can just use xkb_atom_text instead. This removes a some more dynamic allocations. For this change we had to remove the ability to append two strings, e.g. "foo" + "bar" -> "foobar" which is only possible with string literals. This is unused and quite useless for our purposes. xkb_atom_strdup is left unused, as it may still be useful. Running rulescomp in valgrind, Before: ==7907== total heap usage: 173,698 allocs, 173,698 frees, 9,775,973 bytes allocated After: ==6348== total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-26expr: Remove ExprResolveFloatRan Benita1-3/+0
Remnant from geometry. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-23expr: use new log functionsRan Benita1-2/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18Get rid of struct xkb_key_nameRan Benita1-1/+1
Just embed it directly. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-17Run source tree through uncrustifyDaniel Stone1-41/+38
.uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11Rename 'ctx' back to 'context' in external APIDaniel Stone1-16/+16
Still keep things as 'ctx' internally so we don't have to worry about typing it too often, but rename the user-visible API back as it was kinda ugly. This partially reverts e7bb1e5f. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09Shorten context to ctxRan Benita1-16/+16
(This breaks the API.) "context" is really annoying to type all the time (and we're going to type it a lot more :). "ctx" is clear, concise and common in many other libraries. Use it! Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fix for xkb -> keymap change.]
2012-05-09Make the context available for XkbcAtomTextRan Benita1-21/+32
And rename the function to xkb_atom_text. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb -> keymap.]
2012-05-09Make the context available for XkbcAtomGetStringRan Benita1-2/+4
In preparation of contextualizing atom handling. Since we touch every function call, we also rename the function to xkb_atom_strdup to match xkb_atom_intern, and be more descriptive. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb -> keymap.]
2012-05-09Change all 'xkb' xkb_keymap names to 'keymap'Daniel Stone1-1/+1
To make it a bit more clear what it actually is. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08Rename xkbcomp/misc.h to xkbcomp-priv.h and use itRan Benita1-1/+1
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-04-30Use stdbool.hRan Benita1-3/+5
'Cause defining your own True and False is so 1990's. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fixed for xkb_desc -> xkb_keymap changes.]
2012-04-30Fix formatting in xkbcomp headersRan Benita1-84/+61
Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fixed for xkb_desc -> xkb_keymap change.]
2012-04-09Rename xkb_desc to xkb_keymapDaniel Stone1-1/+1
struct xkb_desc was just a hangover from the old XkbDescRec, which isn't a very descriptive name. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-10Remove half-implemented radio groupsDaniel Stone1-4/+0
It looks like this could never have worked anyway, what with num_rg always being 0 everywhere. Remove it. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09Introduce xkb_atom_t typeDaniel Stone1-3/+3
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-03Constify some more text functionsRan Benita1-1/+1
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-03Constify global tablesRan Benita1-5/+5
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-20Switch expression resolution priv from char to voidDaniel Stone1-3/+3
Avoids a lot of really lame casts. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20Invert LookupModMask/LookupVModMask orderDaniel Stone1-0/+12
We never want to solely lookup a virtual modifier without also looking up core modifiers. So, rather than chaining the vmod lookup inside the core modifier lookup, invert the ordering. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20Move some definitions from expr.h to expr.cDaniel Stone1-32/+0
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20Remove field reference lookup supportDaniel Stone1-6/+1
None of the lookup functions anyone ever used supported field references, so don't pretend we do in the API. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-20Turn ExprResolveInteger into a simple wrapperDaniel Stone1-3/+1
Move the bulk of ExprResolveInteger into an internal function called ExprResolveIntegerLookup, and introduce ExprResolveInteger as a simple wrapper which doesn't take priv/lookup arguments. Signed-off-by: Daniel Stone <daniel@fooishbar.org>