ddlp.c
来自「db.* (pronounced dee-be star) is an adva」· C语言 代码 · 共 2,072 行 · 第 1/5 页
C
2,072 行
/* A Bison parser, made by GNU Bison 1.875c. *//* 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 { T_ALLOCATION = 258, T_ASCENDING = 259, T_BITMAP = 260, T_BLOB = 261, T_BY = 262, T_COMPOUND = 263, T_CONST = 264, T_CONTAINS = 265, T_DATA = 266, T_DATABASE = 267, T_DEFINE = 268, T_DESCENDING = 269, T_DIRECTREF = 270, T_FILE = 271, T_FIRST = 272, T_INCLUDE = 273, T_INITIAL = 274, T_KEY = 275, T_LAST = 276, T_LINE = 277, T_MEMBER = 278, T_NEXT = 279, T_NUMBER = 280, T_OPTIONAL = 281, T_ORDER = 282, T_OWNER = 283, T_PCTINCREASE = 284, T_PAGESIZE = 285, T_RECORD = 286, T_RECS = 287, T_RELATEDTO = 288, T_SET = 289, T_SETS = 290, T_STATIC = 291, T_STRUCT = 292, T_THRU = 293, T_TIMESTAMP = 294, T_TYPEDEF = 295, T_UNIQUE = 296, T_UNSIGNED = 297, T_VARILEN = 298, T_IDENT = 299, T_STRING = 300 };#endif#define T_ALLOCATION 258#define T_ASCENDING 259#define T_BITMAP 260#define T_BLOB 261#define T_BY 262#define T_COMPOUND 263#define T_CONST 264#define T_CONTAINS 265#define T_DATA 266#define T_DATABASE 267#define T_DEFINE 268#define T_DESCENDING 269#define T_DIRECTREF 270#define T_FILE 271#define T_FIRST 272#define T_INCLUDE 273#define T_INITIAL 274#define T_KEY 275#define T_LAST 276#define T_LINE 277#define T_MEMBER 278#define T_NEXT 279#define T_NUMBER 280#define T_OPTIONAL 281#define T_ORDER 282#define T_OWNER 283#define T_PCTINCREASE 284#define T_PAGESIZE 285#define T_RECORD 286#define T_RECS 287#define T_RELATEDTO 288#define T_SET 289#define T_SETS 290#define T_STATIC 291#define T_STRUCT 292#define T_THRU 293#define T_TIMESTAMP 294#define T_TYPEDEF 295#define T_UNIQUE 296#define T_UNSIGNED 297#define T_VARILEN 298#define T_IDENT 299#define T_STRING 300/* Copy the first part of user declarations. */#line 1 "ddlp.y"/*************************************************************************** * * * db.* * * open source database, ddlp utility * * * * Copyright (c) 2000 Centura Software Corporation. All rights reserved. * * * * Use of this software, whether in source code format, or in executable, * * binary object code form, is governed by the CENTURA OPEN SOURCE LICENSE * * which is fully described in the LICENSE.TXT file, included within this * * distribution of source code files. * * * **************************************************************************//*------------------------------------------------------------------------ db.* Database Definition Language Processor ddlp.y -- YACC grammar and semantics source------------------------------------------------------------------------*/#include "db.star.h"#include "parser.h"#include "ddldefs.h"#if defined(UNICODE)#define yyerror(s) yyerror(L ## s)#endif#define YYMAXDEPTH 480static DB_TCHAR fld_comp[NAMELEN];static DB_TCHAR rec_comp[NAMELEN];static short pagesize = 0; /* if it is still zero, figure it out later */static CONST_INFO *ci[MAXDIMS];static TYPE_INFO *ti;static OM_INFO *om;static ID_INFO *id_list, *currid, *ids;static MEM_INFO *memList, *currmem, *mem;static struct set_info *current_set;static int last_ordering;static int dim = 0; /* current # of array dimensions */static int elts;static int n_optkeys; /* number of optional keys in record */static short tempnum;static int sign_flag;static int inline_struct = 0;static FIELD_ENTRY struct_fd; /* save struct def when processing struct flds */static int in_db = 0;/*lint -e525 *//*lint -e778 */ /* constant expression evaluates to 0 *//* Initialize static variables, etc. */void ddlpInit (void){ pagesize = 0; inline_struct = 0; dim = 0; ddlp_g.abort_flag = 0;}/* QNX yacc and byacc (GNU) takes care of this */#if !defined(QNX) && !defined(VXWORKS) && !defined(yyerrok) && !defined(YYBISON)#define yyerrok yyerrflag = 0#endif/* 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 76 "ddlp.y"typedef union YYSTYPE { STRTOK tstr; NUMTOK tnum;} YYSTYPE;/* Line 191 of yacc.c. */#line 244 "ddlp.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 256 "ddlp.c"#if ! defined (yyoverflow) || YYERROR_VERBOSE# ifndef YYFREE# define YYFREE free# endif# ifndef YYMALLOC# define YYMALLOC malloc# endif/* The parser invokes alloca or malloc; define the necessary symbols. */# ifdef YYSTACK_USE_ALLOCA# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# endif# else# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# 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 YYMALLOC# define YYSTACK_FREE YYFREE# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && 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 defined (__GNUC__) && 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 27/* YYLAST -- Last index in YYTABLE. */#define YYLAST 282/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 56/* YYNNTS -- Number of nonterminals. */#define YYNNTS 55/* YYNRULES -- Number of rules. */#define YYNRULES 136/* YYNRULES -- Number of states. */#define YYNSTATES 263/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 300#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, 54, 55, 2, 2, 49, 2, 53, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 48, 2, 50, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 51, 2, 52, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 46, 2, 47, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45};#if YYDEBUG
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?