loadkeys -a: Switch to ASCII mode
authorAlexey Gladkov <gladkov.alexey@gmail.com>
Wed, 30 Jun 2010 13:56:16 +0000 (17:56 +0400)
committerAlexey Gladkov <gladkov.alexey@gmail.com>
Wed, 30 Jun 2010 14:19:00 +0000 (18:19 +0400)
This change is introduced in order to be forced to stay
in ASCII mode to Unicode console, see http://bugs.gentoo.org/324351.

Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
src/loadkeys.c
src/loadkeys.y

index a610722..1d3d849 100644 (file)
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+   
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-
+   
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -47,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Pure parsers.  */
 #define YYPURE 0
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
+/* Push parsers.  */
+#define YYPUSH 0
 
+/* Pull parsers.  */
+#define YYPULL 1
 
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     EOL = 258,
-     NUMBER = 259,
-     LITERAL = 260,
-     CHARSET = 261,
-     KEYMAPS = 262,
-     KEYCODE = 263,
-     EQUALS = 264,
-     PLAIN = 265,
-     SHIFT = 266,
-     CONTROL = 267,
-     ALT = 268,
-     ALTGR = 269,
-     SHIFTL = 270,
-     SHIFTR = 271,
-     CTRLL = 272,
-     CTRLR = 273,
-     CAPSSHIFT = 274,
-     COMMA = 275,
-     DASH = 276,
-     STRING = 277,
-     STRLITERAL = 278,
-     COMPOSE = 279,
-     TO = 280,
-     CCHAR = 281,
-     ERROR = 282,
-     PLUS = 283,
-     UNUMBER = 284,
-     ALT_IS_META = 285,
-     STRINGS = 286,
-     AS = 287,
-     USUAL = 288,
-     ON = 289,
-     FOR = 290
-   };
-#endif
-/* Tokens.  */
-#define EOL 258
-#define NUMBER 259
-#define LITERAL 260
-#define CHARSET 261
-#define KEYMAPS 262
-#define KEYCODE 263
-#define EQUALS 264
-#define PLAIN 265
-#define SHIFT 266
-#define CONTROL 267
-#define ALT 268
-#define ALTGR 269
-#define SHIFTL 270
-#define SHIFTR 271
-#define CTRLL 272
-#define CTRLR 273
-#define CAPSSHIFT 274
-#define COMMA 275
-#define DASH 276
-#define STRING 277
-#define STRLITERAL 278
-#define COMPOSE 279
-#define TO 280
-#define CCHAR 281
-#define ERROR 282
-#define PLUS 283
-#define UNUMBER 284
-#define ALT_IS_META 285
-#define STRINGS 286
-#define AS 287
-#define USUAL 288
-#define ON 289
-#define FOR 290
-
+/* Using locations.  */
+#define YYLSP_NEEDED 0
 
 
 
 /* Copy the first part of user declarations.  */
+
+/* Line 189 of yacc.c  */
 #line 12 "loadkeys.y"
 
 #include <errno.h>
@@ -234,6 +162,9 @@ FILE *find_incl_file(char *s);
 int yylex (void);
 
 
