ncdf4a13/ncgen/ncgentab.c

Go to the documentation of this file.
00001 #ifndef lint
00002 static char const 
00003 yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
00004 #endif
00005 #include <stdlib.h>
00006 #define YYBYACC 1
00007 #define YYMAJOR 1
00008 #define YYMINOR 9
00009 #define YYLEX yylex()
00010 #define YYEMPTY -1
00011 #define yyclearin (yychar=(YYEMPTY))
00012 #define yyerrok (yyerrflag=0)
00013 #define YYRECOVERING() (yyerrflag!=0)
00014 static int yygrowstack();
00015 #define YYPREFIX "yy"
00016 #line 10 "ncgen.y"
00017 #ifndef lint
00018 static char SccsId[] = "$Id: ncgentab.c,v 1.15 2005/02/17 23:24:25 ed Exp $";
00019 #endif
00020 #include        <string.h>
00021 #include        <stdlib.h>
00022 #include        <netcdf.h>
00023 #include        "generic.h"
00024 #include        "ncgen.h"
00025 #include        "genlib.h"      /* for grow_darray() et al */
00026 
00027 typedef struct Symbol {         /* symbol table entry */
00028         char            *name;
00029         struct Symbol   *next;
00030         unsigned        is_dim : 1;     /* appears as netCDF dimension */
00031         unsigned        is_var : 1;     /* appears as netCDF variable */
00032         unsigned        is_att : 1;     /* appears as netCDF attribute */
00033         int             dnum;           /* handle as a dimension */
00034         int             vnum;           /* handle as a variable */
00035         } *YYSTYPE1;
00036 
00037 /* True if string a equals string b*/
00038 #define STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
00039 #define NC_UNSPECIFIED ((nc_type)0)     /* unspecified (as yet) type */
00040 
00041 #define YYSTYPE YYSTYPE1
00042 YYSTYPE symlist;                /* symbol table: linked list */
00043 
00044 extern int derror_count;        /* counts errors in netcdf definition */
00045 extern int lineno;              /* line number for error messages */
00046 
00047 static int not_a_string;        /* whether last constant read was a string */
00048 static char termstring[MAXTRST]; /* last terminal string read */
00049 static double double_val;       /* last double value read */
00050 static float float_val;         /* last float value read */
00051 static int int_val;             /* last int value read */
00052 static short short_val;         /* last short value read */
00053 static char char_val;           /* last char value read */
00054 static signed char byte_val;    /* last byte value read */
00055 
00056 static nc_type type_code;       /* holds declared type for variables */
00057 static nc_type atype_code;      /* holds derived type for attributes */
00058 static char *netcdfname;        /* to construct netcdf file name */
00059 static void *att_space;         /* pointer to block for attribute values */
00060 static nc_type valtype;         /* type code for list of attribute values  */
00061 
00062 static char *char_valp;         /* pointers used to accumulate data values */
00063 static signed char *byte_valp;
00064 static short *short_valp;
00065 static int *int_valp;
00066 static float *float_valp;
00067 static double *double_valp;
00068 static void *rec_cur;           /* pointer to where next data value goes */
00069 static void *rec_start;         /* start of space for data */
00070 #line 71 "y.tab.c"
00071 #define YYERRCODE 256
00072 #define NC_UNLIMITED_K 257
00073 #define BYTE_K 258
00074 #define CHAR_K 259
00075 #define SHORT_K 260
00076 #define INT_K 261
00077 #define FLOAT_K 262
00078 #define DOUBLE_K 263
00079 #define IDENT 264
00080 #define TERMSTRING 265
00081 #define BYTE_CONST 266
00082 #define CHAR_CONST 267
00083 #define SHORT_CONST 268
00084 #define INT_CONST 269
00085 #define FLOAT_CONST 270
00086 #define DOUBLE_CONST 271
00087 #define DIMENSIONS 272
00088 #define VARIABLES 273
00089 #define NETCDF 274
00090 #define DATA 275
00091 #define FILLVALUE 276
00092 const short yylhs[] = {                                        -1,
00093     2,    5,    0,    1,    1,    6,    6,    7,    7,    8,
00094     8,    8,    9,   10,    3,    3,    3,   11,   11,   13,
00095    13,   12,   12,   16,   14,   17,   17,   17,   17,   17,
00096    17,   18,   18,   22,   19,   20,   21,   21,   23,   23,
00097    24,   26,   15,   25,   25,   28,   29,   27,   27,   30,
00098    31,   31,   31,   31,   31,   31,   31,    4,    4,    4,
00099    32,   32,   34,   33,   35,   35,   38,   36,   37,   37,
00100    37,   37,   37,   37,   37,   37,
00101 };
00102 const short yylen[] = {                                         2,
00103     0,    0,    8,    0,    2,    2,    3,    1,    3,    3,
00104     3,    3,    1,    1,    0,    2,    1,    2,    3,    1,
00105     1,    2,    3,    1,    2,    1,    1,    1,    1,    1,
00106     1,    1,    3,    0,    3,    1,    0,    3,    1,    3,
00107     1,    0,    4,    3,    2,    1,    1,    1,    3,    1,
00108     1,    1,    1,    1,    1,    1,    1,    0,    2,    1,
00109     2,    3,    0,    4,    1,    3,    0,    2,    1,    1,
00110     1,    1,    1,    1,    1,    1,
00111 };
00112 const short yydefred[] = {                                      0,
00113     0,    0,    1,    0,    0,    0,   14,    0,    0,    8,
00114     0,   13,   36,    0,    0,    2,    0,   24,    0,   46,
00115    42,    0,    0,    6,    0,    0,   26,   27,   28,   29,
00116    30,   31,    0,    0,   20,   21,    0,   47,   45,    0,
00117     0,   22,    0,    0,    7,    9,   12,   10,   11,    0,
00118    18,    0,   32,   34,    0,    0,   23,    0,   44,   19,
00119     0,    0,   63,    0,    0,    3,   52,   53,   51,   54,
00120    55,   56,   57,    0,   48,   50,   33,    0,   35,    0,
00121     0,   61,    0,   41,    0,   39,   67,   62,   49,    0,
00122    38,    0,   65,    0,   40,   67,   70,   71,   69,   72,
00123    73,   74,   75,   76,   68,   66,
00124 };
00125 const short yydgoto[] = {                                       2,
00126     6,    4,   16,   56,   40,    8,    9,   10,   11,   12,
00127    33,   17,   34,   35,   18,   19,   37,   52,   53,   20,
00128    79,   62,   85,   86,   21,   43,   74,   22,   39,   75,
00129    76,   64,   65,   80,   92,   93,  105,   94,
00130 };
00131 const short yysindex[] = {                                   -261,
00132  -109,    0,    0, -253, -242,  -54,    0, -242,  -35,    0,
00133   -22,    0,    0,  -38, -224,    0,  -56,    0,  -36,    0,
00134     0,  -17,  -34,    0, -242, -241,    0,    0,    0,    0,
00135     0,    0,  -38,   -8,    0,    0, -222,    0,    0, -223,
00136    -5,    0,   -4, -224,    0,    0,    0,    0,    0,   -3,
00137     0,    9,    0,    0, -222,  -70,    0, -221,    0,    0,
00138  -222,   18,    0, -222,    1,    0,    0,    0,    0,    0,
00139     0,    0,    0,   15,    0,    0,    0, -242,    0,    2,
00140     3,    0, -221,    0,  -26,    0,    0,    0,    0, -242,
00141     0,   17,    0, -233,    0,    0,    0,    0,    0,    0,
00142     0,    0,    0,    0,    0,    0,
00143 };
00144 const short yyrindex[] = {                                      0,
00145     0,    0,    0,  -58,    0, -122,    0,  -57,    0,    0,
00146     0,    0,    0,    0,    0,    0, -120,    0,    0,    0,
00147     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00148     0,    0, -119,    0,    0,    0,    0,    0,    0,  -60,
00149     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00150     0,    5,    0,    0,  -59,    0,    0,    0,    0,    0,
00151     0,  -33,    0,  -55,    0,    0,    0,    0,    0,    0,
00152     0,    0,    0,   10,    0,    0,    0,    0,    0,    0,
00153     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00154     0,   12,    0,    0,    0,    0,    0,    0,    0,    0,
00155     0,    0,    0,    0,    0,    0,
00156 };
00157 const short yygindex[] = {                                      0,
00158     0,    0,    0,    0,    0,    0,   64,   48,    0,  -61,
00159     0,    0,   41,    0,   -6,   58,    0,    0,   16,  -30,
00160     0,    0,    0,  -14,    0,    0,    0,  -43,   34,   -2,
00161     0,    0,   19,    0,    0,  -16,    0,    0,
00162 };
00163 #define YYTABLESIZE 226
00164 const short yytable[] = {                                       4,
00165     5,   15,   15,   15,   17,   16,   54,   36,   25,   25,
00166    37,   63,    1,    3,   91,   47,   84,   90,    5,   15,
00167    63,    7,   42,   24,   45,   37,   36,   48,   84,   49,
00168    54,   97,   98,   99,  100,  101,  102,  103,   26,   38,
00169    44,   13,  104,   67,   68,   69,   70,   71,   72,   73,
00170    51,   55,   61,   57,   66,   60,   58,   78,   83,   82,
00171    96,   88,   87,   25,   58,   60,    4,    5,   43,   59,
00172    64,   23,   46,   50,   41,   95,   77,   59,    0,  106,
00173    89,    0,   81,    0,    0,    0,    0,    0,    0,    0,
00174     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00175     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00176     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00177     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00178     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00179     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00180     0,    0,   15,    0,   17,   16,    0,    0,    0,    0,
00181     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00182     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00183     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00184     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00185     0,    0,    0,    0,    0,    4,    0,   13,    0,   13,
00186     0,    0,    0,    0,    4,    5,    4,    5,   14,   27,
00187    28,   29,   30,   31,   32,   13,
00188 };
00189 const short yycheck[] = {                                      58,
00190    58,   58,  125,   58,  125,  125,   37,   14,   44,   44,
00191    44,   55,  274,  123,   41,  257,   78,   44,  272,   58,
00192    64,  264,   59,   59,   59,   59,   33,  269,   90,  271,
00193    61,  265,  266,  267,  268,  269,  270,  271,   61,  264,
00194    58,  264,  276,  265,  266,  267,  268,  269,  270,  271,
00195    59,  275,   44,   59,  125,   59,   61,   40,   44,   59,
00196    44,   59,   61,   59,  125,  125,  125,  125,   59,  125,
00197    59,    8,   25,   33,   17,   90,   61,   44,   -1,   96,
00198    83,   -1,   64,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00199    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00200    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00201    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00202    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00203    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00204    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00205    -1,   -1,  275,   -1,  275,  275,   -1,   -1,   -1,   -1,
00206    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00207    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00208    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00209    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00210    -1,   -1,   -1,   -1,   -1,  264,   -1,  264,   -1,  264,
00211    -1,   -1,   -1,   -1,  273,  273,  275,  275,  273,  258,
00212   259,  260,  261,  262,  263,  264,
00213 };
00214 #define YYFINAL 2
00215 #ifndef YYDEBUG
00216 #define YYDEBUG 0
00217 #endif
00218 #define YYMAXTOKEN 276
00219 #if YYDEBUG
00220 const char * const yyname[] = {
00221 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00222 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'","';'",0,"'='",
00223 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00224 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,
00225 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00226 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00227 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00228 "NC_UNLIMITED_K","BYTE_K","CHAR_K","SHORT_K","INT_K","FLOAT_K","DOUBLE_K",
00229 "IDENT","TERMSTRING","BYTE_CONST","CHAR_CONST","SHORT_CONST","INT_CONST",
00230 "FLOAT_CONST","DOUBLE_CONST","DIMENSIONS","VARIABLES","NETCDF","DATA",
00231 "FILLVALUE",
00232 };
00233 const char * const yyrule[] = {
00234 "$accept : ncdesc",
00235 "$$1 :",
00236 "$$2 :",
00237 "ncdesc : NETCDF '{' $$1 dimsection vasection $$2 datasection '}'",
00238 "dimsection :",
00239 "dimsection : DIMENSIONS dimdecls",
00240 "dimdecls : dimdecline ';'",
00241 "dimdecls : dimdecls dimdecline ';'",
00242 "dimdecline : dimdecl",
00243 "dimdecline : dimdecline ',' dimdecl",
00244 "dimdecl : dimd '=' INT_CONST",
00245 "dimdecl : dimd '=' DOUBLE_CONST",
00246 "dimdecl : dimd '=' NC_UNLIMITED_K",
00247 "dimd : dim",
00248 "dim : IDENT",
00249 "vasection :",
00250 "vasection : VARIABLES vadecls",
00251 "vasection : gattdecls",
00252 "vadecls : vadecl ';'",
00253 "vadecls : vadecls vadecl ';'",
00254 "vadecl : vardecl",
00255 "vadecl : attdecl",
00256 "gattdecls : gattdecl ';'",
00257 "gattdecls : gattdecls gattdecl ';'",
00258 "gattdecl : attdecl",
00259 "vardecl : type varlist",
00260 "type : BYTE_K",
00261 "type : CHAR_K",
00262 "type : SHORT_K",
00263 "type : INT_K",
00264 "type : FLOAT_K",
00265 "type : DOUBLE_K",
00266 "varlist : varspec",
00267 "varlist : varlist ',' varspec",
00268 "$$3 :",
00269 "varspec : var $$3 dimspec",
00270 "var : IDENT",
00271 "dimspec :",
00272 "dimspec : '(' dimlist ')'",
00273 "dimlist : vdim",
00274 "dimlist : dimlist ',' vdim",
00275 "vdim : dim",
00276 "$$4 :",
00277 "attdecl : att $$4 '=' attvallist",
00278 "att : avar ':' attr",
00279 "att : ':' attr",
00280 "avar : var",
00281 "attr : IDENT",
00282 "attvallist : aconst",
00283 "attvallist : attvallist ',' aconst",
00284 "aconst : attconst",
00285 "attconst : CHAR_CONST",
00286 "attconst : TERMSTRING",
00287 "attconst : BYTE_CONST",
00288 "attconst : SHORT_CONST",
00289 "attconst : INT_CONST",
00290 "attconst : FLOAT_CONST",
00291 "attconst : DOUBLE_CONST",
00292 "datasection :",
00293 "datasection : DATA datadecls",
00294 "datasection : DATA",
00295 "datadecls : datadecl ';'",
00296 "datadecls : datadecls datadecl ';'",
00297 "$$5 :",
00298 "datadecl : avar $$5 '=' constlist",
00299 "constlist : dconst",
00300 "constlist : constlist ',' dconst",
00301 "$$6 :",
00302 "dconst : $$6 const",
00303 "const : CHAR_CONST",
00304 "const : TERMSTRING",
00305 "const : BYTE_CONST",
00306 "const : SHORT_CONST",
00307 "const : INT_CONST",
00308 "const : FLOAT_CONST",
00309 "const : DOUBLE_CONST",
00310 "const : FILLVALUE",
00311 };
00312 #endif
00313 #ifndef YYSTYPE
00314 typedef int YYSTYPE;
00315 #endif
00316 #if YYDEBUG
00317 #include <stdio.h>
00318 #endif
00319 #ifdef YYSTACKSIZE
00320 #undef YYMAXDEPTH
00321 #define YYMAXDEPTH YYSTACKSIZE
00322 #else
00323 #ifdef YYMAXDEPTH
00324 #define YYSTACKSIZE YYMAXDEPTH
00325 #else
00326 #define YYSTACKSIZE 10000
00327 #define YYMAXDEPTH 10000
00328 #endif
00329 #endif
00330 #define YYINITSTACKSIZE 200
00331 int yydebug;
00332 int yynerrs;
00333 int yyerrflag;
00334 int yychar;
00335 short *yyssp;
00336 YYSTYPE *yyvsp;
00337 YYSTYPE yyval;
00338 YYSTYPE yylval;
00339 short *yyss;
00340 short *yysslim;
00341 YYSTYPE *yyvs;
00342 int yystacksize;
00343 #line 767 "ncgen.y"
00344 
00345 /* PROGRAMS */
00346 
00347 #ifdef vms
00348 void
00349 #else
00350 int
00351 #endif
00352 yyerror(        /* called for yacc syntax error */
00353      char *s)
00354 {
00355         derror(s);
00356 #ifndef vms
00357         return -1;
00358 #endif
00359 }
00360 
00361 /* undefine yywrap macro, in case we are using bison instead of yacc */
00362 #ifdef yywrap
00363 #undef yywrap
00364 #endif
00365 
00366 int
00367 yywrap(void)                    /* returns 1 on EOF if no more input */
00368 {
00369     return  1;
00370 }
00371 
00372 
00373 /* Symbol table operations for ncgen tool */
00374 
00375 YYSTYPE lookup(       /* find sname in symbol table (linear search) */
00376         const char *sname)
00377 {
00378     YYSTYPE sp;
00379     for (sp = symlist; sp != (YYSTYPE) 0; sp = sp -> next)
00380         if (STREQ(sp -> name, sname)) {
00381             return sp;
00382         }
00383     return 0;                   /* 0 ==> not found */
00384 }
00385 
00386 YYSTYPE install(  /* install sname in symbol table */
00387         const char *sname)
00388 {
00389     YYSTYPE sp;
00390 
00391     sp = (YYSTYPE) emalloc (sizeof (struct Symbol));
00392     sp -> name = (char *) emalloc (strlen (sname) + 1);/* +1 for '\0' */
00393     (void) strcpy (sp -> name, sname);
00394     sp -> next = symlist;       /* put at front of list */
00395     sp -> is_dim = 0;
00396     sp -> is_var = 0;
00397     sp -> is_att = 0;
00398     symlist = sp;
00399     return sp;
00400 }
00401 
00402 void
00403 clearout(void)  /* reset symbol table to empty */
00404 {
00405     YYSTYPE sp, tp;
00406     for (sp = symlist; sp != (YYSTYPE) 0;) {
00407         tp = sp -> next;
00408         free (sp -> name);
00409         free ((char *) sp);
00410         sp = tp;
00411     }
00412     symlist = 0;
00413 }
00414 
00415 /* get lexical input routine generated by lex  */
00416 #include "ncgenyy.c"
00417 #line 418 "y.tab.c"
00418 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
00419 static int yygrowstack()
00420 {
00421     int newsize, i;
00422     short *newss;
00423     YYSTYPE *newvs;
00424 
00425     if ((newsize = yystacksize) == 0)
00426         newsize = YYINITSTACKSIZE;
00427     else if (newsize >= YYMAXDEPTH)
00428         return -1;
00429     else if ((newsize *= 2) > YYMAXDEPTH)
00430         newsize = YYMAXDEPTH;
00431     i = yyssp - yyss;
00432     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
00433       (short *)malloc(newsize * sizeof *newss);
00434     if (newss == NULL)
00435         return -1;
00436     yyss = newss;
00437     yyssp = newss + i;
00438     newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
00439       (YYSTYPE *)malloc(newsize * sizeof *newvs);
00440     if (newvs == NULL)
00441         return -1;
00442     yyvs = newvs;
00443     yyvsp = newvs + i;
00444     yystacksize = newsize;
00445     yysslim = yyss + newsize - 1;
00446     return 0;
00447 }
00448 
00449 #define YYABORT goto yyabort
00450 #define YYREJECT goto yyabort
00451 #define YYACCEPT goto yyaccept
00452 #define YYERROR goto yyerrlab
00453 
00454 #ifndef YYPARSE_PARAM
00455 #if defined(__cplusplus) || __STDC__
00456 #define YYPARSE_PARAM_ARG void
00457 #define YYPARSE_PARAM_DECL
00458 #else   /* ! ANSI-C/C++ */
00459 #define YYPARSE_PARAM_ARG
00460 #define YYPARSE_PARAM_DECL
00461 #endif  /* ANSI-C/C++ */
00462 #else   /* YYPARSE_PARAM */
00463 #ifndef YYPARSE_PARAM_TYPE
00464 #define YYPARSE_PARAM_TYPE void *
00465 #endif
00466 #if defined(__cplusplus) || __STDC__
00467 #define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
00468 #define YYPARSE_PARAM_DECL
00469 #else   /* ! ANSI-C/C++ */
00470 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
00471 #define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
00472 #endif  /* ANSI-C/C++ */
00473 #endif  /* ! YYPARSE_PARAM */
00474 
00475 int
00476 yyparse (YYPARSE_PARAM_ARG)
00477     YYPARSE_PARAM_DECL
00478 {
00479     register int yym, yyn, yystate;
00480 #if YYDEBUG
00481     register const char *yys;
00482 
00483     if ((yys = getenv("YYDEBUG")))
00484     {
00485         yyn = *yys;
00486         if (yyn >= '0' && yyn <= '9')
00487             yydebug = yyn - '0';
00488     }
00489 #endif
00490 
00491     yynerrs = 0;
00492     yyerrflag = 0;
00493     yychar = (-1);
00494 
00495     if (yyss == NULL && yygrowstack()) goto yyoverflow;
00496     yyssp = yyss;
00497     yyvsp = yyvs;
00498     *yyssp = yystate = 0;
00499 
00500 yyloop:
00501     if ((yyn = yydefred[yystate])) goto yyreduce;
00502     if (yychar < 0)
00503     {
00504         if ((yychar = yylex()) < 0) yychar = 0;
00505 #if YYDEBUG
00506         if (yydebug)
00507         {
00508             yys = 0;
00509             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00510             if (!yys) yys = "illegal-symbol";
00511             printf("%sdebug: state %d, reading %d (%s)\n",
00512                     YYPREFIX, yystate, yychar, yys);
00513         }
00514 #endif
00515     }
00516     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
00517             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00518     {
00519 #if YYDEBUG
00520         if (yydebug)
00521             printf("%sdebug: state %d, shifting to state %d\n",
00522                     YYPREFIX, yystate, yytable[yyn]);
00523 #endif
00524         if (yyssp >= yysslim && yygrowstack())
00525         {
00526             goto yyoverflow;
00527         }
00528         *++yyssp = yystate = yytable[yyn];
00529         *++yyvsp = yylval;
00530         yychar = (-1);
00531         if (yyerrflag > 0)  --yyerrflag;
00532         goto yyloop;
00533     }
00534     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
00535             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00536     {
00537         yyn = yytable[yyn];
00538         goto yyreduce;
00539     }
00540     if (yyerrflag) goto yyinrecovery;
00541 #if defined(lint) || defined(__GNUC__)
00542     goto yynewerror;
00543 #endif
00544 yynewerror:
00545     yyerror("syntax error");
00546 #if defined(lint) || defined(__GNUC__)
00547     goto yyerrlab;
00548 #endif
00549 yyerrlab:
00550     ++yynerrs;
00551 yyinrecovery:
00552     if (yyerrflag < 3)
00553     {
00554         yyerrflag = 3;
00555         for (;;)
00556         {
00557             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
00558                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
00559             {
00560 #if YYDEBUG
00561                 if (yydebug)
00562                     printf("%sdebug: state %d, error recovery shifting\
00563  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
00564 #endif
00565                 if (yyssp >= yysslim && yygrowstack())
00566                 {
00567                     goto yyoverflow;
00568                 }
00569                 *++yyssp = yystate = yytable[yyn];
00570                 *++yyvsp = yylval;
00571                 goto yyloop;
00572             }
00573             else
00574             {
00575 #if YYDEBUG
00576                 if (yydebug)
00577                     printf("%sdebug: error recovery discarding state %d\n",
00578                             YYPREFIX, *yyssp);
00579 #endif
00580                 if (yyssp <= yyss) goto yyabort;
00581                 --yyssp;
00582                 --yyvsp;
00583             }
00584         }
00585     }
00586     else
00587     {
00588         if (yychar == 0) goto yyabort;
00589 #if YYDEBUG
00590         if (yydebug)
00591         {
00592             yys = 0;
00593             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00594             if (!yys) yys = "illegal-symbol";
00595             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
00596                     YYPREFIX, yystate, yychar, yys);
00597         }
00598 #endif
00599         yychar = (-1);
00600         goto yyloop;
00601     }
00602 yyreduce:
00603 #if YYDEBUG
00604     if (yydebug)
00605         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
00606                 YYPREFIX, yystate, yyn, yyrule[yyn]);
00607 #endif
00608     yym = yylen[yyn];
00609     yyval = yyvsp[1-yym];
00610     switch (yyn)
00611     {
00612 case 1:
00613 #line 97 "ncgen.y"
00614 { init_netcdf(); }
00615 break;
00616 case 2:
00617 #line 100 "ncgen.y"
00618 {
00619                        if (derror_count == 0)
00620                          define_netcdf(netcdfname);
00621                        if (derror_count > 0)
00622                            exit(6);
00623                    }
00624 break;
00625 case 3:
00626 #line 108 "ncgen.y"
00627 {
00628                        if (derror_count == 0)
00629                          close_netcdf();
00630                    }
00631 break;
00632 case 10:
00633 #line 123 "ncgen.y"
00634 { if (int_val <= 0)
00635                          derror("dimension length must be positive");
00636                      dims[ndims].size = int_val;
00637                      ndims++;
00638                    }
00639 break;
00640 case 11:
00641 #line 129 "ncgen.y"
00642 { /* for rare case where 2^31 < dimsize < 2^32 */
00643                        if (double_val <= 0)
00644                          derror("dimension length must be positive");
00645                        if (double_val > 4294967295.0)
00646                          derror("dimension too large");
00647                        if (double_val - (size_t) double_val > 0)
00648                          derror("dimension length must be an integer");
00649                        dims[ndims].size = (size_t) double_val;
00650                        ndims++;
00651                    }
00652 break;
00653 case 12:
00654 #line 140 "ncgen.y"
00655 {  if (rec_dim != -1)
00656                          derror("only one NC_UNLIMITED dimension allowed");
00657                      rec_dim = ndims; /* the unlimited (record) dimension */
00658                      dims[ndims].size = NC_UNLIMITED;
00659                      ndims++;
00660                    }
00661 break;
00662 case 13:
00663 #line 148 "ncgen.y"
00664 { if (yyvsp[0]->is_dim == 1) {
00665                         derror( "duplicate dimension declaration for %s",
00666                                 yyvsp[0]->name);
00667                      }
00668                      yyvsp[0]->is_dim = 1;
00669                      yyvsp[0]->dnum = ndims;
00670                      /* make sure dims array will hold dimensions */
00671                      grow_darray(ndims,  /* must hold ndims+1 dims */
00672                                  &dims); /* grow as needed */
00673                      dims[ndims].name = (char *) emalloc(strlen(yyvsp[0]->name)+1);
00674                      (void) strcpy(dims[ndims].name, yyvsp[0]->name);
00675                      /* name for use in generated Fortran and C variables */
00676                      dims[ndims].lname = decodify(yyvsp[0]->name);
00677                    }
00678 break;
00679 case 26:
00680 #line 181 "ncgen.y"
00681 { type_code = NC_BYTE; }
00682 break;
00683 case 27:
00684 #line 182 "ncgen.y"
00685 { type_code = NC_CHAR; }
00686 break;
00687 case 28:
00688 #line 183 "ncgen.y"
00689 { type_code = NC_SHORT; }
00690 break;
00691 case 29:
00692 #line 184 "ncgen.y"
00693 { type_code = NC_INT; }
00694 break;
00695 case 30:
00696 #line 185 "ncgen.y"
00697 { type_code = NC_FLOAT; }
00698 break;
00699 case 31:
00700 #line 186 "ncgen.y"
00701 { type_code = NC_DOUBLE; }
00702 break;
00703 case 34:
00704 #line 192 "ncgen.y"
00705 {
00706                     static struct vars dummyvar;
00707 
00708                     dummyvar.name = "dummy";
00709                     dummyvar.type = NC_DOUBLE;
00710                     dummyvar.ndims = 0;
00711                     dummyvar.dims = 0;
00712                     dummyvar.fill_value.doublev = NC_FILL_DOUBLE;
00713                     dummyvar.has_data = 0;
00714 
00715                     nvdims = 0;
00716                     /* make sure variable not re-declared */
00717                     if (yyvsp[0]->is_var == 1) {
00718                        derror( "duplicate variable declaration for %s",
00719                                yyvsp[0]->name);
00720                     }
00721                     yyvsp[0]->is_var = 1;
00722                     yyvsp[0]->vnum = nvars;
00723                     /* make sure vars array will hold variables */
00724                     grow_varray(nvars,  /* must hold nvars+1 vars */
00725                                 &vars); /* grow as needed */
00726                     vars[nvars] = dummyvar; /* to make Purify happy */
00727                     vars[nvars].name = (char *) emalloc(strlen(yyvsp[0]->name)+1);
00728                     (void) strcpy(vars[nvars].name, yyvsp[0]->name);
00729                     /* name for use in generated Fortran and C variables */
00730                     vars[nvars].lname = decodify(yyvsp[0]->name);
00731                     vars[nvars].type = type_code;
00732                     /* set default fill value.  You can override this with
00733                      * the variable attribute "_FillValue". */
00734                     nc_getfill(type_code, &vars[nvars].fill_value);
00735                     vars[nvars].has_data = 0; /* has no data (yet) */
00736                    }
00737 break;
00738 case 35:
00739 #line 225 "ncgen.y"
00740 {
00741                     vars[nvars].ndims = nvdims;
00742                     nvars++;
00743                    }
00744 break;
00745 case 41:
00746 #line 239 "ncgen.y"
00747 {
00748                     if (nvdims >= NC_MAX_VAR_DIMS) {
00749                        derror("%s has too many dimensions",vars[nvars].name);
00750                     }
00751                     if (yyvsp[0]->is_dim == 1)
00752                        dimnum = yyvsp[0]->dnum;
00753                     else {
00754                        derror( "%s is not declared as a dimension",
00755                                yyvsp[0]->name);
00756                        dimnum = ndims;
00757                     }
00758                     if (rec_dim != -1 && dimnum == rec_dim && nvdims != 0) {
00759                        derror("unlimited dimension must be first");
00760                     }
00761                     grow_iarray(nvdims, /* must hold nvdims+1 ints */
00762                                 &vars[nvars].dims); /* grow as needed */
00763                     vars[nvars].dims[nvdims] = dimnum;
00764                     nvdims++;
00765                    }
00766 break;
00767 case 42:
00768 #line 260 "ncgen.y"
00769 {
00770                        valnum = 0;
00771                        valtype = NC_UNSPECIFIED;
00772                        /* get a large block for attributes, realloc later */
00773                        att_space = emalloc(MAX_NC_ATTSIZE);
00774                        /* make all kinds of pointers point to it */
00775                        char_valp = (char *) att_space;
00776                        byte_valp = (signed char *) att_space;
00777                        short_valp = (short *) att_space;
00778                        int_valp = (int *) att_space;
00779                        float_valp = (float *) att_space;
00780                        double_valp = (double *) att_space;
00781                    }
00782 break;
00783 case 43:
00784 #line 274 "ncgen.y"
00785 {
00786                        {        /* check if duplicate attribute for this var */
00787                            int i;
00788                            for(i=0; i<natts; i++) { /* expensive */
00789                                if(atts[i].var == varnum &&
00790                                   STREQ(atts[i].name,atts[natts].name)) {
00791                                    derror("duplicate attribute %s:%s",
00792                                           vars[varnum].name,atts[natts].name);
00793                                }
00794                            }
00795                        }
00796                        atts[natts].var = varnum ;
00797                        atts[natts].type = valtype;
00798                        atts[natts].len = valnum;
00799                        /* shrink space down to what was really needed */
00800                        att_space = erealloc(att_space, valnum*nctypesize(valtype));
00801                        atts[natts].val = att_space;
00802                        if (STREQ(atts[natts].name, _FillValue) &&
00803                            atts[natts].var != NC_GLOBAL) {
00804                            nc_putfill(atts[natts].type,
00805                                        atts[natts].val,
00806                                        &vars[atts[natts].var].fill_value);
00807                            if(atts[natts].type != vars[atts[natts].var].type) {
00808                                derror("variable %s: %s type mismatch",
00809                                       vars[atts[natts].var].name, _FillValue);
00810                            }
00811                        }
00812                        natts++;
00813                    }
00814 break;
00815 case 45:
00816 #line 306 "ncgen.y"
00817 {
00818                     varnum = NC_GLOBAL;  /* handle of "global" attribute */
00819                    }
00820 break;
00821 case 46:
00822 #line 312 "ncgen.y"
00823 { if (yyvsp[0]->is_var == 1)
00824                        varnum = yyvsp[0]->vnum;
00825                     else {
00826                       derror("%s not declared as a variable, fatal error",
00827                              yyvsp[0]->name);
00828                       YYABORT;
00829                       }
00830                    }
00831 break;
00832 case 47:
00833 #line 322 "ncgen.y"
00834 {
00835                        /* make sure atts array will hold attributes */
00836                        grow_aarray(natts,  /* must hold natts+1 atts */
00837                                    &atts); /* grow as needed */
00838                        atts[natts].name = (char *) emalloc(strlen(yyvsp[0]->name)+1);
00839                        (void) strcpy(atts[natts].name,yyvsp[0]->name);
00840                        /* name for use in generated Fortran and C variables */
00841                        atts[natts].lname = decodify(yyvsp[0]->name);
00842                    }
00843 break;
00844 case 50:
00845 #line 336 "ncgen.y"
00846 {
00847                     if (valtype == NC_UNSPECIFIED)
00848                       valtype = atype_code;
00849                     if (valtype != atype_code)
00850                       derror("values for attribute must be all of same type");
00851                    }
00852 break;
00853 case 51:
00854 #line 345 "ncgen.y"
00855 {
00856                        atype_code = NC_CHAR;
00857                        *char_valp++ = char_val;
00858                        valnum++;
00859                    }
00860 break;
00861 case 52:
00862 #line 351 "ncgen.y"
00863 {
00864                        atype_code = NC_CHAR;
00865                        {
00866                            /* don't null-terminate attribute strings */
00867                            size_t len = strlen(termstring);
00868                            if (len == 0) /* need null if that's only value */
00869                                len = 1;
00870                            (void)strncpy(char_valp,termstring,len);
00871                            valnum += len;
00872                            char_valp += len;
00873                        }
00874                    }
00875 break;
00876 case 53:
00877 #line 364 "ncgen.y"
00878 {
00879                        atype_code = NC_BYTE;
00880                        *byte_valp++ = byte_val;
00881                        valnum++;
00882                    }
00883 break;
00884 case 54:
00885 #line 370 "ncgen.y"
00886 {
00887                        atype_code = NC_SHORT;
00888                        *short_valp++ = short_val;
00889                        valnum++;
00890                    }
00891 break;
00892 case 55:
00893 #line 376 "ncgen.y"
00894 {
00895                        atype_code = NC_INT;
00896                        *int_valp++ = int_val;
00897                        valnum++;
00898                    }
00899 break;
00900 case 56:
00901 #line 382 "ncgen.y"
00902 {
00903                        atype_code = NC_FLOAT;
00904                        *float_valp++ = float_val;
00905                        valnum++;
00906                    }
00907 break;
00908 case 57:
00909 #line 388 "ncgen.y"
00910 {
00911                        atype_code = NC_DOUBLE;
00912                        *double_valp++ = double_val;
00913                        valnum++;
00914                    }
00915 break;
00916 case 63:
00917 #line 404 "ncgen.y"
00918 {
00919                        valtype = vars[varnum].type; /* variable type */
00920                        valnum = 0;      /* values accumulated for variable */
00921                        vars[varnum].has_data = 1;
00922                        /* compute dimensions product */
00923                        var_size = nctypesize(valtype);
00924                        if (vars[varnum].ndims == 0) { /* scalar */
00925                            var_len = 1;
00926                        } else if (vars[varnum].dims[0] == rec_dim) {
00927                            var_len = 1; /* one record for unlimited vars */
00928                        } else {
00929                            var_len = dims[vars[varnum].dims[0]].size;
00930                        }
00931                        for(dimnum = 1; dimnum < vars[varnum].ndims; dimnum++)
00932                          var_len = var_len*dims[vars[varnum].dims[dimnum]].size;
00933                        /* allocate memory for variable data */
00934                        if (var_len*var_size != (size_t)(var_len*var_size)) {
00935                            derror("variable %s too large for memory",
00936                                   vars[varnum].name);
00937                            exit(9);
00938                        }
00939                        rec_len = var_len;
00940                        rec_start = malloc ((size_t)(rec_len*var_size));
00941                        if (rec_start == 0) {
00942                            derror ("out of memory\n");
00943                            exit(3);
00944                        }
00945                        rec_cur = rec_start;
00946                        switch (valtype) {
00947                          case NC_CHAR:
00948                            char_valp = (char *) rec_start;
00949                            break;
00950                          case NC_BYTE:
00951                            byte_valp = (signed char *) rec_start;
00952                            break;
00953                          case NC_SHORT:
00954                            short_valp = (short *) rec_start;
00955                            break;
00956                          case NC_INT:
00957                            int_valp = (int *) rec_start;
00958                            break;
00959                          case NC_FLOAT:
00960                            float_valp = (float *) rec_start;
00961                            break;
00962                          case NC_DOUBLE:
00963                            double_valp = (double *) rec_start;
00964                            break;
00965                        }
00966                  }
00967 break;
00968 case 64:
00969 #line 454 "ncgen.y"
00970 {
00971                        if (valnum < var_len) { /* leftovers */
00972                            nc_fill(valtype,
00973                                     var_len - valnum,
00974                                     rec_cur,
00975                                     vars[varnum].fill_value);
00976                        }
00977                        /* put out var_len values */
00978                        /* vars[varnum].nrecs = valnum / rec_len; */
00979                        vars[varnum].nrecs = var_len / rec_len;
00980                        if (derror_count == 0)
00981                            put_variable(rec_start);
00982                        free ((char *) rec_start);
00983                  }
00984 break;
00985 case 67:
00986 #line 473 "ncgen.y"
00987 {
00988                        if(valnum >= var_len) {
00989                            if (vars[varnum].dims[0] != rec_dim) { /* not recvar */
00990                                derror("too many values for this variable, %d >= %d",
00991                                       valnum, var_len);
00992                                exit (4);
00993                            } else { /* a record variable, so grow data
00994                                       container and increment var_len by
00995                                       multiple of record size */
00996                                ptrdiff_t rec_inc = (char *)rec_cur
00997                                    - (char *)rec_start;
00998                                var_len = rec_len * (1 + valnum / rec_len);
00999                                rec_start = erealloc(rec_start, var_len*var_size);
01000                                rec_cur = (char *)rec_start + rec_inc;
01001                                char_valp = (char *) rec_cur;
01002                                byte_valp = (signed char *) rec_cur;
01003                                short_valp = (short *) rec_cur;
01004                                int_valp = (int *) rec_cur;
01005                                float_valp = (float *) rec_cur;
01006                                double_valp = (double *) rec_cur;
01007                            }
01008                        }
01009                        not_a_string = 1;
01010                    }
01011 break;
01012 case 68:
01013 #line 498 "ncgen.y"
01014 {
01015                        if (not_a_string) {
01016                            switch (valtype) {
01017                              case NC_CHAR:
01018                                rec_cur = (void *) char_valp;
01019                                break;
01020                              case NC_BYTE:
01021                                rec_cur = (void *) byte_valp;
01022                                break;
01023                              case NC_SHORT:
01024                                rec_cur = (void *) short_valp;
01025                                break;
01026                              case NC_INT:
01027                                rec_cur = (void *) int_valp;
01028                                break;
01029                              case NC_FLOAT:
01030                                rec_cur = (void *) float_valp;
01031                                break;
01032                              case NC_DOUBLE:
01033                                rec_cur = (void *) double_valp;
01034                                break;
01035                            }
01036                        }
01037                    }
01038 break;
01039 case 69:
01040 #line 525 "ncgen.y"
01041 {
01042                        atype_code = NC_CHAR;
01043                        switch (valtype) {
01044                          case NC_CHAR:
01045                            *char_valp++ = char_val;
01046                            break;
01047                          case NC_BYTE:
01048                            *byte_valp++ = char_val;
01049                            break;
01050                          case NC_SHORT:
01051                            *short_valp++ = char_val;
01052                            break;
01053                          case NC_INT:
01054                            *int_valp++ = char_val;
01055                            break;
01056                          case NC_FLOAT:
01057                            *float_valp++ = char_val;
01058                            break;
01059                          case NC_DOUBLE:
01060                            *double_valp++ = char_val;
01061                            break;
01062                        }
01063                        valnum++;
01064                    }
01065 break;
01066 case 70:
01067 #line 550 "ncgen.y"
01068 {
01069                        not_a_string = 0;
01070                        atype_code = NC_CHAR;
01071                        {
01072                            size_t len = strlen(termstring);
01073 
01074                            if(valnum + len > var_len) {
01075                                if (vars[varnum].dims[0] != rec_dim) {
01076                                    derror("too many values for this variable, %d>%d", 
01077                                           valnum+len, var_len);
01078                                    exit (5);
01079                                } else {/* a record variable so grow it */
01080                                    ptrdiff_t rec_inc = (char *)rec_cur
01081                                        - (char *)rec_start;
01082                                    var_len += rec_len * (len + valnum - var_len)/rec_len;
01083                                    rec_start = erealloc(rec_start, var_len*var_size);
01084                                    rec_cur = (char *)rec_start + rec_inc;
01085                                    char_valp = (char *) rec_cur;
01086                                }
01087                            }
01088                            switch (valtype) {
01089                              case NC_CHAR:
01090                                {
01091                                    int ld;
01092                                    size_t i, sl;
01093                                    (void)strncpy(char_valp,termstring,len);
01094                                    ld = vars[varnum].ndims-1;
01095                                    if (ld > 0) {/* null-fill to size of last dim */
01096                                        sl = dims[vars[varnum].dims[ld]].size;
01097                                        for (i =len;i<sl;i++)
01098                                            char_valp[i] = '\0';
01099                                        if (sl < len)
01100                                            sl = len;
01101                                        valnum += sl;
01102                                        char_valp += sl;
01103                                    } else { /* scalar or 1D strings */
01104                                        valnum += len;
01105                                        char_valp += len;
01106                                    }
01107                                    rec_cur = (void *) char_valp;
01108                                }
01109                                break;
01110                              case NC_BYTE:
01111                              case NC_SHORT:
01112                              case NC_INT:
01113                              case NC_FLOAT:
01114                              case NC_DOUBLE:
01115                                derror("string value invalid for %s variable",
01116                                       nctype(valtype));
01117                                break;
01118                            }
01119                        }
01120                    }
01121 break;
01122 case 71:
01123 #line 604 "ncgen.y"
01124 {
01125                        atype_code = NC_BYTE;
01126                        switch (valtype) {
01127                          case NC_CHAR:
01128                            *char_valp++ = byte_val;
01129                            break;
01130                          case NC_BYTE:
01131                            *byte_valp++ = byte_val;
01132                            break;
01133                          case NC_SHORT:
01134                            *short_valp++ = byte_val;
01135                            break;
01136                          case NC_INT:
01137                            *int_valp++ = byte_val;
01138                            break;
01139                          case NC_FLOAT:
01140                            *float_valp++ = byte_val;
01141                            break;
01142                          case NC_DOUBLE:
01143                            *double_valp++ = byte_val;
01144                            break;
01145                        }
01146                        valnum++;
01147                    }
01148 break;
01149 case 72:
01150 #line 629 "ncgen.y"
01151 {
01152                        atype_code = NC_SHORT;
01153                        switch (valtype) {
01154                          case NC_CHAR:
01155                            *char_valp++ = short_val;
01156                            break;
01157                          case NC_BYTE:
01158                            *byte_valp++ = short_val;
01159                            break;
01160                          case NC_SHORT:
01161                            *short_valp++ = short_val;
01162                            break;
01163                          case NC_INT:
01164                            *int_valp++ = short_val;
01165                            break;
01166                          case NC_FLOAT:
01167                            *float_valp++ = short_val;
01168                            break;
01169                          case NC_DOUBLE:
01170                            *double_valp++ = short_val;
01171                            break;
01172                        }
01173                        valnum++;
01174                    }
01175 break;
01176 case 73:
01177 #line 654 "ncgen.y"
01178 {
01179                        atype_code = NC_INT;
01180                        switch (valtype) {
01181                          case NC_CHAR:
01182                            *char_valp++ = int_val;
01183                            break;
01184                          case NC_BYTE:
01185                            *byte_valp++ = int_val;
01186                            break;
01187                          case NC_SHORT:
01188                            *short_valp++ = int_val;
01189                            break;
01190                          case NC_INT:
01191                            *int_valp++ = int_val;
01192                            break;
01193                          case NC_FLOAT:
01194                            *float_valp++ = int_val;
01195                            break;
01196                          case NC_DOUBLE:
01197                            *double_valp++ = int_val;
01198                            break;
01199                        }
01200                        valnum++;
01201                    }
01202 break;
01203 case 74:
01204 #line 679 "ncgen.y"
01205 {
01206                        atype_code = NC_FLOAT;
01207                        switch (valtype) {
01208                          case NC_CHAR:
01209                            *char_valp++ = float_val;
01210                            break;
01211                          case NC_BYTE:
01212                            *byte_valp++ = float_val;
01213                            break;
01214                          case NC_SHORT:
01215                            *short_valp++ = float_val;
01216                            break;
01217                          case NC_INT:
01218                            *int_valp++ = float_val;
01219                            break;
01220                          case NC_FLOAT:
01221                            *float_valp++ = float_val;
01222                            break;
01223                          case NC_DOUBLE:
01224                            *double_valp++ = float_val;
01225                            break;
01226                        }
01227                        valnum++;
01228                    }
01229 break;
01230 case 75:
01231 #line 704 "ncgen.y"
01232 {
01233                        atype_code = NC_DOUBLE;
01234                        switch (valtype) {
01235                          case NC_CHAR:
01236                            *char_valp++ = double_val;
01237                            break;
01238                          case NC_BYTE:
01239                            *byte_valp++ = double_val;
01240                            break;
01241                          case NC_SHORT:
01242                            *short_valp++ = double_val;
01243                            break;
01244                          case NC_INT:
01245                            *int_valp++ = double_val;
01246                            break;
01247                          case NC_FLOAT:
01248                            if (double_val == NC_FILL_DOUBLE)
01249                              *float_valp++ = NC_FILL_FLOAT;
01250                            else
01251                              *float_valp++ = double_val;
01252                            break;
01253                          case NC_DOUBLE:
01254                            *double_valp++ = double_val;
01255                            break;
01256                        }
01257                        valnum++;
01258                    }
01259 break;
01260 case 76:
01261 #line 732 "ncgen.y"
01262 {
01263                        /* store fill_value */
01264                        switch (valtype) {
01265                        case NC_CHAR:
01266                            nc_fill(valtype, 1, (void *)char_valp++,
01267                                    vars[varnum].fill_value);
01268                            break;
01269                        case NC_BYTE:
01270                            nc_fill(valtype, 1, (void *)byte_valp++,
01271                                    vars[varnum].fill_value);
01272                            break;
01273                        case NC_SHORT:
01274                            nc_fill(valtype, 1, (void *)short_valp++,
01275                                    vars[varnum].fill_value);
01276                            break;
01277                        case NC_INT:
01278                            nc_fill(valtype, 1, (void *)int_valp++,
01279                                    vars[varnum].fill_value);
01280                            break;
01281                        case NC_FLOAT:
01282                            nc_fill(valtype, 1, (void *)float_valp++,
01283                                    vars[varnum].fill_value);
01284                            break;
01285                        case NC_DOUBLE:
01286                            nc_fill(valtype, 1, (void *)double_valp++,
01287                                    vars[varnum].fill_value);
01288                            break;
01289                        }
01290                        valnum++;
01291                    }
01292 break;
01293 #line 1294 "y.tab.c"
01294     }
01295     yyssp -= yym;
01296     yystate = *yyssp;
01297     yyvsp -= yym;
01298     yym = yylhs[yyn];
01299     if (yystate == 0 && yym == 0)
01300     {
01301 #if YYDEBUG
01302         if (yydebug)
01303             printf("%sdebug: after reduction, shifting from state 0 to\
01304  state %d\n", YYPREFIX, YYFINAL);
01305 #endif
01306         yystate = YYFINAL;
01307         *++yyssp = YYFINAL;
01308         *++yyvsp = yyval;
01309         if (yychar < 0)
01310         {
01311             if ((yychar = yylex()) < 0) yychar = 0;
01312 #if YYDEBUG
01313             if (yydebug)
01314             {
01315                 yys = 0;
01316                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
01317                 if (!yys) yys = "illegal-symbol";
01318                 printf("%sdebug: state %d, reading %d (%s)\n",
01319                         YYPREFIX, YYFINAL, yychar, yys);
01320             }
01321 #endif
01322         }
01323         if (yychar == 0) goto yyaccept;
01324         goto yyloop;
01325     }
01326     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
01327             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
01328         yystate = yytable[yyn];
01329     else
01330         yystate = yydgoto[yym];
01331 #if YYDEBUG
01332     if (yydebug)
01333         printf("%sdebug: after reduction, shifting from state %d \
01334 to state %d\n", YYPREFIX, *yyssp, yystate);
01335 #endif
01336     if (yyssp >= yysslim && yygrowstack())
01337     {
01338         goto yyoverflow;
01339     }
01340     *++yyssp = yystate;
01341     *++yyvsp = yyval;
01342     goto yyloop;
01343 yyoverflow:
01344     yyerror("yacc stack overflow");
01345 yyabort:
01346     return (1);
01347 yyaccept:
01348     return (0);
01349 }
01350 

Generated on Thu Mar 16 18:10:14 2006 for nco by  doxygen 1.4.4