src/xkbcomp/misc.c


Log

Author Commit Date CI Message
Ran Benita b2c4331a 2012-07-28T22:15:59 Handle key names consistently We treat the key names as fixed length, non NUL terminated strings of length XkbKeyNameLength, and use the appropriate *Text functions to print them. We also use strncpy everywhere instead of memcpy to copy the names, because it does some NUL padding and we might as well. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 724f62c8 2012-07-25T17:29:08 Convert defines to enums in xkbcomp.h For statement / expression types. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 89723b7c 2012-07-24T19:54:14 utils: add/replace string equality macros It's more tidy and less error prone, since we use strcasecmp == 0 a lot. We replace strcmp == 0 by streq, strcasecmp == 0 by istreq, uStrCasePrefix by istreq_prefix and uDupString by strdup_safe. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4f843c81 2012-07-24T13:24:59 Drop Xkbc prefix of text functions Not really needed and inconsistent. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 885f6c8c 2012-07-21T15:35:17 misc: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8e62b368 2012-07-21T01:35:46 compat: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita db98696d 2012-07-17T17:08:14 Remove CommonInfo Not used by anything anymore. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e21fc886 2012-07-17T00:43:59 compat: use list instead of CommonInfo in SymInterpInfo Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita dfa0929c 2012-07-16T22:15:43 Convert macros to inline functions Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d0097f4e 2012-07-15T15:55:34 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>
Ran Benita 091a0542 2012-07-15T14:24:54 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>
Ran Benita 7d9f0313 2012-07-15T13:00:04 Get rid of struct xkb_key_name Just embed it directly. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e8a6a5f0 2012-07-15T10:38:05 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>
Ran Benita 1313af8f 2012-07-15T01:31:34 Get rid of xkb_key_names Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 9308a460 2012-07-17T10:20:15 Run source tree through uncrustify .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>
Ran Benita 6c3e0811 2012-07-14T15:14:44 Convert missed enum merge_mode variables Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 43bf4136 2012-07-14T15:19:12 Fix fileID mess A few problems here: * In e.g. keycodes.c the fileID field of the Info struct was never initialized to the id of the appropriate file, so it was always 0. There's some code which uses it, mostly for warnings. * Some of the fileID fields were unsigned char, which overflows several times, seeing as the ID in some of our tests can get > 1000 (because we reuse the context). * Some sign mismatches. * fileID vs file_id. Hopefully this fixes everything. I doubt this stuff had ever worked as intended, in xkbcomp or otherwise. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 213dcf68 2012-06-29T17:31:10 Use enum for merge mode The merge mode shows up in a lot of functions, so it's useful to give it a distinct type. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 48b4d30a 2012-06-29T17:05:33 Use enum for file types enums are nice for some type safety and readability. This one also removes the distinction between file type mask / file type index and some naming consistency. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f637d35a 2012-06-27T00:22:31 Use void* instead of old style char* in CommonInfo functions Removes some annoying casts. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 374b0c98 2012-05-22T08:39:09 alloc: use darray in xkb_key_names Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita db3e8f2c 2012-05-13T10:14:10 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>
Daniel Stone 7b00485a 2012-05-11T15:03:43 Rename 'ctx' back to 'context' in external API 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>
Ran Benita e7bb1e5f 2012-05-09T15:03:11 Shorten context to ctx (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.]
Ran Benita 64aa5c95 2012-05-09T11:12:30 Make the context available to the parser We will need the context to remove some global state. Also make the Parse* function just return bool while wer'e at it. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 38cb6390 2012-05-09T15:15:30 Change all 'xkb' xkb_keymap names to 'keymap' To make it a bit more clear what it actually is. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 33273304 2012-05-08T13:57:07 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>
Ran Benita 793908a0 2012-04-11T19:58:03 Remove unused 'compiled' field in XkbFile Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a641a185 2012-04-06T03:38:55 Use stdbool.h '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.]
Ran Benita b08629f9 2012-04-06T05:09:17 Do not enable yacc trace facility unconditionally Define DEBUG and set yydebug if you want that. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d116aaef 2012-04-06T05:02:35 Remove unused struct definition Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone ef88c7ef 2012-04-03T15:14:16 Rename xkb_desc to xkb_keymap 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>
Ran Benita bb6ca768 2012-03-27T22:41:22 Make parser and scanner reentrant All global state is removed from the parser and scanner. This makes use of the standard facilities in Bison and Flex for reentrant/pure scanner/lexer and location tracking. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated to current sources.]
Daniel Stone 034ffce6 2012-03-27T17:22:35 Use xkb_contexts in keymap compilation Primarily for the include path, but also for the logging in future. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 2165e16e 2012-03-24T02:36:11 Fix all -Wsign-compare warnings i.e comparison of signed and unsigned values. These are mostly harmless but fixing them allows to compile cleanly with -Wextra. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0480f427 2012-03-23T23:28:24 Remove useless stuff from utils Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: fixed conflicts from strcasecmp, added includes to make filecomp build again]
Daniel Stone a0e756fd 2012-03-09T19:09:25 Introduce xkb_atom_t type Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone ed5c6c17 2012-03-09T16:26:34 Remove geometry support, again It still parses geometry, but happily throws it away. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone b28823cc 2012-03-09T16:04:00 Remove KcCGST names from the map Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 889a299e 2012-03-02T14:49:36 Free XkbFile's when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita ca9829ea 2012-02-24T09:59:25 Don't cache parsed files This needlessly occupies memory for the lifetime of the library, and does not make a noticeable difference otherwise. Instead, just parse the same file again when it happens. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f278cea1 2012-02-29T20:25:11 Remove all uses of the register keyword Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a0dd0526 2012-02-25T11:46:12 Remove unused includes of "tokens.h" Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 8f01b144 2012-02-15T12:54:11 xkbscan: Copy, rather than assign, file name For some reason, lex decided to reduce a strcpy into an assignment, leading to entirely justified valgrind warnings about invalid reads, when scanFile was set to a string which may have only ever lived on the stack of a now-exited function. Make it a strdup() instead. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 4e228511 2012-02-15T14:34:08 Introduce xkb_keycode_t for keycodes And use it consistently everywhere, including with a special long-safe internal keycode type, to ease the transition to large keycodes. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Adam Jackson 73ca959d 2010-09-27T16:05:52 Dead code removal and static markup Signed-off-by: Adam Jackson <ajax@redhat.com>
Kristian Høgsberg 9f602686 2010-07-01T14:35:24 Pull in enough structs and defines from XKBstr.h to only need XKB.h We want to move away from sharing implementation structs and let libX11 and libxkbcommon use each their own set of structs.
Kristian Høgsberg e10e16ad 2010-06-30T17:20:56 Constify XkbcAtomText() Atoms aren't mutable and this lets us put tbGetBuffer() back in the box.
Kristian Høgsberg 399d4bd6 2010-06-28T06:58:01 Drop malloc wrappers
Kristian Høgsberg 47d3b396 2010-06-28T06:50:12 Drop CARD32 and Opaque types
Daniel Stone 7257d4c8 2010-06-21T14:28:34 Use CARD32 instead of Atom, move geom headers in Use CARD32 instead of Atom/KeySym/et al to avoid type size confusion between server and non-server code; relatedly, move the geometry headers in from kbproto, so every non-simple type (i.e. structs containing nothing more than basic types) is now copied into xkbcommon. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 60e7eeeb 2010-06-17T03:16:09 Use CARD32 instead of Atom, drag in XkbClientMapRec On 64-bit architectures, XID varies in size between the server (always 32 bits), and non-server (always unsigned long) for some inexplicable reason. Use CARD32 instead to avoid this horrible trap. This involves dragging in XkbClientMapRec so we don't get stuck in the KeySym trap. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Dan Nicholson 6a84a34d 2009-04-08T07:46:25 Remove all non-public API from XKBcommon.h header The noble intention was to expose all the new API and new generic types in the split out kbproto headers through XKBcommon.h. It turns out that would be a massive amount of work in the server. Someday, but first just wedging in XkbCompileKeymap* would be good. Most of the API is in new internal xkb*.h headers. In order to allow the XKBcommon.h header to be used from the server, we can't pull in other headers from kbproto since the server has its own copies. However, types that are different (XkbDescRec, XkbAction) still have Xkbc equivalents here, and I think they should be used in the server.
Dan Nicholson a2e59767 2009-04-04T12:50:27 xkbcomp: Don't say we're exiting when we're not
Dan Nicholson 5c910623 2009-04-04T09:19:51 Remove trailing spaces in source files
Dan Nicholson a27e56b6 2009-03-31T07:21:20 xkbcomp: Remove duplicated macros
Dan Nicholson a59ce8f5 2009-03-28T15:24:06 Drop another unneeded format argument Almost cleared of XkbMessage...
Dan Nicholson 39d7be43 2009-03-28T11:45:05 xkbcomp: Use xkbcommon allocation functions s/XkbAlloc/XkbcAlloc/ so we don't know XKBlib.
Dan Nicholson 2671b777 2009-03-28T14:06:26 Add more *Text functions from xkbfile This should cover all the usage in xkbcomp. The format arguments were dropped except for the special case of XkbModMaskText, which needs to write in XkbCFile format in HandleVModDef. This was just changed to a Bool to avoid the need for the macros in XKBfile.h. The function prefixes have been renamed to be unique from xkbfile.
Dan Nicholson c277d3d4 2009-03-27T20:53:26 libxkbcomp: s/Status/int/ since we don't have Xlib.h
Dan Nicholson d5a9be65 2009-03-27T20:32:33 libxkbcomp: Drop unused format field for *Text functions
Dan Nicholson 6a578de9 2009-03-27T20:20:01 libxkbcomp: Add non-xkbfile XkbActionTypeText
Dan Nicholson 4fe322aa 2009-03-27T20:13:22 libxkbcomp: s/XPointer/char */ Replace XPointer with its definition since we don't have the privilege of using Xlib.h. Why this is char * and not void *, I'll never know.
Dan Nicholson 72df9bb3 2009-03-28T06:32:08 Move *Text APIs into libxkbcommon These seem like they might be generally useful, and more will be needed from xkbfile.
Dan Nicholson 37769b5a 2009-03-27T20:01:32 libxkbcomp: s/XkbDescPtr/XkbcDescPtr/ We need to use the keyboard description structure from XKBcommon.h since it doesn't have the Display field.
Dan Nicholson 30e01032 2009-03-27T19:25:14 libxkbcomp: Remove usage of client-side headers This will surely break things. Let's see just what we need to replace.
Dan Nicholson a3809b13 2009-03-27T18:55:13 xkbcomp: Add non-xkbfile XkbConfigText
Dan Nicholson 0c1bbb05 2009-03-27T06:55:32 Import xkbcomp sources for CompileKeymap A copy of the xkbcomp sources (except the frontend) have been copied in to provide a means to compile a XkbDescPtr. This definitely doesn't build or do the right thing yet.