+/* Line 189 of yacc.c  */
+#line 167 "loadkeys.c"
+
 /* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -252,20 +183,99 @@ int yylex (void);
 # define YYTOKEN_TABLE 0
 #endif
 
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     EOL = 258,
+     NUMBER = 259,
+     LITERAL = 260,
+     CHARSET = 261,
+     KEYMAPS = 262,
+     KEYCODE = 263,
+     EQUALS = 264,
+     PLAIN = 265,
+     SHIFT = 266,
+     CONTROL = 267,
+     ALT = 268,
+     ALTGR = 269,
+     SHIFTL = 270,
+     SHIFTR = 271,
+     CTRLL = 272,
+     CTRLR = 273,
+     CAPSSHIFT = 274,
+     COMMA = 275,
+     DASH = 276,
+     STRING = 277,
+     STRLITERAL = 278,
+     COMPOSE = 279,
+     TO = 280,
+     CCHAR = 281,
+     ERROR = 282,
+     PLUS = 283,
+     UNUMBER = 284,
+     ALT_IS_META = 285,
+     STRINGS = 286,
+     AS = 287,
+     USUAL = 288,
+     ON = 289,
+     FOR = 290
+   };
+#endif
+/* Tokens.  */
+#define EOL 258
+#define NUMBER 259
+#define LITERAL 260
+#define CHARSET 261
+#define KEYMAPS 262
+#define KEYCODE 263
+#define EQUALS 264
+#define PLAIN 265
+#define SHIFT 266
+#define CONTROL 267
+#define ALT 268
+#define ALTGR 269
+#define SHIFTL 270
+#define SHIFTR 271
+#define CTRLL 272
+#define CTRLR 273
+#define CAPSSHIFT 274
+#define COMMA 275
+#define DASH 276
+#define STRING 277
+#define STRLITERAL 278
+#define COMPOSE 279
+#define TO 280
+#define CCHAR 281
+#define ERROR 282
+#define PLUS 283
+#define UNUMBER 284
+#define ALT_IS_META 285
+#define STRINGS 286
+#define AS 287
+#define USUAL 288
+#define ON 289
+#define FOR 290
+
+
+
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
-
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 269 "loadkeys.c"
+/* Line 264 of yacc.c  */
+#line 279 "loadkeys.c"
 
 #ifdef short
 # undef short
@@ -340,14 +350,14 @@ typedef short int yytype_int16;
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int i)
+YYID (int yyi)
 #else
 static int
-YYID (i)
-    int i;
+YYID (yyi)
+    int yyi;
 #endif
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -428,9 +438,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-  };
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -464,12 +474,12 @@ union yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack)                                       \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \
     do                                                                 \
       {                                                                        \
        YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack, Stack, yysize);                          \
-       Stack = &yyptr->Stack;                                          \
+       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+       Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
       }                                                                        \
@@ -591,7 +601,7 @@ static const char *const yytname[] =
   "PLUS", "UNUMBER", "ALT_IS_META", "STRINGS", "AS", "USUAL", "ON", "FOR",
   "$accept", "keytable", "line", "charsetline", "altismetaline",
   "usualstringsline", "usualcomposeline", "keymapline", "range", "range0",
-  "strline", "compline", "compsym", "singleline", "@1", "modifiers",
+  "strline", "compline", "compsym", "singleline", "$@1", "modifiers",
   "modifier", "fullline", "rvalue0", "rvalue1", "rvalue", 0
 };
 #endif
@@ -909,17 +919,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
 #else
 static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -953,11 +966,11 @@ yy_reduce_print (yyvsp, yyrule)
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &(yyvsp[(yyi + 1) - (yynrhs)])
                                       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1237,10 +1250,8 @@ yydestruct (yymsg, yytype, yyvaluep)
        break;
     }
 }
-\f
 
 /* Prevent warnings from -Wmissing-prototypes.  */
-
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
@@ -1256,11 +1267,10 @@ int yyparse ();
 #endif /* ! YYPARSE_PARAM */
 
 
-
-/* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
 
 /* Number of syntax errors so far.  */
@@ -1268,9 +1278,9 @@ int yynerrs;
 
 
 
