bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/8] Rule vmod returns an int with the vmod's bit on.


From: Diego Nieto Cid
Subject: [PATCH 3/8] Rule vmod returns an int with the vmod's bit on.
Date: Wed, 4 Aug 2010 04:20:01 -0300

This allows to combine virtual modifiers safely using a bitwise or
operation.
Also, warn when too many virtual modifier are defined.
---
 parser.y  |    5 ++++-
 xkbdata.c |    2 ++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/parser.y b/parser.y
index cf1ca33..2def00a 100644
--- a/parser.y
+++ b/parser.y
@@ -315,7 +315,10 @@ vmods_def:
 
 /* Return the number of the virtual modifier.  */
 vmod:
-       IDENTIFIER              { $$ = vmod_find ($1); }
+       IDENTIFIER
+       { if (($$ = vmod_find ($1)) != 0)
+           $$ = 1 << ($$ - 1);
+       }
 ;
 
 /* A single realmodifier.  */
diff --git a/xkbdata.c b/xkbdata.c
index 1cba0d5..4f022dd 100644
--- a/xkbdata.c
+++ b/xkbdata.c
@@ -376,6 +376,8 @@ vmod_add (char *vmodname)
   vmodnamel = vmn;
 
   lastvmod++;
+  if (lastvmod > 16)
+         debug_printf("warning: only sixteen virtual modifiers are supported, 
%s will not be functional.\n", vmodname);
 
   return 0;
 }
-- 
1.7.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]