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

📄 yacc_config.c

📁 pcmcia source code
💻 C
📖 第 1 页 / 共 3 页
字号:
#define YYMAXDEPTH 10000#endif#endif#define YYINITSTACKSIZE 200int yydebug;int yynerrs;int yyerrflag;int yychar;short *yyssp;YYSTYPE *yyvsp;YYSTYPE yyval;YYSTYPE yylval;short *yyss;short *yysslim;YYSTYPE *yyvs;int yystacksize;#line 470 "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, 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;    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 YYDEBUGadjust_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#line 447 "y.tab.c"/* allocate initial stack or double stack size, up to YYMAXDEPTH */static int yygrowstack(){    int newsize, i;    short *newss;    YYSTYPE *newvs;    if ((newsize = yystacksize) == 0)        newsize = YYINITSTACKSIZE;    else if (newsize >= YYMAXDEPTH)        return -1;    else if ((newsize *= 2) > YYMAXDEPTH)        newsize = YYMAXDEPTH;    i = yyssp - yyss;    newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :      (short *)malloc(newsize * sizeof *newss);    if (newss == NULL)        return -1;    yyss = newss;    yyssp = newss + i;    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :      (YYSTYPE *)malloc(newsize * sizeof *newvs);    if (newvs == NULL)        return -1;    yyvs = newvs;    yyvsp = newvs + i;    yystacksize = newsize;    yysslim = yyss + newsize - 1;    return 0;}#define YYABORT goto yyabort#define YYREJECT goto yyabort#define YYACCEPT goto yyaccept#define YYERROR goto yyerrlab#ifndef YYPARSE_PARAM#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG void#define YYPARSE_PARAM_DECL#else	/* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG#define YYPARSE_PARAM_DECL#endif	/* ANSI-C/C++ */#else	/* YYPARSE_PARAM */#ifndef YYPARSE_PARAM_TYPE#define YYPARSE_PARAM_TYPE void *#endif#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM#define YYPARSE_PARAM_DECL#else	/* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG YYPARSE_PARAM#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;#endif	/* ANSI-C/C++ */#endif	/* ! YYPARSE_PARAM */intyyparse (YYPARSE_PARAM_ARG)    YYPARSE_PARAM_DECL{    register int yym, yyn, yystate;#if YYDEBUG    register const char *yys;    if ((yys = getenv("YYDEBUG")))    {        yyn = *yys;        if (yyn >= '0' && yyn <= '9')            yydebug = yyn - '0';    }#endif    yynerrs = 0;    yyerrflag = 0;    yychar = (-1);    if (yyss == NULL && yygrowstack()) goto yyoverflow;    yyssp = yyss;    yyvsp = yyvs;    *yyssp = yystate = 0;yyloop:    if ((yyn = yydefred[yystate])) goto yyreduce;    if (yychar < 0)    {        if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG        if (yydebug)        {            yys = 0;            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];            if (!yys) yys = "illegal-symbol";            printf("%sdebug: state %d, reading %d (%s)\n",                    YYPREFIX, yystate, yychar, yys);        }#endif    }    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)    {#if YYDEBUG        if (yydebug)            printf("%sdebug: state %d, shifting to state %d\n",                    YYPREFIX, yystate, yytable[yyn]);#endif        if (yyssp >= yysslim && yygrowstack())        {            goto yyoverflow;        }        *++yyssp = yystate = yytable[yyn];        *++yyvsp = yylval;        yychar = (-1);        if (yyerrflag > 0)  --yyerrflag;        goto yyloop;    }    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)    {        yyn = yytable[yyn];        goto yyreduce;    }    if (yyerrflag) goto yyinrecovery;#if defined(lint) || defined(__GNUC__)    goto yynewerror;#endifyynewerror:    yyerror("syntax error");#if defined(lint) || defined(__GNUC__)    goto yyerrlab;#endifyyerrlab:    ++yynerrs;yyinrecovery:    if (yyerrflag < 3)    {        yyerrflag = 3;        for (;;)        {            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)            {#if YYDEBUG                if (yydebug)                    printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);#endif                if (yyssp >= yysslim && yygrowstack())                {                    goto yyoverflow;                }                *++yyssp = yystate = yytable[yyn];                *++yyvsp = yylval;                goto yyloop;            }            else            {#if YYDEBUG                if (yydebug)                    printf("%sdebug: error recovery discarding state %d\n",                            YYPREFIX, *yyssp);#endif                if (yyssp <= yyss) goto yyabort;                --yyssp;                --yyvsp;            }        }    }    else    {        if (yychar == 0) goto yyabort;#if YYDEBUG        if (yydebug)        {            yys = 0;            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];            if (!yys) yys = "illegal-symbol";            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",                    YYPREFIX, yystate, yychar, yys);        }#endif        yychar = (-1);        goto yyloop;    }yyreduce:#if YYDEBUG    if (yydebug)        printf("%sdebug: state %d, reducing by rule %d (%s)\n",                YYPREFIX, yystate, yyn, yyrule[yyn]);#endif    yym = yylen[yyn];    yyval = yyvsp[1-yym];    switch (yyn)    {case 2:#line 84 "yacc_config.y"{		    adjust_list_t **tail = &root_adjust;		    while (*tail != NULL) tail = &(*tail)->next;		    *tail = yyvsp[0].adjust;		}break;case 3:#line 90 "yacc_config.y"{		    yyvsp[0].device->next = root_device;		    root_device = yyvsp[0].device;		}break;case 4:#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 5:#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 10:#line 132 "yacc_config.y"{		    yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;		    yyval.adjust = yyvsp[0].adjust;		}break;case 11:#line 137 "yacc_config.y"{		    yyvsp[0].adjust->adj.Action = REMOVE_MANAGED_RESOURCE;		    yyval.adjust = yyvsp[0].adjust;		}break;case 12:#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 13:#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 14:#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 15:#line 163 "yacc_config.y"{

⌨️ 快捷键说明

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