Things are working?

This commit is contained in:
Ward Fisher 2016-05-11 15:31:17 -06:00
parent 8373de2f12
commit ef2c6f9bc4
7 changed files with 227 additions and 215 deletions

View File

@ -1,4 +1,4 @@
SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c offsets.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c )
SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c offsets.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h )
IF(USE_X_GETOPT)
SET(ncgen_FILES ${ncgen_FILES} XGetopt.c)
@ -56,6 +56,7 @@ ADD_CUSTOM_COMMAND(
COMMAND flex -Pncg -B ncgen.l
COMMAND rm -f ncgenl.c
COMMAND mv lex.ncg.c ncgenl.c
COMMAND bison -pncg -t -d ncgen.y
COMMAND rm -f ncgeny.c ncgeny.h
COMMAND mv ncgen.tab.c ncgeny.c

View File

@ -93,6 +93,7 @@ various C global variables
#define _SUPERBLOCK_FLAG 0x400
#define _FORMAT_FLAG 0x800
extern struct Specialtoken {
char* name;
int token;

View File

@ -34,6 +34,10 @@
/* Fill value used by ncdump from version 2.4 and later. Should match
definition of FILL_STRING in ../ncdump/vardata.h */
#include "ncgen.h"
#include "ncgeny.h"
#define FILL_STRING "_"
#define XDR_INT32_MIN (-2147483647-1)
#define XDR_INT32_MAX 2147483647
@ -115,7 +119,7 @@ static int tagmatch(nc_type nct, int tag);
static int nct2lexeme(nc_type nct);
static int collecttag(char* text, char** stagp);
struct Specialtoken specials[] = {
static struct Specialtoken specials[] = {
{"_FillValue",_FILLVALUE,_FILLVALUE_FLAG},
{"_Format",_FORMAT,_FORMAT_FLAG},
{"_Storage",_STORAGE,_STORAGE_FLAG},

View File

@ -14,6 +14,8 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
*/
#include "includes.h"
#include "offsets.h"
#include "ncgeny.h"
#include "ncgen.h"
/* Following are in ncdump (for now)*/
/* Need some (unused) definitions to get it to compile */

View File

@ -1184,6 +1184,10 @@ char *ncgtext;
/* Fill value used by ncdump from version 2.4 and later. Should match
definition of FILL_STRING in ../ncdump/vardata.h */
#include "ncgen.h"
#include "ncgeny.h"
#define FILL_STRING "_"
#define XDR_INT32_MIN (-2147483647-1)
#define XDR_INT32_MAX 2147483647
@ -1265,7 +1269,7 @@ static int tagmatch(nc_type nct, int tag);
static int nct2lexeme(nc_type nct);
static int collecttag(char* text, char** stagp);
struct Specialtoken specials[] = {
static struct Specialtoken specials[] = {
{"_FillValue",_FILLVALUE,_FILLVALUE_FLAG},
{"_Format",_FORMAT,_FORMAT_FLAG},
{"_Storage",_STORAGE,_STORAGE_FLAG},
@ -1324,7 +1328,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})*
/* Note: this definition of string will work for utf8 as well,
although it is a very relaxed definition
*/
#line 1328 "lex.ncg.c"
#line 1332 "lex.ncg.c"
#define INITIAL 0
#define ST_C_COMMENT 1
@ -1513,9 +1517,9 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 213 "ncgen.l"
#line 217 "ncgen.l"
#line 1519 "lex.ncg.c"
#line 1523 "lex.ncg.c"
if ( !(yy_init) )
{
@ -1596,14 +1600,14 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 214 "ncgen.l"
#line 218 "ncgen.l"
{ /* whitespace */
break;
}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 218 "ncgen.l"
#line 222 "ncgen.l"
{ /* comment */
break;
}
@ -1611,7 +1615,7 @@ YY_RULE_SETUP
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
#line 222 "ncgen.l"
#line 226 "ncgen.l"
{int len;
/* In netcdf4, this will be used in a variety
of places, so only remove escapes */
@ -1638,7 +1642,7 @@ ncgtext[MAXTRST-1] = '\0';
YY_BREAK
case 4:
YY_RULE_SETUP
#line 246 "ncgen.l"
#line 250 "ncgen.l"
{ /* drop leading 0x; pad to even number of chars */
char* p = ncgtext+2;
int len = ncgleng - 2;
@ -1653,113 +1657,113 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 258 "ncgen.l"
#line 262 "ncgen.l"
{return lexdebug(COMPOUND);}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 259 "ncgen.l"
#line 263 "ncgen.l"
{return lexdebug(ENUM);}
YY_BREAK
case 7:
YY_RULE_SETUP
#line 260 "ncgen.l"
#line 264 "ncgen.l"
{return lexdebug(OPAQUE);}
YY_BREAK
case 8:
YY_RULE_SETUP
#line 262 "ncgen.l"
#line 266 "ncgen.l"
{return lexdebug(FLOAT_K);}
YY_BREAK
case 9:
YY_RULE_SETUP
#line 263 "ncgen.l"
#line 267 "ncgen.l"
{return lexdebug(CHAR_K);}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 264 "ncgen.l"
#line 268 "ncgen.l"
{return lexdebug(BYTE_K);}
YY_BREAK
case 11:
YY_RULE_SETUP
#line 265 "ncgen.l"
#line 269 "ncgen.l"
{return lexdebug(UBYTE_K);}
YY_BREAK
case 12:
YY_RULE_SETUP
#line 266 "ncgen.l"
#line 270 "ncgen.l"
{return lexdebug(SHORT_K);}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 267 "ncgen.l"
#line 271 "ncgen.l"
{return lexdebug(USHORT_K);}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 268 "ncgen.l"
#line 272 "ncgen.l"
{return lexdebug(INT_K);}
YY_BREAK
case 15:
YY_RULE_SETUP
#line 269 "ncgen.l"
#line 273 "ncgen.l"
{return lexdebug(UINT_K);}
YY_BREAK
case 16:
YY_RULE_SETUP
#line 270 "ncgen.l"
#line 274 "ncgen.l"
{return lexdebug(INT64_K);}
YY_BREAK
case 17:
YY_RULE_SETUP
#line 271 "ncgen.l"
#line 275 "ncgen.l"
{return lexdebug(UINT64_K);}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 272 "ncgen.l"
#line 276 "ncgen.l"
{return lexdebug(DOUBLE_K);}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 273 "ncgen.l"
#line 277 "ncgen.l"
{int32_val = -1;
return lexdebug(NC_UNLIMITED_K);}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 276 "ncgen.l"
#line 280 "ncgen.l"
{return lexdebug(TYPES);}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 277 "ncgen.l"
#line 281 "ncgen.l"
{return lexdebug(DIMENSIONS);}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 278 "ncgen.l"
#line 282 "ncgen.l"
{return lexdebug(VARIABLES);}
YY_BREAK
case 23:
YY_RULE_SETUP
#line 279 "ncgen.l"
#line 283 "ncgen.l"
{return lexdebug(DATA);}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 280 "ncgen.l"
#line 284 "ncgen.l"
{return lexdebug(GROUP);}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 282 "ncgen.l"
#line 286 "ncgen.l"
{BEGIN(TEXT);return lexdebug(NETCDF);}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 284 "ncgen.l"
#line 288 "ncgen.l"
{ /* missing value (pre-2.4 backward compatibility) */
if (ncgtext[0] == '-') {
double_val = NEGNC_INFINITE;
@ -1772,7 +1776,7 @@ YY_RULE_SETUP
YY_BREAK
case 27:
YY_RULE_SETUP
#line 293 "ncgen.l"
#line 297 "ncgen.l"
{ /* missing value (pre-2.4 backward compatibility) */
double_val = NAN;
specialconstants = 1;
@ -1781,7 +1785,7 @@ YY_RULE_SETUP
YY_BREAK
case 28:
YY_RULE_SETUP
#line 299 "ncgen.l"
#line 303 "ncgen.l"
{/* missing value (pre-2.4 backward compatibility)*/
if (ncgtext[0] == '-') {
float_val = NEGNC_INFINITEF;
@ -1794,7 +1798,7 @@ YY_RULE_SETUP
YY_BREAK
case 29:
YY_RULE_SETUP
#line 308 "ncgen.l"
#line 312 "ncgen.l"
{ /* missing value (pre-2.4 backward compatibility) */
float_val = NANF;
specialconstants = 1;
@ -1803,7 +1807,7 @@ YY_RULE_SETUP
YY_BREAK
case 30:
YY_RULE_SETUP
#line 314 "ncgen.l"
#line 318 "ncgen.l"
{
#ifdef USE_NETCDF4
if(l_flag == L_C || l_flag == L_BINARY)
@ -1816,7 +1820,7 @@ YY_RULE_SETUP
YY_BREAK
case 31:
YY_RULE_SETUP
#line 324 "ncgen.l"
#line 328 "ncgen.l"
{
bbClear(lextext);
bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
@ -1827,7 +1831,7 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
#line 333 "ncgen.l"
#line 337 "ncgen.l"
{struct Specialtoken* st;
bbClear(lextext);
bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
@ -1841,7 +1845,7 @@ YY_RULE_SETUP
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
#line 343 "ncgen.l"
#line 347 "ncgen.l"
{
int c;
char* p; char* q;
@ -1860,7 +1864,7 @@ YY_RULE_SETUP
YY_BREAK
case 34:
YY_RULE_SETUP
#line 359 "ncgen.l"
#line 363 "ncgen.l"
{ char* id; int len;
bbClear(lextext);
bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
@ -1875,7 +1879,7 @@ YY_RULE_SETUP
YY_BREAK
case 35:
YY_RULE_SETUP
#line 371 "ncgen.l"
#line 375 "ncgen.l"
{
/*
We need to try to see what size of integer ((u)int).
@ -1944,7 +1948,7 @@ done: return 0;
YY_BREAK
case 36:
YY_RULE_SETUP
#line 437 "ncgen.l"
#line 441 "ncgen.l"
{
int c;
int token = 0;
@ -1995,7 +1999,7 @@ YY_RULE_SETUP
YY_BREAK
case 37:
YY_RULE_SETUP
#line 484 "ncgen.l"
#line 488 "ncgen.l"
{
if (sscanf((char*)ncgtext, "%le", &double_val) != 1) {
sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext);
@ -2006,7 +2010,7 @@ YY_RULE_SETUP
YY_BREAK
case 38:
YY_RULE_SETUP
#line 491 "ncgen.l"
#line 495 "ncgen.l"
{
if (sscanf((char*)ncgtext, "%e", &float_val) != 1) {
sprintf(errstr,"bad float constant: %s",(char*)ncgtext);
@ -2018,7 +2022,7 @@ YY_RULE_SETUP
case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
#line 498 "ncgen.l"
#line 502 "ncgen.l"
{
(void) sscanf((char*)&ncgtext[1],"%c",&byte_val);
return lexdebug(BYTE_CONST);
@ -2026,7 +2030,7 @@ YY_RULE_SETUP
YY_BREAK
case 40:
YY_RULE_SETUP
#line 502 "ncgen.l"
#line 506 "ncgen.l"
{
int oct = unescapeoct(&ncgtext[2]);
if(oct < 0) {
@ -2039,7 +2043,7 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
#line 511 "ncgen.l"
#line 515 "ncgen.l"
{
int hex = unescapehex(&ncgtext[3]);
if(byte_val < 0) {
@ -2052,7 +2056,7 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
#line 520 "ncgen.l"
#line 524 "ncgen.l"
{
switch ((char)ncgtext[2]) {
case 'a': byte_val = '\007'; break; /* not everyone under-
@ -2074,7 +2078,7 @@ YY_RULE_SETUP
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP
#line 538 "ncgen.l"
#line 542 "ncgen.l"
{
lineno++ ;
break;
@ -2082,7 +2086,7 @@ YY_RULE_SETUP
YY_BREAK
case 44:
YY_RULE_SETUP
#line 543 "ncgen.l"
#line 547 "ncgen.l"
{/*initial*/
BEGIN(ST_C_COMMENT);
break;
@ -2091,21 +2095,21 @@ YY_RULE_SETUP
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 548 "ncgen.l"
#line 552 "ncgen.l"
{/* continuation */
break;
}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 552 "ncgen.l"
#line 556 "ncgen.l"
{/* final */
BEGIN(INITIAL);
break;
}
YY_BREAK
case YY_STATE_EOF(ST_C_COMMENT):
#line 557 "ncgen.l"
#line 561 "ncgen.l"
{/* final, error */
fprintf(stderr,"unterminated /**/ comment");
BEGIN(INITIAL);
@ -2114,17 +2118,17 @@ case YY_STATE_EOF(ST_C_COMMENT):
YY_BREAK
case 47:
YY_RULE_SETUP
#line 563 "ncgen.l"
#line 567 "ncgen.l"
{/* Note: this next rule will not work for UTF8 characters */
return lexdebug(ncgtext[0]) ;
}
YY_BREAK
case 48:
YY_RULE_SETUP
#line 566 "ncgen.l"
#line 570 "ncgen.l"
ECHO;
YY_BREAK
#line 2128 "lex.ncg.c"
#line 2132 "lex.ncg.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(TEXT):
yyterminate();
@ -3124,7 +3128,7 @@ void ncgfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 566 "ncgen.l"
#line 570 "ncgen.l"
static int

File diff suppressed because it is too large Load Diff

View File

@ -99,14 +99,14 @@ typedef union YYSTYPE
{
/* Line 1685 of yacc.c */
#line 134 "ncgen.y"
#line 136 "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;
NCConstant constant;
@ -119,5 +119,3 @@ NCConstant constant;
#endif
extern YYSTYPE ncglval;