|
7a87c202
|
2014-09-10T13:10:33
|
|
ast-build: fix leak in error path
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
40f109af
|
2014-07-27T14:24:20
|
|
ast-build: make sure InterpDef is freeable
With the following two rules:
InterpretDecl : INTERPRET InterpretMatch OBRACE
VarDeclList
CBRACE SEMI
{ $2->def = $4; $$ = $2; }
;
InterpretMatch : KeySym PLUS Expr
{ $$ = InterpCreate($1, $3); }
| KeySym
{ $$ = InterpCreate($1, NULL); }
;
And the fact that InterpCreate doesn't initialize ->def, if the
VarDeclList fails, the %destructor tries to recursively free the
uninitialized ->def VarDef. So always initialize it.
That was the only problematic code in the parser for %destructor (I'm
pretty sure).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
61fed8da
|
2014-07-26T00:19:34
|
|
Replace darray_mem with a new darray_steal
That's a more declarative interface.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fbd92860
|
2014-07-26T00:13:54
|
|
ast-build: use cast instead of ->common
Missed in 1b2bb204e0baa2246a6232aea762c1edb00cd44a.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
86cfef63
|
2014-05-11T09:47:56
|
|
ast-build: don't leak on OOM in BoolVarCreate
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
1b2bb204
|
2014-02-13T23:57:22
|
|
ast: cast to ParseCommon explictly instead of using ->common
Some tools were getting mighty confused with what we were doing.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
16aab829
|
2014-02-09T23:21:19
|
|
ast: remove unneeded 'ctx' param to XkbFileCreate
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
50b73ec0
|
2014-02-08T15:10:09
|
|
Use unsigned int for saving darray_size return value
See: b9b3593cbdeb7f5b02d50cecaba6a0b47d4979ad
So these should be unsigned int's now.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
6ea15719
|
2014-02-08T01:26:35
|
|
ast: use more suitable types in a few ast nodes
The int ones cannot be signed (they come as such from the scanner, and
NEGATE is never applied to them).
The uint32_t one is really an atom, but presumably the type was never
converted to xkb_atom_t.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4884a8e6
|
2013-08-02T10:19:01
|
|
keymap: move XkbEscapeMapName() to keymap.c.
So we can use it outside src/xkbcomp; it is not really specific to it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b63fa3b1
|
2013-12-01T13:32:51
|
|
expr: make Expr creation naming and file location consistent
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
07334f4d
|
2013-12-01T13:29:30
|
|
expr: add wrapper macro for ExprCreate
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
972395b8
|
2013-12-01T12:08:47
|
|
expr: split expression types and allocate them separately
Currently, we have one ExprDef type, which contains a tagged union with
the value of all expression types. Turns out, this union is quite
wasteful memory-wise. Instead, create separate types for all expressions
(e.g ExprBinary, ExprInteger) which embed the common fields
(ExprCommon), and malloc them per their size; ExprDef then becomes a
union of all these types, but is just used as a generic pointer.
[Instead of making ExprDef a union, another option is to use
ExprCommon as the generic pointer type and then do up-castings, like we
do with ParseCommon. But this makes the code much uglier.]
The diff is mostly straightforward mechanical adaptations. It could have
been much smaller with the help of C11 anonymous structs (which were
previously a gnu extension). This will have saved all of the 'op' ->
'expr->op', etc changes. But if we can be a bit more portable for a
little effort, we should.
Before (./test/rulescomp, x86 32 bit, -O2):
==12974== total heap usage: 145,217 allocs, 145,217 frees, 10,476,238 bytes allocated
After:
==11145== total heap usage: 145,217 allocs, 145,217 frees, 8,270,358 bytes allocated
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
068016e4
|
2013-12-01T10:45:52
|
|
parser, symbols: drop unnecessary casts
It's casted into ExprDef and then uncasted for no reason.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4a7bfb68
|
2013-12-01T10:31:27
|
|
expr: use ExprCreate in more places
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c24b6420
|
2013-11-30T23:24:18
|
|
expr: add constructor for boolean expressions
Also add a 'bool set' to the ExprDef union, instead of using 'ival' as a
bool.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c5d85938
|
2013-11-30T23:12:45
|
|
expr: add constructors for more expression types
This makes the parser a bit more declarative. But really it might make
error handling easier.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
dbd8b1ef
|
2013-11-30T22:25:39
|
|
expr: add 'ident' value to ExprDef union
This distinguishes between an identifier expression and a string
expression in the union.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9dc5b8cb
|
2013-11-27T13:49:13
|
|
Resolve keysyms early in parser
Instead of having the parser passing strings to the AST, and
symbols/compat etc. resolving them themselves. This simplifies the code
a bit, and makes it possible to print where exactly in the file the bad
keysym originates from.
The previous lazy approach had an advantage of not needlessly resolving
keysyms from unrelated maps. However, I think reporting these errors in
*any* map is better, and the parser is also a bit smarter then old
xkbcomp and doesn't parse many useless maps. So there's no discernible
speed/memory difference with this change.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4b560287
|
2013-07-18T14:50:21
|
|
xkbcomp: escape the section names before storing them in the keymap
This ensures the names are escaped before having any interaction with
the user.
This was caught by noticing dump(compile(dump())) != dump. Since that's
a nice test we add it to stringcomp.
https://bugs.freedesktop.org/show_bug.cgi?id=67032
Reported-By: Auke Booij
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
56ba9866
|
2013-03-04T14:16:36
|
|
Remove file_id entirely
It is not used anymore.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
35657c66
|
2013-02-25T16:38:56
|
|
ast-build: remove malloc_or_die
This should be fixed properly.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d1f7100b
|
2013-02-25T01:12:38
|
|
ast: add error handling to XkbFileFromComponents
And try to not repeat ourselves.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fc56b513
|
2013-02-08T00:02:49
|
|
ast: constify argument
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
8cee7490
|
2013-02-17T22:18:57
|
|
Change 'indicator' to 'led' everywhere possible
The code currently uses the two names interchangeably.
Settle on 'led', because it is shorter, more recognizable, and what we
use in our API (though of course the parser still uses 'indicator').
In camel case we make it 'Led'.
We change 'xkb_indicator_map' to just 'xkb_led' and the variables of
this type are 'led'. This mimics 'xkb_key' and 'key'.
IndicatorNameInfo and LEDInfo are changed to 'LedNameInfo' and
'LedInfo', and the variables are 'ledi' (like 'keyi' etc.). This is
instead of 'ii' and 'im'.
This might make a few places a bit confusing, but less than before I
think. It's also shorter.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
89523789
|
2012-10-11T21:50:21
|
|
ast: simplify AppendStmt
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
41a7fed3
|
2012-09-27T19:21:26
|
|
Fix type of keycode in parser and ast
For some reason keycodes were listed under mapFlags in the yylval union.
Fix it and some sanity checks.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3b389b15
|
2012-09-27T18:49:13
|
|
Don't limit key names to 4 characters
Currently you can't give a key in xkb_keycodes a name of more than
XKB_KEY_NAME_LENGTH (= 4) chars. This is a pretty annoying and arbitrary
limitation; it leads to names such as <RTSH>, <COMP>, <PRSC>, <KPAD>
etc. which may be hard to decipher, and makes it impossible to give
more standard names (e.g. from linux/input.h) to keycodes.
The purpose of this, as far as I can tell, was to save memory and to
allow encoding a key name directly to a 32 bit value (unsigned long it
was).
We remove this limitation by just storing the names as atoms; this lifts
the limit, allows for easy comparison like the unsigned long thing, and
doesn't use more memory than previous solution. It also relieves us from
doing all of the annoying conversions to/from long.
This has a large diffstat only because KeyNameText, which is used a lot,
now needs to take the context in order to resolve the atom.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c1741732
|
2012-09-21T11:14:39
|
|
Don't choke on RMLVO layout string with holes
This old rules parser gives the same kccgst here, so in the interest of
staying compatible we shouldn't fix it there. Similarly we shouldn't
touch ParseIncludeMap, so this is the best place to handle this.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b4b40d73
|
2012-09-12T16:54:07
|
|
Copyright updates
With Dan Nicholson's permission (via email), update his copyright and
license statements to the standard X.Org boilerplate MIT license, as
both myself and Ran have been using.
Clean up my copyright declarations (in some cases to correct ownership),
and add copyright/license statements from myself and/or Ran where
appropriate.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
b6e04571
|
2012-09-10T20:16:05
|
|
kbproto unentanglement: XkbLC_*
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
|
|
f5dffd2b
|
2012-08-21T11:21:19
|
|
kbproto untanglement: XkbKeyNameLength
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>
|
|
591df115
|
2012-08-27T19:20:41
|
|
Move enum xkb_file_type to xkbcomp/ast.h
This is a more suitable place for this enum, since it's internal to
xkbcomp.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
efc2d741
|
2012-08-27T18:58:36
|
|
xkbcomp: clean up compile_keymap function
We make the xkb_file_type enum sequential instead of masks, and then
we don't have to repeat the file types several times in the function.
Makes the code cleaner.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d3ddcf70
|
2012-08-15T21:45:02
|
|
expr: move op_type/value_type_to_string functions to ast
Generally the enum-to-string function should appear where the enum is
defined.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
cdc228ea
|
2012-08-13T11:00:43
|
|
Organize xkbcomp/ header files
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>
|