ddlp.c
来自「db.* (pronounced dee-be star) is an adva」· C语言 代码 · 共 2,072 行 · 第 1/5 页
C
2,072 行
# 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 5:#line 104 "ddlp.y" { ddwarning(DB_TEXT("';' not required after '}'"), yyvsp[0].tnum.numline); if (ddlp_g.abort_flag) return(-1); } break; case 6:#line 110 "ddlp.y" { yyerrok; dderror(DB_TEXT("missing '}'"), ddlp_g.line); if (ddlp_g.abort_flag) return(-1); } break; case 14:#line 134 "ddlp.y" { if (!add_const(yyvsp[-3].tstr.str, (short) yyvsp[-1].tnum.num)) ddwarning(DB_TEXT("constant redefined"), yyvsp[-3].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 15:#line 141 "ddlp.y" { if (find_const(yyvsp[-1].tstr.str, &tempnum)) { if (!add_const(yyvsp[-3].tstr.str, tempnum)) ddwarning(DB_TEXT("constant redefined"), yyvsp[-3].tstr.strline); } else dderror(DB_TEXT("constant not defined"), yyvsp[-1].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 16:#line 153 "ddlp.y" { dderror(DB_TEXT("missing ';'"), yyvsp[-1].tnum.numline); if (ddlp_g.abort_flag) return(-1); } break; case 17:#line 159 "ddlp.y" { dderror(DB_TEXT("missing ';'"), yyvsp[-1].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 18:#line 165 "ddlp.y" { dderror(DB_TEXT("missing '=' after identifier"), yyvsp[-1].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 19:#line 171 "ddlp.y" { dderror(DB_TEXT("missing identifier after const"), yyvsp[-1].tnum.numline); if (ddlp_g.abort_flag) return(-1); } break; case 20:#line 181 "ddlp.y" { if (!add_const(yyvsp[-1].tstr.str, (short) yyvsp[0].tnum.num)) ddwarning(DB_TEXT("constant redefined"), yyvsp[-1].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 21:#line 188 "ddlp.y" { if (find_const(yyvsp[0].tstr.str, &tempnum)) { if (!add_const(yyvsp[-1].tstr.str, tempnum)) ddwarning(DB_TEXT("const redefined"), yyvsp[-1].tstr.strline); } else dderror(DB_TEXT("constant not defined"), yyvsp[0].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 24:#line 210 "ddlp.y" { dderror(DB_TEXT("missing ';'"), ddlp_g.line); if (ddlp_g.abort_flag) return(-1); } break; case 25:#line 220 "ddlp.y" { DB_TCHAR tempbuff[NAMELEN]; vtstrcpy(tempbuff, DB_TEXT("_s_")); vtstrcat(tempbuff, yyvsp[-3].tstr.str); if (ddlp_g.elem_list) { if (!add_struct_type(tempbuff)) { vstprintf(ddlp_g.msg, DB_TEXT("type already defined: %s"), yyvsp[-3].tstr.str); dderror(ddlp_g.msg, yyvsp[-3].tstr.strline); } } if ((ti = find_type(tempbuff, 0)) == NULL) { vstprintf(ddlp_g.msg, DB_TEXT("structure '%s' not defined.\n"), yyvsp[-3].tstr.str); dderror(ddlp_g.msg, yyvsp[-3].tstr.strline); } memcpy(&ddlp_g.fd_entry, &struct_fd, sizeof(FIELD_ENTRY)); if (ddlp_g.abort_flag) return(-1); } break; case 26:#line 247 "ddlp.y" { if (!add_struct_type(DB_TEXT("_s_temp_"))) dderror(DB_TEXT("cannot nest structures"), yyvsp[-2].tnum.numline); else { ti = find_type(DB_TEXT("_s_temp_"), 0); memcpy(&ddlp_g.fd_entry, &struct_fd, sizeof(FIELD_ENTRY)); } if (ddlp_g.abort_flag) return(-1); } break; case 27:#line 263 "ddlp.y" { memcpy(&struct_fd, &ddlp_g.fd_entry, sizeof(FIELD_ENTRY)); } break; case 30:#line 275 "ddlp.y" { if (!add_elem(yyvsp[-2].tstr.str, ddlp_g.fd_entry.fd_key, ti, (short *) ddlp_g.fd_entry.fd_dim, ci)) { vstprintf(ddlp_g.msg, DB_TEXT("element already defined: %s"), yyvsp[-2].tstr.str); dderror(ddlp_g.msg, yyvsp[-2].tstr.strline); } if (ddlp_g.abort_flag) return(-1); } break; case 31:#line 285 "ddlp.y" { dderror(DB_TEXT("invalid field name"), ddlp_g.line); if (ddlp_g.abort_flag) return(-1); } break; case 32:#line 295 "ddlp.y" { if (!add_type(yyvsp[-2].tstr.str, ti)) dderror(DB_TEXT("type already defined"), yyvsp[-2].tstr.strline); del_type(DB_TEXT("_s_temp_")); if (ddlp_g.abort_flag) return(-1); } break; case 33:#line 303 "ddlp.y" { dderror(DB_TEXT("missing ';'"), yyvsp[-2].tstr.strline); if (ddlp_g.abort_flag) return(-1); } break; case 34:#line 309 "ddlp.y" { dderror(DB_TEXT("invalid type"), yyvsp[-2].tnum.numline); if (ddlp_g.abort_flag) return(-1); } break; case 35:#line 319 "ddlp.y" { in_db = 1; vtstrcpy(ddlp_g.db_name, yyvsp[-1].tstr.str); } break; case 36:#line 324 "ddlp.y" { in_db = 1; if ( yyvsp[-2].tnum.num < 128 ) { ddwarning(DB_TEXT("database page size must be at least 128 bytes"), yyvsp[-2].tnum.numline); pagesize = 0; } else if ( yyvsp[-2].tnum.num > 32766 ) { ddwarning(DB_TEXT("maximum database page size is 32766"), yyvsp[-2].tnum.numline); pagesize = 0; } else { pagesize = (short) yyvsp[-2].tnum.num; } vtstrcpy(ddlp_g.db_name, yyvsp[-4].tstr.str); if (ddlp_g.abort_flag) return(-1); } break; case 37:#line 346 "ddlp.y" { in_db = 1; if (find_const(yyvsp[-2].tstr.str, &tempnum)) { if (tempnum < 128) { ddwarning(DB_TEXT("database page size must be at least 128 bytes"), yyvsp[-2].tstr.strline); pagesize = 0; } else if (tempnum > 32766) { ddwarning(DB_TEXT("maximum database page size is 32766"), yyvsp[-2].tstr.strline); pagesize = 0; } else pagesize = tempnum; vtstrcpy(ddlp_g.db_name, yyvsp[-4].tstr.str); } else dderror(DB_TEXT("constant not defined"), yyvsp[-2].tstr.strline);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?