mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
3580 lines
106 KiB
C
3580 lines
106 KiB
C
/* A Bison parser, made by GNU Bison 2.3. */
|
||
|
||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
||
|
||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||
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., 51 Franklin Street, Fifth Floor,
|
||
Boston, MA 02110-1301, USA. */
|
||
|
||
/* As a special exception, you may create a larger work that contains
|
||
part or all of the Bison parser skeleton and distribute that work
|
||
under terms of your choice, so long as that work isn't itself a
|
||
parser generator using the skeleton or a modified version thereof
|
||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||
the parser skeleton itself, you may (at your option) remove this
|
||
special exception, which will cause the skeleton and the resulting
|
||
Bison output files to be licensed under the GNU General Public
|
||
License without this special exception.
|
||
|
||
This special exception was added by the Free Software Foundation in
|
||
version 2.2 of Bison. */
|
||
|
||
/* C LALR(1) parser skeleton 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
|
||
|
||
/* Bison version. */
|
||
#define YYBISON_VERSION "2.3"
|
||
|
||
/* Skeleton name. */
|
||
#define YYSKELETON_NAME "yacc.c"
|
||
|
||
/* Pure parsers. */
|
||
#define YYPURE 0
|
||
|
||
/* Using locations. */
|
||
#define YYLSP_NEEDED 0
|
||
|
||
/* Substitute the variable and function names. */
|
||
#define yyparse ncgparse
|
||
#define yylex ncglex
|
||
#define yyerror ncgerror
|
||
#define yylval ncglval
|
||
#define yychar ncgchar
|
||
#define yydebug ncgdebug
|
||
#define yynerrs ncgnerrs
|
||
|
||
|
||
/* Tokens. */
|
||
#ifndef YYTOKENTYPE
|
||
# define YYTOKENTYPE
|
||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||
know about them. */
|
||
enum yytokentype {
|
||
NC_UNLIMITED_K = 258,
|
||
CHAR_K = 259,
|
||
BYTE_K = 260,
|
||
SHORT_K = 261,
|
||
INT_K = 262,
|
||
FLOAT_K = 263,
|
||
DOUBLE_K = 264,
|
||
UBYTE_K = 265,
|
||
USHORT_K = 266,
|
||
UINT_K = 267,
|
||
INT64_K = 268,
|
||
UINT64_K = 269,
|
||
IDENT = 270,
|
||
TERMSTRING = 271,
|
||
CHAR_CONST = 272,
|
||
BYTE_CONST = 273,
|
||
SHORT_CONST = 274,
|
||
INT_CONST = 275,
|
||
INT64_CONST = 276,
|
||
UBYTE_CONST = 277,
|
||
USHORT_CONST = 278,
|
||
UINT_CONST = 279,
|
||
UINT64_CONST = 280,
|
||
FLOAT_CONST = 281,
|
||
DOUBLE_CONST = 282,
|
||
DIMENSIONS = 283,
|
||
VARIABLES = 284,
|
||
NETCDF = 285,
|
||
DATA = 286,
|
||
TYPES = 287,
|
||
COMPOUND = 288,
|
||
ENUM = 289,
|
||
OPAQUE_ = 290,
|
||
OPAQUESTRING = 291,
|
||
GROUP = 292,
|
||
PATH = 293,
|
||
FILLMARKER = 294,
|
||
NIL = 295,
|
||
_FILLVALUE = 296,
|
||
_FORMAT = 297,
|
||
_STORAGE = 298,
|
||
_CHUNKSIZES = 299,
|
||
_DEFLATELEVEL = 300,
|
||
_SHUFFLE = 301,
|
||
_ENDIANNESS = 302,
|
||
_NOFILL = 303,
|
||
_FLETCHER32 = 304,
|
||
_NCPROPS = 305,
|
||
_ISNETCDF4 = 306,
|
||
_SUPERBLOCK = 307,
|
||
DATASETID = 308
|
||
};
|
||
#endif
|
||
/* Tokens. */
|
||
#define NC_UNLIMITED_K 258
|
||
#define CHAR_K 259
|
||
#define BYTE_K 260
|
||
#define SHORT_K 261
|
||
#define INT_K 262
|
||
#define FLOAT_K 263
|
||
#define DOUBLE_K 264
|
||
#define UBYTE_K 265
|
||
#define USHORT_K 266
|
||
#define UINT_K 267
|
||
#define INT64_K 268
|
||
#define UINT64_K 269
|
||
#define IDENT 270
|
||
#define TERMSTRING 271
|
||
#define CHAR_CONST 272
|
||
#define BYTE_CONST 273
|
||
#define SHORT_CONST 274
|
||
#define INT_CONST 275
|
||
#define INT64_CONST 276
|
||
#define UBYTE_CONST 277
|
||
#define USHORT_CONST 278
|
||
#define UINT_CONST 279
|
||
#define UINT64_CONST 280
|
||
#define FLOAT_CONST 281
|
||
#define DOUBLE_CONST 282
|
||
#define DIMENSIONS 283
|
||
#define VARIABLES 284
|
||
#define NETCDF 285
|
||
#define DATA 286
|
||
#define TYPES 287
|
||
#define COMPOUND 288
|
||
#define ENUM 289
|
||
#define OPAQUE_ 290
|
||
#define OPAQUESTRING 291
|
||
#define GROUP 292
|
||
#define PATH 293
|
||
#define FILLMARKER 294
|
||
#define NIL 295
|
||
#define _FILLVALUE 296
|
||
#define _FORMAT 297
|
||
#define _STORAGE 298
|
||
#define _CHUNKSIZES 299
|
||
#define _DEFLATELEVEL 300
|
||
#define _SHUFFLE 301
|
||
#define _ENDIANNESS 302
|
||
#define _NOFILL 303
|
||
#define _FLETCHER32 304
|
||
#define _NCPROPS 305
|
||
#define _ISNETCDF4 306
|
||
#define _SUPERBLOCK 307
|
||
#define DATASETID 308
|
||
|
||
|
||
|
||
|
||
/* Copy the first part of user declarations. */
|
||
#line 11 "ncgen.y"
|
||
|
||
/*
|
||
static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
|
||
*/
|
||
#include "includes.h"
|
||
#include "ncoffsets.h"
|
||
#include "ncgeny.h"
|
||
#include "ncgen.h"
|
||
|
||
/* Following are in ncdump (for now)*/
|
||
/* Need some (unused) definitions to get it to compile */
|
||
#define ncatt_t void*
|
||
#define ncvar_t void
|
||
#include "nctime.h"
|
||
|
||
/* parser controls */
|
||
#define YY_NO_INPUT 1
|
||
|
||
/* True if string a equals string b*/
|
||
#ifndef STREQ
|
||
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
|
||
#endif
|
||
#define VLENSIZE (sizeof(nc_vlen_t))
|
||
#define MAXFLOATDIM 4294967295.0
|
||
|
||
/* mnemonic */
|
||
typedef enum Attrkind {ATTRVAR, ATTRGLOBAL, DONTKNOW} Attrkind;
|
||
|
||
typedef nc_vlen_t vlen_t;
|
||
|
||
/* We retain the old representation of the symbol list
|
||
as a linked list.
|
||
*/
|
||
Symbol* symlist;
|
||
|
||
/* Track rootgroup separately*/
|
||
Symbol* rootgroup;
|
||
|
||
/* Track the group sequence */
|
||
static List* groupstack;
|
||
|
||
/* Provide a separate sequence for accumulating values
|
||
during the parse.
|
||
*/
|
||
static List* stack;
|
||
|
||
/* track homogeneity of types for data lists*/
|
||
static nc_type consttype;
|
||
|
||
/* Misc. */
|
||
static int stackbase;
|
||
static int stacklen;
|
||
static int count;
|
||
static int opaqueid; /* counter for opaque constants*/
|
||
static int arrayuid; /* counter for pseudo-array types*/
|
||
|
||
char* primtypenames[PRIMNO] = {
|
||
"nat",
|
||
"byte", "char", "short",
|
||
"int", "float", "double",
|
||
"ubyte", "ushort", "uint",
|
||
"int64", "uint64",
|
||
"string"
|
||
};
|
||
|
||
static int GLOBAL_SPECIAL = _NCPROPS_FLAG | _ISNETCDF4_FLAG | _SUPERBLOCK_FLAG | _FORMAT_FLAG ;
|
||
|
||
/*Defined in ncgen.l*/
|
||
extern int lineno; /* line number for error messages */
|
||
extern Bytebuffer* lextext; /* name or string with escapes removed */
|
||
|
||
extern double double_val; /* last double value read */
|
||
extern float float_val; /* last float value read */
|
||
extern long long int64_val; /* last int64 value read */
|
||
extern int int32_val; /* last int32 value read */
|
||
extern short int16_val; /* last short value read */
|
||
extern unsigned long long uint64_val; /* last int64 value read */
|
||
extern unsigned int uint32_val; /* last int32 value read */
|
||
extern unsigned short uint16_val; /* last short value read */
|
||
extern char char_val; /* last char value read */
|
||
extern signed char byte_val; /* last byte value read */
|
||
extern unsigned char ubyte_val; /* last byte value read */
|
||
|
||
/* Track definitions of dims, types, attributes, and vars*/
|
||
List* grpdefs;
|
||
List* dimdefs;
|
||
List* attdefs; /* variable-specific attributes*/
|
||
List* gattdefs; /* global attributes only*/
|
||
List* xattdefs; /* unknown attributes*/
|
||
List* typdefs;
|
||
List* vardefs;
|
||
List* condefs; /* non-dimension constants used in type defs*/
|
||
List* tmp;
|
||
|
||
/* Forward */
|
||
static NCConstant makeconstdata(nc_type);
|
||
static NCConstant evaluate(Symbol* fcn, Datalist* arglist);
|
||
static NCConstant makeenumconstref(Symbol*);
|
||
static void addtogroup(Symbol*);
|
||
static Symbol* currentgroup(void);
|
||
static Symbol* createrootgroup(const char*);
|
||
static Symbol* creategroup(Symbol*);
|
||
static int dupobjectcheck(nc_class,Symbol*);
|
||
static void setpathcurrent(Symbol* sym);
|
||
static Symbol* makeattribute(Symbol*,Symbol*,Symbol*,Datalist*,Attrkind);
|
||
static Symbol* makeprimitivetype(nc_type i);
|
||
static Symbol* makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst);
|
||
static int containsfills(Datalist* list);
|
||
static void datalistextend(Datalist* dl, NCConstant* con);
|
||
static void vercheck(int ncid);
|
||
static long long extractint(NCConstant con);
|
||
|
||
int yylex(void);
|
||
|
||
#ifndef NO_STDARG
|
||
static void yyerror(const char *fmt, ...);
|
||
#else
|
||
static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
|
||
#endif
|
||
|
||
/* Extern */
|
||
extern int lex_init(void);
|
||
|
||
|
||
|
||
/* Enabling traces. */
|
||
#ifndef YYDEBUG
|
||
# define YYDEBUG 1
|
||
#endif
|
||
|
||
/* Enabling verbose error messages. */
|
||
#ifdef YYERROR_VERBOSE
|
||
# undef YYERROR_VERBOSE
|
||
# define YYERROR_VERBOSE 1
|
||
#else
|
||
# define YYERROR_VERBOSE 1
|
||
#endif
|
||
|
||
/* Enabling the token table. */
|
||
#ifndef YYTOKEN_TABLE
|
||
# define YYTOKEN_TABLE 0
|
||
#endif
|
||
|
||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||
typedef union YYSTYPE
|
||
#line 138 "ncgen.y"
|
||
{
|
||
Symbol* sym;
|
||
unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/
|
||
long mark; /* track indices into the sequence*/
|
||
int nctype; /* for tracking attribute list type*/
|
||
Datalist* datalist;
|
||
NCConstant constant;
|
||
}
|
||
/* Line 193 of yacc.c. */
|
||
#line 344 "ncgen.tab.c"
|
||
YYSTYPE;
|
||
# 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 216 of yacc.c. */
|
||
#line 357 "ncgen.tab.c"
|
||
|
||
#ifdef short
|
||
# undef short
|
||
#endif
|
||
|
||
#ifdef YYTYPE_UINT8
|
||
typedef YYTYPE_UINT8 yytype_uint8;
|
||
#else
|
||
typedef unsigned char yytype_uint8;
|
||
#endif
|
||
|
||
#ifdef YYTYPE_INT8
|
||
typedef YYTYPE_INT8 yytype_int8;
|
||
#elif (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
typedef signed char yytype_int8;
|
||
#else
|
||
typedef short int yytype_int8;
|
||
#endif
|
||
|
||
#ifdef YYTYPE_UINT16
|
||
typedef YYTYPE_UINT16 yytype_uint16;
|
||
#else
|
||
typedef unsigned short int yytype_uint16;
|
||
#endif
|
||
|
||
#ifdef YYTYPE_INT16
|
||
typedef YYTYPE_INT16 yytype_int16;
|
||
#else
|
||
typedef short int yytype_int16;
|
||
#endif
|
||
|
||
#ifndef YYSIZE_T
|
||
# ifdef __SIZE_TYPE__
|
||
# define YYSIZE_T __SIZE_TYPE__
|
||
# elif defined size_t
|
||
# define YYSIZE_T size_t
|
||
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||
# define YYSIZE_T size_t
|
||
# else
|
||
# define YYSIZE_T unsigned int
|
||
# endif
|
||
#endif
|
||
|
||
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
||
|
||
#ifndef YY_
|
||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||
# if ENABLE_NLS
|
||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||
# endif
|
||
# endif
|
||
# ifndef YY_
|
||
# define YY_(msgid) msgid
|
||
# endif
|
||
#endif
|
||
|
||
/* Suppress unused-variable warnings by "using" E. */
|
||
#if ! defined lint || defined __GNUC__
|
||
# define YYUSE(e) ((void) (e))
|
||
#else
|
||
# define YYUSE(e) /* empty */
|
||
#endif
|
||
|
||
/* Identity function, used to suppress warnings about constant conditions. */
|
||
#ifndef lint
|
||
# define YYID(n) (n)
|
||
#else
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static int
|
||
YYID (int i)
|
||
#else
|
||
static int
|
||
YYID (i)
|
||
int i;
|
||
#endif
|
||
{
|
||
return i;
|
||
}
|
||
#endif
|
||
|
||
#if ! defined yyoverflow || YYERROR_VERBOSE
|
||
|
||
/* The parser invokes alloca or malloc; define the necessary symbols. */
|
||
|
||
# ifdef YYSTACK_USE_ALLOCA
|
||
# if YYSTACK_USE_ALLOCA
|
||
# ifdef __GNUC__
|
||
# define YYSTACK_ALLOC __builtin_alloca
|
||
# elif defined __BUILTIN_VA_ARG_INCR
|
||
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
|
||
# elif defined _AIX
|
||
# define YYSTACK_ALLOC __alloca
|
||
# elif defined _MSC_VER
|
||
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
|
||
# define alloca _alloca
|
||
# else
|
||
# define YYSTACK_ALLOC alloca
|
||
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||
# ifndef _STDLIB_H
|
||
# define _STDLIB_H 1
|
||
# endif
|
||
# endif
|
||
# endif
|
||
# endif
|
||
# endif
|
||
|
||
# ifdef YYSTACK_ALLOC
|
||
/* Pacify GCC's `empty if-body' warning. */
|
||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
|
||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||
/* The OS might guarantee only one guard page at the bottom of the stack,
|
||
and a page size can be as small as 4096 bytes. So we cannot safely
|
||
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
|
||
to allow for a few compiler-allocated temporary stack slots. */
|
||
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
|
||
# endif
|
||
# else
|
||
# define YYSTACK_ALLOC YYMALLOC
|
||
# define YYSTACK_FREE YYFREE
|
||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
||
# endif
|
||
# if (defined __cplusplus && ! defined _STDLIB_H \
|
||
&& ! ((defined YYMALLOC || defined malloc) \
|
||
&& (defined YYFREE || defined free)))
|
||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||
# ifndef _STDLIB_H
|
||
# define _STDLIB_H 1
|
||
# endif
|
||
# endif
|
||
# ifndef YYMALLOC
|
||
# define YYMALLOC malloc
|
||
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
||
# endif
|
||
# endif
|
||
# ifndef YYFREE
|
||
# define YYFREE free
|
||
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||
# endif
|
||
# endif
|
||
# 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
|
||
{
|
||
yytype_int16 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 (yytype_int16) + 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 \
|
||
{ \
|
||
YYSIZE_T yyi; \
|
||
for (yyi = 0; yyi < (Count); yyi++) \
|
||
(To)[yyi] = (From)[yyi]; \
|
||
} \
|
||
while (YYID (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 (YYID (0))
|
||
|
||
#endif
|
||
|
||
/* YYFINAL -- State number of the termination state. */
|
||
#define YYFINAL 5
|
||
/* YYLAST -- Last index in YYTABLE. */
|
||
#define YYLAST 370
|
||
|
||
/* YYNTOKENS -- Number of terminals. */
|
||
#define YYNTOKENS 63
|
||
/* YYNNTS -- Number of nonterminals. */
|
||
#define YYNNTS 67
|
||
/* YYNRULES -- Number of rules. */
|
||
#define YYNRULES 151
|
||
/* YYNRULES -- Number of states. */
|
||
#define YYNSTATES 258
|
||
|
||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||
#define YYUNDEFTOK 2
|
||
#define YYMAXUTOK 308
|
||
|
||
#define YYTRANSLATE(YYX) \
|
||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||
|
||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||
static const yytype_uint8 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,
|
||
59, 60, 61, 2, 57, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 62, 56,
|
||
2, 58, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 55, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||
2, 2, 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, 46, 47, 48, 49, 50, 51, 52, 53
|
||
};
|
||
|
||
#if YYDEBUG
|
||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||
YYRHS. */
|
||
static const yytype_uint16 yyprhs[] =
|
||
{
|
||
0, 0, 3, 7, 9, 14, 20, 21, 24, 25,
|
||
26, 36, 37, 39, 42, 44, 47, 49, 51, 54,
|
||
57, 60, 63, 66, 67, 69, 76, 78, 82, 86,
|
||
92, 98, 104, 107, 111, 114, 116, 118, 120, 122,
|
||
124, 126, 128, 130, 132, 134, 136, 137, 139, 142,
|
||
145, 149, 151, 153, 155, 159, 163, 167, 169, 170,
|
||
172, 175, 178, 182, 184, 186, 189, 191, 195, 198,
|
||
199, 203, 205, 209, 211, 213, 217, 220, 221, 225,
|
||
227, 231, 233, 235, 237, 239, 241, 243, 244, 248,
|
||
253, 258, 263, 268, 275, 281, 287, 294, 300, 306,
|
||
312, 318, 324, 330, 336, 341, 343, 345, 346, 348,
|
||
351, 354, 358, 362, 364, 366, 367, 369, 373, 375,
|
||
379, 381, 383, 385, 387, 389, 391, 393, 398, 400,
|
||
404, 406, 408, 410, 412, 414, 416, 418, 420, 422,
|
||
424, 426, 428, 430, 434, 436, 438, 440, 442, 444,
|
||
446, 448
|
||
};
|
||
|
||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||
static const yytype_int16 yyrhs[] =
|
||
{
|
||
64, 0, -1, 30, 65, 66, -1, 53, -1, 54,
|
||
67, 68, 55, -1, 110, 72, 87, 93, 113, -1,
|
||
-1, 68, 69, -1, -1, -1, 37, 129, 54, 70,
|
||
67, 68, 71, 55, 110, -1, -1, 32, -1, 32,
|
||
73, -1, 75, -1, 73, 75, -1, 129, -1, 76,
|
||
-1, 111, 56, -1, 78, 77, -1, 83, 77, -1,
|
||
82, 77, -1, 81, 77, -1, -1, 56, -1, 86,
|
||
34, 74, 54, 79, 55, -1, 80, -1, 79, 57,
|
||
80, -1, 129, 58, 126, -1, 35, 59, 20, 60,
|
||
74, -1, 108, 59, 61, 60, 74, -1, 33, 74,
|
||
54, 84, 55, -1, 85, 56, -1, 84, 85, 56,
|
||
-1, 108, 102, -1, 4, -1, 5, -1, 6, -1,
|
||
7, -1, 8, -1, 9, -1, 10, -1, 11, -1,
|
||
12, -1, 13, -1, 14, -1, -1, 28, -1, 28,
|
||
88, -1, 89, 56, -1, 88, 89, 56, -1, 90,
|
||
-1, 111, -1, 91, -1, 90, 57, 91, -1, 92,
|
||
58, 126, -1, 92, 58, 3, -1, 129, -1, -1,
|
||
29, -1, 29, 94, -1, 95, 56, -1, 94, 95,
|
||
56, -1, 96, -1, 111, -1, 108, 97, -1, 98,
|
||
-1, 97, 57, 98, -1, 129, 99, -1, -1, 59,
|
||
100, 60, -1, 101, -1, 100, 57, 101, -1, 112,
|
||
-1, 103, -1, 102, 57, 103, -1, 129, 104, -1,
|
||
-1, 59, 105, 60, -1, 106, -1, 105, 57, 106,
|
||
-1, 24, -1, 20, -1, 109, -1, 109, -1, 112,
|
||
-1, 86, -1, -1, 111, 56, 110, -1, 62, 50,
|
||
58, 127, -1, 62, 51, 58, 128, -1, 62, 52,
|
||
58, 126, -1, 62, 129, 58, 116, -1, 108, 109,
|
||
62, 129, 58, 116, -1, 109, 62, 129, 58, 116,
|
||
-1, 109, 62, 41, 58, 116, -1, 108, 109, 62,
|
||
41, 58, 116, -1, 109, 62, 43, 58, 127, -1,
|
||
109, 62, 44, 58, 125, -1, 109, 62, 49, 58,
|
||
128, -1, 109, 62, 45, 58, 126, -1, 109, 62,
|
||
46, 58, 128, -1, 109, 62, 47, 58, 127, -1,
|
||
109, 62, 48, 58, 128, -1, 62, 42, 58, 127,
|
||
-1, 129, -1, 38, -1, -1, 31, -1, 31, 114,
|
||
-1, 115, 56, -1, 114, 115, 56, -1, 107, 58,
|
||
116, -1, 117, -1, 118, -1, -1, 119, -1, 116,
|
||
57, 119, -1, 120, -1, 54, 116, 55, -1, 124,
|
||
-1, 36, -1, 39, -1, 40, -1, 121, -1, 122,
|
||
-1, 112, -1, 129, 59, 123, 60, -1, 124, -1,
|
||
123, 57, 124, -1, 17, -1, 18, -1, 19, -1,
|
||
20, -1, 21, -1, 22, -1, 23, -1, 24, -1,
|
||
25, -1, 26, -1, 27, -1, 16, -1, 126, -1,
|
||
125, 57, 126, -1, 20, -1, 24, -1, 21, -1,
|
||
25, -1, 16, -1, 127, -1, 126, -1, 15, -1
|
||
};
|
||
|
||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||
static const yytype_uint16 yyrline[] =
|
||
{
|
||
0, 218, 218, 224, 226, 233, 240, 240, 243, 252,
|
||
242, 257, 258, 259, 263, 263, 265, 275, 275, 278,
|
||
279, 280, 281, 284, 284, 287, 317, 319, 336, 345,
|
||
357, 371, 404, 405, 408, 422, 423, 424, 425, 426,
|
||
427, 428, 429, 430, 431, 432, 435, 436, 437, 440,
|
||
441, 444, 444, 446, 447, 451, 458, 468, 480, 481,
|
||
482, 485, 486, 489, 489, 491, 513, 517, 521, 548,
|
||
549, 552, 553, 557, 571, 575, 580, 609, 610, 614,
|
||
615, 620, 630, 650, 661, 672, 691, 698, 698, 701,
|
||
703, 705, 707, 709, 718, 729, 731, 733, 735, 737,
|
||
739, 741, 743, 745, 747, 752, 759, 768, 769, 770,
|
||
773, 774, 777, 781, 782, 786, 790, 791, 796, 797,
|
||
801, 802, 803, 804, 805, 806, 810, 814, 818, 820,
|
||
825, 826, 827, 828, 829, 830, 831, 832, 833, 834,
|
||
835, 836, 840, 841, 845, 847, 849, 851, 856, 860,
|
||
861, 867
|
||
};
|
||
#endif
|
||
|
||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
||
/* YYTNAME[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", "NC_UNLIMITED_K", "CHAR_K", "BYTE_K",
|
||
"SHORT_K", "INT_K", "FLOAT_K", "DOUBLE_K", "UBYTE_K", "USHORT_K",
|
||
"UINT_K", "INT64_K", "UINT64_K", "IDENT", "TERMSTRING", "CHAR_CONST",
|
||
"BYTE_CONST", "SHORT_CONST", "INT_CONST", "INT64_CONST", "UBYTE_CONST",
|
||
"USHORT_CONST", "UINT_CONST", "UINT64_CONST", "FLOAT_CONST",
|
||
"DOUBLE_CONST", "DIMENSIONS", "VARIABLES", "NETCDF", "DATA", "TYPES",
|
||
"COMPOUND", "ENUM", "OPAQUE_", "OPAQUESTRING", "GROUP", "PATH",
|
||
"FILLMARKER", "NIL", "_FILLVALUE", "_FORMAT", "_STORAGE", "_CHUNKSIZES",
|
||
"_DEFLATELEVEL", "_SHUFFLE", "_ENDIANNESS", "_NOFILL", "_FLETCHER32",
|
||
"_NCPROPS", "_ISNETCDF4", "_SUPERBLOCK", "DATASETID", "'{'", "'}'",
|
||
"';'", "','", "'='", "'('", "')'", "'*'", "':'", "$accept", "ncdesc",
|
||
"datasetid", "rootgroup", "groupbody", "subgrouplist", "namedgroup",
|
||
"@1", "@2", "typesection", "typedecls", "typename", "type_or_attr_decl",
|
||
"typedecl", "optsemicolon", "enumdecl", "enumidlist", "enumid",
|
||
"opaquedecl", "vlendecl", "compounddecl", "fields", "field", "primtype",
|
||
"dimsection", "dimdecls", "dim_or_attr_decl", "dimdeclist", "dimdecl",
|
||
"dimd", "vasection", "vadecls", "vadecl_or_attr", "vardecl", "varlist",
|
||
"varspec", "dimspec", "dimlist", "dimref", "fieldlist", "fieldspec",
|
||
"fielddimspec", "fielddimlist", "fielddim", "varref", "typeref",
|
||
"type_var_ref", "attrdecllist", "attrdecl", "path", "datasection",
|
||
"datadecls", "datadecl", "datalist", "datalist0", "datalist1",
|
||
"dataitem", "constdata", "econstref", "function", "arglist",
|
||
"simpleconstant", "intlist", "constint", "conststring", "constbool",
|
||
"ident", 0
|
||
};
|
||
#endif
|
||
|
||
# ifdef YYPRINT
|
||
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
|
||
token YYLEX-NUM. */
|
||
static const yytype_uint16 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, 287, 288, 289, 290, 291, 292, 293, 294,
|
||
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
|
||
305, 306, 307, 308, 123, 125, 59, 44, 61, 40,
|
||
41, 42, 58
|
||
};
|
||
# endif
|
||
|
||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||
static const yytype_uint8 yyr1[] =
|
||
{
|
||
0, 63, 64, 65, 66, 67, 68, 68, 70, 71,
|
||
69, 72, 72, 72, 73, 73, 74, 75, 75, 76,
|
||
76, 76, 76, 77, 77, 78, 79, 79, 80, 81,
|
||
82, 83, 84, 84, 85, 86, 86, 86, 86, 86,
|
||
86, 86, 86, 86, 86, 86, 87, 87, 87, 88,
|
||
88, 89, 89, 90, 90, 91, 91, 92, 93, 93,
|
||
93, 94, 94, 95, 95, 96, 97, 97, 98, 99,
|
||
99, 100, 100, 101, 102, 102, 103, 104, 104, 105,
|
||
105, 106, 106, 107, 108, 109, 109, 110, 110, 111,
|
||
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
|
||
111, 111, 111, 111, 111, 112, 112, 113, 113, 113,
|
||
114, 114, 115, 116, 116, 117, 118, 118, 119, 119,
|
||
120, 120, 120, 120, 120, 120, 121, 122, 123, 123,
|
||
124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
|
||
124, 124, 125, 125, 126, 126, 126, 126, 127, 128,
|
||
128, 129
|
||
};
|
||
|
||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||
static const yytype_uint8 yyr2[] =
|
||
{
|
||
0, 2, 3, 1, 4, 5, 0, 2, 0, 0,
|
||
9, 0, 1, 2, 1, 2, 1, 1, 2, 2,
|
||
2, 2, 2, 0, 1, 6, 1, 3, 3, 5,
|
||
5, 5, 2, 3, 2, 1, 1, 1, 1, 1,
|
||
1, 1, 1, 1, 1, 1, 0, 1, 2, 2,
|
||
3, 1, 1, 1, 3, 3, 3, 1, 0, 1,
|
||
2, 2, 3, 1, 1, 2, 1, 3, 2, 0,
|
||
3, 1, 3, 1, 1, 3, 2, 0, 3, 1,
|
||
3, 1, 1, 1, 1, 1, 1, 0, 3, 4,
|
||
4, 4, 4, 6, 5, 5, 6, 5, 5, 5,
|
||
5, 5, 5, 5, 4, 1, 1, 0, 1, 2,
|
||
2, 3, 3, 1, 1, 0, 1, 3, 1, 3,
|
||
1, 1, 1, 1, 1, 1, 1, 4, 1, 3,
|
||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||
1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
|
||
1, 1
|
||
};
|
||
|
||
/* 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 yytype_uint8 yydefact[] =
|
||
{
|
||
0, 0, 0, 3, 0, 1, 87, 2, 35, 36,
|
||
37, 38, 39, 40, 41, 42, 43, 44, 45, 151,
|
||
106, 0, 6, 86, 0, 84, 11, 0, 85, 105,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 12, 46,
|
||
87, 0, 0, 0, 0, 115, 0, 4, 7, 0,
|
||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 13, 14, 17, 23, 23, 23, 23, 86, 0,
|
||
0, 47, 58, 88, 148, 104, 89, 144, 146, 145,
|
||
147, 150, 149, 90, 91, 141, 130, 131, 132, 133,
|
||
134, 135, 136, 137, 138, 139, 140, 121, 122, 123,
|
||
115, 126, 92, 113, 114, 116, 118, 124, 125, 120,
|
||
105, 0, 0, 0, 115, 0, 0, 0, 0, 0,
|
||
0, 0, 115, 0, 16, 0, 15, 24, 19, 22,
|
||
21, 20, 0, 0, 18, 48, 0, 51, 53, 0,
|
||
52, 105, 59, 107, 0, 0, 0, 8, 115, 115,
|
||
95, 97, 98, 142, 100, 101, 102, 103, 99, 94,
|
||
0, 0, 0, 0, 0, 49, 0, 0, 60, 0,
|
||
63, 0, 64, 108, 5, 119, 117, 0, 128, 87,
|
||
96, 93, 0, 0, 0, 0, 84, 0, 0, 0,
|
||
50, 54, 57, 56, 55, 0, 61, 65, 66, 69,
|
||
0, 83, 109, 0, 0, 127, 6, 143, 31, 0,
|
||
32, 34, 74, 77, 29, 0, 26, 0, 30, 62,
|
||
0, 0, 68, 115, 0, 110, 129, 9, 33, 0,
|
||
0, 76, 25, 0, 0, 67, 69, 0, 71, 73,
|
||
112, 111, 0, 75, 82, 81, 0, 79, 27, 28,
|
||
0, 70, 87, 0, 78, 72, 10, 80
|
||
};
|
||
|
||
/* YYDEFGOTO[NTERM-NUM]. */
|
||
static const yytype_int16 yydefgoto[] =
|
||
{
|
||
-1, 2, 4, 7, 22, 35, 48, 179, 242, 39,
|
||
61, 123, 62, 63, 128, 64, 215, 216, 65, 66,
|
||
67, 183, 184, 23, 72, 135, 136, 137, 138, 139,
|
||
143, 168, 169, 170, 197, 198, 222, 237, 238, 211,
|
||
212, 231, 246, 247, 200, 24, 25, 26, 27, 28,
|
||
174, 202, 203, 102, 103, 104, 105, 106, 107, 108,
|
||
177, 109, 152, 81, 82, 83, 29
|
||
};
|
||
|
||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||
STATE-NUM. */
|
||
#define YYPACT_NINF -133
|
||
static const yytype_int16 yypact[] =
|
||
{
|
||
-11, -48, 20, -133, -19, -133, 210, -133, -133, -133,
|
||
-133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
|
||
-133, -3, -133, -133, 332, -16, 8, -4, -133, -133,
|
||
18, 19, 29, 41, 48, -22, 47, 128, 56, 75,
|
||
210, 94, 94, 136, 33, 281, 102, -133, -133, 2,
|
||
63, 64, 65, 68, 71, 74, 76, 77, 78, 102,
|
||
82, 56, -133, -133, 81, 81, 81, 81, 99, 222,
|
||
88, 210, 117, -133, -133, -133, -133, -133, -133, -133,
|
||
-133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
|
||
-133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
|
||
281, -133, 90, -133, -133, -133, -133, -133, -133, -133,
|
||
89, 97, 91, 100, 281, 94, 33, 33, 136, 94,
|
||
136, 136, 281, 105, -133, 142, -133, -133, -133, -133,
|
||
-133, -133, 102, 109, -133, 210, 107, 121, -133, 123,
|
||
-133, 125, 210, 148, 35, 281, 333, -133, 281, 281,
|
||
90, -133, 129, -133, -133, -133, -133, -133, -133, 90,
|
||
332, 127, 131, 130, 132, -133, 102, 95, 210, 133,
|
||
-133, 332, -133, 332, -133, -133, -133, -23, -133, 210,
|
||
90, 90, 33, 278, 135, 102, -133, 102, 102, 102,
|
||
-133, -133, -133, -133, -133, 137, -133, 138, -133, -32,
|
||
139, -133, 332, 140, 333, -133, -133, -133, -133, 144,
|
||
-133, 141, -133, 145, -133, 45, -133, 143, -133, -133,
|
||
102, -12, -133, 281, 147, -133, -133, 157, -133, 102,
|
||
-2, -133, -133, 102, 33, -133, 146, 25, -133, -133,
|
||
90, -133, 151, -133, -133, -133, 26, -133, -133, -133,
|
||
-12, -133, 210, -2, -133, -133, -133, -133
|
||
};
|
||
|
||
/* YYPGOTO[NTERM-NUM]. */
|
||
static const yytype_int16 yypgoto[] =
|
||
{
|
||
-133, -133, -133, -133, 28, 4, -133, -133, -133, -133,
|
||
-133, -109, 150, -133, 30, -133, -133, 5, -133, -133,
|
||
-133, -133, 57, -25, -133, -133, 104, -133, 79, -133,
|
||
-133, -133, 73, -133, -133, 22, -133, -133, -7, -133,
|
||
15, -133, -133, -6, -133, -29, -18, -39, -30, -41,
|
||
-133, -133, 44, -93, -133, -133, 106, -133, -133, -133,
|
||
-133, -132, -133, -42, -31, -76, -21
|
||
};
|
||
|
||
/* 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 -106
|
||
static const yytype_int16 yytable[] =
|
||
{
|
||
34, 73, 84, 19, 101, 3, 36, 144, 70, 69,
|
||
75, 76, 19, 68, 178, 46, 58, 19, 244, 1,
|
||
5, 150, 245, 162, 110, 111, 20, 221, 113, 159,
|
||
-105, 70, 69, 47, 204, 6, 68, 205, 124, 30,
|
||
38, 140, 155, 112, 157, 158, 37, 31, 32, 33,
|
||
141, 36, 40, 77, 78, 180, 181, 79, 80, 101,
|
||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||
18, 19, 226, 101, 153, 154, 41, 42, 214, 110,
|
||
218, 101, 250, 253, 151, 251, 254, 43, 156, 59,
|
||
175, 60, 145, 110, 20, 129, 130, 131, 193, 44,
|
||
232, 110, 233, 71, 101, 140, 45, 101, 101, 49,
|
||
74, 124, 172, 171, 141, 77, 78, 19, 21, 79,
|
||
80, 114, 115, 116, 110, 194, 117, 110, 110, 118,
|
||
240, 185, 119, 132, 120, 121, 122, 127, 172, 171,
|
||
207, 125, 186, 19, 134, 192, 142, 145, 146, 148,
|
||
199, 147, 74, 36, 185, 201, 77, 78, 149, 160,
|
||
79, 80, 161, 165, 213, 186, 124, 217, 124, 50,
|
||
163, 51, 52, 53, 54, 55, 56, 57, 166, 173,
|
||
239, 167, 101, -57, 201, 188, 182, 187, 190, 196,
|
||
189, 210, 249, 219, 46, 220, 225, 223, 229, 236,
|
||
228, 234, 110, 241, 230, 221, 252, 206, 213, 239,
|
||
227, 126, 217, 256, 8, 9, 10, 11, 12, 13,
|
||
14, 15, 16, 17, 18, 19, 8, 9, 10, 11,
|
||
12, 13, 14, 15, 16, 17, 18, 19, 248, 164,
|
||
209, 195, 235, 255, 243, 191, 224, 257, 20, 0,
|
||
0, 176, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 133, 8, 9, 10, 11, 12, 13, 14, 15,
|
||
16, 17, 18, 19, 0, 0, 19, 85, 86, 87,
|
||
88, 89, 90, 91, 92, 93, 94, 95, 96, 0,
|
||
0, 0, 0, 0, 0, 0, 20, 97, 0, 20,
|
||
98, 99, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
0, 0, 0, 208, 0, 100, 8, 9, 10, 11,
|
||
12, 13, 14, 15, 16, 17, 18, 19, 0, 85,
|
||
86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||
96, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
20
|
||
};
|
||
|
||
static const yytype_int16 yycheck[] =
|
||
{
|
||
21, 40, 44, 15, 45, 53, 24, 100, 38, 38,
|
||
41, 42, 15, 38, 146, 37, 37, 15, 20, 30,
|
||
0, 114, 24, 132, 45, 46, 38, 59, 49, 122,
|
||
62, 61, 61, 55, 57, 54, 61, 60, 59, 42,
|
||
32, 71, 118, 41, 120, 121, 62, 50, 51, 52,
|
||
71, 69, 56, 20, 21, 148, 149, 24, 25, 100,
|
||
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||
14, 15, 204, 114, 116, 117, 58, 58, 187, 100,
|
||
189, 122, 57, 57, 115, 60, 60, 58, 119, 33,
|
||
55, 35, 57, 114, 38, 65, 66, 67, 3, 58,
|
||
55, 122, 57, 28, 145, 135, 58, 148, 149, 62,
|
||
16, 132, 142, 142, 135, 20, 21, 15, 62, 24,
|
||
25, 58, 58, 58, 145, 167, 58, 148, 149, 58,
|
||
223, 160, 58, 34, 58, 58, 58, 56, 168, 168,
|
||
182, 59, 160, 15, 56, 166, 29, 57, 59, 58,
|
||
171, 54, 16, 171, 183, 173, 20, 21, 58, 54,
|
||
24, 25, 20, 56, 185, 183, 187, 188, 189, 41,
|
||
61, 43, 44, 45, 46, 47, 48, 49, 57, 31,
|
||
221, 58, 223, 58, 202, 54, 57, 60, 56, 56,
|
||
60, 56, 234, 56, 37, 57, 56, 58, 57, 220,
|
||
56, 58, 223, 56, 59, 59, 55, 179, 229, 250,
|
||
206, 61, 233, 252, 4, 5, 6, 7, 8, 9,
|
||
10, 11, 12, 13, 14, 15, 4, 5, 6, 7,
|
||
8, 9, 10, 11, 12, 13, 14, 15, 233, 135,
|
||
183, 168, 220, 250, 229, 166, 202, 253, 38, -1,
|
||
-1, 145, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
38, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, 62, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, 59, 4, 5, 6, 7, 8, 9, 10, 11,
|
||
12, 13, 14, 15, -1, -1, 15, 16, 17, 18,
|
||
19, 20, 21, 22, 23, 24, 25, 26, 27, -1,
|
||
-1, -1, -1, -1, -1, -1, 38, 36, -1, 38,
|
||
39, 40, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
-1, -1, -1, 55, -1, 54, 4, 5, 6, 7,
|
||
8, 9, 10, 11, 12, 13, 14, 15, -1, 16,
|
||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||
27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||
38
|
||
};
|
||
|
||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||
symbol of state STATE-NUM. */
|
||
static const yytype_uint8 yystos[] =
|
||
{
|
||
0, 30, 64, 53, 65, 0, 54, 66, 4, 5,
|
||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||
38, 62, 67, 86, 108, 109, 110, 111, 112, 129,
|
||
42, 50, 51, 52, 129, 68, 109, 62, 32, 72,
|
||
56, 58, 58, 58, 58, 58, 37, 55, 69, 62,
|
||
41, 43, 44, 45, 46, 47, 48, 49, 129, 33,
|
||
35, 73, 75, 76, 78, 81, 82, 83, 86, 108,
|
||
111, 28, 87, 110, 16, 127, 127, 20, 21, 24,
|
||
25, 126, 127, 128, 126, 16, 17, 18, 19, 20,
|
||
21, 22, 23, 24, 25, 26, 27, 36, 39, 40,
|
||
54, 112, 116, 117, 118, 119, 120, 121, 122, 124,
|
||
129, 129, 41, 129, 58, 58, 58, 58, 58, 58,
|
||
58, 58, 58, 74, 129, 59, 75, 56, 77, 77,
|
||
77, 77, 34, 59, 56, 88, 89, 90, 91, 92,
|
||
111, 129, 29, 93, 116, 57, 59, 54, 58, 58,
|
||
116, 127, 125, 126, 126, 128, 127, 128, 128, 116,
|
||
54, 20, 74, 61, 89, 56, 57, 58, 94, 95,
|
||
96, 108, 111, 31, 113, 55, 119, 123, 124, 70,
|
||
116, 116, 57, 84, 85, 108, 109, 60, 54, 60,
|
||
56, 91, 129, 3, 126, 95, 56, 97, 98, 129,
|
||
107, 109, 114, 115, 57, 60, 67, 126, 55, 85,
|
||
56, 102, 103, 129, 74, 79, 80, 129, 74, 56,
|
||
57, 59, 99, 58, 115, 56, 124, 68, 56, 57,
|
||
59, 104, 55, 57, 58, 98, 129, 100, 101, 112,
|
||
116, 56, 71, 103, 20, 24, 105, 106, 80, 126,
|
||
57, 60, 55, 57, 60, 101, 110, 106
|
||
};
|
||
|
||
#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 yyerrorlab
|
||
|
||
|
||
/* 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 (1); \
|
||
goto yybackup; \
|
||
} \
|
||
else \
|
||
{ \
|
||
yyerror (YY_("syntax error: cannot back up")); \
|
||
YYERROR; \
|
||
} \
|
||
while (YYID (0))
|
||
|
||
|
||
#define YYTERROR 1
|
||
#define YYERRCODE 256
|
||
|
||
|
||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||
If N is 0, then set CURRENT to the empty location which ends
|
||
the previous symbol: RHS[0] (always defined). */
|
||
|
||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||
#ifndef YYLLOC_DEFAULT
|
||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||
do \
|
||
if (YYID (N)) \
|
||
{ \
|
||
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
||
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
||
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
|
||
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
|
||
} \
|
||
else \
|
||
{ \
|
||
(Current).first_line = (Current).last_line = \
|
||
YYRHSLOC (Rhs, 0).last_line; \
|
||
(Current).first_column = (Current).last_column = \
|
||
YYRHSLOC (Rhs, 0).last_column; \
|
||
} \
|
||
while (YYID (0))
|
||
#endif
|
||
|
||
|
||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||
This macro was not mandated originally: define only if we know
|
||
we won't break user code: when these are the locations we know. */
|
||
|
||
#ifndef YY_LOCATION_PRINT
|
||
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
||
# define YY_LOCATION_PRINT(File, Loc) \
|
||
fprintf (File, "%d.%d-%d.%d", \
|
||
(Loc).first_line, (Loc).first_column, \
|
||
(Loc).last_line, (Loc).last_column)
|
||
# else
|
||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||
# endif
|
||
#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 (YYID (0))
|
||
|
||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||
do { \
|
||
if (yydebug) \
|
||
{ \
|
||
YYFPRINTF (stderr, "%s ", Title); \
|
||
yy_symbol_print (stderr, \
|
||
Type, Value); \
|
||
YYFPRINTF (stderr, "\n"); \
|
||
} \
|
||
} while (YYID (0))
|
||
|
||
|
||
/*--------------------------------.
|
||
| Print this symbol on YYOUTPUT. |
|
||
`--------------------------------*/
|
||
|
||
/*ARGSUSED*/
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static void
|
||
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
||
#else
|
||
static void
|
||
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
|
||
FILE *yyoutput;
|
||
int yytype;
|
||
YYSTYPE const * const yyvaluep;
|
||
#endif
|
||
{
|
||
if (!yyvaluep)
|
||
return;
|
||
# ifdef YYPRINT
|
||
if (yytype < YYNTOKENS)
|
||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||
# else
|
||
YYUSE (yyoutput);
|
||
# endif
|
||
switch (yytype)
|
||
{
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
|
||
/*--------------------------------.
|
||
| Print this symbol on YYOUTPUT. |
|
||
`--------------------------------*/
|
||
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static void
|
||
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
||
#else
|
||
static void
|
||
yy_symbol_print (yyoutput, yytype, yyvaluep)
|
||
FILE *yyoutput;
|
||
int yytype;
|
||
YYSTYPE const * const yyvaluep;
|
||
#endif
|
||
{
|
||
if (yytype < YYNTOKENS)
|
||
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||
else
|
||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||
|
||
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
|
||
YYFPRINTF (yyoutput, ")");
|
||
}
|
||
|
||
/*------------------------------------------------------------------.
|
||
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
||
| TOP (included). |
|
||
`------------------------------------------------------------------*/
|
||
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static void
|
||
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
|
||
#else
|
||
static void
|
||
yy_stack_print (bottom, top)
|
||
yytype_int16 *bottom;
|
||
yytype_int16 *top;
|
||
#endif
|
||
{
|
||
YYFPRINTF (stderr, "Stack now");
|
||
for (; 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 (YYID (0))
|
||
|
||
|
||
/*------------------------------------------------.
|
||
| Report that the YYRULE is going to be reduced. |
|
||
`------------------------------------------------*/
|
||
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static void
|
||
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
|
||
#else
|
||
static void
|
||
yy_reduce_print (yyvsp, yyrule)
|
||
YYSTYPE *yyvsp;
|
||
int yyrule;
|
||
#endif
|
||
{
|
||
int yynrhs = yyr2[yyrule];
|
||
int yyi;
|
||
unsigned long int yylno = yyrline[yyrule];
|
||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||
yyrule - 1, yylno);
|
||
/* The symbols being reduced. */
|
||
for (yyi = 0; yyi < yynrhs; yyi++)
|
||
{
|
||
fprintf (stderr, " $%d = ", yyi + 1);
|
||
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||
);
|
||
fprintf (stderr, "\n");
|
||
}
|
||
}
|
||
|
||
# define YY_REDUCE_PRINT(Rule) \
|
||
do { \
|
||
if (yydebug) \
|
||
yy_reduce_print (yyvsp, Rule); \
|
||
} while (YYID (0))
|
||
|
||
/* Nonzero means print parse trace. It is left uninitialized so that
|
||
multiple parsers can coexist. */
|
||
int yydebug;
|
||
#else /* !YYDEBUG */
|
||
# define YYDPRINTF(Args)
|
||
# define YY_SYMBOL_PRINT(Title, Type, 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
|
||
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
|
||
evaluated with infinite-precision integer arithmetic. */
|
||
|
||
#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. */
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static YYSIZE_T
|
||
yystrlen (const char *yystr)
|
||
#else
|
||
static YYSIZE_T
|
||
yystrlen (yystr)
|
||
const char *yystr;
|
||
#endif
|
||
{
|
||
YYSIZE_T yylen;
|
||
for (yylen = 0; yystr[yylen]; yylen++)
|
||
continue;
|
||
return yylen;
|
||
}
|
||
# 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. */
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static char *
|
||
yystpcpy (char *yydest, const char *yysrc)
|
||
#else
|
||
static char *
|
||
yystpcpy (yydest, yysrc)
|
||
char *yydest;
|
||
const char *yysrc;
|
||
#endif
|
||
{
|
||
char *yyd = yydest;
|
||
const char *yys = yysrc;
|
||
|
||
while ((*yyd++ = *yys++) != '\0')
|
||
continue;
|
||
|
||
return yyd - 1;
|
||
}
|
||
# endif
|
||
# endif
|
||
|
||
# ifndef yytnamerr
|
||
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
|
||
quotes and backslashes, so that it's suitable for yyerror. The
|
||
heuristic is that double-quoting is unnecessary unless the string
|
||
contains an apostrophe, a comma, or backslash (other than
|
||
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
||
null, do not copy; instead, return the length of what the result
|
||
would have been. */
|
||
static YYSIZE_T
|
||
yytnamerr (char *yyres, const char *yystr)
|
||
{
|
||
if (*yystr == '"')
|
||
{
|
||
YYSIZE_T yyn = 0;
|
||
char const *yyp = yystr;
|
||
|
||
for (;;)
|
||
switch (*++yyp)
|
||
{
|
||
case '\'':
|
||
case ',':
|
||
goto do_not_strip_quotes;
|
||
|
||
case '\\':
|
||
if (*++yyp != '\\')
|
||
goto do_not_strip_quotes;
|
||
/* Fall through. */
|
||
default:
|
||
if (yyres)
|
||
yyres[yyn] = *yyp;
|
||
yyn++;
|
||
break;
|
||
|
||
case '"':
|
||
if (yyres)
|
||
yyres[yyn] = '\0';
|
||
return yyn;
|
||
}
|
||
do_not_strip_quotes: ;
|
||
}
|
||
|
||
if (! yyres)
|
||
return yystrlen (yystr);
|
||
|
||
return yystpcpy (yyres, yystr) - yyres;
|
||
}
|
||
# endif
|
||
|
||
/* Copy into YYRESULT an error message about the unexpected token
|
||
YYCHAR while in state YYSTATE. Return the number of bytes copied,
|
||
including the terminating null byte. If YYRESULT is null, do not
|
||
copy anything; just return the number of bytes that would be
|
||
copied. As a special case, return 0 if an ordinary "syntax error"
|
||
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
||
size calculation. */
|
||
static YYSIZE_T
|
||
yysyntax_error (char *yyresult, int yystate, int yychar)
|
||
{
|
||
int yyn = yypact[yystate];
|
||
|
||
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
|
||
return 0;
|
||
else
|
||
{
|
||
int yytype = YYTRANSLATE (yychar);
|
||
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
|
||
YYSIZE_T yysize = yysize0;
|
||
YYSIZE_T yysize1;
|
||
int yysize_overflow = 0;
|
||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||
int yyx;
|
||
|
||
# if 0
|
||
/* This is so xgettext sees the translatable formats that are
|
||
constructed on the fly. */
|
||
YY_("syntax error, unexpected %s");
|
||
YY_("syntax error, unexpected %s, expecting %s");
|
||
YY_("syntax error, unexpected %s, expecting %s or %s");
|
||
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
|
||
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
|
||
# endif
|
||
char *yyfmt;
|
||
char const *yyf;
|
||
static char const yyunexpected[] = "syntax error, unexpected %s";
|
||
static char const yyexpecting[] = ", expecting %s";
|
||
static char const yyor[] = " or %s";
|
||
char yyformat[sizeof yyunexpected
|
||
+ sizeof yyexpecting - 1
|
||
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
||
* (sizeof yyor - 1))];
|
||
char const *yyprefix = yyexpecting;
|
||
|
||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||
YYCHECK. */
|
||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||
|
||
/* Stay within bounds of both yycheck and yytname. */
|
||
int yychecklim = YYLAST - yyn + 1;
|
||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||
int yycount = 1;
|
||
|
||
yyarg[0] = yytname[yytype];
|
||
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||
|
||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||
{
|
||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||
{
|
||
yycount = 1;
|
||
yysize = yysize0;
|
||
yyformat[sizeof yyunexpected - 1] = '\0';
|
||
break;
|
||
}
|
||
yyarg[yycount++] = yytname[yyx];
|
||
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
|
||
yysize_overflow |= (yysize1 < yysize);
|
||
yysize = yysize1;
|
||
yyfmt = yystpcpy (yyfmt, yyprefix);
|
||
yyprefix = yyor;
|
||
}
|
||
|
||
yyf = YY_(yyformat);
|
||
yysize1 = yysize + yystrlen (yyf);
|
||
yysize_overflow |= (yysize1 < yysize);
|
||
yysize = yysize1;
|
||
|
||
if (yysize_overflow)
|
||
return YYSIZE_MAXIMUM;
|
||
|
||
if (yyresult)
|
||
{
|
||
/* Avoid sprintf, as that infringes on the user's name space.
|
||
Don't have undefined behavior even if the translation
|
||
produced a string with the wrong number of "%s"s. */
|
||
char *yyp = yyresult;
|
||
int yyi = 0;
|
||
while ((*yyp = *yyf) != '\0')
|
||
{
|
||
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
||
{
|
||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||
yyf += 2;
|
||
}
|
||
else
|
||
{
|
||
yyp++;
|
||
yyf++;
|
||
}
|
||
}
|
||
}
|
||
return yysize;
|
||
}
|
||
}
|
||
#endif /* YYERROR_VERBOSE */
|
||
|
||
|
||
/*-----------------------------------------------.
|
||
| Release the memory associated to this symbol. |
|
||
`-----------------------------------------------*/
|
||
|
||
/*ARGSUSED*/
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
static void
|
||
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
|
||
#else
|
||
static void
|
||
yydestruct (yymsg, yytype, yyvaluep)
|
||
const char *yymsg;
|
||
int yytype;
|
||
YYSTYPE *yyvaluep;
|
||
#endif
|
||
{
|
||
YYUSE (yyvaluep);
|
||
|
||
if (!yymsg)
|
||
yymsg = "Deleting";
|
||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||
|
||
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 look-ahead symbol. */
|
||
int yychar;
|
||
|
||
/* The semantic value of the look-ahead symbol. */
|
||
YYSTYPE yylval;
|
||
|
||
/* Number of syntax errors so far. */
|
||
int yynerrs;
|
||
|
||
|
||
|
||
/*----------.
|
||
| yyparse. |
|
||
`----------*/
|
||
|
||
#ifdef YYPARSE_PARAM
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
int
|
||
yyparse (void *YYPARSE_PARAM)
|
||
#else
|
||
int
|
||
yyparse (YYPARSE_PARAM)
|
||
void *YYPARSE_PARAM;
|
||
#endif
|
||
#else /* ! YYPARSE_PARAM */
|
||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||
|| defined __cplusplus || defined _MSC_VER)
|
||
int
|
||
yyparse (void)
|
||
#else
|
||
int
|
||
yyparse ()
|
||
|
||
#endif
|
||
#endif
|
||
{
|
||
|
||
int yystate;
|
||
int yyn;
|
||
int yyresult;
|
||
/* Number of tokens to shift before error messages enabled. */
|
||
int yyerrstatus;
|
||
/* Look-ahead token as an internal (translated) token number. */
|
||
int yytoken = 0;
|
||
#if YYERROR_VERBOSE
|
||
/* Buffer for error messages, and its allocated size. */
|
||
char yymsgbuf[128];
|
||
char *yymsg = yymsgbuf;
|
||
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
||
#endif
|
||
|
||
/* 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. */
|
||
yytype_int16 yyssa[YYINITDEPTH];
|
||
yytype_int16 *yyss = yyssa;
|
||
yytype_int16 *yyssp;
|
||
|
||
/* The semantic value stack. */
|
||
YYSTYPE yyvsa[YYINITDEPTH];
|
||
YYSTYPE *yyvs = yyvsa;
|
||
YYSTYPE *yyvsp;
|
||
|
||
|
||
|
||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
||
|
||
YYSIZE_T yystacksize = YYINITDEPTH;
|
||
|
||
/* The variables used to return semantic value and location from the
|
||
action routines. */
|
||
YYSTYPE yyval;
|
||
|
||
|
||
/* The number of symbols on the RHS of the reduced rule.
|
||
Keep to zero when no symbol should be popped. */
|
||
int yylen = 0;
|
||
|
||
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;
|
||
yytype_int16 *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 (YY_("memory exhausted"),
|
||
&yyss1, yysize * sizeof (*yyssp),
|
||
&yyvs1, yysize * sizeof (*yyvsp),
|
||
|
||
&yystacksize);
|
||
|
||
yyss = yyss1;
|
||
yyvs = yyvs1;
|
||
}
|
||
#else /* no yyoverflow */
|
||
# ifndef YYSTACK_RELOCATE
|
||
goto yyexhaustedlab;
|
||
# else
|
||
/* Extend the stack our own way. */
|
||
if (YYMAXDEPTH <= yystacksize)
|
||
goto yyexhaustedlab;
|
||
yystacksize *= 2;
|
||
if (YYMAXDEPTH < yystacksize)
|
||
yystacksize = YYMAXDEPTH;
|
||
|
||
{
|
||
yytype_int16 *yyss1 = yyss;
|
||
union yyalloc *yyptr =
|
||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||
if (! yyptr)
|
||
goto yyexhaustedlab;
|
||
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
|
||
look-ahead token if we need one and don't already have one. */
|
||
|
||
/* First try to decide what to do without reference to look-ahead token. */
|
||
yyn = yypact[yystate];
|
||
if (yyn == YYPACT_NINF)
|
||
goto yydefault;
|
||
|
||
/* Not known => get a look-ahead token if don't already have one. */
|
||
|
||
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead 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);
|
||
YY_SYMBOL_PRINT ("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;
|
||
|
||
/* Count tokens shifted since error; after three, turn off error
|
||
status. */
|
||
if (yyerrstatus)
|
||
yyerrstatus--;
|
||
|
||
/* Shift the look-ahead token. */
|
||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
||
|
||
/* Discard the shifted token unless it is eof. */
|
||
if (yychar != YYEOF)
|
||
yychar = YYEMPTY;
|
||
|
||
yystate = yyn;
|
||
*++yyvsp = yylval;
|
||
|
||
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 2:
|
||
#line 221 "ncgen.y"
|
||
{if (error_count > 0) YYABORT;;}
|
||
break;
|
||
|
||
case 3:
|
||
#line 224 "ncgen.y"
|
||
{createrootgroup(datasetname);;}
|
||
break;
|
||
|
||
case 8:
|
||
#line 243 "ncgen.y"
|
||
{
|
||
Symbol* id = (yyvsp[(2) - (3)].sym);
|
||
markcdf4("Group specification");
|
||
if(creategroup(id) == NULL)
|
||
yyerror("duplicate group declaration within parent group for %s",
|
||
id->name);
|
||
;}
|
||
break;
|
||
|
||
case 9:
|
||
#line 252 "ncgen.y"
|
||
{listpop(groupstack);;}
|
||
break;
|
||
|
||
case 12:
|
||
#line 258 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 13:
|
||
#line 260 "ncgen.y"
|
||
{markcdf4("Type specification");;}
|
||
break;
|
||
|
||
case 16:
|
||
#line 266 "ncgen.y"
|
||
{ /* Use when defining a type */
|
||
(yyvsp[(1) - (1)].sym)->objectclass = NC_TYPE;
|
||
if(dupobjectcheck(NC_TYPE,(yyvsp[(1) - (1)].sym)))
|
||
yyerror("duplicate type declaration for %s",
|
||
(yyvsp[(1) - (1)].sym)->name);
|
||
listpush(typdefs,(void*)(yyvsp[(1) - (1)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 17:
|
||
#line 275 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 18:
|
||
#line 275 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 25:
|
||
#line 289 "ncgen.y"
|
||
{
|
||
int i;
|
||
addtogroup((yyvsp[(3) - (6)].sym)); /* sets prefix*/
|
||
(yyvsp[(3) - (6)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(3) - (6)].sym)->subclass=NC_ENUM;
|
||
(yyvsp[(3) - (6)].sym)->typ.basetype=(yyvsp[(1) - (6)].sym);
|
||
(yyvsp[(3) - (6)].sym)->typ.size = (yyvsp[(1) - (6)].sym)->typ.size;
|
||
(yyvsp[(3) - (6)].sym)->typ.alignment = (yyvsp[(1) - (6)].sym)->typ.alignment;
|
||
stackbase=(yyvsp[(5) - (6)].mark);
|
||
stacklen=listlength(stack);
|
||
(yyvsp[(3) - (6)].sym)->subnodes = listnew();
|
||
/* Variety of field fixups*/
|
||
/* 1. add in the enum values*/
|
||
/* 2. make this type be their container*/
|
||
/* 3. make constant names visible in the group*/
|
||
/* 4. set field basetype to be same as enum basetype*/
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* eid = (Symbol*)listget(stack,i);
|
||
assert(eid->subclass == NC_ECONST);
|
||
addtogroup(eid);
|
||
listpush((yyvsp[(3) - (6)].sym)->subnodes,(void*)eid);
|
||
eid->container = (yyvsp[(3) - (6)].sym);
|
||
eid->typ.basetype = (yyvsp[(3) - (6)].sym)->typ.basetype;
|
||
}
|
||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||
;}
|
||
break;
|
||
|
||
case 26:
|
||
#line 318 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
|
||
break;
|
||
|
||
case 27:
|
||
#line 320 "ncgen.y"
|
||
{
|
||
int i;
|
||
(yyval.mark)=(yyvsp[(1) - (3)].mark);
|
||
/* check for duplicates*/
|
||
stackbase=(yyvsp[(1) - (3)].mark);
|
||
stacklen=listlength(stack);
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* elem = (Symbol*)listget(stack,i);
|
||
if(strcmp((yyvsp[(3) - (3)].sym)->name,elem->name)==0)
|
||
yyerror("duplicate enum declaration for %s",
|
||
elem->name);
|
||
}
|
||
listpush(stack,(void*)(yyvsp[(3) - (3)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 28:
|
||
#line 337 "ncgen.y"
|
||
{
|
||
(yyvsp[(1) - (3)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(1) - (3)].sym)->subclass=NC_ECONST;
|
||
(yyvsp[(1) - (3)].sym)->typ.econst=(yyvsp[(3) - (3)].constant);
|
||
(yyval.sym)=(yyvsp[(1) - (3)].sym);
|
||
;}
|
||
break;
|
||
|
||
case 29:
|
||
#line 346 "ncgen.y"
|
||
{
|
||
vercheck(NC_OPAQUE);
|
||
addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
|
||
(yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(5) - (5)].sym)->subclass=NC_OPAQUE;
|
||
(yyvsp[(5) - (5)].sym)->typ.typecode=NC_OPAQUE;
|
||
(yyvsp[(5) - (5)].sym)->typ.size=int32_val;
|
||
(yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
|
||
;}
|
||
break;
|
||
|
||
case 30:
|
||
#line 358 "ncgen.y"
|
||
{
|
||
Symbol* basetype = (yyvsp[(1) - (5)].sym);
|
||
vercheck(NC_VLEN);
|
||
addtogroup((yyvsp[(5) - (5)].sym)); /*sets prefix*/
|
||
(yyvsp[(5) - (5)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(5) - (5)].sym)->subclass=NC_VLEN;
|
||
(yyvsp[(5) - (5)].sym)->typ.basetype=basetype;
|
||
(yyvsp[(5) - (5)].sym)->typ.typecode=NC_VLEN;
|
||
(yyvsp[(5) - (5)].sym)->typ.size=VLENSIZE;
|
||
(yyvsp[(5) - (5)].sym)->typ.alignment=nctypealignment(NC_VLEN);
|
||
;}
|
||
break;
|
||
|
||
case 31:
|
||
#line 372 "ncgen.y"
|
||
{
|
||
int i,j;
|
||
vercheck(NC_COMPOUND);
|
||
addtogroup((yyvsp[(2) - (5)].sym));
|
||
/* check for duplicate field names*/
|
||
stackbase=(yyvsp[(4) - (5)].mark);
|
||
stacklen=listlength(stack);
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* elem1 = (Symbol*)listget(stack,i);
|
||
for(j=i+1;j<stacklen;j++) {
|
||
Symbol* elem2 = (Symbol*)listget(stack,j);
|
||
if(strcmp(elem1->name,elem2->name)==0) {
|
||
yyerror("duplicate field declaration for %s",elem1->name);
|
||
}
|
||
}
|
||
}
|
||
(yyvsp[(2) - (5)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(2) - (5)].sym)->subclass=NC_COMPOUND;
|
||
(yyvsp[(2) - (5)].sym)->typ.basetype=NULL;
|
||
(yyvsp[(2) - (5)].sym)->typ.typecode=NC_COMPOUND;
|
||
(yyvsp[(2) - (5)].sym)->subnodes = listnew();
|
||
/* Add in the fields*/
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* fsym = (Symbol*)listget(stack,i);
|
||
fsym->container = (yyvsp[(2) - (5)].sym);
|
||
listpush((yyvsp[(2) - (5)].sym)->subnodes,(void*)fsym);
|
||
}
|
||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||
;}
|
||
break;
|
||
|
||
case 32:
|
||
#line 404 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (2)].mark);;}
|
||
break;
|
||
|
||
case 33:
|
||
#line 405 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (3)].mark);;}
|
||
break;
|
||
|
||
case 34:
|
||
#line 409 "ncgen.y"
|
||
{
|
||
int i;
|
||
(yyval.mark)=(yyvsp[(2) - (2)].mark);
|
||
stackbase=(yyvsp[(2) - (2)].mark);
|
||
stacklen=listlength(stack);
|
||
/* process each field in the fieldlist*/
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* f = (Symbol*)listget(stack,i);
|
||
f->typ.basetype = (yyvsp[(1) - (2)].sym);
|
||
}
|
||
;}
|
||
break;
|
||
|
||
case 35:
|
||
#line 422 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_CHAR]; ;}
|
||
break;
|
||
|
||
case 36:
|
||
#line 423 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_BYTE]; ;}
|
||
break;
|
||
|
||
case 37:
|
||
#line 424 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_SHORT]; ;}
|
||
break;
|
||
|
||
case 38:
|
||
#line 425 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_INT]; ;}
|
||
break;
|
||
|
||
case 39:
|
||
#line 426 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_FLOAT]; ;}
|
||
break;
|
||
|
||
case 40:
|
||
#line 427 "ncgen.y"
|
||
{ (yyval.sym) = primsymbols[NC_DOUBLE]; ;}
|
||
break;
|
||
|
||
case 41:
|
||
#line 428 "ncgen.y"
|
||
{ vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; ;}
|
||
break;
|
||
|
||
case 42:
|
||
#line 429 "ncgen.y"
|
||
{ vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; ;}
|
||
break;
|
||
|
||
case 43:
|
||
#line 430 "ncgen.y"
|
||
{ vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; ;}
|
||
break;
|
||
|
||
case 44:
|
||
#line 431 "ncgen.y"
|
||
{ vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; ;}
|
||
break;
|
||
|
||
case 45:
|
||
#line 432 "ncgen.y"
|
||
{ vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; ;}
|
||
break;
|
||
|
||
case 47:
|
||
#line 436 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 48:
|
||
#line 437 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 51:
|
||
#line 444 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 52:
|
||
#line 444 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 55:
|
||
#line 452 "ncgen.y"
|
||
{
|
||
(yyvsp[(1) - (3)].sym)->dim.declsize = (size_t)extractint((yyvsp[(3) - (3)].constant));
|
||
#ifdef GENDEBUG1
|
||
fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[(1) - (3)].sym)->name,(unsigned long long)(yyvsp[(1) - (3)].sym)->dim.declsize);
|
||
#endif
|
||
;}
|
||
break;
|
||
|
||
case 56:
|
||
#line 459 "ncgen.y"
|
||
{
|
||
(yyvsp[(1) - (3)].sym)->dim.declsize = NC_UNLIMITED;
|
||
(yyvsp[(1) - (3)].sym)->dim.isunlimited = 1;
|
||
#ifdef GENDEBUG1
|
||
fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[(1) - (3)].sym)->name);
|
||
#endif
|
||
;}
|
||
break;
|
||
|
||
case 57:
|
||
#line 469 "ncgen.y"
|
||
{
|
||
(yyvsp[(1) - (1)].sym)->objectclass=NC_DIM;
|
||
if(dupobjectcheck(NC_DIM,(yyvsp[(1) - (1)].sym)))
|
||
yyerror( "Duplicate dimension declaration for %s",
|
||
(yyvsp[(1) - (1)].sym)->name);
|
||
addtogroup((yyvsp[(1) - (1)].sym));
|
||
(yyval.sym)=(yyvsp[(1) - (1)].sym);
|
||
listpush(dimdefs,(void*)(yyvsp[(1) - (1)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 59:
|
||
#line 481 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 60:
|
||
#line 482 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 63:
|
||
#line 489 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 64:
|
||
#line 489 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 65:
|
||
#line 492 "ncgen.y"
|
||
{
|
||
int i;
|
||
stackbase=(yyvsp[(2) - (2)].mark);
|
||
stacklen=listlength(stack);
|
||
/* process each variable in the varlist*/
|
||
for(i=stackbase;i<stacklen;i++) {
|
||
Symbol* sym = (Symbol*)listget(stack,i);
|
||
sym->objectclass = NC_VAR;
|
||
if(dupobjectcheck(NC_VAR,sym)) {
|
||
yyerror("Duplicate variable declaration for %s",
|
||
sym->name);
|
||
} else {
|
||
sym->typ.basetype = (yyvsp[(1) - (2)].sym);
|
||
addtogroup(sym);
|
||
listpush(vardefs,(void*)sym);
|
||
}
|
||
}
|
||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||
;}
|
||
break;
|
||
|
||
case 66:
|
||
#line 514 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack);
|
||
listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 67:
|
||
#line 518 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
|
||
break;
|
||
|
||
case 68:
|
||
#line 522 "ncgen.y"
|
||
{
|
||
int i;
|
||
Dimset dimset;
|
||
stacklen=listlength(stack);
|
||
stackbase=(yyvsp[(2) - (2)].mark);
|
||
count = stacklen - stackbase;
|
||
if(count >= NC_MAX_VAR_DIMS) {
|
||
yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
|
||
count = NC_MAX_VAR_DIMS - 1;
|
||
stacklen = stackbase + count;
|
||
}
|
||
dimset.ndims = count;
|
||
/* extract the actual dimensions*/
|
||
if(dimset.ndims > 0) {
|
||
for(i=0;i<count;i++) {
|
||
Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
|
||
dimset.dimsyms[i] = dsym;
|
||
}
|
||
(yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
|
||
}
|
||
(yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
|
||
(yyvsp[(1) - (2)].sym)->objectclass=NC_VAR;
|
||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||
;}
|
||
break;
|
||
|
||
case 69:
|
||
#line 548 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack);;}
|
||
break;
|
||
|
||
case 70:
|
||
#line 549 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(2) - (3)].mark);;}
|
||
break;
|
||
|
||
case 71:
|
||
#line 552 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
|
||
break;
|
||
|
||
case 72:
|
||
#line 554 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
|
||
break;
|
||
|
||
case 73:
|
||
#line 558 "ncgen.y"
|
||
{Symbol* dimsym = (yyvsp[(1) - (1)].sym);
|
||
dimsym->objectclass = NC_DIM;
|
||
/* Find the actual dimension*/
|
||
dimsym = locate(dimsym);
|
||
if(dimsym == NULL) {
|
||
derror("Undefined or forward referenced dimension: %s",(yyvsp[(1) - (1)].sym)->name);
|
||
YYABORT;
|
||
}
|
||
(yyval.sym)=dimsym;
|
||
;}
|
||
break;
|
||
|
||
case 74:
|
||
#line 572 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack);
|
||
listpush(stack,(void*)(yyvsp[(1) - (1)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 75:
|
||
#line 576 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
|
||
break;
|
||
|
||
case 76:
|
||
#line 581 "ncgen.y"
|
||
{
|
||
int i;
|
||
Dimset dimset;
|
||
stackbase=(yyvsp[(2) - (2)].mark);
|
||
stacklen=listlength(stack);
|
||
count = stacklen - stackbase;
|
||
if(count >= NC_MAX_VAR_DIMS) {
|
||
yyerror("%s has too many dimensions",(yyvsp[(1) - (2)].sym)->name);
|
||
count = NC_MAX_VAR_DIMS - 1;
|
||
stacklen = stackbase + count;
|
||
}
|
||
dimset.ndims = count;
|
||
if(count > 0) {
|
||
/* extract the actual dimensions*/
|
||
for(i=0;i<count;i++) {
|
||
Symbol* dsym = (Symbol*)listget(stack,stackbase+i);
|
||
dimset.dimsyms[i] = dsym;
|
||
}
|
||
(yyvsp[(1) - (2)].sym)->typ.dimset = dimset;
|
||
}
|
||
(yyvsp[(1) - (2)].sym)->typ.basetype = NULL; /* not yet known*/
|
||
(yyvsp[(1) - (2)].sym)->objectclass=NC_TYPE;
|
||
(yyvsp[(1) - (2)].sym)->subclass=NC_FIELD;
|
||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||
(yyval.sym) = (yyvsp[(1) - (2)].sym);
|
||
;}
|
||
break;
|
||
|
||
case 77:
|
||
#line 609 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack);;}
|
||
break;
|
||
|
||
case 78:
|
||
#line 610 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(2) - (3)].mark);;}
|
||
break;
|
||
|
||
case 79:
|
||
#line 614 "ncgen.y"
|
||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[(1) - (1)].sym));;}
|
||
break;
|
||
|
||
case 80:
|
||
#line 616 "ncgen.y"
|
||
{(yyval.mark)=(yyvsp[(1) - (3)].mark); listpush(stack,(void*)(yyvsp[(3) - (3)].sym));;}
|
||
break;
|
||
|
||
case 81:
|
||
#line 621 "ncgen.y"
|
||
{ /* Anonymous integer dimension.
|
||
Can only occur in type definitions*/
|
||
char anon[32];
|
||
sprintf(anon,"const%u",uint32_val);
|
||
(yyval.sym) = install(anon);
|
||
(yyval.sym)->objectclass = NC_DIM;
|
||
(yyval.sym)->dim.isconstant = 1;
|
||
(yyval.sym)->dim.declsize = uint32_val;
|
||
;}
|
||
break;
|
||
|
||
case 82:
|
||
#line 631 "ncgen.y"
|
||
{ /* Anonymous integer dimension.
|
||
Can only occur in type definitions*/
|
||
char anon[32];
|
||
if(int32_val <= 0) {
|
||
derror("field dimension must be positive");
|
||
YYABORT;
|
||
}
|
||
sprintf(anon,"const%d",int32_val);
|
||
(yyval.sym) = install(anon);
|
||
(yyval.sym)->objectclass = NC_DIM;
|
||
(yyval.sym)->dim.isconstant = 1;
|
||
(yyval.sym)->dim.declsize = int32_val;
|
||
;}
|
||
break;
|
||
|
||
case 83:
|
||
#line 651 "ncgen.y"
|
||
{Symbol* vsym = (yyvsp[(1) - (1)].sym);
|
||
if(vsym->objectclass != NC_VAR) {
|
||
derror("Undefined or forward referenced variable: %s",vsym->name);
|
||
YYABORT;
|
||
}
|
||
(yyval.sym)=vsym;
|
||
;}
|
||
break;
|
||
|
||
case 84:
|
||
#line 662 "ncgen.y"
|
||
{Symbol* tsym = (yyvsp[(1) - (1)].sym);
|
||
if(tsym->objectclass != NC_TYPE) {
|
||
derror("Undefined or forward referenced type: %s",tsym->name);
|
||
YYABORT;
|
||
}
|
||
(yyval.sym)=tsym;
|
||
;}
|
||
break;
|
||
|
||
case 85:
|
||
#line 673 "ncgen.y"
|
||
{Symbol* tvsym = (yyvsp[(1) - (1)].sym); Symbol* sym;
|
||
/* disambiguate*/
|
||
tvsym->objectclass = NC_VAR;
|
||
sym = locate(tvsym);
|
||
if(sym == NULL) {
|
||
tvsym->objectclass = NC_TYPE;
|
||
sym = locate(tvsym);
|
||
if(tvsym == NULL) {
|
||
derror("Undefined or forward referenced name: %s",(yyvsp[(1) - (1)].sym)->name);
|
||
YYABORT;
|
||
} else tvsym = sym;
|
||
} else tvsym = sym;
|
||
if(tvsym == NULL) {
|
||
derror("Undefined name (line %d): %s",(yyvsp[(1) - (1)].sym)->lineno,(yyvsp[(1) - (1)].sym)->name);
|
||
YYABORT;
|
||
}
|
||
(yyval.sym)=tvsym;
|
||
;}
|
||
break;
|
||
|
||
case 86:
|
||
#line 691 "ncgen.y"
|
||
{(yyval.sym)=(yyvsp[(1) - (1)].sym);;}
|
||
break;
|
||
|
||
case 87:
|
||
#line 698 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 88:
|
||
#line 698 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 89:
|
||
#line 702 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
|
||
break;
|
||
|
||
case 90:
|
||
#line 704 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
|
||
break;
|
||
|
||
case 91:
|
||
#line 706 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),ATTRGLOBAL);;}
|
||
break;
|
||
|
||
case 92:
|
||
#line 708 "ncgen.y"
|
||
{ (yyval.sym)=makeattribute((yyvsp[(2) - (4)].sym),NULL,NULL,(yyvsp[(4) - (4)].datalist),ATTRGLOBAL);;}
|
||
break;
|
||
|
||
case 93:
|
||
#line 710 "ncgen.y"
|
||
{Symbol* tsym = (yyvsp[(1) - (6)].sym); Symbol* vsym = (yyvsp[(2) - (6)].sym); Symbol* asym = (yyvsp[(4) - (6)].sym);
|
||
if(vsym->objectclass == NC_VAR) {
|
||
(yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[(6) - (6)].datalist),ATTRVAR);
|
||
} else {
|
||
derror("Doubly typed attribute: %s",asym->name);
|
||
YYABORT;
|
||
}
|
||
;}
|
||
break;
|
||
|
||
case 94:
|
||
#line 719 "ncgen.y"
|
||
{Symbol* sym = (yyvsp[(1) - (5)].sym); Symbol* asym = (yyvsp[(3) - (5)].sym);
|
||
if(sym->objectclass == NC_VAR) {
|
||
(yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[(5) - (5)].datalist),ATTRVAR);
|
||
} else if(sym->objectclass == NC_TYPE) {
|
||
(yyval.sym)=makeattribute(asym,NULL,sym,(yyvsp[(5) - (5)].datalist),ATTRGLOBAL);
|
||
} else {
|
||
derror("Attribute prefix not a variable or type: %s",asym->name);
|
||
YYABORT;
|
||
}
|
||
;}
|
||
break;
|
||
|
||
case 95:
|
||
#line 730 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;}
|
||
break;
|
||
|
||
case 96:
|
||
#line 732 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[(2) - (6)].sym),(yyvsp[(1) - (6)].sym),(void*)(yyvsp[(6) - (6)].datalist),0);;}
|
||
break;
|
||
|
||
case 97:
|
||
#line 734 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 98:
|
||
#line 736 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)(yyvsp[(5) - (5)].datalist),0);;}
|
||
break;
|
||
|
||
case 99:
|
||
#line 738 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 100:
|
||
#line 740 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 101:
|
||
#line 742 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 102:
|
||
#line 744 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 103:
|
||
#line 746 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[(1) - (5)].sym),NULL,(void*)&(yyvsp[(5) - (5)].constant),1);;}
|
||
break;
|
||
|
||
case 104:
|
||
#line 748 "ncgen.y"
|
||
{(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[(4) - (4)].constant),1);;}
|
||
break;
|
||
|
||
case 105:
|
||
#line 753 "ncgen.y"
|
||
{
|
||
(yyval.sym)=(yyvsp[(1) - (1)].sym);
|
||
(yyvsp[(1) - (1)].sym)->ref.is_ref=1;
|
||
(yyvsp[(1) - (1)].sym)->is_prefixed=0;
|
||
setpathcurrent((yyvsp[(1) - (1)].sym));
|
||
;}
|
||
break;
|
||
|
||
case 106:
|
||
#line 760 "ncgen.y"
|
||
{
|
||
(yyval.sym)=(yyvsp[(1) - (1)].sym);
|
||
(yyvsp[(1) - (1)].sym)->ref.is_ref=1;
|
||
(yyvsp[(1) - (1)].sym)->is_prefixed=1;
|
||
/* path is set in ncgen.l*/
|
||
;}
|
||
break;
|
||
|
||
case 108:
|
||
#line 769 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 109:
|
||
#line 770 "ncgen.y"
|
||
{;}
|
||
break;
|
||
|
||
case 112:
|
||
#line 778 "ncgen.y"
|
||
{(yyvsp[(1) - (3)].sym)->data = (yyvsp[(3) - (3)].datalist);;}
|
||
break;
|
||
|
||
case 113:
|
||
#line 781 "ncgen.y"
|
||
{(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;}
|
||
break;
|
||
|
||
case 114:
|
||
#line 782 "ncgen.y"
|
||
{(yyval.datalist) = (yyvsp[(1) - (1)].datalist);;}
|
||
break;
|
||
|
||
case 115:
|
||
#line 786 "ncgen.y"
|
||
{(yyval.datalist) = builddatalist(0);;}
|
||
break;
|
||
|
||
case 116:
|
||
#line 790 "ncgen.y"
|
||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
|
||
break;
|
||
|
||
case 117:
|
||
#line 792 "ncgen.y"
|
||
{datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;}
|
||
break;
|
||
|
||
case 118:
|
||
#line 796 "ncgen.y"
|
||
{(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
|
||
break;
|
||
|
||
case 119:
|
||
#line 797 "ncgen.y"
|
||
{(yyval.constant)=builddatasublist((yyvsp[(2) - (3)].datalist));;}
|
||
break;
|
||
|
||
case 120:
|
||
#line 801 "ncgen.y"
|
||
{(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
|
||
break;
|
||
|
||
case 121:
|
||
#line 802 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_OPAQUE);;}
|
||
break;
|
||
|
||
case 122:
|
||
#line 803 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_FILLVALUE);;}
|
||
break;
|
||
|
||
case 123:
|
||
#line 804 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_NIL);;}
|
||
break;
|
||
|
||
case 124:
|
||
#line 805 "ncgen.y"
|
||
{(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
|
||
break;
|
||
|
||
case 126:
|
||
#line 810 "ncgen.y"
|
||
{(yyval.constant) = makeenumconstref((yyvsp[(1) - (1)].sym));;}
|
||
break;
|
||
|
||
case 127:
|
||
#line 814 "ncgen.y"
|
||
{(yyval.constant)=evaluate((yyvsp[(1) - (4)].sym),(yyvsp[(3) - (4)].datalist));;}
|
||
break;
|
||
|
||
case 128:
|
||
#line 819 "ncgen.y"
|
||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
|
||
break;
|
||
|
||
case 129:
|
||
#line 821 "ncgen.y"
|
||
{datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant))); (yyval.datalist)=(yyvsp[(1) - (3)].datalist);;}
|
||
break;
|
||
|
||
case 130:
|
||
#line 825 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_CHAR);;}
|
||
break;
|
||
|
||
case 131:
|
||
#line 826 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_BYTE);;}
|
||
break;
|
||
|
||
case 132:
|
||
#line 827 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_SHORT);;}
|
||
break;
|
||
|
||
case 133:
|
||
#line 828 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_INT);;}
|
||
break;
|
||
|
||
case 134:
|
||
#line 829 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_INT64);;}
|
||
break;
|
||
|
||
case 135:
|
||
#line 830 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_UBYTE);;}
|
||
break;
|
||
|
||
case 136:
|
||
#line 831 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_USHORT);;}
|
||
break;
|
||
|
||
case 137:
|
||
#line 832 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_UINT);;}
|
||
break;
|
||
|
||
case 138:
|
||
#line 833 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_UINT64);;}
|
||
break;
|
||
|
||
case 139:
|
||
#line 834 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_FLOAT);;}
|
||
break;
|
||
|
||
case 140:
|
||
#line 835 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_DOUBLE);;}
|
||
break;
|
||
|
||
case 141:
|
||
#line 836 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_STRING);;}
|
||
break;
|
||
|
||
case 142:
|
||
#line 840 "ncgen.y"
|
||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[(1) - (1)].constant)));;}
|
||
break;
|
||
|
||
case 143:
|
||
#line 841 "ncgen.y"
|
||
{(yyval.datalist)=(yyvsp[(1) - (3)].datalist); datalistextend((yyvsp[(1) - (3)].datalist),&((yyvsp[(3) - (3)].constant)));;}
|
||
break;
|
||
|
||
case 144:
|
||
#line 846 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_INT);;}
|
||
break;
|
||
|
||
case 145:
|
||
#line 848 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_UINT);;}
|
||
break;
|
||
|
||
case 146:
|
||
#line 850 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_INT64);;}
|
||
break;
|
||
|
||
case 147:
|
||
#line 852 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_UINT64);;}
|
||
break;
|
||
|
||
case 148:
|
||
#line 856 "ncgen.y"
|
||
{(yyval.constant)=makeconstdata(NC_STRING);;}
|
||
break;
|
||
|
||
case 149:
|
||
#line 860 "ncgen.y"
|
||
{(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
|
||
break;
|
||
|
||
case 150:
|
||
#line 861 "ncgen.y"
|
||
{(yyval.constant)=(yyvsp[(1) - (1)].constant);;}
|
||
break;
|
||
|
||
case 151:
|
||
#line 867 "ncgen.y"
|
||
{(yyval.sym)=(yyvsp[(1) - (1)].sym);;}
|
||
break;
|
||
|
||
|
||
/* Line 1267 of yacc.c. */
|
||
#line 2738 "ncgen.tab.c"
|
||
default: break;
|
||
}
|
||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||
|
||
YYPOPSTACK (yylen);
|
||
yylen = 0;
|
||
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
|
||
yyerror (YY_("syntax error"));
|
||
#else
|
||
{
|
||
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
|
||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
||
{
|
||
YYSIZE_T yyalloc = 2 * yysize;
|
||
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
|
||
yyalloc = YYSTACK_ALLOC_MAXIMUM;
|
||
if (yymsg != yymsgbuf)
|
||
YYSTACK_FREE (yymsg);
|
||
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
|
||
if (yymsg)
|
||
yymsg_alloc = yyalloc;
|
||
else
|
||
{
|
||
yymsg = yymsgbuf;
|
||
yymsg_alloc = sizeof yymsgbuf;
|
||
}
|
||
}
|
||
|
||
if (0 < yysize && yysize <= yymsg_alloc)
|
||
{
|
||
(void) yysyntax_error (yymsg, yystate, yychar);
|
||
yyerror (yymsg);
|
||
}
|
||
else
|
||
{
|
||
yyerror (YY_("syntax error"));
|
||
if (yysize != 0)
|
||
goto yyexhaustedlab;
|
||
}
|
||
}
|
||
#endif
|
||
}
|
||
|
||
|
||
|
||
if (yyerrstatus == 3)
|
||
{
|
||
/* If just tried and failed to reuse look-ahead token after an
|
||
error, discard it. */
|
||
|
||
if (yychar <= YYEOF)
|
||
{
|
||
/* Return failure if at end of input. */
|
||
if (yychar == YYEOF)
|
||
YYABORT;
|
||
}
|
||
else
|
||
{
|
||
yydestruct ("Error: discarding",
|
||
yytoken, &yylval);
|
||
yychar = YYEMPTY;
|
||
}
|
||
}
|
||
|
||
/* Else will try to reuse look-ahead token after shifting the error
|
||
token. */
|
||
goto yyerrlab1;
|
||
|
||
|
||
/*---------------------------------------------------.
|
||
| yyerrorlab -- error raised explicitly by YYERROR. |
|
||
`---------------------------------------------------*/
|
||
yyerrorlab:
|
||
|
||
/* Pacify compilers like GCC when the user code never invokes
|
||
YYERROR and the label yyerrorlab therefore never appears in user
|
||
code. */
|
||
if (/*CONSTCOND*/ 0)
|
||
goto yyerrorlab;
|
||
|
||
/* Do not reclaim the symbols of the rule which action triggered
|
||
this YYERROR. */
|
||
YYPOPSTACK (yylen);
|
||
yylen = 0;
|
||
YY_STACK_PRINT (yyss, yyssp);
|
||
yystate = *yyssp;
|
||
goto yyerrlab1;
|
||
|
||
|
||
/*-------------------------------------------------------------.
|
||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||
`-------------------------------------------------------------*/
|
||
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;
|
||
|
||
|
||
yydestruct ("Error: popping",
|
||
yystos[yystate], yyvsp);
|
||
YYPOPSTACK (1);
|
||
yystate = *yyssp;
|
||
YY_STACK_PRINT (yyss, yyssp);
|
||
}
|
||
|
||
if (yyn == YYFINAL)
|
||
YYACCEPT;
|
||
|
||
*++yyvsp = yylval;
|
||
|
||
|
||
/* Shift the error token. */
|
||
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
|
||
|
||
yystate = yyn;
|
||
goto yynewstate;
|
||
|
||
|
||
/*-------------------------------------.
|
||
| yyacceptlab -- YYACCEPT comes here. |
|
||
`-------------------------------------*/
|
||
yyacceptlab:
|
||
yyresult = 0;
|
||
goto yyreturn;
|
||
|
||
/*-----------------------------------.
|
||
| yyabortlab -- YYABORT comes here. |
|
||
`-----------------------------------*/
|
||
yyabortlab:
|
||
yyresult = 1;
|
||
goto yyreturn;
|
||
|
||
#ifndef yyoverflow
|
||
/*-------------------------------------------------.
|
||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||
`-------------------------------------------------*/
|
||
yyexhaustedlab:
|
||
yyerror (YY_("memory exhausted"));
|
||
yyresult = 2;
|
||
/* Fall through. */
|
||
#endif
|
||
|
||
yyreturn:
|
||
if (yychar != YYEOF && yychar != YYEMPTY)
|
||
yydestruct ("Cleanup: discarding lookahead",
|
||
yytoken, &yylval);
|
||
/* Do not reclaim the symbols of the rule which action triggered
|
||
this YYABORT or YYACCEPT. */
|
||
YYPOPSTACK (yylen);
|
||
YY_STACK_PRINT (yyss, yyssp);
|
||
while (yyssp != yyss)
|
||
{
|
||
yydestruct ("Cleanup: popping",
|
||
yystos[*yyssp], yyvsp);
|
||
YYPOPSTACK (1);
|
||
}
|
||
#ifndef yyoverflow
|
||
if (yyss != yyssa)
|
||
YYSTACK_FREE (yyss);
|
||
#endif
|
||
#if YYERROR_VERBOSE
|
||
if (yymsg != yymsgbuf)
|
||
YYSTACK_FREE (yymsg);
|
||
#endif
|
||
/* Make sure YYID is used. */
|
||
return YYID (yyresult);
|
||
}
|
||
|
||
|
||
#line 870 "ncgen.y"
|
||
|
||
|
||
#ifndef NO_STDARG
|
||
static void
|
||
yyerror(const char *fmt, ...)
|
||
#else
|
||
static void
|
||
yyerror(fmt,va_alist) const char* fmt; va_dcl
|
||
#endif
|
||
{
|
||
va_list argv;
|
||
vastart(argv,fmt);
|
||
(void)fprintf(stderr,"%s: %s line %d: ", progname, cdlname, lineno);
|
||
vderror(fmt,argv);
|
||
vaend(argv,fmt);
|
||
}
|
||
|
||
/* undefine yywrap macro, in case we are using bison instead of yacc */
|
||
#ifdef yywrap
|
||
#undef yywrap
|
||
#endif
|
||
|
||
static int
|
||
ncgwrap(void) /* returns 1 on EOF if no more input */
|
||
{
|
||
return 1;
|
||
}
|
||
|
||
/* get lexical input routine generated by lex */
|
||
#include "ncgenl.c"
|
||
|
||
/* Really should init our data within this file */
|
||
void
|
||
parse_init(void)
|
||
{
|
||
int i;
|
||
opaqueid = 0;
|
||
arrayuid = 0;
|
||
symlist = NULL;
|
||
stack = listnew();
|
||
groupstack = listnew();
|
||
consttype = NC_NAT;
|
||
grpdefs = listnew();
|
||
dimdefs = listnew();
|
||
attdefs = listnew();
|
||
gattdefs = listnew();
|
||
xattdefs = listnew();
|
||
typdefs = listnew();
|
||
vardefs = listnew();
|
||
condefs = listnew();
|
||
tmp = listnew();
|
||
/* Create the primitive types */
|
||
for(i=NC_NAT+1;i<=NC_STRING;i++) {
|
||
primsymbols[i] = makeprimitivetype(i);
|
||
}
|
||
lex_init();
|
||
}
|
||
|
||
static Symbol*
|
||
makeprimitivetype(nc_type nctype)
|
||
{
|
||
Symbol* sym = install(primtypenames[nctype]);
|
||
sym->objectclass=NC_TYPE;
|
||
sym->subclass=NC_PRIM;
|
||
sym->ncid = nctype;
|
||
sym->typ.typecode = nctype;
|
||
sym->typ.size = ncsize(nctype);
|
||
sym->typ.nelems = 1;
|
||
sym->typ.alignment = nctypealignment(nctype);
|
||
/* Make the basetype circular so we can always ask for it */
|
||
sym->typ.basetype = sym;
|
||
sym->prefix = listnew();
|
||
return sym;
|
||
}
|
||
|
||
/* Symbol table operations for ncgen tool */
|
||
/* install sname in symbol table even if it is already there */
|
||
Symbol*
|
||
install(const char *sname)
|
||
{
|
||
Symbol* sp;
|
||
sp = (Symbol*) emalloc (sizeof (struct Symbol));
|
||
memset((void*)sp,0,sizeof(struct Symbol));
|
||
sp->name = nulldup(sname);
|
||
sp->next = symlist;
|
||
sp->lineno = lineno;
|
||
sp->location = currentgroup();
|
||
sp->container = currentgroup();
|
||
symlist = sp;
|
||
return sp;
|
||
}
|
||
|
||
|
||
static Symbol*
|
||
currentgroup(void)
|
||
{
|
||
if(listlength(groupstack) == 0) return rootgroup;
|
||
return (Symbol*)listtop(groupstack);
|
||
}
|
||
|
||
static Symbol*
|
||
createrootgroup(const char* dataset)
|
||
{
|
||
Symbol* gsym = install(dataset);
|
||
gsym->objectclass = NC_GRP;
|
||
gsym->container = NULL;
|
||
gsym->subnodes = listnew();
|
||
gsym->grp.is_root = 1;
|
||
gsym->prefix = listnew();
|
||
listpush(grpdefs,(void*)gsym);
|
||
rootgroup = gsym;
|
||
return gsym;
|
||
}
|
||
|
||
static Symbol*
|
||
creategroup(Symbol * gsym)
|
||
{
|
||
/* See if this group already exists in currentgroup */
|
||
gsym->objectclass = NC_GRP;
|
||
if(dupobjectcheck(NC_GRP,gsym)) {
|
||
derror("Duplicate group name in same scope: %s",gsym->name);
|
||
return NULL;
|
||
}
|
||
addtogroup(gsym);
|
||
gsym->subnodes = listnew();
|
||
listpush(groupstack,(void*)gsym);
|
||
listpush(grpdefs,(void*)gsym);
|
||
return gsym;
|
||
}
|
||
|
||
static NCConstant
|
||
makeconstdata(nc_type nctype)
|
||
{
|
||
NCConstant con = nullconstant;
|
||
consttype = nctype;
|
||
con.nctype = nctype;
|
||
con.lineno = lineno;
|
||
con.filled = 0;
|
||
switch (nctype) {
|
||
case NC_CHAR: con.value.charv = char_val; break;
|
||
case NC_BYTE: con.value.int8v = byte_val; break;
|
||
case NC_SHORT: con.value.int16v = int16_val; break;
|
||
case NC_INT: con.value.int32v = int32_val; break;
|
||
case NC_FLOAT:
|
||
con.value.floatv = float_val;
|
||
break;
|
||
case NC_DOUBLE:
|
||
con.value.doublev = double_val;
|
||
break;
|
||
case NC_STRING: { /* convert to a set of chars*/
|
||
size_t len;
|
||
len = bbLength(lextext);
|
||
con.value.stringv.len = len;
|
||
con.value.stringv.stringv = bbDup(lextext);
|
||
bbClear(lextext);
|
||
}
|
||
break;
|
||
|
||
/* Allow these constants even in netcdf-3 */
|
||
case NC_UBYTE: con.value.uint8v = ubyte_val; break;
|
||
case NC_USHORT: con.value.uint16v = uint16_val; break;
|
||
case NC_UINT: con.value.uint32v = uint32_val; break;
|
||
case NC_INT64: con.value.int64v = int64_val; break;
|
||
case NC_UINT64: con.value.uint64v = uint64_val; break;
|
||
|
||
#ifdef USE_NETCDF4
|
||
case NC_OPAQUE: {
|
||
char* s;
|
||
int len;
|
||
len = bbLength(lextext);
|
||
s = (char*)emalloc(len+1);
|
||
strncpy(s,bbContents(lextext),len);
|
||
s[len] = '\0';
|
||
con.value.opaquev.stringv = s;
|
||
con.value.opaquev.len = len;
|
||
} break;
|
||
|
||
case NC_NIL:
|
||
break; /* no associated value*/
|
||
#endif
|
||
|
||
case NC_FILLVALUE:
|
||
break; /* no associated value*/
|
||
|
||
default:
|
||
yyerror("Data constant: unexpected NC type: %s",
|
||
nctypename(nctype));
|
||
con.value.stringv.stringv = NULL;
|
||
con.value.stringv.len = 0;
|
||
}
|
||
return con;
|
||
}
|
||
|
||
static NCConstant
|
||
makeenumconstref(Symbol* refsym)
|
||
{
|
||
NCConstant con;
|
||
|
||
markcdf4("Enum type");
|
||
consttype = NC_ENUM;
|
||
con.nctype = NC_ECONST;
|
||
con.lineno = lineno;
|
||
con.filled = 0;
|
||
refsym->objectclass = NC_TYPE;
|
||
refsym->subclass = NC_ECONST;
|
||
con.value.enumv = refsym;
|
||
return con;
|
||
}
|
||
|
||
static void
|
||
addtogroup(Symbol* sym)
|
||
{
|
||
Symbol* grp = currentgroup();
|
||
sym->container = grp;
|
||
listpush(grp->subnodes,(void*)sym);
|
||
setpathcurrent(sym);
|
||
}
|
||
|
||
/* Check for duplicate name of given type within current group*/
|
||
static int
|
||
dupobjectcheck(nc_class objectclass, Symbol* pattern)
|
||
{
|
||
int i;
|
||
Symbol* grp;
|
||
if(pattern == NULL) return 0;
|
||
grp = pattern->container;
|
||
if(grp == NULL || grp->subnodes == NULL) return 0;
|
||
for(i=0;i<listlength(grp->subnodes);i++) {
|
||
Symbol* sym = (Symbol*)listget(grp->subnodes,i);
|
||
if(!sym->ref.is_ref && sym->objectclass == objectclass
|
||
&& strcmp(sym->name,pattern->name)==0) return 1;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
static void
|
||
setpathcurrent(Symbol* sym)
|
||
{
|
||
sym->is_prefixed = 0;
|
||
sym->prefix = prefixdup(groupstack);
|
||
}
|
||
|
||
/* Convert an nc_type code to the corresponding Symbol*/
|
||
Symbol*
|
||
basetypefor(nc_type nctype)
|
||
{
|
||
return primsymbols[nctype];
|
||
}
|
||
|
||
static int
|
||
truefalse(NCConstant* con, int tag)
|
||
{
|
||
if(con->nctype == NC_STRING) {
|
||
char* sdata = con->value.stringv.stringv;
|
||
if(strncmp(sdata,"false",NC_MAX_NAME) == 0
|
||
|| strncmp(sdata,"0",NC_MAX_NAME) == 0)
|
||
return 0;
|
||
else if(strncmp(sdata,"true",NC_MAX_NAME) == 0
|
||
|| strncmp(sdata,"1",NC_MAX_NAME) == 0)
|
||
return 1;
|
||
else goto fail;
|
||
} else if(con->value.int32v < 0 || con->value.int32v > 1)
|
||
goto fail;
|
||
return con->value.int32v;
|
||
|
||
fail:
|
||
derror("%s: illegal value",specialname(tag));
|
||
return 0;
|
||
}
|
||
|
||
/* Since this may be affected by the _Format attribute, which
|
||
may come last, capture all the special info and sort it out
|
||
in semantics.
|
||
*/
|
||
static Symbol*
|
||
makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
||
{
|
||
Symbol* attr = NULL;
|
||
Datalist* list;
|
||
NCConstant* con;
|
||
NCConstant iconst;
|
||
int tf = 0;
|
||
char* sdata = NULL;
|
||
int idata = -1;
|
||
|
||
if((GLOBAL_SPECIAL & tag) != 0) {
|
||
if(vsym != NULL) {
|
||
derror("_Format: must be global attribute");
|
||
vsym = NULL;
|
||
}
|
||
} else {
|
||
if(vsym == NULL) {
|
||
derror("%s: must have non-NULL vsym", specialname(tag));
|
||
return NULL;
|
||
}
|
||
}
|
||
|
||
if(tag != _FILLVALUE_FLAG && tag != _FORMAT_FLAG)
|
||
/*Main.*/specials_flag++;
|
||
|
||
if(isconst) {
|
||
con = (NCConstant*)data;
|
||
list = builddatalist(1);
|
||
dlappend(list,(NCConstant*)data);
|
||
} else {
|
||
list = (Datalist*)data;
|
||
con = (NCConstant*)list->data;
|
||
}
|
||
|
||
switch (tag) {
|
||
case _FLETCHER32_FLAG:
|
||
case _SHUFFLE_FLAG:
|
||
case _ISNETCDF4_FLAG:
|
||
case _NOFILL_FLAG:
|
||
iconst.nctype = (con->nctype == NC_STRING?NC_STRING:NC_INT);
|
||
convert1(con,&iconst);
|
||
tf = truefalse(&iconst,tag);
|
||
break;
|
||
case _FORMAT_FLAG:
|
||
case _STORAGE_FLAG:
|
||
case _NCPROPS_FLAG:
|
||
case _ENDIAN_FLAG:
|
||
iconst.nctype = NC_STRING;
|
||
convert1(con,&iconst);
|
||
if(iconst.nctype == NC_STRING)
|
||
sdata = iconst.value.stringv.stringv;
|
||
else
|
||
derror("%s: illegal value",specialname(tag));
|
||
break;
|
||
case _SUPERBLOCK_FLAG:
|
||
case _DEFLATE_FLAG:
|
||
iconst.nctype = NC_INT;
|
||
convert1(con,&iconst);
|
||
if(iconst.nctype == NC_INT)
|
||
idata = iconst.value.int32v;
|
||
else
|
||
derror("%s: illegal value",specialname(tag));
|
||
break;
|
||
case _CHUNKSIZES_FLAG:
|
||
case _FILLVALUE_FLAG:
|
||
/* Handle below */
|
||
break;
|
||
default: PANIC1("unexpected special tag: %d",tag);
|
||
}
|
||
|
||
if(tag == _FORMAT_FLAG) {
|
||
/* Watch out: this is a global attribute */
|
||
struct Kvalues* kvalue;
|
||
int found = 0;
|
||
/* Use the table in main.c */
|
||
for(kvalue = legalkinds; kvalue->name; kvalue++) {
|
||
if(sdata) {
|
||
if(strcmp(sdata, kvalue->name) == 0) {
|
||
globalspecials._Format = kvalue->k_flag;
|
||
/*Main.*/format_attribute = 1;
|
||
found = 1;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if(!found)
|
||
derror("_Format: illegal value: %s",sdata);
|
||
} else if((GLOBAL_SPECIAL & tag) != 0) {
|
||
if(tag == _ISNETCDF4_FLAG)
|
||
globalspecials._IsNetcdf4 = tf;
|
||
else if(tag == _SUPERBLOCK_FLAG)
|
||
globalspecials._Superblock = idata;
|
||
else if(tag == _NCPROPS_FLAG)
|
||
globalspecials._NCProperties = strdup(sdata);
|
||
} else {
|
||
Specialdata* special;
|
||
/* Set up special info */
|
||
special = &vsym->var.special;
|
||
if(tag == _FILLVALUE_FLAG) {
|
||
special->_Fillvalue = list;
|
||
/* fillvalue must be a single value*/
|
||
if(list->length != 1)
|
||
derror("_FillValue: must be a single (possibly compound) value",
|
||
vsym->name);
|
||
/* check that the attribute value contains no fill values*/
|
||
if(containsfills(list)) {
|
||
derror("Attribute data may not contain fill values (i.e. _ )");
|
||
}
|
||
/* _FillValue is also a real attribute*/
|
||
if(vsym->objectclass != NC_VAR) {
|
||
derror("_FillValue attribute not associated with variable: %s",vsym->name);
|
||
}
|
||
if(tsym == NULL) tsym = vsym->typ.basetype;
|
||
else if(vsym->typ.basetype != tsym) {
|
||
derror("_FillValue attribute type does not match variable type: %s",vsym->name);
|
||
}
|
||
attr = makeattribute(install("_FillValue"),vsym,tsym,list,ATTRVAR);
|
||
} else switch (tag) {
|
||
/* These will be output as attributes later */
|
||
case _STORAGE_FLAG:
|
||
if(!sdata)
|
||
derror("_Storage: illegal NULL value");
|
||
else if(strcmp(sdata,"contiguous") == 0)
|
||
special->_Storage = NC_CONTIGUOUS;
|
||
else if(strcmp(sdata,"chunked") == 0)
|
||
special->_Storage = NC_CHUNKED;
|
||
else
|
||
derror("_Storage: illegal value: %s",sdata);
|
||
special->flags |= _STORAGE_FLAG;
|
||
break;
|
||
case _FLETCHER32_FLAG:
|
||
special->_Fletcher32 = tf;
|
||
special->flags |= _FLETCHER32_FLAG;
|
||
break;
|
||
case _DEFLATE_FLAG:
|
||
special->_DeflateLevel = idata;
|
||
special->flags |= _DEFLATE_FLAG;
|
||
break;
|
||
case _SHUFFLE_FLAG:
|
||
special->_Shuffle = tf;
|
||
special->flags |= _SHUFFLE_FLAG;
|
||
break;
|
||
case _ENDIAN_FLAG:
|
||
if(!sdata)
|
||
derror("_Endianness: illegal NULL value");
|
||
else if(strcmp(sdata,"little") == 0)
|
||
special->_Endianness = 1;
|
||
else if(strcmp(sdata,"big") == 0)
|
||
special->_Endianness = 2;
|
||
else
|
||
derror("_Endianness: illegal value: %s",sdata);
|
||
special->flags |= _ENDIAN_FLAG;
|
||
break;
|
||
case _NOFILL_FLAG:
|
||
special->_Fill = (1 - tf); /* negate */
|
||
special->flags |= _NOFILL_FLAG;
|
||
break;
|
||
case _CHUNKSIZES_FLAG: {
|
||
int i;
|
||
special->nchunks = list->length;
|
||
special->_ChunkSizes = (size_t*)emalloc(sizeof(size_t)*special->nchunks);
|
||
for(i=0;i<special->nchunks;i++) {
|
||
iconst.nctype = NC_INT;
|
||
convert1(&list->data[i],&iconst);
|
||
if(iconst.nctype == NC_INT) {
|
||
special->_ChunkSizes[i] = (size_t)iconst.value.int32v;
|
||
} else {
|
||
efree(special->_ChunkSizes);
|
||
derror("%s: illegal value",specialname(tag));
|
||
}
|
||
}
|
||
special->flags |= _CHUNKSIZES_FLAG;
|
||
/* Chunksizes => storage == chunked */
|
||
special->flags |= _STORAGE_FLAG;
|
||
special->_Storage = NC_CHUNKED;
|
||
} break;
|
||
default: PANIC1("makespecial: illegal token: %d",tag);
|
||
}
|
||
}
|
||
return attr;
|
||
}
|
||
|
||
static Symbol*
|
||
makeattribute(Symbol* asym,
|
||
Symbol* vsym,
|
||
Symbol* tsym,
|
||
Datalist* data,
|
||
Attrkind kind) /* global var or unknown*/
|
||
{
|
||
asym->objectclass = NC_ATT;
|
||
asym->data = data;
|
||
switch (kind) {
|
||
case ATTRVAR:
|
||
asym->att.var = vsym;
|
||
asym->typ.basetype = tsym;
|
||
listpush(attdefs,(void*)asym);
|
||
addtogroup(asym);
|
||
break;
|
||
case ATTRGLOBAL:
|
||
asym->att.var = NULL; /* NULL => NC_GLOBAL*/
|
||
asym->typ.basetype = tsym;
|
||
listpush(gattdefs,(void*)asym);
|
||
addtogroup(asym);
|
||
break;
|
||
default: PANIC1("unexpected attribute type: %d",kind);
|
||
}
|
||
/* finally; check that the attribute value contains no fill values*/
|
||
if(containsfills(data)) {
|
||
derror("Attribute data may not contain fill values (i.e. _ ): %s",asym->name);
|
||
}
|
||
return asym;
|
||
}
|
||
|
||
static long long
|
||
extractint(NCConstant con)
|
||
{
|
||
switch (con.nctype) {
|
||
case NC_BYTE: return (long long)(con.value.int8v);
|
||
case NC_SHORT: return (long long)(con.value.int16v);
|
||
case NC_INT: return (long long)(con.value.int32v);
|
||
case NC_UBYTE: return (long long)(con.value.uint8v);
|
||
case NC_USHORT: return (long long)(con.value.uint16v);
|
||
case NC_UINT: return (long long)(con.value.uint32v);
|
||
case NC_INT64: return (long long)(con.value.int64v);
|
||
default:
|
||
derror("Not a signed integer type: %d",con.nctype);
|
||
break;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
static int
|
||
containsfills(Datalist* list)
|
||
{
|
||
if(list != NULL) {
|
||
int i;
|
||
NCConstant* con = list->data;
|
||
for(i=0;i<list->length;i++,con++) {
|
||
if(con->nctype == NC_COMPOUND) {
|
||
if(containsfills(con->value.compoundv)) return 1;
|
||
} else if(con->nctype == NC_FILLVALUE) return 1;
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
static void
|
||
datalistextend(Datalist* dl, NCConstant* con)
|
||
{
|
||
dlappend(dl,con);
|
||
}
|
||
|
||
static void
|
||
vercheck(int tid)
|
||
{
|
||
switch (tid) {
|
||
case NC_UBYTE: markcdf5("netCDF4/5 type: UBYTE"); break;
|
||
case NC_USHORT: markcdf5("netCDF4/5 type: USHORT"); break;
|
||
case NC_UINT: markcdf5("netCDF4/5 type: UINT"); break;
|
||
case NC_INT64: markcdf5("netCDF4/5 type: INT64"); break;
|
||
case NC_UINT64: markcdf5("netCDF4/5 type: UINT64"); break;
|
||
case NC_STRING: markcdf4("netCDF4 type: STRING"); break;
|
||
case NC_VLEN: markcdf4("netCDF4 type: VLEN"); break;
|
||
case NC_OPAQUE: markcdf4("netCDF4 type: OPAQUE"); break;
|
||
case NC_ENUM: markcdf4("netCDF4 type: ENUM"); break;
|
||
case NC_COMPOUND: markcdf4("netCDF4 type: COMPOUND"); break;
|
||
default: break;
|
||
}
|
||
}
|
||
|
||
const char*
|
||
specialname(int tag)
|
||
{
|
||
struct Specialtoken* spp = specials;
|
||
for(;spp->name;spp++) {
|
||
if(spp->tag == tag)
|
||
return spp->name;
|
||
}
|
||
return "<unknown>";
|
||
}
|
||
|
||
/*
|
||
Since the arguments are all simple constants,
|
||
we can evaluate the function immediately
|
||
and return its value.
|
||
Note that currently, only a single value can
|
||
be returned.
|
||
*/
|
||
|
||
static NCConstant
|
||
evaluate(Symbol* fcn, Datalist* arglist)
|
||
{
|
||
NCConstant result = nullconstant;
|
||
|
||
/* prepare the result */
|
||
result.lineno = fcn->lineno;
|
||
|
||
if(strcasecmp(fcn->name,"time") == 0) {
|
||
char* timekind = NULL;
|
||
char* timevalue = NULL;
|
||
result.nctype = NC_DOUBLE;
|
||
result.value.doublev = 0;
|
||
/* int time([string],string) */
|
||
switch (arglist->length) {
|
||
case 2:
|
||
if(arglist->data[1].nctype != NC_STRING) {
|
||
derror("Expected function signature: time([string,]string)");
|
||
goto done;
|
||
}
|
||
/* fall thru */
|
||
case 1:
|
||
if(arglist->data[0].nctype != NC_STRING) {
|
||
derror("Expected function signature: time([string,]string)");
|
||
goto done;
|
||
}
|
||
break;
|
||
case 0:
|
||
default:
|
||
derror("Expected function signature: time([string,]string)");
|
||
goto done;
|
||
}
|
||
if(arglist->length == 2) {
|
||
timekind = arglist->data[0].value.stringv.stringv;
|
||
timevalue = arglist->data[1].value.stringv.stringv;
|
||
} else
|
||
timevalue = arglist->data[0].value.stringv.stringv;
|
||
if(timekind == NULL) { /* use cd time as the default */
|
||
cdCompTime comptime;
|
||
CdTime cdtime;
|
||
cdCalenType timetype = cdStandard;
|
||
cdChar2Comp(timetype,timevalue,&comptime);
|
||
/* convert comptime to cdTime */
|
||
cdtime.year = comptime.year;
|
||
cdtime.month = comptime.month;
|
||
cdtime.day = comptime.day;
|
||
cdtime.hour = comptime.hour;
|
||
cdtime.baseYear = 1970;
|
||
cdtime.timeType = CdChron;
|
||
/* convert to double value */
|
||
Cdh2e(&cdtime,&result.value.doublev);
|
||
} else {
|
||
derror("Time conversion '%s' not supported",timekind);
|
||
goto done;
|
||
}
|
||
} else { /* Unknown function */
|
||
derror("Unknown function name: %s",fcn->name);
|
||
goto done;
|
||
}
|
||
|
||
done:
|
||
return result;
|
||
}
|
||
|