Merge branch 'master' into ejh_docs_2

This commit is contained in:
Ed Hartnett 2017-11-05 10:09:27 -07:00 committed by GitHub
commit 48c6d544e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 703 additions and 533 deletions

View File

@ -8,7 +8,10 @@ This file contains a high-level description of this package's evolution. Release
## 4.5.1 - TBD
* Corrected a memory overflow in `tst_h_dimscales`, see [Github #511](https://github.com/Unidata/netcdf-c/issues/511), [Github #505](https://github.com/Unidata/netcdf-c/issues/505), [Github #363](https://github.com/Unidata/netcdf-c/issues/363) and [Github #244](https://github.com/Unidata/netcdf-c/issues/244) for more information.
* [Enhancement] Reverted behavior/handling of out-of-range attribute values to pre-4.5.0 default. See [Github #512](https://github.com/Unidata/netcdf-c/issues/512) for more information.
* [Bug] Fixed error in tst_parallel2.c. See [Github #545](https://github.com/Unidata/netcdf-c/issues/545) for more information.
* [Bug] Fixed handling of corrupt files + proper offset handling for hdf5 files. See [Github #552](https://github.com/Unidata/netcdf-c/issues/552) for more information.
* [Bug] Corrected a memory overflow in `tst_h_dimscales`, see [Github #511](https://github.com/Unidata/netcdf-c/issues/511), [Github #505](https://github.com/Unidata/netcdf-c/issues/505), [Github #363](https://github.com/Unidata/netcdf-c/issues/363) and [Github #244](https://github.com/Unidata/netcdf-c/issues/244) for more information.
## 4.5.0 - October 20, 2017

20
cf
View File

@ -7,7 +7,7 @@ FAST=1
HDF5=1
DAP=1
#HDF4=1
#PNETCDF=1
PNETCDF=1
#PAR4=1
if test $# != 0 ; then
@ -152,19 +152,11 @@ FLAGS="$FLAGS --disable-dap"
fi
if test "x$MPIO" = x1 ; then
if test -f /machine/local_mpich2 ; then
MPI1=/machine/local_mpich2
MPI2=/machine/local_par7
MPI3=/machine/local_par
else
MPI1=/usr/local
MPI2=${MPI1}
MPI3=${MPI1}
fi
PATH=${PATH}:${MPI1}/bin
CC="${MPI1}/bin/mpicc"
CPPFLAGS="-I${MPI2}/include -I${MPI1}/include -I${MPI3}/include"
LDFLAGS="-L${MPI2}/lib -L${MPI1}/lib -L${MPI3}/lib"
MPIDIR=/usr/lib64/mpich
PATH="${PATH}:${MPIDIR}/bin"
CC="${MPIDIR}/bin/mpicc"
CPPFLAGS="-I${MPIDIR}/include"
LDFLAGS="$LDFLAGS -L${MPIDIR}"
LDLIBS="-lmpich"
FLAGS="$FLAGS --enable-pnetcdf"
FLAGS="$FLAGS --enable-parallel-tests"

View File

@ -33,6 +33,7 @@ FLAGS="$FLAGS -DENABLE_TESTS=true"
FLAGS="$FLAGS -DENABLE_EXAMPLES=false"
#FLAGS="$FLAGS -DENABLE_HDF4=true"
FLAGS="$FLAGS -DENABLE_DYNAMIC_LOADING=false"
#FLAGS="$FLAGS -DENABLE_LARGE_FILE_TESTS=true"
rm -fr build
mkdir build

View File

@ -27,6 +27,7 @@ typedef struct NC {
void* dispatchdata; /*per-'file' data; points to e.g. NC3_INFO data*/
char* path;
int mode; /* as provided to nc_open/nc_create */
int model; /* as determined by libdispatch/dfile.c */
#ifdef USE_REFCOUNT
int refcount; /* To enable multiple name-based opens */
#endif
@ -68,6 +69,8 @@ extern int nc__pseudofd(void);
/* This function gets a current default create flag */
extern int nc_get_default_format(void);
extern int NC_check_file_type(const char *path, int flags, void *parameters, int* model, int* version);
extern int add_to_NCList(NC*);
extern void del_from_NCList(NC*);/* does not free object */
extern NC* find_in_NCList(int ext_ncid);
@ -78,7 +81,7 @@ extern int iterate_NCList(int i,NC**); /* Walk from 0 ...; ERANGE return => stop
/* Defined in nc.c */
extern void free_NC(NC*);
extern int new_NC(struct NC_Dispatch*, const char*, int, NC**);
extern int new_NC(struct NC_Dispatch*, const char*, int, int, NC**);
/* Defined in nc.c */
extern int ncdebug;

View File

@ -29,7 +29,8 @@
#define X_INT_MAX 2147483647
/* Given a filename, check its magic number */
#define MAGIC_NUMBER_LEN 4
/* Change magic number size from 4 to 8 to be more precise for HDF5 */
#define MAGIC_NUMBER_LEN 8
#define MAGIC_HDF5_FILE 1
#define MAGIC_HDF4_FILE 2
#define MAGIC_CDF1_FILE 1 /* std classic format */

View File

@ -217,7 +217,8 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
#ifdef _MSC_VER
_ASSERTE(_CrtCheckMemory());
#endif
if(ival < 0 || ival > NC_MAX_UBYTE) ok = 0;
/* For back compatibility, we allow any value, but force conversion */
ival = (ival & 0xFF);
*p = (char)ival;
} break;
case NC_CHAR: {
@ -246,7 +247,8 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
unsigned int uval;
ok = sscanf(s,"%u%n",&uval,&nread);
_ASSERTE(_CrtCheckMemory());
if(uval > NC_MAX_UBYTE) ok = 0;
/* For back compatibility, we allow any value, but force conversion */
uval = (uval & 0xFF);
*p = (unsigned char)uval;
#else
ok = sscanf(s,"%hhu%n",p,&nread);

View File

@ -24,9 +24,38 @@ Research/Unidata. See COPYRIGHT file for more info.
#include "netcdf_mem.h"
#include "ncwinpath.h"
/* If Defined, then use only stdio for all magic number io;
otherwise use stdio or mpio as required.
*/
#define USE_STDIO
/**
Sort info for open/read/close of
file when searching for magic numbers
*/
struct MagicFile {
const char* path;
long long filelen;
int use_parallel;
int inmemory;
void* parameters;
FILE* fp;
#ifdef USE_PARALLEL
MPI_File fh;
#endif
};
static int openmagic(struct MagicFile* file);
static int readmagic(struct MagicFile* file, long pos, char* magic);
static int closemagic(struct MagicFile* file);
static void printmagic(const char* tag, char* magic,struct MagicFile*);
extern int NC_initialized;
extern int NC_finalized;
/* To be consistent with H5Fis_hdf5, use the complete HDF5 magic number */
static char HDF5_SIGNATURE[MAGIC_NUMBER_LEN] = "\211HDF\r\n\032\n";
/** \defgroup datasets NetCDF File and Data I/O
NetCDF opens datasets as files or remote access URLs.
@ -63,56 +92,66 @@ interfaces, the rest of this chapter presents a detailed description
of the interfaces for these operations.
*/
/*!
Interpret the magic number found in the header of a netCDF file.
This function interprets the magic number/string contained in the header of a netCDF file and sets the appropriate NC_FORMATX flags.
@param[in] magic Pointer to a character array with the magic number block.
@param[out] model Pointer to an integer to hold the corresponding netCDF type.
@param[out] version Pointer to an integer to hold the corresponding netCDF version.
@param[in] use_parallel 1 if using parallel, 0 if not.
@return Returns an error code or 0 on success.
@returns NC_NOERR if a legitimate file type found
@returns NC_ENOTNC otherwise
\internal
\ingroup datasets
*/
static int
NC_interpret_magic_number(char* magic, int* model, int* version, int use_parallel)
NC_interpret_magic_number(char* magic, int* model, int* version)
{
int status = NC_NOERR;
/* Look at the magic number */
/* Ignore the first byte for HDF */
*model = 0;
*version = 0;
#ifdef USE_NETCDF4
if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F') {
/* Use the complete magic number string for HDF5 */
if(memcmp(magic,HDF5_SIGNATURE,sizeof(HDF5_SIGNATURE))==0) {
*model = NC_FORMATX_NC4;
*version = 5;
#ifdef USE_HDF4
} else if(magic[0] == '\016' && magic[1] == '\003'
&& magic[2] == '\023' && magic[3] == '\001') {
*model = NC_FORMATX_NC4;
*version = 4;
*version = 5; /* redundant */
goto done;
}
#endif
} else
#if defined(USE_NETCDF4) && defined(USE_HDF4)
if(magic[0] == '\016' && magic[1] == '\003'
&& magic[2] == '\023' && magic[3] == '\001') {
*model = NC_FORMATX_NC_HDF4;
*version = 4; /* redundant */
goto done;
}
#endif
if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
if(magic[3] == '\001') {
*version = 1; /* netcdf classic version 1 */
*model = NC_FORMATX_NC3;
} else if(magic[3] == '\002') {
goto done;
}
if(magic[3] == '\002') {
*version = 2; /* netcdf classic version 2 */
*model = NC_FORMATX_NC3;
goto done;
}
#ifdef USE_CDF5
} else if(magic[3] == '\005') {
if(magic[3] == '\005') {
*version = 5; /* cdf5 (including pnetcdf) file */
*model = NC_FORMATX_NC3;
*model = NC_FORMATX_NC3;
goto done;
}
#endif
} else
{status = NC_ENOTNC; goto done;}
} else
{status = NC_ENOTNC; goto done;}
}
/* No match */
status = NC_ENOTNC;
goto done;
done:
return status;
}
@ -123,112 +162,78 @@ and return that format value (NC_FORMATX_XXX)
in model arg. Assume any path conversion was
already performed at a higher level.
*/
static int
int
NC_check_file_type(const char *path, int flags, void *parameters,
int* model, int* version)
{
char magic[MAGIC_NUMBER_LEN];
int status = NC_NOERR;
int diskless = ((flags & NC_DISKLESS) == NC_DISKLESS);
int use_parallel = ((flags & NC_MPIIO) == NC_MPIIO);
int inmemory = (diskless && ((flags & NC_INMEMORY) == NC_INMEMORY));
char magic[MAGIC_NUMBER_LEN];
int status = NC_NOERR;
int diskless = ((flags & NC_DISKLESS) == NC_DISKLESS);
#ifdef USE_STDIO
int use_parallel = 0;
#else
int use_parallel = ((flags & NC_MPIIO) == NC_MPIIO);
#endif
int inmemory = (diskless && ((flags & NC_INMEMORY) == NC_INMEMORY));
struct MagicFile file;
*model = 0;
*version = 0;
if(inmemory) {
NC_MEM_INFO* meminfo = (NC_MEM_INFO*)parameters;
if(meminfo == NULL || meminfo->size < MAGIC_NUMBER_LEN)
{status = NC_EDISKLESS; goto done;}
memcpy(magic,meminfo->memory,MAGIC_NUMBER_LEN);
} else {/* presumably a real file */
/* Get the 4-byte magic from the beginning of the file. Don't use posix
* for parallel, use the MPI functions instead. */
memset((void*)&file,0,sizeof(file));
file.path = path; /* do not free */
file.parameters = parameters;
if(inmemory && parameters == NULL)
{status = NC_EDISKLESS; goto done;}
if(inmemory) {
file.inmemory = inmemory;
goto next;
}
/* presumably a real file */
#ifdef USE_PARALLEL
if (use_parallel) {
MPI_File fh;
MPI_Status mstatus;
int retval;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if(parameters != NULL) {
comm = ((NC_MPI_INFO*)parameters)->comm;
info = ((NC_MPI_INFO*)parameters)->info;
}
if((retval = MPI_File_open(comm,(char*)path,MPI_MODE_RDONLY,info,
&fh)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
if((retval = MPI_File_read(fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,
&mstatus)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
if((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
} else
/* for parallel, use the MPI functions instead (why?) */
if (use_parallel) {
file.use_parallel = use_parallel;
goto next;
}
#endif /* USE_PARALLEL */
{
FILE *fp;
size_t i;
#ifdef HAVE_FILE_LENGTH_I64
__int64 file_len = 0;
#else
struct stat st;
#endif
if(path == NULL || strlen(path)==0)
{status = NC_EINVAL; goto done;}
if (!(fp = fopen(path, "r")))
{status = errno; goto done;}
#ifdef HAVE_SYS_STAT_H
/* The file must be at least MAGIC_NUMBER_LEN in size,
or otherwise the following fread will exhibit unexpected
behavior. */
/* Windows and fstat have some issues, this will work around that. */
#ifdef HAVE_FILE_LENGTH_I64
if((file_len = _filelengthi64(fileno(fp))) < 0) {
fclose(fp);
status = errno;
goto done;
}
if(file_len < MAGIC_NUMBER_LEN) {
fclose(fp);
status = NC_ENOTNC;
goto done;
}
#else
{ int fno = fileno(fp);
if(!(fstat(fno,&st) == 0)) {
fclose(fp);
status = errno;
goto done;
}
if(st.st_size < MAGIC_NUMBER_LEN) {
fclose(fp);
status = NC_ENOTNC;
goto done;
}
}
#endif //HAVE_FILE_LENGTH_I64
#endif //HAVE_SYS_STAT_H
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
fclose(fp);
if(i == 0)
{status = NC_ENOTNC; goto done;}
if(i != 1)
{status = errno; goto done;}
}
} /* !inmemory */
next:
status = openmagic(&file);
if(status != NC_NOERR) {goto done;}
/* Verify we have a large enough file */
if(file.filelen < MAGIC_NUMBER_LEN)
{status = NC_ENOTNC; goto done;}
if((status = readmagic(&file,0L,magic)) != NC_NOERR) {
status = NC_ENOTNC;
*model = 0;
*version = 0;
goto done;
}
/* Look at the magic number */
status = NC_interpret_magic_number(magic,model,version,use_parallel);
if(NC_interpret_magic_number(magic,model,version) == NC_NOERR
&& *model != 0)
goto done; /* found something */
/* Remaining case is to search forward at starting at 512
and doubling to see if we have HDF5 magic number */
{
long pos = 512L;
for(;;) {
if((pos+MAGIC_NUMBER_LEN) > file.filelen)
{status = NC_ENOTNC; goto done;}
if((status = readmagic(&file,pos,magic)) != NC_NOERR)
{status = NC_ENOTNC; goto done; }
NC_interpret_magic_number(magic,model,version);
if(*model == NC_FORMATX_NC4) break;
/* double and try again */
pos = 2*pos;
}
}
done:
return status;
closemagic(&file);
return status;
}
/** \ingroup datasets
@ -1668,7 +1673,6 @@ NC_create(const char *path0, int cmode, size_t initialsz,
#ifdef WINPATH
/* Need to do path conversion */
path = NCpathcvt(path0);
fprintf(stderr,"XXX: path0=%s path=%s\n",path0,path); fflush(stderr);
#else
path = nulldup(path0);
#endif
@ -1777,7 +1781,7 @@ fprintf(stderr,"XXX: path0=%s path=%s\n",path0,path); fflush(stderr);
}
/* Create the NC* instance and insert its dispatcher */
stat = new_NC(dispatcher,path,cmode,&ncp);
stat = new_NC(dispatcher,path,cmode,model,&ncp);
nullfree(path); path = NULL; /* no longer needed */
if(stat) return stat;
@ -1906,7 +1910,7 @@ NC_open(const char *path0, int cmode,
}
/* Force flag consistentcy */
if(model == NC_FORMATX_NC4 || model == NC_FORMATX_DAP4)
if(model == NC_FORMATX_NC4 || model == NC_FORMATX_NC_HDF4 || model == NC_FORMATX_DAP4)
cmode |= NC_NETCDF4;
else if(model == NC_FORMATX_DAP2) {
cmode &= ~NC_NETCDF4;
@ -1964,7 +1968,7 @@ NC_open(const char *path0, int cmode,
else
#endif
#if defined(USE_NETCDF4)
if(model == (NC_FORMATX_NC4))
if(model == (NC_FORMATX_NC4) || model == (NC_FORMATX_NC_HDF4))
dispatcher = NC4_dispatch_table;
else
#endif
@ -1983,7 +1987,7 @@ havetable:
}
/* Create the NC* instance and insert its dispatcher */
stat = new_NC(dispatcher,path,cmode,&ncp);
stat = new_NC(dispatcher,path,cmode,model,&ncp);
nullfree(path); path = NULL; /* no longer need path */
if(stat) return stat;
@ -2035,3 +2039,166 @@ nc__pseudofd(void)
}
return pseudofd++;
}
/**
\internal
\ingroup datasets
Provide open, read and close for use when searching for magic numbers
*/
static int
openmagic(struct MagicFile* file)
{
int status = NC_NOERR;
if(file->inmemory) {
/* Get its length */
NC_MEM_INFO* meminfo = (NC_MEM_INFO*)file->parameters;
file->filelen = (long long)meminfo->size;
fprintf(stderr,"XXX: openmagic: memory=0x%llx size=%ld\n",meminfo->memory,meminfo->size);
goto done;
}
#ifdef USE_PARALLEL
if (file->use_parallel) {
MPI_Status mstatus;
int retval;
MPI_Offset size;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if(file->parameters != NULL) {
comm = ((NC_MPI_INFO*)file->parameters)->comm;
info = ((NC_MPI_INFO*)file->parameters)->info;
}
if((retval = MPI_File_open(comm,(char*)file->path,MPI_MODE_RDONLY,info,
&file->fh)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
/* Get its length */
if((retval=MPI_File_get_size(file->fh, &size)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
file->filelen = (long long)size;
goto done;
}
#endif /* USE_PARALLEL */
{
if(file->path == NULL || strlen(file->path)==0)
{status = NC_EINVAL; goto done;}
#ifdef _MSC_VER
file->fp = fopen(file->path, "rb");
#else
file->fp = fopen(file->path, "r");
#endif
if(file->fp == NULL)
{status = errno; goto done;}
/* Get its length */
{
#ifdef _MSC_VER
int fd = fileno(file->fp);
__int64 len64 = _filelengthi64(fd);
if(len64 < 0)
{status = errno; goto done;}
file->filelen = (long long)len64;
#else
long size;
if((status = fseek(file->fp, 0L, SEEK_END)) < 0)
{status = errno; goto done;}
size = ftell(file->fp);
file->filelen = (long long)size;
#endif
rewind(file->fp);
}
goto done;
}
done:
return status;
}
static int
readmagic(struct MagicFile* file, long pos, char* magic)
{
int status = NC_NOERR;
memset(magic,0,MAGIC_NUMBER_LEN);
if(file->inmemory) {
char* mempos;
NC_MEM_INFO* meminfo = (NC_MEM_INFO*)file->parameters;
fprintf(stderr,"XXX: readmagic: memory=0x%llx size=%ld\n",meminfo->memory,meminfo->size);
fprintf(stderr,"XXX: readmagic: pos=%ld filelen=%lld\n",pos,file->filelen);
if((pos + MAGIC_NUMBER_LEN) > meminfo->size)
{status = NC_EDISKLESS; goto done;}
mempos = ((char*)meminfo->memory) + pos;
memcpy((void*)magic,mempos,MAGIC_NUMBER_LEN);
printmagic("XXX: readmagic",magic,file);
goto done;
}
#ifdef USE_PARALLEL
if (file->use_parallel) {
MPI_Status mstatus;
int retval;
MPI_Offset offset;
offset = pos;
if((retval = MPI_File_seek(file->fh, offset, MPI_SEEK_SET)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
if((retval = MPI_File_read(file->fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,
&mstatus)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
goto done;
}
#endif /* USE_PARALLEL */
{
size_t count;
int i = fseek(file->fp,pos,SEEK_SET);
if(i < 0)
{status = errno; goto done;}
for(i=0;i<MAGIC_NUMBER_LEN;) {/* make sure to read proper # of bytes */
count=fread(&magic[i],1,(MAGIC_NUMBER_LEN-i),file->fp);
if(count == 0 || ferror(file->fp))
{status = errno; goto done;}
i += count;
}
goto done;
}
done:
if(file && file->fp) clearerr(file->fp);
return status;
}
static int
closemagic(struct MagicFile* file)
{
int status = NC_NOERR;
if(file->inmemory) goto done; /* noop*/
#ifdef USE_PARALLEL
if (file->use_parallel) {
MPI_Status mstatus;
int retval;
if((retval = MPI_File_close(&file->fh)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
goto done;
}
#endif
{
if(file->fp) fclose(file->fp);
goto done;
}
done:
return status;
}
static void
printmagic(const char* tag, char* magic, struct MagicFile* f)
{
int i;
fprintf(stderr,"%s: inmem=%d ispar=%d magic=",tag,f->inmemory,f->use_parallel);
for(i=0;i<MAGIC_NUMBER_LEN;i++) {
unsigned int c = (unsigned int)magic[i];
c = c & 0x000000FF;
if(c == '\n')
fprintf(stderr," 0x%0x/'\\n'",c);
else if(c == '\r')
fprintf(stderr," 0x%0x/'\\r'",c);
else if(c < ' ')
fprintf(stderr," 0x%0x/'?'",c);
else
fprintf(stderr," 0x%0x/'%c'",c,c);
}
fprintf(stderr,"\n");
fflush(stderr);
}

View File

@ -161,9 +161,7 @@ int
NCopen3(const char* path, int flags, int mode)
{
int fd = -1;
fflush(stderr);
char* cvtname = NCpathcvt(path);
fflush(stderr);
if(cvtname == NULL) return -1;
fd = open(cvtname,flags,mode);
free(cvtname);

View File

@ -54,13 +54,14 @@ free_NC(NC *ncp)
}
int
new_NC(NC_Dispatch* dispatcher, const char* path, int mode, NC** ncpp)
new_NC(NC_Dispatch* dispatcher, const char* path, int mode, int model, NC** ncpp)
{
NC *ncp = (NC*)calloc(1,sizeof(NC));
if(ncp == NULL) return NC_ENOMEM;
ncp->dispatch = dispatcher;
ncp->path = nulldup(path);
ncp->mode = mode;
ncp->model = model;
if(ncp->path == NULL) { /* fail */
free_NC(ncp);
return NC_ENOMEM;

View File

@ -373,3 +373,26 @@ void NC_hashmapDelete(NC_hashmap* hash)
free(hash);
}
}
void
NC_hashmap_verify(NC_hashmap* hash, NC_dim** dims)
{
unsigned long i;
if(hash->count == 0) {
fprintf(stderr,"<empty>\n");
goto done;
}
for(i=0;i<hash->size;i++) {
hEntry* e = &hash->table[i];
if(e->flags == ACTIVE) {
fprintf(stderr,"[%d] key=%lu data=%ld",i,e->key,e->data-1);
if(dims != NULL) {
fprintf(stderr," name=%s",dims[e->data-1]->name->cp);
}
fprintf(stderr,"\n");
}
}
done:
fflush(stderr);
}

View File

@ -286,84 +286,6 @@ nc4typelen(nc_type type)
return -1;
}
/* Given a filename, check to see if it is a HDF5 file. */
#define MAGIC_NUMBER_LEN 4
#define NC_HDF5_FILE 1
#define NC_HDF4_FILE 2
static int
nc_check_for_hdf(const char *path, int flags, void* parameters, int *hdf_file)
{
char blob[MAGIC_NUMBER_LEN];
#ifdef USE_PARALLEL4
int use_parallel = ((flags & NC_MPIIO) == NC_MPIIO);
NC_MPI_INFO* mpiinfo = (NC_MPI_INFO*)parameters;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
#endif
int inmemory = ((flags & NC_INMEMORY) == NC_INMEMORY);
NC_MEM_INFO* meminfo = (NC_MEM_INFO*)parameters;
#ifdef USE_PARALLEL4
if(use_parallel) {
comm = mpiinfo->comm;
info = mpiinfo->info;
}
#endif
assert(hdf_file);
LOG((3, "%s: path %s", __func__, path));
/* HDF5 function handles possible user block at beginning of file */
if(!inmemory && H5Fis_hdf5(path))
{
*hdf_file = NC_HDF5_FILE;
} else {
/* Get the 4-byte blob from the beginning of the file. Don't use posix
* for parallel, use the MPI functions instead. */
#ifdef USE_PARALLEL4
if (!inmemory && use_parallel)
{
MPI_File fh;
MPI_Status status;
int retval;
if ((retval = MPI_File_open(comm, (char *)path, MPI_MODE_RDONLY,
info, &fh)) != MPI_SUCCESS)
return NC_EPARINIT;
if ((retval = MPI_File_read(fh, blob, MAGIC_NUMBER_LEN, MPI_CHAR,
&status)) != MPI_SUCCESS)
return NC_EPARINIT;
if ((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
return NC_EPARINIT;
}
else
#endif /* USE_PARALLEL4 */
if(!inmemory) {
FILE *fp;
if (!(fp = fopen(path, "r")) ||
fread(blob, MAGIC_NUMBER_LEN, 1, fp) != 1) {
if(fp) fclose(fp);
return errno;
}
fclose(fp);
} else { /*inmemory*/
if(meminfo->size < MAGIC_NUMBER_LEN)
return NC_ENOTNC;
memcpy(blob,meminfo->memory,MAGIC_NUMBER_LEN);
}
/* Check for HDF4. */
if (memcmp(blob, "\016\003\023\001", 4)==0)
*hdf_file = NC_HDF4_FILE;
else if (memcmp(blob, "HDF", 3)==0)
*hdf_file = NC_HDF5_FILE;
else
*hdf_file = 0;
}
return NC_NOERR;
}
/* Create a HDF5/netcdf-4 file. */
static int
@ -2818,7 +2740,8 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
int use_parallel, void *parameters, NC_Dispatch *dispatch, NC *nc_file)
{
int res;
int hdf_file = 0;
int is_hdf5_file = 0;
int is_hdf4_file = 0;
#ifdef USE_PARALLEL4
NC_MPI_INFO mpidfalt = {MPI_COMM_WORLD, MPI_INFO_NULL};
#endif
@ -2860,21 +2783,22 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
#endif /* USE_PARALLEL_POSIX */
/* Figure out if this is a hdf4 or hdf5 file. */
if ((res = nc_check_for_hdf(path, use_parallel, parameters, &hdf_file)))
goto done;
if(nc_file->model == NC_FORMATX_NC4)
is_hdf5_file = 1;
else if(nc_file->model == NC_FORMATX_NC_HDF4)
is_hdf4_file = 1;
/* Depending on the type of file, open it. */
nc_file->int_ncid = nc_file->ext_ncid;
if (hdf_file == NC_HDF5_FILE)
if (is_hdf5_file)
res = nc4_open_file(path, mode, parameters, nc_file);
#ifdef USE_HDF4
else if (hdf_file == NC_HDF4_FILE && inmemory)
else if (is_hdf4_file && inmemory)
{res = NC_EDISKLESS; goto done;}
else if (hdf_file == NC_HDF4_FILE)
else if (is_hdf4_file)
res = nc4_open_hdf4_file(path, mode, nc_file);
#endif /* USE_HDF4 */
else
assert(0); /* should never happen */
res = NC_ENOTNC;
done:
return res;
}

View File

@ -1,11 +1,14 @@
# Test c output
T=tst_utf8_normalize2
T=tst_addvar
ARGS=test_pnetcdf.nc
#CMD=valgrind --leak-check=full
CMD=gdb --args
#PAR=1
PAR=1
CFLAGS=-Wall -Wno-unused-variable -Wno-unused-function -g -O0 -I.. -I../include
CFLAGS=-Wall -Wno-unused-variable -Wno-unused-function -g -O -I.. -I../include
ifdef PAR
CC=mpicc
@ -23,7 +26,7 @@ LLP=/usr/local/lib:${LD_LIBRARY_PATH}
all:: cmp
export LD_LIBRARY_PATH=${LLP}; export CFLAGS; export LDFLAGS; \
${CMD} ./t
${CMD} ./t ${ARGS}
cmp::
export LD_LIBRARY_PATH=${LLP}; export CFLAGS; export LDFLAGS; \

View File

@ -5,6 +5,9 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
set -e
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# Get the target OS and CPU
CPU=`uname -p`
OS=`uname`

View File

@ -221,12 +221,13 @@ main(int argc, char **argv)
MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */
MPI_Barrier(MPI_COMM_WORLD);
if (mpi_rank == 0)
remove(file_name);
/* Shut down MPI. */
MPI_Finalize();
/* Delete this large file. */
remove(file_name);
#ifdef DEBUG
if (!mpi_rank)
{

View File

@ -23,7 +23,6 @@ main(int argc, char **argv)
{
int nc_argc = argc;
int nc_argv = argv;
nc_initialize();
printf("\n*** Create some files for testing benchmarks.\n");
@ -301,6 +300,5 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
nc_finalize();
FINAL_RESULTS;
}

View File

@ -58,7 +58,5 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
nc_finalize();
FINAL_RESULTS;
}

View File

@ -96,7 +96,5 @@ int main(int argc, char **argv)
}
SUMMARIZE_ERR;
nc_finalize();
FINAL_RESULTS;
}

View File

@ -96,8 +96,6 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
nc_finalize();
FINAL_RESULTS;
}

View File

@ -140,7 +140,5 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
nc_finalize();
FINAL_RESULTS;
}

View File

@ -329,7 +329,5 @@ int main(int argc, char *argv[])
else
printf(" *** success!\n");
nc_finalize();
return 2 ? errors : 0;
}

View File

@ -102,5 +102,6 @@ clean-local: clean-local-check
clean-local-check:
-rm -rf results
-rm .dodsrc
-rm -f .dodsrc

View File

@ -128,6 +128,7 @@ ENDIF()
IF(USE_NETCDF4)
add_sh_test(ncdump run_utf8_nc4_tests)
add_sh_test(ncdump tst_fileinfo)
add_sh_test(ncdump tst_hdf5_offset)
ENDIF(USE_NETCDF4)
add_sh_test(ncdump tst_nccopy3)
@ -245,8 +246,10 @@ INSTALL(TARGETS ncdump RUNTIME DESTINATION bin COMPONENT utilities)
INSTALL(TARGETS nccopy RUNTIME DESTINATION bin COMPONENT utilities)
SET(MAN_FILES nccopy.1 ncdump.1)
# Note, te L512.bin file is file containing exactly 512 bytes each of value 0.
# It is used for creating hdf5 files with varying offsets for testing.
FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1)
FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1 ${CMAKE_CURRENT_SOURCE_DIR}/L512.bin)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
ADD_SUBDIRECTORY(cdl)

1
ncdump/L512.bin Normal file
View File

@ -0,0 +1 @@

View File

@ -8,6 +8,9 @@
include $(top_srcdir)/lib_flags.am
LDADD = ${top_builddir}/liblib/libnetcdf.la
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
TESTS_ENVIRONMENT=CC=${CC}
# This is the program we're building, and it's sources.
@ -48,7 +51,9 @@ tst_dimsizes.sh run_ncgen_tests.sh
if USE_NETCDF4
check_PROGRAMS += tst_fileinfo
TESTS += tst_fileinfo.sh run_ncgen_nc4_tests.sh
TESTS += tst_fileinfo.sh
TESTS += tst_hdf5_offset.sh
TESTS += run_ncgen_nc4_tests.sh
endif
if LARGE_FILE_TESTS
@ -173,7 +178,11 @@ CMakeLists.txt XGetopt.c tst_bom.sh tst_inmemory_nc3.sh \
tst_dimsizes.sh tst_inmemory_nc4.sh tst_fileinfo.sh run_ncgen_tests.sh \
test_360_day_1900.nc test_365_day_1900.nc test_366_day_1900.nc \
ref_test_360_day_1900.cdl ref_test_365_day_1900.cdl ref_test_366_day_1900.cdl \
run_ncgen_nc4_tests.sh tst_nccopy3_subset.sh ref_nccopy3_subset.nc
tst_hdf5_offset.sh run_ncgen_nc4_tests.sh tst_nccopy3_subset.sh ref_nccopy3_subset.nc test_corrupt_magic.nc
# The L512.bin file is file containing exactly 512 bytes each of value 0.
# It is used for creating hdf5 files with varying offsets for testing.
EXTRA_DIST += L512.bin
# CDL files and Expected results
SUBDIRS=cdl expected

Binary file not shown.

View File

@ -0,0 +1,11 @@
netcdf test_corrupt_magic {
dimensions:
recNum = 8;
variables:
string UTC_time(recNum) ;
data:
UTC_time = "2012-03-04 03:54:19", "2012-03-04 03:54:42",
"2012-03-04 03:54:59", "2012-03-04 03:55:20", "2012-03-04 03:55:43",
"2012-03-04 03:56:09", "2012-03-04 03:56:41", "2012-03-04 03:57:12" ;
}

Binary file not shown.

45
ncdump/tst_hdf5_offset.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
# This tests that we can detect an HDF5 file with an offset
rm -f ./offset.cdl ./offset.nc
cp ${srcdir}/small.cdl ./offset.cdl
${NCGEN} -4 ./offset.cdl
# Test a 512 byte offset
rm -f L512.hdf5
# verify size of L512.bin
#LSIZE=`wc -c ${srcdir}/L512.bin | cut -d ' ' -f 1`
cat ${srcdir}/L512.bin offset.nc > L512.hdf5
K=`${NCDUMP} -k L512.hdf5`
if test "x$K" = "xnetCDF-4" ; then
echo "***Pass: 512 offset"
else
echo "***FAIL: 512 offset"
FAILURES=1
fi
# Test a 1024 byte offset
rm -f L1024.hdf5
cat ${srcdir}/L512.bin ${srcdir}/L512.bin offset.nc > L1024.hdf5
K=`${NCDUMP} -k L1024.hdf5`
if test "x$K" = "xnetCDF-4" ; then
echo "***Pass: 1024 offset"
else
echo "***FAIL: 1024 offset"
FAILURES=1
fi
#cleanup
rm -f L512.hdf5 L1024.hdf5
rm -f ./offset.cdl ./offset.nc
if test "x$FAILURES" = x1 ; then
exit 1
fi
exit 0

View File

@ -86,7 +86,15 @@ ${NCDUMP} -c -s tst_special_atts.nc \
echo "*** comparing tst_special_atts.cdl with ref_tst_special_atts.cdl..."
diff -b tst_special_atts.cdl $srcdir/ref_tst_special_atts.cdl
echo ""
echo "*** Testing ncdump on file with corrupted header "
rm -f ./ignore
if ${NCDUMP} ${srcdir}/test_corrupt_magic.nc > ./ignore 2>&1 ; then
echo "***Fail: ncdump should have failed on test_corrupt_magic.nc"
else
echo "***XFail: ncdump properly failed on test_corrupt_magic.nc"
fi
rm -fr ./ignore
echo "*** All ncgen and ncdump test output for netCDF-4 format passed!"
exit 0

View File

@ -19,33 +19,33 @@ define_netcdf(void)
char filename[2048+1];
/* Rule for specifying the dataset name:
1. use explicit datasetname
2. use the datasetname from the .cdl file (see ncgen.l)
3. use -o name ?implemented?
4. use input cdl file name (with .cdl removed) ?implemented?
*/
/* Rule for specifying the output file name:
1. use -o name
2. use the datasetname from the .cdl file
3. use input cdl file name (with .cdl removed)
It would be better if there was some way
to specify the datasetname independently of the
file name, but oh well.
2. use input cdl file name (with .cdl removed)
3. use the datasetname
*/
if(netcdf_name) { /* -o flag name */
strncpy(filename,netcdf_name,2048);
} else { /* construct a usable output file name */
if (cdlname != NULL && strcmp(cdlname,"-") != 0) {/* cmd line name */
char* p;
strncpy(filename,cdlname,2048);
/* remove any suffix and prefix*/
/* remove any suffix and prefix => create in cwd */
p = strrchr(filename,'.');
if(p != NULL) {*p= '\0';}
p = strrchr(filename,'/');
if(p != NULL) {memmove(filename,(p+1),2048);}
} else {/* construct name from dataset name */
} else {/* construct name from dataset name */
strncpy(filename,datasetname,2048); /* Reserve space for extension, terminating '\0' */
}
/* Append the proper extension */
strncat(filename,binary_ext,2048-(strlen(filename) + strlen(binary_ext)));
}
/* Execute exactly one of these */
#ifdef ENABLE_C
if (l_flag == L_C) gen_ncc(filename); else /* create C code to create netcdf */

View File

@ -57,7 +57,7 @@ size_t nciterbuffersize;
struct Vlendata* vlendata;
char *netcdf_name; /* command line -o file name */
char *datasetname; /* name from the netcdf <name> {} */
char *datasetname; /* name from the netcdf <name> {} || from -N */
extern FILE *ncgin;
@ -200,6 +200,8 @@ usage(void)
" [-o outfile]"
" [-P]"
" [-x]"
" [-N datasetname]"
" [-L loglevel]"
" [file ... ]",
progname);
derror("netcdf library version %s", nc_inq_libvers());
@ -250,7 +252,7 @@ main(
(void) par_io_init(32, 32);
#endif
while ((c = getopt(argc, argv, "134567bB:cdD:fhHk:l:M:no:Pv:xL:")) != EOF)
while ((c = getopt(argc, argv, "134567bB:cdD:fhHk:l:M:no:Pv:xL:N:")) != EOF)
switch(c) {
case 'd':
debug = 1;
@ -324,6 +326,9 @@ main(
case 'o': /* to explicitly specify output name */
netcdf_name = nulldup(optarg);
break;
case 'N': /* to explicitly specify dataset name */
datasetname = nulldup(optarg);
break;
case 'x': /* set nofill mode to speed up creation of large files */
nofill_flag = 1;
break;

View File

@ -355,7 +355,8 @@ NIL|nil|Nil {
q = p;
while((c=*p++)) {if(c > ' ') *q++ = c;}
*q = '\0';
datasetname = bbDup(lextext);
if(datasetname == NULL)
datasetname = bbDup(lextext);
BEGIN(INITIAL);
return lexdebug(DATASETID);
}

View File

@ -1,5 +1,5 @@
#line 3 "lex.ncg.c"
#line 3 "ncgenl.c"
#define YY_INT_ALIGNED short int
@ -26,8 +26,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 0
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@ -72,6 +72,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@ -180,12 +171,7 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
extern yy_size_t ncgleng;
extern int ncgleng;
extern FILE *ncgin, *ncgout;
@ -194,7 +180,6 @@ extern FILE *ncgin, *ncgout;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
@ -212,6 +197,11 @@ extern FILE *ncgin, *ncgout;
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@ -300,7 +290,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when ncgtext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t ncgleng;
int ncgleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
@ -328,7 +318,7 @@ static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file );
YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str );
YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len );
YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,int len );
void *ncgalloc (yy_size_t );
void *ncgrealloc (void *,yy_size_t );
@ -371,17 +361,11 @@ extern int ncglineno;
int ncglineno = 1;
extern char *ncgtext;
#ifdef yytext_ptr
#undef yytext_ptr
#endif
#define yytext_ptr ncgtext
static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
static int yy_get_next_buffer (void );
#if defined(__GNUC__) && __GNUC__ >= 3
__attribute__((__noreturn__))
#endif
static void yy_fatal_error (yyconst char msg[] );
/* Done after the current pattern has been matched and before the
@ -453,7 +437,7 @@ static yyconst flex_int16_t yy_accept[417] =
34, 34, 34, 34, 34, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
@ -485,7 +469,7 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst YY_CHAR yy_meta[69] =
static yyconst flex_int32_t yy_meta[69] =
{ 0,
1, 1, 2, 1, 1, 1, 3, 4, 5, 5,
6, 7, 8, 8, 8, 8, 8, 8, 8, 1,
@ -496,7 +480,7 @@ static yyconst YY_CHAR yy_meta[69] =
11, 11, 11, 14, 1, 11, 11, 11
} ;
static yyconst flex_uint16_t yy_base[435] =
static yyconst flex_int16_t yy_base[435] =
{ 0,
0, 0, 325, 321, 264, 255, 318, 2347, 67, 2347,
64, 269, 61, 62, 95, 77, 136, 259, 51, 61,
@ -600,7 +584,7 @@ static yyconst flex_int16_t yy_def[435] =
416, 416, 416, 416
} ;
static yyconst flex_uint16_t yy_nxt[2416] =
static yyconst flex_int16_t yy_nxt[2416] =
{ 0,
8, 9, 10, 9, 8, 11, 12, 8, 13, 14,
15, 16, 17, 18, 18, 18, 18, 18, 18, 8,
@ -1335,7 +1319,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 1339 "lex.ncg.c"
#line 1323 "ncgenl.c"
#define INITIAL 0
#define ST_C_COMMENT 1
@ -1370,19 +1354,19 @@ void ncgset_extra (YY_EXTRA_TYPE user_defined );
FILE *ncgget_in (void );
void ncgset_in (FILE * _in_str );
void ncgset_in (FILE * in_str );
FILE *ncgget_out (void );
void ncgset_out (FILE * _out_str );
void ncgset_out (FILE * out_str );
yy_size_t ncgget_leng (void );
int ncgget_leng (void );
char *ncgget_text (void );
int ncgget_lineno (void );
void ncgset_lineno (int _line_number );
void ncgset_lineno (int line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -1396,12 +1380,8 @@ extern int ncgwrap (void );
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput (int c,char *buf_ptr );
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
@ -1422,12 +1402,7 @@ static int input (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@ -1435,7 +1410,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@ -1446,7 +1421,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
int n; \
for ( n = 0; n < max_size && \
(c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@ -1514,7 +1489,7 @@ extern int ncglex (void);
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK /*LINTED*/break;
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
@ -1524,10 +1499,14 @@ extern int ncglex (void);
*/
YY_DECL
{
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 217 "ncgen.l"
#line 1509 "ncgenl.c"
if ( !(yy_init) )
{
(yy_init) = 1;
@ -1554,12 +1533,7 @@ YY_DECL
ncg_load_buffer_state( );
}
{
#line 217 "ncgen.l"
#line 1561 "lex.ncg.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@ -1575,7 +1549,7 @@ YY_DECL
yy_match:
do
{
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -1873,14 +1847,15 @@ YY_RULE_SETUP
q = p;
while((c=*p++)) {if(c > ' ') *q++ = c;}
*q = '\0';
datasetname = bbDup(lextext);
if(datasetname == NULL)
datasetname = bbDup(lextext);
BEGIN(INITIAL);
return lexdebug(DATASETID);
}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 363 "ncgen.l"
#line 364 "ncgen.l"
{ char* id; int len;
bbClear(lextext);
bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
@ -1895,7 +1870,7 @@ YY_RULE_SETUP
YY_BREAK
case 35:
YY_RULE_SETUP
#line 375 "ncgen.l"
#line 376 "ncgen.l"
{
/*
We need to try to see what size of integer ((u)int).
@ -1964,7 +1939,7 @@ done: return 0;
YY_BREAK
case 36:
YY_RULE_SETUP
#line 441 "ncgen.l"
#line 442 "ncgen.l"
{
int c;
int token = 0;
@ -2015,7 +1990,7 @@ YY_RULE_SETUP
YY_BREAK
case 37:
YY_RULE_SETUP
#line 488 "ncgen.l"
#line 489 "ncgen.l"
{
if (sscanf((char*)ncgtext, "%le", &double_val) != 1) {
sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext);
@ -2026,7 +2001,7 @@ YY_RULE_SETUP
YY_BREAK
case 38:
YY_RULE_SETUP
#line 495 "ncgen.l"
#line 496 "ncgen.l"
{
if (sscanf((char*)ncgtext, "%e", &float_val) != 1) {
sprintf(errstr,"bad float constant: %s",(char*)ncgtext);
@ -2038,7 +2013,7 @@ YY_RULE_SETUP
case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
#line 502 "ncgen.l"
#line 503 "ncgen.l"
{
(void) sscanf((char*)&ncgtext[1],"%c",&byte_val);
return lexdebug(BYTE_CONST);
@ -2046,7 +2021,7 @@ YY_RULE_SETUP
YY_BREAK
case 40:
YY_RULE_SETUP
#line 506 "ncgen.l"
#line 507 "ncgen.l"
{
int oct = unescapeoct(&ncgtext[2]);
if(oct < 0) {
@ -2059,7 +2034,7 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
#line 515 "ncgen.l"
#line 516 "ncgen.l"
{
int hex = unescapehex(&ncgtext[3]);
if(byte_val < 0) {
@ -2072,7 +2047,7 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
#line 524 "ncgen.l"
#line 525 "ncgen.l"
{
switch ((char)ncgtext[2]) {
case 'a': byte_val = '\007'; break; /* not everyone under-
@ -2094,7 +2069,7 @@ YY_RULE_SETUP
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP
#line 542 "ncgen.l"
#line 543 "ncgen.l"
{
lineno++ ;
break;
@ -2102,7 +2077,7 @@ YY_RULE_SETUP
YY_BREAK
case 44:
YY_RULE_SETUP
#line 547 "ncgen.l"
#line 548 "ncgen.l"
{/*initial*/
BEGIN(ST_C_COMMENT);
break;
@ -2111,21 +2086,21 @@ YY_RULE_SETUP
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 552 "ncgen.l"
#line 553 "ncgen.l"
{/* continuation */
break;
}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 556 "ncgen.l"
#line 557 "ncgen.l"
{/* final */
BEGIN(INITIAL);
break;
}
YY_BREAK
case YY_STATE_EOF(ST_C_COMMENT):
#line 561 "ncgen.l"
#line 562 "ncgen.l"
{/* final, error */
fprintf(stderr,"unterminated /**/ comment");
BEGIN(INITIAL);
@ -2134,17 +2109,17 @@ case YY_STATE_EOF(ST_C_COMMENT):
YY_BREAK
case 47:
YY_RULE_SETUP
#line 567 "ncgen.l"
#line 568 "ncgen.l"
{/* Note: this next rule will not work for UTF8 characters */
return lexdebug(ncgtext[0]) ;
}
YY_BREAK
case 48:
YY_RULE_SETUP
#line 570 "ncgen.l"
#line 571 "ncgen.l"
ECHO;
YY_BREAK
#line 2148 "lex.ncg.c"
#line 2123 "ncgenl.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(TEXT):
yyterminate();
@ -2276,7 +2251,6 @@ case YY_STATE_EOF(TEXT):
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of user's declarations */
} /* end of ncglex */
/* yy_get_next_buffer - try to read in a new buffer
@ -2288,9 +2262,9 @@ case YY_STATE_EOF(TEXT):
*/
static int yy_get_next_buffer (void)
{
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = (yytext_ptr);
yy_size_t number_to_move, i;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@ -2319,7 +2293,7 @@ static int yy_get_next_buffer (void)
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@ -2332,21 +2306,21 @@ static int yy_get_next_buffer (void)
else
{
yy_size_t num_to_read =
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
yy_size_t new_size = b->yy_buf_size * 2;
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
@ -2377,7 +2351,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), num_to_read );
(yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@ -2401,9 +2375,9 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@ -2422,14 +2396,14 @@ static int yy_get_next_buffer (void)
static yy_state_type yy_get_previous_state (void)
{
yy_state_type yy_current_state;
char *yy_cp;
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -2454,10 +2428,10 @@ static int yy_get_next_buffer (void)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
int yy_is_jam;
char *yy_cp = (yy_c_buf_p);
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
YY_CHAR yy_c = 1;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@ -2472,14 +2446,12 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 416);
return yy_is_jam ? 0 : yy_current_state;
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
static void yyunput (int c, char * yy_bp )
static void yyunput (int c, register char * yy_bp )
{
char *yy_cp;
register char *yy_cp;
yy_cp = (yy_c_buf_p);
@ -2489,10 +2461,10 @@ static int yy_get_next_buffer (void)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
yy_size_t number_to_move = (yy_n_chars) + 2;
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
register int number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
char *source =
register char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@ -2514,8 +2486,6 @@ static int yy_get_next_buffer (void)
(yy_c_buf_p) = yy_cp;
}
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void)
@ -2540,7 +2510,7 @@ static int yy_get_next_buffer (void)
else
{ /* need more input */
yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
int offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
@ -2665,7 +2635,7 @@ static void ncg_load_buffer_state (void)
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" );
b->yy_buf_size = (yy_size_t)size;
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
@ -2700,6 +2670,10 @@ static void ncg_load_buffer_state (void)
ncgfree((void *) b );
}
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a ncgrestart() or at EOF.
@ -2812,7 +2786,7 @@ void ncgpop_buffer_state (void)
*/
static void ncgensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
int num_to_alloc;
if (!(yy_buffer_stack)) {
@ -2820,7 +2794,7 @@ static void ncgensure_buffer_stack (void)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
num_to_alloc = 1;
(yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
@ -2837,7 +2811,7 @@ static void ncgensure_buffer_stack (void)
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
/* Increase the buffer to prepare for a possible push. */
yy_size_t grow_size = 8 /* arbitrary grow size */;
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc
@ -2904,17 +2878,17 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to ncglex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, int _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
yy_size_t i;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@ -2945,7 +2919,7 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
static void yy_fatal_error (yyconst char* msg )
{
(void) fprintf( stderr, "%s\n", msg );
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@ -2996,7 +2970,7 @@ FILE *ncgget_out (void)
/** Get the length of the current token.
*
*/
yy_size_t ncgget_leng (void)
int ncgget_leng (void)
{
return ncgleng;
}
@ -3011,29 +2985,29 @@ char *ncgget_text (void)
}
/** Set the current line number.
* @param _line_number line number
* @param line_number
*
*/
void ncgset_lineno (int _line_number )
void ncgset_lineno (int line_number )
{
ncglineno = _line_number;
ncglineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param _in_str A readable stream.
* @param in_str A readable stream.
*
* @see ncg_switch_to_buffer
*/
void ncgset_in (FILE * _in_str )
void ncgset_in (FILE * in_str )
{
ncgin = _in_str ;
ncgin = in_str ;
}
void ncgset_out (FILE * _out_str )
void ncgset_out (FILE * out_str )
{
ncgout = _out_str ;
ncgout = out_str ;
}
int ncgget_debug (void)
@ -3041,9 +3015,9 @@ int ncgget_debug (void)
return ncg_flex_debug;
}
void ncgset_debug (int _bdebug )
void ncgset_debug (int bdebug )
{
ncg_flex_debug = _bdebug ;
ncg_flex_debug = bdebug ;
}
static int yy_init_globals (void)
@ -3103,8 +3077,7 @@ int ncglex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
int i;
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@ -3113,7 +3086,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
int n;
register int n;
for ( n = 0; s[n]; ++n )
;
@ -3123,12 +3096,11 @@ static int yy_flex_strlen (yyconst char * s )
void *ncgalloc (yy_size_t size )
{
return (void *) malloc( size );
return (void *) malloc( size );
}
void *ncgrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@ -3141,12 +3113,12 @@ void *ncgrealloc (void * ptr, yy_size_t size )
void ncgfree (void * ptr )
{
free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */
free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#line 570 "ncgen.l"
#line 571 "ncgen.l"
static int

View File

@ -195,7 +195,7 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
extern int lex_init(void);
#line 199 "ncgen.tab.c" /* yacc.c:339 */
#line 199 "ncgeny.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@ -214,7 +214,7 @@ extern int lex_init(void);
#endif
/* In a future release of Bison, this section will be replaced
by #include "ncgen.tab.h". */
by #include "ncgeny.h". */
#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
# define YY_NCG_NCGEN_TAB_H_INCLUDED
/* Debug traces. */
@ -298,7 +298,7 @@ int nctype; /* for tracking attribute list type*/
Datalist* datalist;
NCConstant constant;
#line 302 "ncgen.tab.c" /* yacc.c:355 */
#line 302 "ncgeny.c" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
@ -315,7 +315,7 @@ int ncgparse (void);
/* Copy the second part of user declarations. */
#line 319 "ncgen.tab.c" /* yacc.c:358 */
#line 319 "ncgeny.c" /* yacc.c:358 */
#ifdef short
# undef short
@ -1619,13 +1619,13 @@ yyreduce:
case 2:
#line 221 "ncgen.y" /* yacc.c:1646 */
{if (error_count > 0) YYABORT;}
#line 1623 "ncgen.tab.c" /* yacc.c:1646 */
#line 1623 "ncgeny.c" /* yacc.c:1646 */
break;
case 3:
#line 224 "ncgen.y" /* yacc.c:1646 */
{createrootgroup(datasetname);}
#line 1629 "ncgen.tab.c" /* yacc.c:1646 */
#line 1629 "ncgeny.c" /* yacc.c:1646 */
break;
case 8:
@ -1637,25 +1637,25 @@ yyreduce:
yyerror("duplicate group declaration within parent group for %s",
id->name);
}
#line 1641 "ncgen.tab.c" /* yacc.c:1646 */
#line 1641 "ncgeny.c" /* yacc.c:1646 */
break;
case 9:
#line 252 "ncgen.y" /* yacc.c:1646 */
{listpop(groupstack);}
#line 1647 "ncgen.tab.c" /* yacc.c:1646 */
#line 1647 "ncgeny.c" /* yacc.c:1646 */
break;
case 12:
#line 258 "ncgen.y" /* yacc.c:1646 */
{}
#line 1653 "ncgen.tab.c" /* yacc.c:1646 */
#line 1653 "ncgeny.c" /* yacc.c:1646 */
break;
case 13:
#line 260 "ncgen.y" /* yacc.c:1646 */
{markcdf4("Type specification");}
#line 1659 "ncgen.tab.c" /* yacc.c:1646 */
#line 1659 "ncgeny.c" /* yacc.c:1646 */
break;
case 16:
@ -1667,19 +1667,19 @@ yyreduce:
(yyvsp[0].sym)->name);
listpush(typdefs,(void*)(yyvsp[0].sym));
}
#line 1671 "ncgen.tab.c" /* yacc.c:1646 */
#line 1671 "ncgeny.c" /* yacc.c:1646 */
break;
case 17:
#line 275 "ncgen.y" /* yacc.c:1646 */
{}
#line 1677 "ncgen.tab.c" /* yacc.c:1646 */
#line 1677 "ncgeny.c" /* yacc.c:1646 */
break;
case 18:
#line 275 "ncgen.y" /* yacc.c:1646 */
{}
#line 1683 "ncgen.tab.c" /* yacc.c:1646 */
#line 1683 "ncgeny.c" /* yacc.c:1646 */
break;
case 25:
@ -1710,13 +1710,13 @@ yyreduce:
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
#line 1714 "ncgen.tab.c" /* yacc.c:1646 */
#line 1714 "ncgeny.c" /* yacc.c:1646 */
break;
case 26:
#line 318 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
#line 1720 "ncgen.tab.c" /* yacc.c:1646 */
#line 1720 "ncgeny.c" /* yacc.c:1646 */
break;
case 27:
@ -1735,7 +1735,7 @@ yyreduce:
}
listpush(stack,(void*)(yyvsp[0].sym));
}
#line 1739 "ncgen.tab.c" /* yacc.c:1646 */
#line 1739 "ncgeny.c" /* yacc.c:1646 */
break;
case 28:
@ -1746,7 +1746,7 @@ yyreduce:
(yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant);
(yyval.sym)=(yyvsp[-2].sym);
}
#line 1750 "ncgen.tab.c" /* yacc.c:1646 */
#line 1750 "ncgeny.c" /* yacc.c:1646 */
break;
case 29:
@ -1760,7 +1760,7 @@ yyreduce:
(yyvsp[0].sym)->typ.size=int32_val;
(yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
}
#line 1764 "ncgen.tab.c" /* yacc.c:1646 */
#line 1764 "ncgeny.c" /* yacc.c:1646 */
break;
case 30:
@ -1776,7 +1776,7 @@ yyreduce:
(yyvsp[0].sym)->typ.size=VLENSIZE;
(yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN);
}
#line 1780 "ncgen.tab.c" /* yacc.c:1646 */
#line 1780 "ncgeny.c" /* yacc.c:1646 */
break;
case 31:
@ -1810,19 +1810,19 @@ yyreduce:
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
#line 1814 "ncgen.tab.c" /* yacc.c:1646 */
#line 1814 "ncgeny.c" /* yacc.c:1646 */
break;
case 32:
#line 404 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-1].mark);}
#line 1820 "ncgen.tab.c" /* yacc.c:1646 */
#line 1820 "ncgeny.c" /* yacc.c:1646 */
break;
case 33:
#line 405 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-2].mark);}
#line 1826 "ncgen.tab.c" /* yacc.c:1646 */
#line 1826 "ncgeny.c" /* yacc.c:1646 */
break;
case 34:
@ -1838,97 +1838,97 @@ yyreduce:
f->typ.basetype = (yyvsp[-1].sym);
}
}
#line 1842 "ncgen.tab.c" /* yacc.c:1646 */
#line 1842 "ncgeny.c" /* yacc.c:1646 */
break;
case 35:
#line 422 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_CHAR]; }
#line 1848 "ncgen.tab.c" /* yacc.c:1646 */
#line 1848 "ncgeny.c" /* yacc.c:1646 */
break;
case 36:
#line 423 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_BYTE]; }
#line 1854 "ncgen.tab.c" /* yacc.c:1646 */
#line 1854 "ncgeny.c" /* yacc.c:1646 */
break;
case 37:
#line 424 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_SHORT]; }
#line 1860 "ncgen.tab.c" /* yacc.c:1646 */
#line 1860 "ncgeny.c" /* yacc.c:1646 */
break;
case 38:
#line 425 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_INT]; }
#line 1866 "ncgen.tab.c" /* yacc.c:1646 */
#line 1866 "ncgeny.c" /* yacc.c:1646 */
break;
case 39:
#line 426 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_FLOAT]; }
#line 1872 "ncgen.tab.c" /* yacc.c:1646 */
#line 1872 "ncgeny.c" /* yacc.c:1646 */
break;
case 40:
#line 427 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym) = primsymbols[NC_DOUBLE]; }
#line 1878 "ncgen.tab.c" /* yacc.c:1646 */
#line 1878 "ncgeny.c" /* yacc.c:1646 */
break;
case 41:
#line 428 "ncgen.y" /* yacc.c:1646 */
{ vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; }
#line 1884 "ncgen.tab.c" /* yacc.c:1646 */
#line 1884 "ncgeny.c" /* yacc.c:1646 */
break;
case 42:
#line 429 "ncgen.y" /* yacc.c:1646 */
{ vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; }
#line 1890 "ncgen.tab.c" /* yacc.c:1646 */
#line 1890 "ncgeny.c" /* yacc.c:1646 */
break;
case 43:
#line 430 "ncgen.y" /* yacc.c:1646 */
{ vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; }
#line 1896 "ncgen.tab.c" /* yacc.c:1646 */
#line 1896 "ncgeny.c" /* yacc.c:1646 */
break;
case 44:
#line 431 "ncgen.y" /* yacc.c:1646 */
{ vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; }
#line 1902 "ncgen.tab.c" /* yacc.c:1646 */
#line 1902 "ncgeny.c" /* yacc.c:1646 */
break;
case 45:
#line 432 "ncgen.y" /* yacc.c:1646 */
{ vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; }
#line 1908 "ncgen.tab.c" /* yacc.c:1646 */
#line 1908 "ncgeny.c" /* yacc.c:1646 */
break;
case 47:
#line 436 "ncgen.y" /* yacc.c:1646 */
{}
#line 1914 "ncgen.tab.c" /* yacc.c:1646 */
#line 1914 "ncgeny.c" /* yacc.c:1646 */
break;
case 48:
#line 437 "ncgen.y" /* yacc.c:1646 */
{}
#line 1920 "ncgen.tab.c" /* yacc.c:1646 */
#line 1920 "ncgeny.c" /* yacc.c:1646 */
break;
case 51:
#line 444 "ncgen.y" /* yacc.c:1646 */
{}
#line 1926 "ncgen.tab.c" /* yacc.c:1646 */
#line 1926 "ncgeny.c" /* yacc.c:1646 */
break;
case 52:
#line 444 "ncgen.y" /* yacc.c:1646 */
{}
#line 1932 "ncgen.tab.c" /* yacc.c:1646 */
#line 1932 "ncgeny.c" /* yacc.c:1646 */
break;
case 55:
@ -1939,7 +1939,7 @@ yyreduce:
fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize);
#endif
}
#line 1943 "ncgen.tab.c" /* yacc.c:1646 */
#line 1943 "ncgeny.c" /* yacc.c:1646 */
break;
case 56:
@ -1951,7 +1951,7 @@ fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long lon
fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
#endif
}
#line 1955 "ncgen.tab.c" /* yacc.c:1646 */
#line 1955 "ncgeny.c" /* yacc.c:1646 */
break;
case 57:
@ -1965,31 +1965,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyval.sym)=(yyvsp[0].sym);
listpush(dimdefs,(void*)(yyvsp[0].sym));
}
#line 1969 "ncgen.tab.c" /* yacc.c:1646 */
#line 1969 "ncgeny.c" /* yacc.c:1646 */
break;
case 59:
#line 481 "ncgen.y" /* yacc.c:1646 */
{}
#line 1975 "ncgen.tab.c" /* yacc.c:1646 */
#line 1975 "ncgeny.c" /* yacc.c:1646 */
break;
case 60:
#line 482 "ncgen.y" /* yacc.c:1646 */
{}
#line 1981 "ncgen.tab.c" /* yacc.c:1646 */
#line 1981 "ncgeny.c" /* yacc.c:1646 */
break;
case 63:
#line 489 "ncgen.y" /* yacc.c:1646 */
{}
#line 1987 "ncgen.tab.c" /* yacc.c:1646 */
#line 1987 "ncgeny.c" /* yacc.c:1646 */
break;
case 64:
#line 489 "ncgen.y" /* yacc.c:1646 */
{}
#line 1993 "ncgen.tab.c" /* yacc.c:1646 */
#line 1993 "ncgeny.c" /* yacc.c:1646 */
break;
case 65:
@ -2013,7 +2013,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
}
listsetlength(stack,stackbase);/* remove stack nodes*/
}
#line 2017 "ncgen.tab.c" /* yacc.c:1646 */
#line 2017 "ncgeny.c" /* yacc.c:1646 */
break;
case 66:
@ -2021,13 +2021,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
{(yyval.mark)=listlength(stack);
listpush(stack,(void*)(yyvsp[0].sym));
}
#line 2025 "ncgen.tab.c" /* yacc.c:1646 */
#line 2025 "ncgeny.c" /* yacc.c:1646 */
break;
case 67:
#line 518 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2031 "ncgen.tab.c" /* yacc.c:1646 */
#line 2031 "ncgeny.c" /* yacc.c:1646 */
break;
case 68:
@ -2056,31 +2056,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyvsp[-1].sym)->objectclass=NC_VAR;
listsetlength(stack,stackbase);/* remove stack nodes*/
}
#line 2060 "ncgen.tab.c" /* yacc.c:1646 */
#line 2060 "ncgeny.c" /* yacc.c:1646 */
break;
case 69:
#line 548 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=listlength(stack);}
#line 2066 "ncgen.tab.c" /* yacc.c:1646 */
#line 2066 "ncgeny.c" /* yacc.c:1646 */
break;
case 70:
#line 549 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-1].mark);}
#line 2072 "ncgen.tab.c" /* yacc.c:1646 */
#line 2072 "ncgeny.c" /* yacc.c:1646 */
break;
case 71:
#line 552 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2078 "ncgen.tab.c" /* yacc.c:1646 */
#line 2078 "ncgeny.c" /* yacc.c:1646 */
break;
case 72:
#line 554 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2084 "ncgen.tab.c" /* yacc.c:1646 */
#line 2084 "ncgeny.c" /* yacc.c:1646 */
break;
case 73:
@ -2095,7 +2095,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
}
(yyval.sym)=dimsym;
}
#line 2099 "ncgen.tab.c" /* yacc.c:1646 */
#line 2099 "ncgeny.c" /* yacc.c:1646 */
break;
case 74:
@ -2103,13 +2103,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
{(yyval.mark)=listlength(stack);
listpush(stack,(void*)(yyvsp[0].sym));
}
#line 2107 "ncgen.tab.c" /* yacc.c:1646 */
#line 2107 "ncgeny.c" /* yacc.c:1646 */
break;
case 75:
#line 576 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2113 "ncgen.tab.c" /* yacc.c:1646 */
#line 2113 "ncgeny.c" /* yacc.c:1646 */
break;
case 76:
@ -2140,31 +2140,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
listsetlength(stack,stackbase);/* remove stack nodes*/
(yyval.sym) = (yyvsp[-1].sym);
}
#line 2144 "ncgen.tab.c" /* yacc.c:1646 */
#line 2144 "ncgeny.c" /* yacc.c:1646 */
break;
case 77:
#line 609 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=listlength(stack);}
#line 2150 "ncgen.tab.c" /* yacc.c:1646 */
#line 2150 "ncgeny.c" /* yacc.c:1646 */
break;
case 78:
#line 610 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-1].mark);}
#line 2156 "ncgen.tab.c" /* yacc.c:1646 */
#line 2156 "ncgeny.c" /* yacc.c:1646 */
break;
case 79:
#line 614 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2162 "ncgen.tab.c" /* yacc.c:1646 */
#line 2162 "ncgeny.c" /* yacc.c:1646 */
break;
case 80:
#line 616 "ncgen.y" /* yacc.c:1646 */
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
#line 2168 "ncgen.tab.c" /* yacc.c:1646 */
#line 2168 "ncgeny.c" /* yacc.c:1646 */
break;
case 81:
@ -2178,7 +2178,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyval.sym)->dim.isconstant = 1;
(yyval.sym)->dim.declsize = uint32_val;
}
#line 2182 "ncgen.tab.c" /* yacc.c:1646 */
#line 2182 "ncgeny.c" /* yacc.c:1646 */
break;
case 82:
@ -2196,7 +2196,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyval.sym)->dim.isconstant = 1;
(yyval.sym)->dim.declsize = int32_val;
}
#line 2200 "ncgen.tab.c" /* yacc.c:1646 */
#line 2200 "ncgeny.c" /* yacc.c:1646 */
break;
case 83:
@ -2208,7 +2208,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
}
(yyval.sym)=vsym;
}
#line 2212 "ncgen.tab.c" /* yacc.c:1646 */
#line 2212 "ncgeny.c" /* yacc.c:1646 */
break;
case 84:
@ -2220,7 +2220,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
}
(yyval.sym)=tsym;
}
#line 2224 "ncgen.tab.c" /* yacc.c:1646 */
#line 2224 "ncgeny.c" /* yacc.c:1646 */
break;
case 85:
@ -2243,49 +2243,49 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
}
(yyval.sym)=tvsym;
}
#line 2247 "ncgen.tab.c" /* yacc.c:1646 */
#line 2247 "ncgeny.c" /* yacc.c:1646 */
break;
case 86:
#line 691 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym)=(yyvsp[0].sym);}
#line 2253 "ncgen.tab.c" /* yacc.c:1646 */
#line 2253 "ncgeny.c" /* yacc.c:1646 */
break;
case 87:
#line 698 "ncgen.y" /* yacc.c:1646 */
{}
#line 2259 "ncgen.tab.c" /* yacc.c:1646 */
#line 2259 "ncgeny.c" /* yacc.c:1646 */
break;
case 88:
#line 698 "ncgen.y" /* yacc.c:1646 */
{}
#line 2265 "ncgen.tab.c" /* yacc.c:1646 */
#line 2265 "ncgeny.c" /* yacc.c:1646 */
break;
case 89:
#line 702 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2271 "ncgen.tab.c" /* yacc.c:1646 */
#line 2271 "ncgeny.c" /* yacc.c:1646 */
break;
case 90:
#line 704 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2277 "ncgen.tab.c" /* yacc.c:1646 */
#line 2277 "ncgeny.c" /* yacc.c:1646 */
break;
case 91:
#line 706 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2283 "ncgen.tab.c" /* yacc.c:1646 */
#line 2283 "ncgeny.c" /* yacc.c:1646 */
break;
case 92:
#line 708 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
#line 2289 "ncgen.tab.c" /* yacc.c:1646 */
#line 2289 "ncgeny.c" /* yacc.c:1646 */
break;
case 93:
@ -2298,7 +2298,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
YYABORT;
}
}
#line 2302 "ncgen.tab.c" /* yacc.c:1646 */
#line 2302 "ncgeny.c" /* yacc.c:1646 */
break;
case 94:
@ -2313,67 +2313,67 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
YYABORT;
}
}
#line 2317 "ncgen.tab.c" /* yacc.c:1646 */
#line 2317 "ncgeny.c" /* yacc.c:1646 */
break;
case 95:
#line 730 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
#line 2323 "ncgen.tab.c" /* yacc.c:1646 */
#line 2323 "ncgeny.c" /* yacc.c:1646 */
break;
case 96:
#line 732 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);}
#line 2329 "ncgen.tab.c" /* yacc.c:1646 */
#line 2329 "ncgeny.c" /* yacc.c:1646 */
break;
case 97:
#line 734 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2335 "ncgen.tab.c" /* yacc.c:1646 */
#line 2335 "ncgeny.c" /* yacc.c:1646 */
break;
case 98:
#line 736 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
#line 2341 "ncgen.tab.c" /* yacc.c:1646 */
#line 2341 "ncgeny.c" /* yacc.c:1646 */
break;
case 99:
#line 738 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2347 "ncgen.tab.c" /* yacc.c:1646 */
#line 2347 "ncgeny.c" /* yacc.c:1646 */
break;
case 100:
#line 740 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2353 "ncgen.tab.c" /* yacc.c:1646 */
#line 2353 "ncgeny.c" /* yacc.c:1646 */
break;
case 101:
#line 742 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2359 "ncgen.tab.c" /* yacc.c:1646 */
#line 2359 "ncgeny.c" /* yacc.c:1646 */
break;
case 102:
#line 744 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2365 "ncgen.tab.c" /* yacc.c:1646 */
#line 2365 "ncgeny.c" /* yacc.c:1646 */
break;
case 103:
#line 746 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
#line 2371 "ncgen.tab.c" /* yacc.c:1646 */
#line 2371 "ncgeny.c" /* yacc.c:1646 */
break;
case 104:
#line 748 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);}
#line 2377 "ncgen.tab.c" /* yacc.c:1646 */
#line 2377 "ncgeny.c" /* yacc.c:1646 */
break;
case 105:
@ -2384,7 +2384,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyvsp[0].sym)->is_prefixed=0;
setpathcurrent((yyvsp[0].sym));
}
#line 2388 "ncgen.tab.c" /* yacc.c:1646 */
#line 2388 "ncgeny.c" /* yacc.c:1646 */
break;
case 106:
@ -2395,257 +2395,257 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
(yyvsp[0].sym)->is_prefixed=1;
/* path is set in ncgen.l*/
}
#line 2399 "ncgen.tab.c" /* yacc.c:1646 */
#line 2399 "ncgeny.c" /* yacc.c:1646 */
break;
case 108:
#line 769 "ncgen.y" /* yacc.c:1646 */
{}
#line 2405 "ncgen.tab.c" /* yacc.c:1646 */
#line 2405 "ncgeny.c" /* yacc.c:1646 */
break;
case 109:
#line 770 "ncgen.y" /* yacc.c:1646 */
{}
#line 2411 "ncgen.tab.c" /* yacc.c:1646 */
#line 2411 "ncgeny.c" /* yacc.c:1646 */
break;
case 112:
#line 778 "ncgen.y" /* yacc.c:1646 */
{(yyvsp[-2].sym)->data = (yyvsp[0].datalist);}
#line 2417 "ncgen.tab.c" /* yacc.c:1646 */
#line 2417 "ncgeny.c" /* yacc.c:1646 */
break;
case 113:
#line 781 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = (yyvsp[0].datalist);}
#line 2423 "ncgen.tab.c" /* yacc.c:1646 */
#line 2423 "ncgeny.c" /* yacc.c:1646 */
break;
case 114:
#line 782 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = (yyvsp[0].datalist);}
#line 2429 "ncgen.tab.c" /* yacc.c:1646 */
#line 2429 "ncgeny.c" /* yacc.c:1646 */
break;
case 115:
#line 786 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = builddatalist(0);}
#line 2435 "ncgen.tab.c" /* yacc.c:1646 */
#line 2435 "ncgeny.c" /* yacc.c:1646 */
break;
case 116:
#line 790 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
#line 2441 "ncgen.tab.c" /* yacc.c:1646 */
#line 2441 "ncgeny.c" /* yacc.c:1646 */
break;
case 117:
#line 792 "ncgen.y" /* yacc.c:1646 */
{datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
#line 2447 "ncgen.tab.c" /* yacc.c:1646 */
#line 2447 "ncgeny.c" /* yacc.c:1646 */
break;
case 118:
#line 796 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=(yyvsp[0].constant);}
#line 2453 "ncgen.tab.c" /* yacc.c:1646 */
#line 2453 "ncgeny.c" /* yacc.c:1646 */
break;
case 119:
#line 797 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=builddatasublist((yyvsp[-1].datalist));}
#line 2459 "ncgen.tab.c" /* yacc.c:1646 */
#line 2459 "ncgeny.c" /* yacc.c:1646 */
break;
case 120:
#line 801 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=(yyvsp[0].constant);}
#line 2465 "ncgen.tab.c" /* yacc.c:1646 */
#line 2465 "ncgeny.c" /* yacc.c:1646 */
break;
case 121:
#line 802 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_OPAQUE);}
#line 2471 "ncgen.tab.c" /* yacc.c:1646 */
#line 2471 "ncgeny.c" /* yacc.c:1646 */
break;
case 122:
#line 803 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_FILLVALUE);}
#line 2477 "ncgen.tab.c" /* yacc.c:1646 */
#line 2477 "ncgeny.c" /* yacc.c:1646 */
break;
case 123:
#line 804 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_NIL);}
#line 2483 "ncgen.tab.c" /* yacc.c:1646 */
#line 2483 "ncgeny.c" /* yacc.c:1646 */
break;
case 124:
#line 805 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=(yyvsp[0].constant);}
#line 2489 "ncgen.tab.c" /* yacc.c:1646 */
#line 2489 "ncgeny.c" /* yacc.c:1646 */
break;
case 126:
#line 810 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant) = makeenumconstref((yyvsp[0].sym));}
#line 2495 "ncgen.tab.c" /* yacc.c:1646 */
#line 2495 "ncgeny.c" /* yacc.c:1646 */
break;
case 127:
#line 814 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));}
#line 2501 "ncgen.tab.c" /* yacc.c:1646 */
#line 2501 "ncgeny.c" /* yacc.c:1646 */
break;
case 128:
#line 819 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
#line 2507 "ncgen.tab.c" /* yacc.c:1646 */
#line 2507 "ncgeny.c" /* yacc.c:1646 */
break;
case 129:
#line 821 "ncgen.y" /* yacc.c:1646 */
{datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
#line 2513 "ncgen.tab.c" /* yacc.c:1646 */
#line 2513 "ncgeny.c" /* yacc.c:1646 */
break;
case 130:
#line 825 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_CHAR);}
#line 2519 "ncgen.tab.c" /* yacc.c:1646 */
#line 2519 "ncgeny.c" /* yacc.c:1646 */
break;
case 131:
#line 826 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_BYTE);}
#line 2525 "ncgen.tab.c" /* yacc.c:1646 */
#line 2525 "ncgeny.c" /* yacc.c:1646 */
break;
case 132:
#line 827 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_SHORT);}
#line 2531 "ncgen.tab.c" /* yacc.c:1646 */
#line 2531 "ncgeny.c" /* yacc.c:1646 */
break;
case 133:
#line 828 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_INT);}
#line 2537 "ncgen.tab.c" /* yacc.c:1646 */
#line 2537 "ncgeny.c" /* yacc.c:1646 */
break;
case 134:
#line 829 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_INT64);}
#line 2543 "ncgen.tab.c" /* yacc.c:1646 */
#line 2543 "ncgeny.c" /* yacc.c:1646 */
break;
case 135:
#line 830 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_UBYTE);}
#line 2549 "ncgen.tab.c" /* yacc.c:1646 */
#line 2549 "ncgeny.c" /* yacc.c:1646 */
break;
case 136:
#line 831 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_USHORT);}
#line 2555 "ncgen.tab.c" /* yacc.c:1646 */
#line 2555 "ncgeny.c" /* yacc.c:1646 */
break;
case 137:
#line 832 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_UINT);}
#line 2561 "ncgen.tab.c" /* yacc.c:1646 */
#line 2561 "ncgeny.c" /* yacc.c:1646 */
break;
case 138:
#line 833 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_UINT64);}
#line 2567 "ncgen.tab.c" /* yacc.c:1646 */
#line 2567 "ncgeny.c" /* yacc.c:1646 */
break;
case 139:
#line 834 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_FLOAT);}
#line 2573 "ncgen.tab.c" /* yacc.c:1646 */
#line 2573 "ncgeny.c" /* yacc.c:1646 */
break;
case 140:
#line 835 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_DOUBLE);}
#line 2579 "ncgen.tab.c" /* yacc.c:1646 */
#line 2579 "ncgeny.c" /* yacc.c:1646 */
break;
case 141:
#line 836 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_STRING);}
#line 2585 "ncgen.tab.c" /* yacc.c:1646 */
#line 2585 "ncgeny.c" /* yacc.c:1646 */
break;
case 142:
#line 840 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
#line 2591 "ncgen.tab.c" /* yacc.c:1646 */
#line 2591 "ncgeny.c" /* yacc.c:1646 */
break;
case 143:
#line 841 "ncgen.y" /* yacc.c:1646 */
{(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));}
#line 2597 "ncgen.tab.c" /* yacc.c:1646 */
#line 2597 "ncgeny.c" /* yacc.c:1646 */
break;
case 144:
#line 846 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_INT);}
#line 2603 "ncgen.tab.c" /* yacc.c:1646 */
#line 2603 "ncgeny.c" /* yacc.c:1646 */
break;
case 145:
#line 848 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_UINT);}
#line 2609 "ncgen.tab.c" /* yacc.c:1646 */
#line 2609 "ncgeny.c" /* yacc.c:1646 */
break;
case 146:
#line 850 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_INT64);}
#line 2615 "ncgen.tab.c" /* yacc.c:1646 */
#line 2615 "ncgeny.c" /* yacc.c:1646 */
break;
case 147:
#line 852 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_UINT64);}
#line 2621 "ncgen.tab.c" /* yacc.c:1646 */
#line 2621 "ncgeny.c" /* yacc.c:1646 */
break;
case 148:
#line 856 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=makeconstdata(NC_STRING);}
#line 2627 "ncgen.tab.c" /* yacc.c:1646 */
#line 2627 "ncgeny.c" /* yacc.c:1646 */
break;
case 149:
#line 860 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=(yyvsp[0].constant);}
#line 2633 "ncgen.tab.c" /* yacc.c:1646 */
#line 2633 "ncgeny.c" /* yacc.c:1646 */
break;
case 150:
#line 861 "ncgen.y" /* yacc.c:1646 */
{(yyval.constant)=(yyvsp[0].constant);}
#line 2639 "ncgen.tab.c" /* yacc.c:1646 */
#line 2639 "ncgeny.c" /* yacc.c:1646 */
break;
case 151:
#line 867 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym)=(yyvsp[0].sym);}
#line 2645 "ncgen.tab.c" /* yacc.c:1646 */
#line 2645 "ncgeny.c" /* yacc.c:1646 */
break;
#line 2649 "ncgen.tab.c" /* yacc.c:1646 */
#line 2649 "ncgeny.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -3401,15 +3401,19 @@ datalistextend(Datalist* dl, NCConstant* con)
dlappend(dl,con);
}
/*
Try to infer the file type from the
kinds of constructs used in the cdl file.
*/
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_UBYTE: markcdf4("netCDF4/5 type: UBYTE"); break;
case NC_USHORT: markcdf4("netCDF4/5 type: USHORT"); break;
case NC_UINT: markcdf4("netCDF4/5 type: UINT"); break;
case NC_INT64: markcdf4("netCDF4/5 type: INT64"); break;
case NC_UINT64: markcdf4("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;

View File

@ -113,7 +113,7 @@ int nctype; /* for tracking attribute list type*/
Datalist* datalist;
NCConstant constant;
#line 117 "ncgen.tab.h" /* yacc.c:1909 */
#line 117 "ncgeny.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;