2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-03-07 17:08:02 +08:00

Oops, forgot to test nc3 only.

Fixed some errors from that case.
This commit is contained in:
Dennis Heimbigner 2016-05-05 15:59:54 -06:00
parent 2e55a233eb
commit 5540749298
7 changed files with 28 additions and 23 deletions

2
cf
View File

@ -5,7 +5,7 @@ DB=1
#FAST=1
HDF5=1
DAP=1
#DAP=1
#PNETCDF=1
#PAR4=1

View File

@ -759,10 +759,12 @@ pr_att(
ncatt_t att; /* attribute */
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
#ifdef ENABLE_FILEINFO
if (ncid == getrootid(ncid)
&& varid == NC_GLOBAL
&& strcmp(att.name,NCPROPS)==0)
return; /* will be printed elsewere */
#endif
NC_CHECK( nc_inq_att(ncid, varid, att.name, &att.type, &att.len) );
att.tinfo = get_typeinfo(att.type);
@ -1132,6 +1134,7 @@ pr_attx(
int attvalslen = 0;
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
#ifdef ENABLE_FILEINFO
if (ncid == getrootid(ncid)
&& varid == NC_GLOBAL
&& strcmp(att.name,NCPROPS)==0
@ -1139,6 +1142,7 @@ pr_attx(
|| !formatting_specs.xopt_props)
)
return;
#endif
NC_CHECK( nc_inq_att(ncid, varid, att.name, &att.type, &att.len) );
/* Put attribute values into a single string, with blanks in between */
@ -1743,7 +1747,9 @@ do_ncdump_rec(int ncid, const char *path)
}
if (is_root && formatting_specs.special_atts) { /* output special attribute
* for format variant */
#ifdef ENABLE_FILEINFO
pr_att_hidden(ncid, kind);
#endif
pr_att_global_format(ncid, kind);
}

View File

@ -746,6 +746,7 @@ nc_inq_grps_full(int rootid, int *numgrps, int *grpids)
return stat;
}
#ifdef ENABLE_FILEINFO
int
getrootid(int grpid)
{
@ -759,4 +760,5 @@ getrootid(int grpid)
}
return current;
}
#endif

View File

@ -694,14 +694,14 @@ type_var_ref:
attrdecllist: /*empty*/ {} | attrdecl ';' attrdecllist {} ;
attrdecl:
':' ident '=' datalist
{ $$=makeattribute($2,NULL,NULL,$4,ATTRGLOBAL);}
| ':' _NCPROPS '=' conststring
':' _NCPROPS '=' conststring
{$$ = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&$4,ATTRGLOBAL);}
| ':' _ISNETCDF4 '=' constbool
{$$ = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&$4,ATTRGLOBAL);}
| ':' _SUPERBLOCK '=' constint
{$$ = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&$4,ATTRGLOBAL);}
| ':' ident '=' datalist
{ $$=makeattribute($2,NULL,NULL,$4,ATTRGLOBAL);}
| typeref type_var_ref ':' ident '=' datalist
{Symbol* tsym = $1; Symbol* vsym = $2; Symbol* asym = $4;
if(vsym->objectclass == NC_VAR) {
@ -1338,11 +1338,8 @@ makeattribute(Symbol* asym,
case ATTRGLOBAL:
asym->att.var = NULL; /* NULL => NC_GLOBAL*/
asym->typ.basetype = tsym;
// If we are adding NCPROPS to root group, then don't.
if(strcmp(NCPROPS,asym->name)!=0 || !currentgroup()->grp.is_root) {
addtogroup(asym);
listpush(gattdefs,(void*)asym);
}
listpush(gattdefs,(void*)asym);
addtogroup(asym);
break;
default: PANIC1("unexpected attribute type: %d",kind);
}

View File

@ -733,10 +733,10 @@ static const yytype_uint8 yydefact[] =
87, 0, 0, 0, 0, 115, 0, 4, 7, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 13, 14, 17, 23, 23, 23, 23, 86, 0,
0, 47, 58, 88, 148, 104, 90, 144, 146, 145,
147, 150, 149, 91, 92, 141, 130, 131, 132, 133,
0, 47, 58, 88, 148, 104, 89, 144, 146, 145,
147, 150, 149, 90, 91, 141, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 121, 122, 123,
115, 126, 89, 113, 114, 116, 118, 124, 125, 120,
115, 126, 92, 113, 114, 116, 118, 124, 125, 120,
105, 0, 0, 0, 115, 0, 0, 0, 0, 0,
0, 0, 115, 0, 16, 0, 15, 24, 19, 22,
21, 20, 0, 0, 18, 48, 0, 51, 53, 0,
@ -2262,25 +2262,25 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
case 89:
#line 698 "ncgen.y" /* yacc.c:1646 */
{ (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
{(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2267 "ncgeny.c" /* yacc.c:1646 */
break;
case 90:
#line 700 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
{(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2273 "ncgeny.c" /* yacc.c:1646 */
break;
case 91:
#line 702 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
{(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
#line 2279 "ncgeny.c" /* yacc.c:1646 */
break;
case 92:
#line 704 "ncgen.y" /* yacc.c:1646 */
{(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
{ (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
#line 2285 "ncgeny.c" /* yacc.c:1646 */
break;
@ -3345,11 +3345,8 @@ makeattribute(Symbol* asym,
case ATTRGLOBAL:
asym->att.var = NULL; /* NULL => NC_GLOBAL*/
asym->typ.basetype = tsym;
// If we are adding NCPROPS to root group, then don't.
if(strcmp(NCPROPS,asym->name)!=0 || !currentgroup()->grp.is_root) {
addtogroup(asym);
listpush(gattdefs,(void*)asym);
}
listpush(gattdefs,(void*)asym);
addtogroup(asym);
break;
default: PANIC1("unexpected attribute type: %d",kind);
}

View File

@ -766,7 +766,8 @@ processattributes(void)
List* list = listnew();
for(j=0;j<listlength(attdefs);j++) {
Symbol* asym = (Symbol*)listget(attdefs,j);
ASSERT(asym->att.var != NULL);
if(asym->att.var == NULL)
continue; /* ignore globals for now */
if(asym->att.var != vsym) continue;
listpush(list,(void*)asym);
}

View File

@ -696,7 +696,8 @@ kind_string(int kind)
return NULL;
}
int
#ifdef USE_NETCDF4i
nt
getrootid(int grpid)
{
int current = grpid;
@ -709,3 +710,4 @@ getrootid(int grpid)
}
return current;
}
#endif