Logo Search packages:      
Sourcecode: pcmcia-cs version File versions

yacc_config.c

/* A Bison parser, made by GNU Bison 1.875a.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.

   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.

   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., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Using locations.  */
#define YYLSP_NEEDED 0



/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     DEVICE = 258,
     CARD = 259,
     ANONYMOUS = 260,
     TUPLE = 261,
     MANFID = 262,
     VERSION = 263,
     FUNCTION = 264,
     PCI = 265,
     BIND = 266,
     CIS = 267,
     TO = 268,
     NEEDS_MTD = 269,
     MODULE = 270,
     OPTS = 271,
     CLASS = 272,
     REGION = 273,
     JEDEC = 274,
     DTYPE = 275,
     DEFAULT = 276,
     MTD = 277,
     INCLUDE = 278,
     EXCLUDE = 279,
     RESERVE = 280,
     IRQ_NO = 281,
     PORT = 282,
     MEMORY = 283,
     STRING = 284,
     NUMBER = 285,
     SOURCE = 286
   };
#endif
#define DEVICE 258
#define CARD 259
#define ANONYMOUS 260
#define TUPLE 261
#define MANFID 262
#define VERSION 263
#define FUNCTION 264
#define PCI 265
#define BIND 266
#define CIS 267
#define TO 268
#define NEEDS_MTD 269
#define MODULE 270
#define OPTS 271
#define CLASS 272
#define REGION 273
#define JEDEC 274
#define DTYPE 275
#define DEFAULT 276
#define MTD 277
#define INCLUDE 278
#define EXCLUDE 279
#define RESERVE 280
#define IRQ_NO 281
#define PORT 282
#define MEMORY 283
#define STRING 284
#define NUMBER 285
#define SOURCE 286




/* Copy the first part of user declarations.  */
#line 1 "yacc_config.y"

/*
 * yacc_config.y 1.59 2003/06/12 07:24:27
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License
 * at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and
 * limitations under the License. 
 *
 * The initial developer of the original code is David A. Hinds
 * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
 * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
 *
 * Alternatively, the contents of this file may be used under the
 * terms of the GNU General Public License version 2 (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of the
 * above.  If you wish to allow the use of your version of this file
 * only under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting the provisions above and replace them with the notice and
 * other provisions required by the GPL.  If you do not delete the
 * provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL.
 */
    
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/types.h>

#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
    
#include "cardmgr.h"

/* If bison: generate nicer error messages */ 
#define YYERROR_VERBOSE 1
 
/* from lex_config, for nice error messages */
extern char *current_file;
extern int current_lineno;

void yyerror(char *msg, ...);

static int add_binding(card_info_t *card, char *name, char *class, int fn);
static int add_module(device_info_t *card, char *name);



/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 65 "yacc_config.y"
typedef union YYSTYPE {
    char *str;
    u_long num;
    struct device_info_t *device;
    struct card_info_t *card;
    struct mtd_ident_t *mtd;
    struct adjust_list_t *adjust;
} YYSTYPE;
/* Line 191 of yacc.c.  */
#line 205 "y.tab.c"
# 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 214 of yacc.c.  */
#line 217 "y.tab.c"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
       || (YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                   \
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)        \
      do                            \
      {                             \
        register YYSIZE_T yyi;            \
        for (yyi = 0; yyi < (Count); yyi++)     \
          (To)[yyi] = (From)[yyi];        \
      }                             \
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   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)                            \
    do                                                      \
      {                                                     \
      YYSIZE_T yynewbytes;                                  \
      YYCOPY (&yyptr->Stack, Stack, yysize);                      \
      Stack = &yyptr->Stack;                                \
      yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
      yyptr += yynewbytes / sizeof (*yyptr);                      \
      }                                                     \
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  2
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   99

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  34
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  24
/* YYNRULES -- Number of rules. */
#define YYNRULES  62
/* YYNRULES -- Number of states. */
#define YYNSTATES  116

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   286

#define YYTRANSLATE(YYX)                                    \
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned char yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,    32,    33,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned char yyprhs[] =
{
       0,     0,     3,     4,     7,    10,    13,    16,    19,    22,
      25,    28,    31,    34,    37,    41,    44,    49,    54,    57,
      59,    61,    63,    66,    68,    70,    72,    74,    76,    78,
      80,    82,    85,    93,    99,   105,   109,   113,   117,   121,
     125,   131,   137,   145,   149,   155,   161,   169,   172,   177,
     181,   185,   189,   193,   196,   198,   200,   202,   206,   211,
     214,   218,   222
};

