mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-11 16:40:36 +08:00
fix appel problems with data lists
This commit is contained in:
parent
2d46d44e96
commit
599f35d2e6
6
cf
6
cf
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#X="-x"
|
||||
|
||||
#HDF5=1
|
||||
HDF5=1
|
||||
#DAP=1
|
||||
#CDMR=1
|
||||
#RPC=1
|
||||
@ -98,8 +98,8 @@ FLAGS="$FLAGS --disable-pnetcdf"
|
||||
#FLAGS="$FLAGS --enable-dap-long-tests"
|
||||
#FLAGS="$FLAGS --with-udunits"
|
||||
#FLAGS="$FLAGS --with-libcf"
|
||||
FLAGS="$FLAGS --enable-benchmarks"
|
||||
FLAGS="$FLAGS --enable-extra-tests"
|
||||
#FLAGS="$FLAGS --enable-benchmarks"
|
||||
#FLAGS="$FLAGS --enable-extra-tests"
|
||||
|
||||
FLAGS="$FLAGS --disable-shared"
|
||||
#FLAGS="$FLAGS --enable-shared"
|
||||
|
@ -15,7 +15,7 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
|
||||
AC_PREREQ([2.59])
|
||||
|
||||
# Initialize with name, version, and support email address.
|
||||
AC_INIT([netCDF], [4.2-rc1], [support-netcdf@unidata.ucar.edu])
|
||||
AC_INIT([netCDF], [4.2-rc2], [support-netcdf@unidata.ucar.edu])
|
||||
|
||||
# Create the VERSION file, which contains the package version from
|
||||
# AC_INIT.
|
||||
|
@ -8,13 +8,21 @@
|
||||
either.
|
||||
*/
|
||||
|
||||
#include <nc_tests.h>
|
||||
#include "nc_tests.h"
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
|
||||
#define FILE_NAME "tst_h_mem.h5"
|
||||
#define STR_LEN 255
|
||||
|
||||
const char*
|
||||
nc_strerror(int ncerr)
|
||||
{
|
||||
static char msg[1024];
|
||||
snprintf(msg,sizeof(msg),"error: %d\n",ncerr);
|
||||
return msg;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
|
@ -129,22 +129,42 @@ bindata_basetype(Symbol* tsym, Datasrc* datasrc, Bytebuffer* memory, Datalist* f
|
||||
case NC_VLEN: {
|
||||
Constant* con;
|
||||
nc_vlen_t ptr;
|
||||
if(!isfillvalue(datasrc) && !issublist(datasrc)) {/* fail on no compound*/
|
||||
semerror(srcline(datasrc),"Vlen data must be enclosed in {..}");
|
||||
}
|
||||
con = srcnext(datasrc);
|
||||
if(con == NULL || con->nctype == NC_FILLVALUE) {
|
||||
Datalist* filler = getfiller(tsym,fillsrc);
|
||||
ASSERT(filler->length == 1);
|
||||
con = &filler->data[0];
|
||||
if(con->nctype != NC_COMPOUND) {
|
||||
semerror(con->lineno,"Vlen data fill value is not enclosed in {..}");
|
||||
Bytebuffer* vlenmem;
|
||||
int count;
|
||||
int pushed = 0;
|
||||
Datasrc* olddatasrc = NULL;
|
||||
|
||||
if(isfillvalue(datasrc)) {
|
||||
con = srcnext(datasrc);
|
||||
if(con == NULL || con->nctype == NC_FILLVALUE) {
|
||||
Datalist* filler = getfiller(tsym,fillsrc);
|
||||
ASSERT(filler->length == 1);
|
||||
con = &filler->data[0];
|
||||
if(con->nctype != NC_COMPOUND) {
|
||||
semerror(con->lineno,"Vlen data fill value is not enclosed in {..}");
|
||||
} else {
|
||||
olddatasrc = datasrc;
|
||||
datasrc = const2src(con);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* generate the nc_vlen_t instance*/
|
||||
ptr.p = vlendata[con->value.compoundv->vlen.uid].data;
|
||||
ptr.len = vlendata[con->value.compoundv->vlen.uid].count;
|
||||
if(!issublist(datasrc)) {
|
||||
semerror(srcline(datasrc),"Vlen data must be enclosed in {..}");
|
||||
} else {
|
||||
SRCPUSH(pushed,datasrc);
|
||||
}
|
||||
|
||||
/* collect the nc_vlen_t instance*/
|
||||
vlenmem = bbNew();
|
||||
for(count=0;srcmore(datasrc);count++) {
|
||||
bindata_basetype(tsym->typ.basetype,datasrc,vlenmem,NULL);
|
||||
}
|
||||
ptr.len = count;
|
||||
ptr.p = bbDup(vlenmem);
|
||||
bbFree(vlenmem);
|
||||
bbAppendn(memory,(char*)&ptr,sizeof(ptr));
|
||||
if(pushed) srcpop(datasrc);
|
||||
if(olddatasrc) datasrc = olddatasrc;
|
||||
} break;
|
||||
|
||||
case NC_FIELD:
|
||||
@ -305,6 +325,7 @@ done:
|
||||
}
|
||||
|
||||
|
||||
#ifdef IGNORE
|
||||
/*
|
||||
This walk of the data lists collects
|
||||
vlen sublists and constructs separate C constants
|
||||
@ -353,5 +374,6 @@ bindata_vlenconstants(List* vlenconstants)
|
||||
}
|
||||
bbFree(memory);
|
||||
}
|
||||
#endif /*IGNORE*/
|
||||
|
||||
#endif /*ENABLE_BINARY*/
|
||||
|
@ -26,6 +26,9 @@ EXTERNC int bbFill(Bytebuffer*, const char fill);
|
||||
/* Produce a duplicate of the contents*/
|
||||
EXTERNC char* bbDup(const Bytebuffer*);
|
||||
|
||||
/* pull a duplicate of the contents*/
|
||||
EXTERNC char* bbDup(const Bytebuffer*);
|
||||
|
||||
/* Return the ith char; -1 if no such char */
|
||||
EXTERNC int bbGet(Bytebuffer*,unsigned int);
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
static void cdata_primdata(Symbol*, Datasrc*, Bytebuffer*, Datalist*);
|
||||
static void cdata_fieldarray(Symbol*, Datasrc*, Odometer*, int, Bytebuffer*, Datalist* fillsrc);
|
||||
|
||||
/* vlen uid generator */
|
||||
static int uid = 0;
|
||||
|
||||
/* Specialty wrappers for cdata_data */
|
||||
void
|
||||
cdata_attrdata(Symbol* asym, Bytebuffer* codebuf)
|
||||
@ -128,23 +131,47 @@ cdata_basetype(Symbol* tsym, Datasrc* datasrc, Bytebuffer* codebuf, Datalist* fi
|
||||
|
||||
case NC_VLEN: {
|
||||
Constant* con;
|
||||
if(!isfillvalue(datasrc) && !issublist(datasrc)) {/* fail on no compound*/
|
||||
semerror(srcline(datasrc),"Vlen data must be enclosed in {..}");
|
||||
}
|
||||
con = srcnext(datasrc);
|
||||
if(con == NULL || con->nctype == NC_FILLVALUE) {
|
||||
Datalist* filler = getfiller(tsym,fillsrc);
|
||||
ASSERT(filler->length == 1);
|
||||
con = &filler->data[0];
|
||||
if(con->nctype != NC_COMPOUND) {
|
||||
semerror(con->lineno,"Vlen data fill value is not enclosed in {..}");
|
||||
nc_vlen_t ptr;
|
||||
Bytebuffer* vlenmem;
|
||||
int count;
|
||||
int pushed = 0;
|
||||
Datasrc* olddatasrc = NULL;
|
||||
if(isfillvalue(datasrc)) {
|
||||
con = srcnext(datasrc);
|
||||
if(con == NULL || con->nctype == NC_FILLVALUE) {
|
||||
Datalist* filler = getfiller(tsym,fillsrc);
|
||||
ASSERT(filler->length == 1);
|
||||
con = &filler->data[0];
|
||||
if(con->nctype != NC_COMPOUND) {
|
||||
semerror(con->lineno,"Vlen data fill value is not enclosed in {..}");
|
||||
} else {
|
||||
olddatasrc = datasrc;
|
||||
datasrc = const2src(con);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!issublist(datasrc)) {
|
||||
semerror(srcline(datasrc),"Vlen data must be enclosed in {..}");
|
||||
} else {
|
||||
SRCPUSH(pushed,datasrc);
|
||||
}
|
||||
|
||||
/* generate the nc_vlen_t instance*/
|
||||
bbprintf0(stmt,"{%u (void*)vlen_%u}",
|
||||
con->value.compoundv->vlen.count,
|
||||
con->value.compoundv->vlen.uid);
|
||||
vlenmem = bbNew();
|
||||
for(count=0;srcmore(datasrc);count++) {
|
||||
cdata_basetype(tsym->typ.basetype,datasrc,vlenmem,NULL);
|
||||
}
|
||||
|
||||
/* generate the nc_vlen_t instance*/
|
||||
bbprintf0(stmt,"{%u (void*)vlen_%u}",count,++uid);
|
||||
bbCatbuf(codebuf,stmt);
|
||||
|
||||
ptr.len = count;
|
||||
ptr.p = bbDup(vlenmem);
|
||||
bbFree(vlenmem);
|
||||
if(pushed) srcpop(datasrc);
|
||||
if(olddatasrc) datasrc = olddatasrc;
|
||||
|
||||
} break;
|
||||
|
||||
case NC_FIELD:
|
||||
|
@ -97,7 +97,6 @@ int isstringable(nc_type nctype);
|
||||
void bindata_array(struct Symbol*,Bytebuffer*,Datasrc*,Odometer*,int,Datalist*);
|
||||
void bindata_attrdata(struct Symbol* asym, Bytebuffer*);
|
||||
void bindata_vardata(struct Symbol* vsym, Bytebuffer*);
|
||||
void bindata_vlenconstants(List*);
|
||||
void bindata_basetype(struct Symbol*,struct Datasrc*,Bytebuffer*,struct Datalist*);
|
||||
#endif
|
||||
|
||||
@ -208,7 +207,7 @@ extern Constant fillconstant;
|
||||
|
||||
/* From genchar.c */
|
||||
void gen_charattr(struct Symbol* asym, Bytebuffer* databuf);
|
||||
void gen_chararray(struct Symbol* vsym, Bytebuffer* databuf, Datalist* fillsrc);
|
||||
void gen_chararray(struct Symbol* vsym, Datasrc*, Bytebuffer* databuf, Datalist* fillsrc);
|
||||
void gen_charfield(Datasrc* src, Odometer*, Bytebuffer* databuf);
|
||||
void gen_charvlen(Datasrc*, Bytebuffer*);
|
||||
int collectstring(struct Constant*, size_t, Bytebuffer*, int);
|
||||
|
@ -13,7 +13,9 @@
|
||||
|
||||
#undef TRACE
|
||||
|
||||
#ifdef IGNORE
|
||||
extern List* vlenconstants;
|
||||
#endif
|
||||
|
||||
/* Forward*/
|
||||
static void genbin_defineattr(Symbol* asym,Bytebuffer*);
|
||||
@ -124,7 +126,9 @@ gen_netcdf(const char *filename)
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
/* Collect vlen data*/
|
||||
#ifdef IGNORE
|
||||
bindata_vlenconstants(vlenconstants);
|
||||
#endif
|
||||
|
||||
/* define special variable properties */
|
||||
if(nvars > 0) {
|
||||
@ -443,8 +447,6 @@ genbin_defineattr(Symbol* asym,Bytebuffer* databuf)
|
||||
static void
|
||||
genbin_definevardata(Symbol* vsym)
|
||||
{
|
||||
int varid, grpid;
|
||||
int rank;
|
||||
Bytebuffer* memory;
|
||||
nciter_t iter;
|
||||
Odometer* odom = NULL;
|
||||
@ -452,10 +454,13 @@ genbin_definevardata(Symbol* vsym)
|
||||
int chartype = (vsym->typ.basetype->typ.typecode == NC_CHAR);
|
||||
Datalist* fillsrc = vsym->var.special._Fillvalue;
|
||||
int isscalar = (vsym->typ.dimset.ndims == 0);
|
||||
Datasrc* src;
|
||||
|
||||
#ifdef IGNORE
|
||||
grpid = vsym->container->ncid,
|
||||
varid = vsym->ncid;
|
||||
rank = vsym->typ.dimset.ndims;
|
||||
#endif
|
||||
|
||||
memory = bbNew();
|
||||
/* give the buffer a running start to be large enough*/
|
||||
@ -463,14 +468,15 @@ genbin_definevardata(Symbol* vsym)
|
||||
|
||||
if(vsym->data == NULL) return;
|
||||
|
||||
src = datalist2src(vsym->data);
|
||||
|
||||
/* Generate character constants separately */
|
||||
if(!isscalar && chartype) {
|
||||
gen_chararray(vsym,memory,fillsrc);
|
||||
gen_chararray(vsym,src,memory,fillsrc);
|
||||
/* generate a corresponding odometer */
|
||||
odom = newodometer(&vsym->typ.dimset,NULL,NULL);
|
||||
genbin_write(vsym,memory,odom,0);
|
||||
} else { /* not character constant */
|
||||
Datasrc* src = datalist2src(vsym->data);
|
||||
if(isscalar) { /*scalar */
|
||||
bindata_basetype(vsym->typ.basetype,src,memory,fillsrc); /*scalar*/
|
||||
if(bbLength(memory) > 0)
|
||||
@ -504,6 +510,10 @@ fprintf(stderr,"]\n");
|
||||
}
|
||||
odometerfree(odom);
|
||||
bbFree(memory);
|
||||
/* See if we have too much data */
|
||||
if(srcmore(src)) {
|
||||
semerror(srcline(src),"Extra data found at end of datalist");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1081,19 +1081,19 @@ genc_definevardata(Symbol* vsym)
|
||||
int chartype = (vsym->typ.basetype->typ.typecode == NC_CHAR);
|
||||
|
||||
if(vsym->data == NULL) return;
|
||||
src = datalist2src(vsym->data);
|
||||
|
||||
code = bbNew();
|
||||
/* give the buffer a running start to be large enough*/
|
||||
bbSetalloc(code, nciterbuffersize);
|
||||
|
||||
if(!isscalar && chartype) {
|
||||
gen_chararray(vsym,code,fillsrc);
|
||||
gen_chararray(vsym,src,code,fillsrc);
|
||||
/* generate a corresponding odometer */
|
||||
odom = newodometer(&vsym->typ.dimset,NULL,NULL);
|
||||
/* patch the odometer to use the right counts */
|
||||
genc_write(vsym,code,odom,0);
|
||||
} else { /* not character constant */
|
||||
src = datalist2src(vsym->data);
|
||||
fillsrc = vsym->var.special._Fillvalue;
|
||||
/* Handle special cases first*/
|
||||
if(isscalar) {
|
||||
|
@ -21,7 +21,7 @@ So, this rather ugly code is kept in this file
|
||||
and a variety of heuristics are used to mimic ncgen.
|
||||
*/
|
||||
|
||||
static void gen_chararrayr(Dimset*, Bytebuffer*, int index, Datalist*, int fillchar, size_t);
|
||||
static void gen_chararrayr(Dimset*, Bytebuffer*, int index, Datasrc*, int fillchar, size_t);
|
||||
|
||||
extern List* vlenconstants;
|
||||
|
||||
@ -120,20 +120,17 @@ datalistpad(Datalist* data, size_t targetlen)
|
||||
1. pad
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void
|
||||
gen_chararray(Symbol* vsym, Bytebuffer* databuf, Datalist* fillsrc)
|
||||
gen_chararray(Symbol* vsym, Datasrc* data, Bytebuffer* databuf, Datalist* fillsrc)
|
||||
{
|
||||
int i,fillchar = getfillchar(fillsrc);
|
||||
Datalist* data = vsym->data;
|
||||
int lastunlimitedindex = lastunlimited(&vsym->typ.dimset);
|
||||
|
||||
/* If there is no unlimited, then treat similarly to a field array */
|
||||
if(lastunlimitedindex < 0) {
|
||||
/* Semantics.c:walkchararray will have done all the hard work */
|
||||
for(i=0;i<data->length;i++) {
|
||||
Constant* con = data->data+i;
|
||||
while(srcmore(data)) {
|
||||
Constant* con = srcnext(data);
|
||||
ASSERT(con->nctype == NC_STRING);
|
||||
bbAppendn(databuf,con->value.stringv.stringv,con->value.stringv.len);
|
||||
}
|
||||
@ -152,7 +149,7 @@ gen_chararray(Symbol* vsym, Bytebuffer* databuf, Datalist* fillsrc)
|
||||
}
|
||||
|
||||
static void
|
||||
gen_chararrayr(Dimset* dimset, Bytebuffer* databuf, int index, Datalist* data,
|
||||
gen_chararrayr(Dimset* dimset, Bytebuffer* databuf, int index, Datasrc* data,
|
||||
int fillchar, size_t subsize)
|
||||
{
|
||||
int i;
|
||||
@ -164,8 +161,8 @@ gen_chararrayr(Dimset* dimset, Bytebuffer* databuf, int index, Datalist* data,
|
||||
if(index == lastunlimitedindex) {
|
||||
Constant* con;
|
||||
/* pad to the unlimited size of the dimension * subsize */
|
||||
ASSERT(data->length == 1);
|
||||
con = data->data;
|
||||
ASSERT(srcmore(data));
|
||||
con = srcnext(data);
|
||||
ASSERT(con->nctype == NC_STRING);
|
||||
padstring(con,dim->dim.unlimitedsize*subsize,fillchar);
|
||||
bbAppendn(databuf,con->value.stringv.stringv,con->value.stringv.len);
|
||||
@ -173,16 +170,16 @@ gen_chararrayr(Dimset* dimset, Bytebuffer* databuf, int index, Datalist* data,
|
||||
/* data should be a set of compounds */
|
||||
size_t expected = (isunlimited ? dim->dim.unlimitedsize : dim->dim.declsize );
|
||||
for(i=0;i<expected;i++) {
|
||||
|
||||
if(i >= data->length) {/* pad buffer */
|
||||
if(!srcmore(data)) { /* pad buffer */
|
||||
int j;
|
||||
for(j=0;j<subsize;j++) bbAppend(databuf,fillchar);
|
||||
} else {
|
||||
Constant* con = data->data+i;
|
||||
Datasrc* subdata;
|
||||
Constant* con = srcnext(data);
|
||||
if(con->nctype != NC_COMPOUND) continue;
|
||||
/* recurse */
|
||||
gen_chararrayr(dimset,databuf,index+1,con->value.compoundv,
|
||||
fillchar,subsize);
|
||||
subdata = datalist2src(con->value.compoundv);
|
||||
gen_chararrayr(dimset,databuf,index+1,subdata,fillchar,subsize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,15 +50,13 @@ void
|
||||
gen_ncf77(const char *filename)
|
||||
{
|
||||
int idim, ivar, iatt;
|
||||
int ndims, nvars, natts, ngatts, ngrps, ntyps;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
char* cmode_string;
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
ngrps = listlength(grpdefs);
|
||||
ntyps = listlength(typdefs);
|
||||
|
||||
/* Construct the main program */
|
||||
|
||||
@ -544,12 +542,10 @@ f77fold(Bytebuffer* lines)
|
||||
char* s;
|
||||
char* line0;
|
||||
char* linen;
|
||||
int linesize;
|
||||
static char trimchars[] = " \t\r\n";
|
||||
|
||||
s = bbDup(lines);
|
||||
bbClear(lines);
|
||||
linesize = 0;
|
||||
line0 = s;
|
||||
/* Start by trimming leading blanks and empty lines */
|
||||
while(*line0 && strchr(trimchars,*line0) != NULL) line0++;
|
||||
@ -771,18 +767,17 @@ genf77_definevardata(Symbol* vsym)
|
||||
int chartype = (vsym->typ.basetype->typ.typecode == NC_CHAR);
|
||||
|
||||
if(vsym->data == NULL) return;
|
||||
src = datalist2src(vsym->data);
|
||||
|
||||
code = bbNew();
|
||||
/* give the buffer a running start to be large enough*/
|
||||
bbSetalloc(code, nciterbuffersize);
|
||||
|
||||
if(!isscalar && chartype) {
|
||||
gen_chararray(vsym,code,fillsrc);
|
||||
gen_chararray(vsym,src,code,fillsrc);
|
||||
genf77_write(vsym,code,NULL,0,0);
|
||||
} else { /* not character constant */
|
||||
src = datalist2src(vsym->data);
|
||||
fillsrc = vsym->var.special._Fillvalue;
|
||||
|
||||
/* Handle special cases first*/
|
||||
if(isscalar) {
|
||||
f77data_basetype(vsym->typ.basetype,src,code,fillsrc);
|
||||
|
12
ncgen/genj.c
12
ncgen/genj.c
@ -41,15 +41,12 @@ void
|
||||
gen_ncjava(const char *filename)
|
||||
{
|
||||
int idim, ivar, iatt, maxdims;
|
||||
int ndims, nvars, natts, ngatts, ngrps, ntyps;
|
||||
char* cmode_string;
|
||||
int ndims, nvars, natts, ngatts;
|
||||
|
||||
ndims = listlength(dimdefs);
|
||||
nvars = listlength(vardefs);
|
||||
natts = listlength(attdefs);
|
||||
ngatts = listlength(gattdefs);
|
||||
ngrps = listlength(grpdefs);
|
||||
ntyps = listlength(typdefs);
|
||||
|
||||
/* Construct the main class */
|
||||
codeline("import java.util.*;");
|
||||
@ -105,6 +102,7 @@ gen_ncjava(const char *filename)
|
||||
codeline("");
|
||||
codelined(1,"/* enter define mode */");
|
||||
|
||||
#ifdef IGNORE
|
||||
if(!cmode_modifier) {
|
||||
cmode_string = "NC_CLOBBER";
|
||||
} else if(cmode_modifier & NC_64BIT_OFFSET) {
|
||||
@ -113,6 +111,7 @@ gen_ncjava(const char *filename)
|
||||
derror("unknown cmode modifier");
|
||||
cmode_string = "NC_CLOBBER";
|
||||
}
|
||||
#endif
|
||||
|
||||
bbprintf0(stmt,
|
||||
"%sNetcdfFileWriteable ncfile = NetcdfFileWriteable.createNew(\"%s\", %s);\n",
|
||||
@ -554,18 +553,17 @@ genj_definevardata(Symbol* vsym)
|
||||
int chartype = (vsym->typ.basetype->typ.typecode == NC_CHAR);
|
||||
|
||||
if(vsym->data == NULL) return;
|
||||
src = datalist2src(vsym->data);
|
||||
|
||||
code = bbNew();
|
||||
/* give the buffer a running start to be large enough*/
|
||||
bbSetalloc(code, nciterbuffersize);
|
||||
|
||||
if(!isscalar && chartype) {
|
||||
gen_chararray(vsym,code,fillsrc);
|
||||
gen_chararray(vsym,src,code,fillsrc);
|
||||
genj_write(vsym,code,NULL,0,0);
|
||||
} else { /* not character constant */
|
||||
src = datalist2src(vsym->data);
|
||||
fillsrc = vsym->var.special._Fillvalue;
|
||||
|
||||
/* Handle special cases first*/
|
||||
if(isscalar) {
|
||||
jdata_basetype(vsym->typ.basetype,src,code,fillsrc);
|
||||
|
@ -638,17 +638,20 @@ the variable
|
||||
Specifying datalists for variables in the `data:` section can be somewhat
|
||||
complicated. There are some rules that must be followed
|
||||
to ensure that datalists are parsed correctly by ncgen.
|
||||
.LP
|
||||
First, the top level is automatically assumed to be a list of items, so it should not be inside {...}.
|
||||
That means that if the variable is a scalar, there will be a single top-level element
|
||||
and if the variable is an array, there will be N top-level elements.
|
||||
For each element of the top level list, the following rules should be applied.
|
||||
.IP 1. 3
|
||||
The top level is automatically assumed to be a list of items, so it should not be inside {...}.
|
||||
.IP 2. 3
|
||||
Instances of UNLIMITED dimensions (other than the first dimension) must be surrounded by {...} in order to specify the size.
|
||||
.IP 3. 3
|
||||
Instances of vlens must be surrounded by {...} in order to specify the size.
|
||||
.IP 4. 3
|
||||
.IP 2. 3
|
||||
Compound instances must be embedded in {...}
|
||||
.IP 5. 3
|
||||
.IP 3. 3
|
||||
Non-scalar fields of compound instances must be embedded in {...}.
|
||||
.IP 6. 3
|
||||
.IP 4. 3
|
||||
Instances of vlens must be surrounded by {...} in order to specify the size.
|
||||
.LP
|
||||
Datalists associated with attributes are implicitly a vector (i.e., a list) of values of the type of the attribute and the above rules must apply with that in mind.
|
||||
.IP 7. 3
|
||||
No other use of braces is allowed.
|
||||
|
@ -33,6 +33,7 @@
|
||||
#define NC_ARRAY 107
|
||||
#define NC_PRIM 108 /*Including NC_STRING */
|
||||
#define NC_STRUCT NC_COMPOUND /* alias */
|
||||
#define NC_LIST NC_COMPOUND /* alias */
|
||||
|
||||
/* Extend nc types with generic fill value*/
|
||||
#define NC_FILLVALUE 31
|
||||
|
@ -1088,10 +1088,8 @@ walkfieldarray(Symbol* basetype, Datasrc* src, Dimset* dimset, int index)
|
||||
int lastdim = (index == (rank-1));
|
||||
Symbol* dim = dimset->dimsyms[index];
|
||||
size_t datasize = dim->dim.declsize;
|
||||
size_t count = 0;
|
||||
|
||||
ASSERT(datasize != 0);
|
||||
count = datasize;
|
||||
for(i=0;i<datasize;i++) {
|
||||
if(lastdim)
|
||||
walktype(basetype,src,NULL);
|
||||
@ -1214,7 +1212,6 @@ walkchararray(Symbol* vsym, Datalist* fillsrc)
|
||||
{
|
||||
Dimset* dimset = &vsym->typ.dimset;
|
||||
int lastunlimindex;
|
||||
int simpleunlim;
|
||||
int rank = dimset->ndims;
|
||||
Symbol* lastdim = dimset->dimsyms[rank-1];
|
||||
size_t lastdimsize = lastdim->dim.declsize;
|
||||
@ -1222,7 +1219,9 @@ walkchararray(Symbol* vsym, Datalist* fillsrc)
|
||||
int fillchar = getfillchar(fillsrc);
|
||||
|
||||
lastunlimindex = lastunlimited(dimset);
|
||||
#ifdef IGNORE
|
||||
simpleunlim = (lastunlimindex == 0);
|
||||
#endif
|
||||
/* If the unlimited is also the last dimension, then do no padding */
|
||||
if(lastdimsize == 0) lastdimsize = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user