-/*----------.
-| yyparse.  |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse.  |
+`-------------------------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1294,66 +1304,68 @@ yyparse ()
 #endif
 #endif
 {
-  
-  int yystate;
-  int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
 
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
 
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
 
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
 
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
+       Refer to the stacks thru separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
 
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
 
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
 
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
+    YYSIZE_T yystacksize;
 
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
 
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY;            /* Cause a token to be read.  */
+  yychar = YYEMPTY; /* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
-
   yyssp = yyss;
   yyvsp = yyvs;
 
@@ -1383,7 +1395,6 @@ yyparse ()
        YYSTYPE *yyvs1 = yyvs;
        yytype_int16 *yyss1 = yyss;
 
-
        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
@@ -1391,7 +1402,6 @@ yyparse ()
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * sizeof (*yyssp),
                    &yyvs1, yysize * sizeof (*yyvsp),
-
                    &yystacksize);
 
        yyss = yyss1;
@@ -1414,9 +1424,8 @@ yyparse ()
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
        if (! yyptr)
          goto yyexhaustedlab;
-       YYSTACK_RELOCATE (yyss);
-       YYSTACK_RELOCATE (yyvs);
-
+       YYSTACK_RELOCATE (yyss_alloc, yyss);
+       YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
@@ -1427,7 +1436,6 @@ yyparse ()
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
-
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                  (unsigned long int) yystacksize));
 
@@ -1437,6 +1445,9 @@ yyparse ()
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
   goto yybackup;
 
 /*-----------.
@@ -1445,16 +1456,16 @@ yyparse ()
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -1486,20 +1497,16 @@ yybackup:
       goto yyreduce;
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
@@ -1539,6 +1546,8 @@ yyreduce:
   switch (yyn)
     {
         case 14:
+
+/* Line 1455 of yacc.c  */
 #line 121 "loadkeys.y"
     {
                            set_charset((char *) kbs_buf.kb_string);
@@ -1546,6 +1555,8 @@ yyreduce:
     break;
 
   case 15:
+
+/* Line 1455 of yacc.c  */
 #line 126 "loadkeys.y"
     {
                            alt_is_meta = 1;
@@ -1553,6 +1564,8 @@ yyreduce:
     break;
 
   case 16:
+
+/* Line 1455 of yacc.c  */
 #line 131 "loadkeys.y"
     {
                            strings_as_usual();
@@ -1560,6 +1573,8 @@ yyreduce:
     break;
 
   case 17:
+
+/* Line 1455 of yacc.c  */
 #line 136 "loadkeys.y"
     {
                            compose_as_usual((char *) kbs_buf.kb_string);
@@ -1567,6 +1582,8 @@ yyreduce:
     break;
 
   case 18:
+
+/* Line 1455 of yacc.c  */
 #line 140 "loadkeys.y"
     {
                            compose_as_usual(0);
@@ -1574,6 +1591,8 @@ yyreduce:
     break;
 
   case 19:
+
+/* Line 1455 of yacc.c  */
 #line 145 "loadkeys.y"
     {
                            keymaps_line_seen = 1;
@@ -1581,6 +1600,8 @@ yyreduce:
     break;
 
   case 22:
+
+/* Line 1455 of yacc.c  */
 #line 153 "loadkeys.y"
     {
                            int i;
@@ -1590,6 +1611,8 @@ yyreduce:
     break;
 
   case 23:
+
+/* Line 1455 of yacc.c  */
 #line 159 "loadkeys.y"
     {
                            addmap((yyvsp[(1) - (1)]),1);
@@ -1597,6 +1620,8 @@ yyreduce:
     break;
 
   case 24:
+
+/* Line 1455 of yacc.c  */
 #line 164 "loadkeys.y"
     {
                            if (KTYP((yyvsp[(2) - (5)])) != KT_FN)
@@ -1608,6 +1633,8 @@ yyreduce:
     break;
 
   case 25:
+
+/* Line 1455 of yacc.c  */
 #line 173 "loadkeys.y"
     {
                            compose((yyvsp[(2) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)]));
@@ -1615,6 +1642,8 @@ yyreduce:
     break;
 
   case 26:
+
+/* Line 1455 of yacc.c  */
 #line 177 "loadkeys.y"
     {
                            compose((yyvsp[(2) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)]));
@@ -1622,21 +1651,29 @@ yyreduce:
     break;
 
   case 27:
+
+/* Line 1455 of yacc.c  */
 #line 182 "loadkeys.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 28:
+
+/* Line 1455 of yacc.c  */
 #line 184 "loadkeys.y"
     { (yyval) = (yyvsp[(1) - (1)]) ^ 0xf000; }
     break;
 
   case 29:
+
+/* Line 1455 of yacc.c  */
 #line 186 "loadkeys.y"
     { mod = 0; }
     break;
 
   case 30:
+
+/* Line 1455 of yacc.c  */
 #line 188 "loadkeys.y"
     {
                            addkey((yyvsp[(4) - (7)]), mod, (yyvsp[(6) - (7)]));
@@ -1644,6 +1681,8 @@ yyreduce:
     break;
 
   case 31:
+
+/* Line 1455 of yacc.c  */
 #line 192 "loadkeys.y"
     {
                            addkey((yyvsp[(3) - (6)]), 0, (yyvsp[(5) - (6)]));
@@ -1651,51 +1690,71 @@ yyreduce:
     break;
 
   case 34:
+
+/* Line 1455 of yacc.c  */
 #line 199 "loadkeys.y"
     { mod |= M_SHIFT;  }
     break;
 
   case 35:
+
+/* Line 1455 of yacc.c  */
 #line 200 "loadkeys.y"
     { mod |= M_CTRL;   }
     break;
 
   case 36:
+
+/* Line 1455 of yacc.c  */
 #line 201 "loadkeys.y"
     { mod |= M_ALT;            }
     break;
 
   case 37:
+
+/* Line 1455 of yacc.c  */
 #line 202 "loadkeys.y"
     { mod |= M_ALTGR;  }
     break;
 
   case 38:
+
+/* Line 1455 of yacc.c  */
 #line 203 "loadkeys.y"
     { mod |= M_SHIFTL; }
     break;
 
   case 39:
+
+/* Line 1455 of yacc.c  */
 #line 204 "loadkeys.y"
     { mod |= M_SHIFTR; }
     break;
 
   case 40:
+
+/* Line 1455 of yacc.c  */
 #line 205 "loadkeys.y"
     { mod |= M_CTRLL;  }
     break;
 
   case 41:
+
+/* Line 1455 of yacc.c  */
 #line 206 "loadkeys.y"
     { mod |= M_CTRLR;  }
     break;
 
   case 42:
+
+/* Line 1455 of yacc.c  */
 #line 207 "loadkeys.y"
     { mod |= M_CAPSSHIFT;      }
     break;
 
   case 43:
+
+/* Line 1455 of yacc.c  */
 #line 210 "loadkeys.y"
     {
            int i, j;
@@ -1730,6 +1789,8 @@ yyreduce:
     break;
 
   case 46:
+
+/* Line 1455 of yacc.c  */
 #line 246 "loadkeys.y"
     {
                            if (rvalct >= MAX_NR_KEYMAPS)
@@ -1739,38 +1800,51 @@ yyreduce:
     break;
 
   case 47:
+
+/* Line 1455 of yacc.c  */
 #line 253 "loadkeys.y"
     {(yyval)=convert_code((yyvsp[(1) - (1)]), TO_AUTO);}
     break;
 
   case 48:
+
+/* Line 1455 of yacc.c  */
 #line 255 "loadkeys.y"
     {(yyval)=add_capslock((yyvsp[(2) - (2)]));}
     break;
 
   case 49:
+
+/* Line 1455 of yacc.c  */
 #line 257 "loadkeys.y"
     {(yyval)=convert_code((yyvsp[(1) - (1)])^0xf000, TO_AUTO);}
     break;
 
   case 50:
+
+/* Line 1455 of yacc.c  */
 #line 259 "loadkeys.y"
     {(yyval)=add_capslock((yyvsp[(2) - (2)])^0xf000);}
     break;
 
   case 51:
+
+/* Line 1455 of yacc.c  */
 #line 261 "loadkeys.y"
     {(yyval)=(yyvsp[(1) - (1)]);}
     break;
 
   case 52:
+
+/* Line 1455 of yacc.c  */
 #line 263 "loadkeys.y"
     {(yyval)=add_capslock((yyvsp[(2) - (2)]));}
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 1774 "loadkeys.c"
+
+/* Line 1455 of yacc.c  */
+#line 1848 "loadkeys.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1781,7 +1855,6 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
@@ -1846,7 +1919,7 @@ yyerrlab:
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
+      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */
 
       if (yychar <= YYEOF)
@@ -1863,7 +1936,7 @@ yyerrlab:
        }
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -1920,9 +1993,6 @@ yyerrlab1:
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   *++yyvsp = yylval;
 
 
@@ -1947,7 +2017,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -1958,7 +2028,7 @@ yyexhaustedlab:
 #endif
 
 yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
+  if (yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
                 yytoken, &yylval);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -1984,6 +2054,8 @@ yyreturn:
 }
 
 
+
+/* Line 1675 of yacc.c  */
 #line 265 "loadkeys.y"
                        
 
@@ -1997,6 +2069,7 @@ usage(void) {
 "\n"
 "Valid options are:\n"
 "\n"
+"  -a --ascii         force conversion to ASCII\n"
 "  -b --bkeymap       output a binary keymap to stdout\n"
 "  -c --clearcompose  clear kernel compose table\n"
 "  -C <cons1,cons2,...> --console=<cons1,cons2,...>\n"
@@ -2012,6 +2085,7 @@ usage(void) {
 }
 
 char **args;
+int opta = 0;
 int optb = 0;
 int optd = 0;
 int optm = 0;
@@ -2023,8 +2097,9 @@ int nocompose = 0;
 
 int
 main(int argc, char *argv[]) {
-       const char *short_opts = "bcC:dhmsuqvV";
+       const char *short_opts = "abcC:dhmsuqvV";
        const struct option long_opts[] = {
+               { "ascii",      no_argument, NULL, 'a' },
                { "bkeymap",    no_argument, NULL, 'b' },
                { "clearcompose", no_argument, NULL, 'c' },
                { "console",    1, NULL, 'C' },
@@ -2054,6 +2129,9 @@ main(int argc, char *argv[]) {
        while ((c = getopt_long(argc, argv,
                short_opts, long_opts, NULL)) != -1) {
                switch (c) {
+                       case 'a':
+                               opta = 1;
+                               break;
                        case 'b':
                                optb = 1;
                                break;
@@ -2100,7 +2178,16 @@ main(int argc, char *argv[]) {
                }
 
                if (kbd_mode == K_UNICODE) {
-                       prefer_unicode = 1;
+                       if (opta) {
+                               fprintf(stderr,
+                                       _("%s: warning: loading non-Unicode keymap on Unicode console\n"
+                                         "    (perhaps you want to do `kbd_mode -a'?)\n"),
+                                       progname);
+                       }
+                       else {
+                               prefer_unicode = 1;
+                       }
+
                        /* reset -u option if keyboard is in K_UNICODE anyway */
                        optu = 0;
                }
index 7df9d04..6f94a09 100644 (file)
@@ -274,6 +274,7 @@ usage(void) {
 "\n"
 "Valid options are:\n"
 "\n"
+"  -a --ascii         force conversion to ASCII\n"
 "  -b --bkeymap       output a binary keymap to stdout\n"
 "  -c --clearcompose  clear kernel compose table\n"
 "  -C <cons1,cons2,...> --console=<cons1,cons2,...>\n"
@@ -289,6 +290,7 @@ usage(void) {
 }
 
 char **args;
+int opta = 0;
 int optb = 0;
 int optd = 0;
 int optm = 0;
@@ -300,8 +302,9 @@ int nocompose = 0;
 
 int
 main(int argc, char *argv[]) {
-       const char *short_opts = "bcC:dhmsuqvV";
+       const char *short_opts = "abcC:dhmsuqvV";
        const struct option long_opts[] = {
+               { "ascii",      no_argument, NULL, 'a' },
                { "bkeymap",    no_argument, NULL, 'b' },
                { "clearcompose", no_argument, NULL, 'c' },
                { "console",    1, NULL, 'C' },
@@ -331,6 +334,9 @@ main(int argc, char *argv[]) {
        while ((c = getopt_long(argc, argv,
                short_opts, long_opts, NULL)) != -1) {
                switch (c) {
+                       case 'a':
+                               opta = 1;
+                               break;
                        case 'b':
                                optb = 1;
                                break;
@@ -366,6 +372,12 @@ main(int argc, char *argv[]) {
                }
        }
 
+       if (optu && opta) {
+               fprintf(stderr, _("%s: Options --unicode and --ascii are mutually exclusive\n"),
+                       progname);
+               exit(1);
+       }
+
        prefer_unicode = optu;
        if (!optm && !optb) {
                /* check whether the keyboard is in Unicode mode */
@@ -377,7 +389,16 @@ main(int argc, char *argv[]) {
                }
 
                if (kbd_mode == K_UNICODE) {
-                       prefer_unicode = 1;
+                       if (opta) {
+                               fprintf(stderr,
+                                       _("%s: warning: loading non-Unicode keymap on Unicode console\n"
+                                         "    (perhaps you want to do `kbd_mode -a'?)\n"),
+                                       progname);
+                       }
+                       else {
+                               prefer_unicode = 1;
+                       }
+
                        /* reset -u option if keyboard is in K_UNICODE anyway */
                        optu = 0;
                }