/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
      35,     0,    -1,    -1,    35,    36,    -1,    35,    38,    -1,
      35,    56,    -1,    35,    39,    -1,    35,    49,    -1,    35,
      57,    -1,    35,    31,    -1,    35,     1,    -1,    23,    37,
      -1,    24,    37,    -1,    25,    37,    -1,    36,    32,    37,
      -1,    26,    30,    -1,    27,    30,    33,    30,    -1,    28,
      30,    33,    30,    -1,     3,    29,    -1,    48,    -1,    50,
      -1,    51,    -1,     4,    29,    -1,    40,    -1,    41,    -1,
      42,    -1,    43,    -1,    44,    -1,    45,    -1,    47,    -1,
      46,    -1,    39,     5,    -1,    39,     6,    30,    32,    30,
      32,    29,    -1,    39,     7,    30,    32,    30,    -1,    39,
      10,    30,    32,    30,    -1,    39,     8,    29,    -1,    44,
      32,    29,    -1,    39,     9,    30,    -1,    39,    12,    29,
      -1,    39,    11,    29,    -1,    39,    11,    29,    17,    29,
      -1,    39,    11,    29,    13,    30,    -1,    39,    11,    29,
      17,    29,    13,    30,    -1,    47,    32,    29,    -1,    47,
      32,    29,    17,    29,    -1,    47,    32,    29,    13,    30,
      -1,    47,    32,    29,    17,    29,    13,    30,    -1,    38,
      14,    -1,    15,    29,    16,    29,    -1,    38,    15,    29,
      -1,    50,    16,    29,    -1,    50,    32,    29,    -1,    38,
      17,    29,    -1,    18,    29,    -1,    53,    -1,    54,    -1,
      55,    -1,    52,    20,    30,    -1,    52,    19,    30,    30,
      -1,    52,    21,    -1,    52,    22,    29,    -1,    56,    16,
      29,    -1,    22,    29,    16,    29,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short yyrline[] =
{
       0,    82,    82,    83,    89,    94,   107,   125,   126,   127,
     128,   131,   136,   141,   147,   156,   162,   173,   186,   193,
     194,   195,   198,   204,   205,   206,   207,   208,   209,   210,
     211,   214,   225,   238,   250,   262,   272,   283,   294,   298,
     303,   308,   313,   318,   323,   328,   333,   340,   346,   369,
     374,   384,   391,   401,   407,   408,   409,   412,   423,   435,
     450,   458,   469
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "DEVICE", "CARD", "ANONYMOUS", "TUPLE", 
  "MANFID", "VERSION", "FUNCTION", "PCI", "BIND", "CIS", "TO", 
  "NEEDS_MTD", "MODULE", "OPTS", "CLASS", "REGION", "JEDEC", "DTYPE", 
  "DEFAULT", "MTD", "INCLUDE", "EXCLUDE", "RESERVE", "IRQ_NO", "PORT", 
  "MEMORY", "STRING", "NUMBER", "SOURCE", "','", "'-'", "$accept", "list", 
  "adjust", "resource", "device", "card", "anonymous", "tuple", "manfid", 
  "pci", "version", "function", "cis", "bind", "needs_mtd", "opts", 
  "module", "class", "region", "dtype", "jedec", "default", "mtd", 
  "mtd_opts", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,    44,    45
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,    34,    35,    35,    35,    35,    35,    35,    35,    35,
      35,    36,    36,    36,    36,    37,    37,    37,    38,    38,
      38,    38,    39,    39,    39,    39,    39,    39,    39,    39,
      39,    40,    41,    42,    43,    44,    44,    45,    46,    47,
      47,    47,    47,    47,    47,    47,    47,    48,    49,    50,
      50,    50,    51,    52,    52,    52,    52,    53,    54,    55,
      56,    56,    57
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     0,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     3,     2,     4,     4,     2,     1,
       1,     1,     2,     1,     1,     1,     1,     1,     1,     1,
       1,     2,     7,     5,     5,     3,     3,     3,     3,     3,
       5,     5,     7,     3,     5,     5,     7,     2,     4,     3,
       3,     3,     3,     2,     1,     1,     1,     3,     4,     2,
       3,     3,     4
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned char yydefact[] =
{
       2,     0,     1,    10,     0,     0,     0,     0,     0,     0,
       0,     0,     9,     3,     4,     6,    23,    24,    25,    26,
      27,    28,    30,    29,    19,     7,    20,    21,     0,    54,
      55,    56,     5,     8,    18,    22,     0,    53,     0,     0,
       0,     0,    11,    12,    13,     0,    47,     0,     0,    31,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    59,     0,     0,     0,     0,    15,     0,
       0,    14,    49,    52,     0,     0,    35,    37,     0,    39,
      38,    36,    43,    50,    51,     0,    57,    60,    61,    48,
      62,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      58,    16,    17,     0,    33,    34,    41,    40,    45,    44,
       0,     0,     0,    32,    42,    46
};

/* YYDEFGOTO[NTERM-NUM]. */
static const yysigned_char yydefgoto[] =
{
      -1,     1,    13,    42,    14,    15,    16,    17,    18,    19,
      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
      30,    31,    32,    33
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -26
static const yysigned_char yypact[] =
{
     -26,     2,   -26,   -26,   -25,   -13,    -8,     0,     1,    18,
      18,    18,   -26,    -1,    26,     3,   -26,   -26,   -26,   -26,
      10,   -26,   -26,    16,   -26,   -26,    -9,   -26,    17,   -26,
     -26,   -26,    31,   -26,   -26,   -26,    33,   -26,    34,   -11,
       4,    21,   -26,   -26,   -26,    18,   -26,    23,    24,   -26,
      25,    27,    29,    30,    32,    35,    36,    37,    38,    39,
      40,    41,    42,   -26,    44,    45,    46,    47,   -26,    28,
      48,   -26,   -26,   -26,    22,    50,   -26,   -26,    51,     5,
     -26,   -26,    15,   -26,   -26,    49,   -26,   -26,   -26,   -26,
     -26,    54,    55,    56,    57,    58,    59,    61,    62,    64,
     -26,   -26,   -26,    63,   -26,   -26,   -26,    43,   -26,    65,
      67,    68,    69,   -26,   -26,   -26
};

/* YYPGOTO[NTERM-NUM].  */
static const yysigned_char yypgoto[] =
{
     -26,   -26,   -26,   -10,   -26,   -26,   -26,   -26,   -26,   -26,
     -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,
     -26,   -26,   -26,   -26
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
      43,    44,     2,     3,    34,     4,     5,    59,    49,    50,
      51,    52,    53,    54,    55,    56,    35,     6,    96,    68,
       7,    36,    97,    60,     8,     9,    10,    11,    98,    37,
      38,    45,    99,    12,    69,    71,    61,    62,    63,    64,
      46,    47,    57,    48,    39,    40,    41,    65,    58,    66,
      67,    70,    72,    73,    93,    74,   111,    75,    76,     0,
      77,    91,    78,     0,    79,    80,    81,    82,    83,    84,
       0,    85,    86,    87,    88,    89,    90,     0,   112,   100,
       0,    92,    94,    95,   101,   102,   103,   104,   105,   106,
     107,     0,   108,   109,     0,   110,   113,     0,   114,   115
};

static const yysigned_char yycheck[] =
{
      10,    11,     0,     1,    29,     3,     4,    16,     5,     6,
       7,     8,     9,    10,    11,    12,    29,    15,    13,    30,
      18,    29,    17,    32,    22,    23,    24,    25,    13,    29,
      29,    32,    17,    31,    30,    45,    19,    20,    21,    22,
      14,    15,    32,    17,    26,    27,    28,    16,    32,    16,
      16,    30,    29,    29,    32,    30,    13,    30,    29,    -1,
      30,    33,    30,    -1,    29,    29,    29,    29,    29,    29,
      -1,    30,    30,    29,    29,    29,    29,    -1,    13,    30,
      -1,    33,    32,    32,    30,    30,    30,    30,    30,    30,
      29,    -1,    30,    29,    -1,    32,    29,    -1,    30,    30
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const unsigned char yystos[] =
{
       0,    35,     0,     1,     3,     4,    15,    18,    22,    23,
      24,    25,    31,    36,    38,    39,    40,    41,    42,    43,
      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      54,    55,    56,    57,    29,    29,    29,    29,    29,    26,
      27,    28,    37,    37,    37,    32,    14,    15,    17,     5,
       6,     7,     8,     9,    10,    11,    12,    32,    32,    16,
      32,    19,    20,    21,    22,    16,    16,    16,    30,    30,
      30,    37,    29,    29,    30,    30,    29,    30,    30,    29,
      29,    29,    29,    29,    29,    30,    30,    29,    29,    29,
      29,    33,    33,    32,    32,    32,    13,    17,    13,    17,
      30,    30,    30,    30,    30,    30,    30,    29,    30,    29,
      32,    13,    13,    29,    30,    30
};

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok         (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0

#define YYACCEPT  goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrlab1


/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */

#define YYFAIL          goto yyerrlab

#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                              \
do                                              \
  if (yychar == YYEMPTY && yylen == 1)                      \
    {                                           \
      yychar = (Token);                               \
      yylval = (Value);                               \
      yytoken = YYTRANSLATE (yychar);                       \
      YYPOPSTACK;                               \
      goto yybackup;                                  \
    }                                           \
  else                                                \
    {                                                 \
      yyerror ("syntax error: cannot back up");\
      YYERROR;                                        \
    }                                           \
while (0)

#define YYTERROR  1
#define YYERRCODE 256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)         \
  Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                  \
do {                                \
  if (yydebug)                            \
    YYFPRINTF Args;                       \
} while (0)

# define YYDSYMPRINT(Args)                \
do {                                \
  if (yydebug)                            \
    yysymprint Args;                      \
} while (0)

# define YYDSYMPRINTF(Title, Token, Value, Location)        \
do {                                            \
  if (yydebug)                                        \
    {                                           \
      YYFPRINTF (stderr, "%s ", Title);                     \
      yysymprint (stderr,                             \
                  Token, Value);    \
      YYFPRINTF (stderr, "\n");                             \
    }                                           \
} while (0)

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (cinluded).                                                   |
`------------------------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short *bottom, short *top)
#else
static void
yy_stack_print (bottom, top)
    short *bottom;
    short *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (/* Nothing. */; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                        \
do {                                            \
  if (yydebug)                                        \
    yy_stack_print ((Bottom), (Top));                       \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
    int yyrule;
#endif
{
  int yyi;
  unsigned int yylineno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
             yyrule - 1, yylineno);
  /* Print the symbols being reduced, and their result.  */
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}

# define YY_REDUCE_PRINT(Rule)            \
do {                          \
  if (yydebug)                      \
    yy_reduce_print (Rule);         \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef     YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
    }
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyoutput, ")");
}

#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  switch (yytype)
    {

      default:
        break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */



/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* 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.  */

  /* The state stack.  */
  short     yyssa[YYINITDEPTH];
  short *yyss = yyssa;
  register short *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  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;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed. so pushing a state here evens the stacks.
     */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
      /* Give user a chance to reallocate the stack. Use copies of
         these so that the &'s don't force the real ones into
         memory.  */
      YYSTYPE *yyvs1 = yyvs;
      short *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
         be undefined if yyoverflow is a macro.  */
      yyoverflow ("parser stack overflow",
                &yyss1, yysize * sizeof (*yyssp),
                &yyvs1, yysize * sizeof (*yyvsp),

                &yystacksize);

      yyss = yyss1;
      yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
      goto yyoverflowlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
      yystacksize = YYMAXDEPTH;

      {
      short *yyss1 = yyss;
      union yyalloc *yyptr =
        (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
      if (! yyptr)
        goto yyoverflowlab;
      YYSTACK_RELOCATE (yyss);
      YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
      if (yyss1 != yyssa)
        YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
              (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
      YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* 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 lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
      goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;


  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
#line 84 "yacc_config.y"
    {
                adjust_list_t **tail = &root_adjust;
                while (*tail != NULL) tail = &(*tail)->next;
                *tail = yyvsp[0].adjust;
            }
    break;

  case 4:
#line 90 "yacc_config.y"
    {
                yyvsp[0].device->next = root_device;
                root_device = yyvsp[0].device;
            }
    break;

  case 5:
#line 95 "yacc_config.y"
    {
                if (yyvsp[0].mtd->mtd_type == 0) {
                  yyerror("no ID method for '%s'", yyvsp[0].mtd->name);
                  YYERROR;
                }
                if (yyvsp[0].mtd->module == NULL) {
                  yyerror("no MTD module for '%s'", yyvsp[0].mtd->name);
                  YYERROR;
                }
                yyvsp[0].mtd->next = root_mtd;
                root_mtd = yyvsp[0].mtd;
            }
    break;

  case 6:
#line 108 "yacc_config.y"
    {
                if (yyvsp[0].card->ident_type == 0) {
                  yyerror("no ID method for '%s'", yyvsp[0].card->name);
                  YYERROR;
                }
                if (yyvsp[0].card->bindings == 0) {
                  yyerror("no driver bindings for '%s'", yyvsp[0].card->name);
                  YYERROR;
                }
                if (yyvsp[0].card->ident_type == FUNC_IDENT) {
                  yyvsp[0].card->next = root_func;
                  root_func = yyvsp[0].card;
                } else {
                  yyvsp[0].card->next = root_card;
                  root_card = yyvsp[0].card;
                }
            }
    break;

  case 11:
#line 132 "yacc_config.y"
    {
                yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
                yyval.adjust = yyvsp[0].adjust;
            }
    break;

  case 12:
#line 137 "yacc_config.y"
    {
                yyvsp[0].adjust->adj.Action = REMOVE_MANAGED_RESOURCE;
                yyval.adjust = yyvsp[0].adjust;
            }
    break;

  case 13:
#line 142 "yacc_config.y"
    {
                yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
                yyvsp[0].adjust->adj.Attributes |= RES_RESERVED;
                yyval.adjust = yyvsp[0].adjust;
            }
    break;

  case 14:
#line 148 "yacc_config.y"
    {
                yyvsp[0].adjust->adj.Action = yyvsp[-2].adjust->adj.Action;
                yyvsp[0].adjust->adj.Attributes = yyvsp[-2].adjust->adj.Attributes;
                yyvsp[0].adjust->next = yyvsp[-2].adjust;
                yyval.adjust = yyvsp[0].adjust;
            }
    break;

  case 15:
#line 157 "yacc_config.y"
    {
                yyval.adjust = calloc(sizeof(adjust_list_t), 1);
                yyval.adjust->adj.Resource = RES_IRQ;
                yyval.adjust->adj.resource.irq.IRQ = yyvsp[0].num;
            }
    break;

  case 16:
#line 163 "yacc_config.y"
    {
                if ((yyvsp[0].num < yyvsp[-2].num) || (yyvsp[0].num > 0xffff)) {
                  yyerror("invalid port range 0x%x-0x%x", yyvsp[-2].num, yyvsp[0].num);
                  YYERROR;
                }
                yyval.adjust = calloc(sizeof(adjust_list_t), 1);
                yyval.adjust->adj.Resource = RES_IO_RANGE;
                yyval.adjust->adj.resource.io.BasePort = yyvsp[-2].num;
                yyval.adjust->adj.resource.io.NumPorts = yyvsp[0].num - yyvsp[-2].num + 1;
            }
    break;

  case 17:
#line 174 "yacc_config.y"
    {
                if (yyvsp[0].num < yyvsp[-2].num) {
                  yyerror("invalid address range 0x%x-0x%x", yyvsp[-2].num, yyvsp[0].num);
                  YYERROR;
                }
                yyval.adjust = calloc(sizeof(adjust_list_t), 1);
                yyval.adjust->adj.Resource = RES_MEMORY_RANGE;
                yyval.adjust->adj.resource.memory.Base = yyvsp[-2].num;
                yyval.adjust->adj.resource.memory.Size = yyvsp[0].num - yyvsp[-2].num + 1;
            }
    break;

  case 18:
#line 187 "yacc_config.y"
    {
                yyval.device = calloc(sizeof(device_info_t), 1);
                yyval.device->refs = 1;
                strcpy(yyval.device->dev_info, yyvsp[0].str);
                free(yyvsp[0].str);
            }
    break;

  case 22:
#line 199 "yacc_config.y"
    {
                yyval.card = calloc(sizeof(card_info_t), 1);
                yyval.card->refs = 1;
                yyval.card->name = yyvsp[0].str;
            }
    break;

  case 31:
#line 215 "yacc_config.y"
    {
                if (yyvsp[-1].card->ident_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-1].card->name);
                  YYERROR;
                }
                yyvsp[-1].card->ident_type = BLANK_IDENT;
                blank_card = yyvsp[-1].card;
            }
    break;

  case 32:
#line 226 "yacc_config.y"
    {
                if (yyvsp[-6].card->ident_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-6].card->name);
                  YYERROR;
                }
                yyvsp[-6].card->ident_type = TUPLE_IDENT;
                yyvsp[-6].card->id.tuple.code = yyvsp[-4].num;
                yyvsp[-6].card->id.tuple.ofs = yyvsp[-2].num;
                yyvsp[-6].card->id.tuple.info = yyvsp[0].str;
            }
    break;

  case 33:
#line 239 "yacc_config.y"
    {
                if (yyvsp[-4].card->ident_type & (EXCL_IDENT|MANFID_IDENT)) {
                  yyerror("ID method already defined for '%s'", yyvsp[-4].card->name);
                  YYERROR;
                }
                yyvsp[-4].card->ident_type |= MANFID_IDENT;
                yyvsp[-4].card->manfid.manf = yyvsp[-2].num;
                yyvsp[-4].card->manfid.card = yyvsp[0].num;
            }
    break;

  case 34:
#line 251 "yacc_config.y"
    {
                if (yyvsp[-4].card->ident_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-4].card->name);
                  YYERROR;
                }
                yyvsp[-4].card->ident_type = PCI_IDENT;
                yyvsp[-4].card->manfid.manf = yyvsp[-2].num;
                yyvsp[-4].card->manfid.card = yyvsp[0].num;
            }
    break;

  case 35:
#line 263 "yacc_config.y"
    {
                if (yyvsp[-2].card->ident_type & (EXCL_IDENT|VERS_1_IDENT)) {
                  yyerror("ID method already defined for '%s'", yyvsp[-2].card->name);
                  YYERROR;
                }
                yyvsp[-2].card->ident_type |= VERS_1_IDENT;
                yyvsp[-2].card->id.vers.ns = 1;
                yyvsp[-2].card->id.vers.pi[0] = yyvsp[0].str;
            }
    break;

  case 36:
#line 273 "yacc_config.y"
    {
                if (yyvsp[-2].card->id.vers.ns == 4) {
                  yyerror("too many version strings for '%s'", yyvsp[-2].card->name);
                  YYERROR;
                }
                yyvsp[-2].card->id.vers.pi[yyvsp[-2].card->id.vers.ns] = yyvsp[0].str;
                yyvsp[-2].card->id.vers.ns++;
            }
    break;

  case 37:
#line 284 "yacc_config.y"
    {
                if (yyvsp[-2].card->ident_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-2].card->name);
                  YYERROR;
                }
                yyvsp[-2].card->ident_type = FUNC_IDENT;
                yyvsp[-2].card->id.func.funcid = yyvsp[0].num;
            }
    break;

  case 38:
#line 295 "yacc_config.y"
    { yyvsp[-2].card->cis_file = strdup(yyvsp[0].str); }
    break;

  case 39:
#line 299 "yacc_config.y"
    {
                if (add_binding(yyvsp[-2].card, yyvsp[0].str, NULL, 0) != 0)
                  YYERROR;
            }
    break;

  case 40:
#line 304 "yacc_config.y"
    {
                if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].str, 0) != 0)
                  YYERROR;
            }
    break;

  case 41:
#line 309 "yacc_config.y"
    {
                if (add_binding(yyvsp[-4].card, yyvsp[-2].str, NULL, yyvsp[0].num) != 0)
                  YYERROR;
            }
    break;

  case 42:
#line 314 "yacc_config.y"
    {
                if (add_binding(yyvsp[-6].card, yyvsp[-4].str, yyvsp[-2].str, yyvsp[0].num) != 0)
                  YYERROR;
            }
    break;

  case 43:
#line 319 "yacc_config.y"
    {
                if (add_binding(yyvsp[-2].card, yyvsp[0].str, NULL, 0) != 0)
                  YYERROR;
            }
    break;

  case 44:
#line 324 "yacc_config.y"
    {
                if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].str, 0) != 0)
                  YYERROR;
            }
    break;

  case 45:
#line 329 "yacc_config.y"
    {
                if (add_binding(yyvsp[-4].card, yyvsp[-2].str, NULL, yyvsp[0].num) != 0)
                  YYERROR;
            }
    break;

  case 46:
#line 334 "yacc_config.y"
    {
                if (add_binding(yyvsp[-6].card, yyvsp[-4].str, yyvsp[-2].str, yyvsp[0].num) != 0)
                  YYERROR;
            }
    break;

  case 47:
#line 341 "yacc_config.y"
    {
                yyvsp[-1].device->needs_mtd = 1;
            }
    break;

  case 48:
#line 347 "yacc_config.y"
    {
                device_info_t *d;
                int i, found = 0;
                for (d = root_device; d; d = d->next) {
                  for (i = 0; i < d->modules; i++)
                      if (strcmp(yyvsp[-2].str, d->module[i]) == 0) break;
                  if (i < d->modules) {
                      if (d->opts[i])
                        free(d->opts[i]);
                      d->opts[i] = strdup(yyvsp[0].str);
                      found = 1;
                  }
                }
                if (!found) {
                  yyerror("module name '%s' not found", yyvsp[-2].str);
                  free(yyvsp[-2].str); free(yyvsp[0].str);
                  YYERROR;
                }
                free(yyvsp[-2].str); free(yyvsp[0].str);
            }
    break;

  case 49:
#line 370 "yacc_config.y"
    {
                if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
                  YYERROR;
            }
    break;

  case 50:
#line 375 "yacc_config.y"
    {
                if (yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] == NULL) {
                  yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] = yyvsp[0].str;
                } else {
                  yyerror("too many module options for '%s'",
                        yyvsp[-2].device->module[yyvsp[-2].device->modules-1]);
                  YYERROR;
                }
            }
    break;

  case 51:
#line 385 "yacc_config.y"
    {
                if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
                  YYERROR;
            }
    break;

  case 52:
#line 392 "yacc_config.y"
    {
                if (yyvsp[-2].device->class != NULL) {
                  yyerror("extra class string '%s'", yyvsp[0].str);
                  YYERROR;
                }
                yyvsp[-2].device->class = yyvsp[0].str;
            }
    break;

  case 53:
#line 402 "yacc_config.y"
    {
                yyval.mtd = calloc(sizeof(mtd_ident_t), 1);
                yyval.mtd->refs = 1;
                yyval.mtd->name = yyvsp[0].str;
            }
    break;

  case 57:
#line 413 "yacc_config.y"
    {
                if (yyvsp[-2].mtd->mtd_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-2].mtd->name);
                  YYERROR;
                }
                yyvsp[-2].mtd->mtd_type = DTYPE_MTD;
                yyvsp[-2].mtd->dtype = yyvsp[0].num;
            }
    break;

  case 58:
#line 424 "yacc_config.y"
    {
                if (yyvsp[-3].mtd->mtd_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-3].mtd->name);
                  YYERROR;
                }
                yyvsp[-3].mtd->mtd_type = JEDEC_MTD;
                yyvsp[-3].mtd->jedec_mfr = yyvsp[-1].num;
                yyvsp[-3].mtd->jedec_info = yyvsp[0].num;
            }
    break;

  case 59:
#line 436 "yacc_config.y"
    {
                if (yyvsp[-1].mtd->mtd_type) {
                  yyerror("ID method already defined for '%s'", yyvsp[-1].mtd->name);
                  YYERROR;
                }
                if (default_mtd) {
                  yyerror("Default MTD already defined");
                  YYERROR;
                }
                yyvsp[-1].mtd->mtd_type = DEFAULT_MTD;
                default_mtd = yyvsp[-1].mtd;
            }
    break;

  case 60:
#line 451 "yacc_config.y"
    {
                if (yyvsp[-2].mtd->module != NULL) {
                  yyerror("extra MTD entry for '%s'", yyvsp[-2].mtd->name);
                  YYERROR;
                }
                yyvsp[-2].mtd->module = yyvsp[0].str;
            }
    break;

  case 61:
#line 459 "yacc_config.y"
    {
                if (yyvsp[-2].mtd->opts == NULL) {
                  yyvsp[-2].mtd->opts = yyvsp[0].str;
                } else {
                  yyerror("too many module options for '%s'", yyvsp[-2].mtd->module);
                  YYERROR;
                }
            }
    break;

  case 62:
#line 470 "yacc_config.y"
    {
                mtd_ident_t *m;
                int found = 0;
                for (m = root_mtd; m; m = m->next)
                  if (strcmp(yyvsp[-2].str, m->module) == 0) break;
                if (m) {
                  if (m->opts) free(m->opts);
                  m->opts = strdup(yyvsp[0].str);
                  found = 1;
                }
                free(yyvsp[-2].str); free(yyvsp[0].str);
                if (!found) {
                  yyerror("MTD name '%s' not found", yyvsp[-2].str);
                  YYERROR;
                }
            }
    break;


    }

/* Line 999 of yacc.c.  */
#line 1659 "y.tab.c"

  yyvsp -= yylen;
  yyssp -= yylen;


  YY_STACK_PRINT (yyss, yyssp);

  *++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.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
      {
        YYSIZE_T yysize = 0;
        int yytype = YYTRANSLATE (yychar);
        char *yymsg;
        int yyx, yycount;

        yycount = 0;
        /* Start YYX at -YYN if negative to avoid negative indexes in
           YYCHECK.  */
        for (yyx = yyn < 0 ? -yyn : 0;
             yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
          if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
            yysize += yystrlen (yytname[yyx]) + 15, yycount++;
        yysize += yystrlen ("syntax error, unexpected ") + 1;
        yysize += yystrlen (yytname[yytype]);
        yymsg = (char *) YYSTACK_ALLOC (yysize);
        if (yymsg != 0)
          {
            char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
            yyp = yystpcpy (yyp, yytname[yytype]);

            if (yycount < 5)
            {
              yycount = 0;
              for (yyx = yyn < 0 ? -yyn : 0;
                   yyx < (int) (sizeof (yytname) / sizeof (char *));
                   yyx++)
                if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
                  {
                  const char *yyq = ! yycount ? ", expecting " : " or ";
                  yyp = yystpcpy (yyp, yyq);
                  yyp = yystpcpy (yyp, yytname[yyx]);
                  yycount++;
                  }
            }
            yyerror (yymsg);
            YYSTACK_FREE (yymsg);
          }
        else
          yyerror ("syntax error; also virtual memory exhausted");
      }
      else
#endif /* YYERROR_VERBOSE */
      yyerror ("syntax error");
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
       error, discard it.  */

      /* Return failure if at end of input.  */
      if (yychar == YYEOF)
        {
        /* Pop the error token.  */
          YYPOPSTACK;
        /* Pop the rest of the stack.  */
        while (yyss < yyssp)
          {
            YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
            yydestruct (yystos[*yyssp], yyvsp);
            YYPOPSTACK;
          }
        YYABORT;
        }

      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
      yydestruct (yytoken, &yylval);
      yychar = YYEMPTY;

    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*----------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action.  |
`----------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
      {
        yyn += YYTERROR;
        if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
          {
            yyn = yytable[yyn];
            if (0 < yyn)
            break;
          }
      }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
      YYABORT;

      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      yyvsp--;
      yystate = *--yyssp;

      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 488 "yacc_config.y"

void yyerror(char *msg, ...)
{
     va_list ap;
     char str[256];

     va_start(ap, msg);
     sprintf(str, "error in file '%s' line %d: ",
           current_file, current_lineno);
     vsprintf(str+strlen(str), msg, ap);
#if YYDEBUG
     fprintf(stderr, "%s\n", str);
#else
     syslog(LOG_ERR, "%s", str);
#endif
     va_end(ap);
}

static int add_binding(card_info_t *card, char *name, char *class, int fn)
{
    device_info_t *dev = root_device;
    if (card->bindings == MAX_BINDINGS) {
      yyerror("too many bindings\n");
      return -1;
    }
    for (; dev; dev = dev->next)
      if (strcmp((char *)dev->dev_info, name) == 0) break;
    if (dev == NULL) {
      yyerror("unknown device '%s'", name);
      return -1;
    }
    card->device[card->bindings] = dev;
    card->dev_fn[card->bindings] = fn;
    if (class)
      card->class[card->bindings] = strdup(class);
    card->bindings++;
    free(name);
    return 0;
}

static int add_module(device_info_t *dev, char *name)
{
    if (dev->modules == MAX_MODULES) {
      yyerror("too many modules for '%s'", dev->dev_info);
      return -1;
    }
    dev->module[dev->modules] = name;
    dev->opts[dev->modules] = NULL;
    dev->modules++;
    return 0;
}

#if YYDEBUG
adjust_list_t *root_adjust = NULL;
device_info_t *root_device = NULL;
card_info_t *root_card = NULL, *blank_card = NULL, *root_func = NULL;
mtd_ident_t *root_mtd = NULL, *default_mtd = NULL;

void main(int argc, char *argv[])
{
    yydebug = 1;
    if (argc > 1)
      parse_configfile(argv[1]);
}
#endif


Generated by  Doxygen 1.6.0   Back to index