⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btsrv-parser.c

📁 affix是一个Open Source的蓝牙协议栈
💻 C
📖 第 1 页 / 共 3 页
字号:
/* 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 {     OPT_DEVICE = 258,     OPT_SERVICE = 259,     OPT_PROFILE = 260,     OPT_FLAGS = 261,     OPT_EXEC = 262,     OPT_PROVIDER = 263,     OPT_DESCRIPT = 264,     OPT_SECURITY = 265,     OPT_COD = 266,     OPT_NAME = 267,     OPT_ROLE = 268,     OPT_PKTTYPE = 269,     OPT_SCANMODE = 270,     OPT_PORT = 271,     OPT_ACTIVE = 272,     OPT_YES = 273,     OPT_NO = 274,     OPT_MANAGEPIN = 275,     OPT_MANAGEKEY = 276,     OPT_STARTSVC = 277,     OPT_INITDEV = 278,     NUM = 279,     STRING = 280,     WORDLIST = 281,     WORD = 282   };#endif#define OPT_DEVICE 258#define OPT_SERVICE 259#define OPT_PROFILE 260#define OPT_FLAGS 261#define OPT_EXEC 262#define OPT_PROVIDER 263#define OPT_DESCRIPT 264#define OPT_SECURITY 265#define OPT_COD 266#define OPT_NAME 267#define OPT_ROLE 268#define OPT_PKTTYPE 269#define OPT_SCANMODE 270#define OPT_PORT 271#define OPT_ACTIVE 272#define OPT_YES 273#define OPT_NO 274#define OPT_MANAGEPIN 275#define OPT_MANAGEKEY 276#define OPT_STARTSVC 277#define OPT_INITDEV 278#define NUM 279#define STRING 280#define WORDLIST 281#define WORD 282/* Copy the first part of user declarations.  */#line 1 "btsrv-parser.y"/*    Affix - Bluetooth Protocol Stack for Linux   Copyright (C) 2001 Nokia Corporation   Original Author: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>   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 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.,   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*//*    $Id: btsrv-parser.y,v 1.3 2004/03/17 12:06:06 kassatki Exp $   parser for btsrv configuration file   Fixes:	   		Dmitry Kasatkin <dmitry.kasatkin@nokia.com>*/#include <affix/config.h>#include <sys/socket.h>#include <sys/ioctl.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/time.h>#include <sys/resource.h>#include <sys/errno.h>#include <fcntl.h>#include <unistd.h>#include <syslog.h>#include <signal.h>#include <stdlib.h>#include <stdio.h>#include <stdarg.h>#include <getopt.h>#include <string.h>#include <termios.h>#include <affix/bluetooth.h>#include <affix/btcore.h>#include "btsrv.h"//#define YYPARSE_PARAM	param//#define YYLEX_PARAM	paramint yylex(void);void yyerror(char *s);void myyyerror(char *format, ...);extern int yylineno;static char		*config_file;static int	 	svcnum;static int		devnum;static struct btdevice		*dev;static struct btservice		*svc;int	waitsemi = 0;/* 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 82 "btsrv-parser.y"typedef union YYSTYPE {	int	num;	char	*str;} YYSTYPE;/* Line 191 of yacc.c.  */#line 211 "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 223 "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  19/* YYLAST -- Last index in YYTABLE.  */#define YYLAST   67/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS  33/* YYNNTS -- Number of nonterminals. */#define YYNNTS  18/* YYNRULES -- Number of rules. */#define YYNRULES  44/* YYNRULES -- Number of states. */#define YYNSTATES  84/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */#define YYUNDEFTOK  2#define YYMAXUTOK   282#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,    28,     2,     2,     2,     2,    32,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,    29,      30,     2,    31,     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};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in   YYRHS.  */static const unsigned char yyprhs[] ={       0,     0,     3,     5,     7,     9,    11,    13,    15,    17,      19,    20,    23,    24,    27,    30,    32,    34,    37,    40,      43,    46,    47,    58,    59,    63,    66,    69,    72,    75,      78,    81,    82,    93,    94,    98,   101,   104,   107,   110,     113,   116,   119,   122,   125};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={      40,     0,    -1,    27,    -1,    25,    -1,    27,    -1,    26,      -1,    18,    -1,    19,    -1,    28,    -1,    34,    -1,    -1,      39,    29,    -1,    -1,    41,    40,    -1,    42,    38,    -1,      43,    -1,    47,    -1,    20,    36,    -1,    21,    36,    -1,      22,    36,    -1,    23,    36,    -1,    -1,    30,     3,    37,      44,    31,    45,    30,    32,     3,    31,    -1,    -1,    46,      38,    45,    -1,    12,    34,    -1,    11,    35,    -1,    13,      35,    -1,    10,    35,    -1,    15,    35,    -1,    14,    35,      -1,    -1,    30,     4,    27,    48,    31,    49,    30,    32,       4,    31,    -1,    -1,    50,    38,    49,    -1,     5,    34,      -1,     6,    35,    -1,     7,    25,    -1,    12,    34,    -1,       8,    34,    -1,     9,    34,    -1,    11,    35,    -1,    10,      35,    -1,    16,    24,    -1,    17,    36,    -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */static const unsigned short yyrline[] ={       0,   103,   103,   103,   104,   104,   105,   105,   106,   106,     108,   108,   111,   112,   115,   115,   115,   122,   123,   124,     125,   130,   129,   151,   152,   156,   160,   165,   170,   175,     181,   194,   193,   214,   215,   219,   223,   238,   243,   248,     252,   256,   261,   265,   270};#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", "OPT_DEVICE", "OPT_SERVICE", "OPT_PROFILE",   "OPT_FLAGS", "OPT_EXEC", "OPT_PROVIDER", "OPT_DESCRIPT", "OPT_SECURITY",   "OPT_COD", "OPT_NAME", "OPT_ROLE", "OPT_PKTTYPE", "OPT_SCANMODE",   "OPT_PORT", "OPT_ACTIVE", "OPT_YES", "OPT_NO", "OPT_MANAGEPIN",   "OPT_MANAGEKEY", "OPT_STARTSVC", "OPT_INITDEV", "NUM", "STRING",   "WORDLIST", "WORD", "'*'", "';'", "'<'", "'>'", "'/'", "$accept",   "string", "params", "bool", "name", "optend", "@1", "config", "entry",   "option", "device", "@2", "devopts", "devopt", "service", "@3",   "svcopts", "svcopt", 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,    42,    59,      60,    62,    47};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */static const unsigned char yyr1[] ={       0,    33,    34,    34,    35,    35,    36,    36,    37,    37,      39,    38,    40,    40,    41,    41,    41,    42,    42,    42,      42,    44,    43,    45,    45,    46,    46,    46,    46,    46,      46,    48,    47,    49,    49,    50,    50,    50,    50,    50,      50,    50,    50,    50,    50};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */static const unsigned char yyr2[] ={       0,     2,     1,     1,     1,     1,     1,     1,     1,     1,       0,     2,     0,     2,     2,     1,     1,     2,     2,     2,       2,     0,    10,     0,     3,     2,     2,     2,     2,     2,       2,     0,    10,     0,     3,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2};/* 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[] ={      12,     0,     0,     0,     0,     0,     0,    12,    10,    15,      16,     6,     7,    17,    18,    19,    20,     0,     0,     1,      13,    14,     0,     3,     2,     8,     9,    21,    31,    11,       0,     0,    23,    33,     0,     0,     0,     0,     0,     0,       0,    10,     0,     0,     0,     0,     0,     0,     0,     0,       0,     0,     0,    10,     5,     4,    28,    26,    25,    27,      30,    29,     0,    23,    35,    36,    37,    39,    40,    42,      41,    38,    43,    44,     0,    33,     0,    24,     0,    34,       0,     0,    22,    32};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={      -1,    26,    56,    13,    27,    21,    22,     6,     7,     8,       9,    30,    40,    41,    10,    31,    52,    53};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing   STATE-NUM.  */#define YYPACT_NINF -33static const yysigned_char yypact[] ={      15,    28,    28,    28,    28,    47,     4,    15,   -33,   -33,     -33,   -33,   -33,   -33,   -33,   -33,   -33,   -15,   -18,   -33,     -33,   -33,    -9,   -33,   -33,   -33,   -33,   -33,   -33,   -33,      23,    24,    29,    17,    26,    26,     5,    26,    26,    26,      18,   -33,     5,    26,    31,     5,     5,    26,    26,     5,      33,    28,    30,   -33,   -33,   -33,   -33,   -33,   -33,   -33,     -33,   -33,    27,    29,   -33,   -33,   -33,   -33,   -33,   -33,     -33,   -33,   -33,   -33,    32,    17,    55,   -33,    57,   -33,      34,    35,   -33,   -33};/* YYPGOTO[NTERM-NUM].  */static const yysigned_char yypgoto[] ={     -33,   -28,   -32,    -2,   -33,   -22,   -33,    56,   -33,   -33,     -33,   -33,    -1,   -33,   -33,   -33,    -8,   -33};/* 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 -1static const unsigned char yytable[] ={      14,    15,    16,    57,    19,    59,    60,    61,    58,    28,      23,    65,    24,    25,    64,    69,    70,    67,    68,    63,      29,    71,    42,    43,    44,    45,    46,    47,    48,    49,      23,    75,    24,    50,    51,     1,     2,     3,     4,    34,      35,    36,    37,    38,    39,     5,    11,    12,    62,    73,      17,    18,    54,    55,    32,    33,    66,    72,    80,    76,      74,    81,    77,    20,    78,    82,    83,    79};static const unsigned char yycheck[] ={       2,     3,     4,    35,     0,    37,    38,    39,    36,    27,      25,    43,    27,    28,    42,    47,    48,    45,    46,    41,      29,    49,     5,     6,     7,     8,     9,    10,    11,    12,      25,    53,    27,    16,    17,    20,    21,    22,    23,    10,      11,    12,    13,    14,    15,    30,    18,    19,    30,    51,       3,     4,    26,    27,    31,    31,    25,    24,     3,    32,      30,     4,    63,     7,    32,    31,    31,    75};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */static const unsigned char yystos[] ={       0,    20,    21,    22,    23,    30,    40,    41,    42,    43,      47,    18,    19,    36,    36,    36,    36,     3,     4,     0,      40,    38,    39,    25,    27,    28,    34,    37,    27,    29,      44,    48,    31,    31,    10,    11,    12,    13,    14,    15,      45,    46,     5,     6,     7,     8,     9,    10,    11,    12,      16,    17,    49,    50,    26,    27,    35,    35,    34,    35,      35,    35,    30,    38,    34,    35,    25,    34,    34,    35,      35,    34,    24,    36,    30,    38,    32,    45,    32,    49,       3,     4,    31,    31};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -