mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Add BitRound to ncgen
This commit is contained in:
parent
7b8c39f722
commit
3299ba534b
@ -257,7 +257,7 @@ genbin_definespecialattributes(Symbol* var)
|
|||||||
}
|
}
|
||||||
CHECK_ERR(stat);
|
CHECK_ERR(stat);
|
||||||
}
|
}
|
||||||
if(special->flags & (_QUANTIZEBG_FLAG | _QUANTIZEGBR_FLAG)) {
|
if(special->flags & (_QUANTIZEBG_FLAG | _QUANTIZEGBR_FLAG | _QUANTIZEBR_FLAG)) {
|
||||||
stat = nc_def_var_quantize(var->container->nc_id,
|
stat = nc_def_var_quantize(var->container->nc_id,
|
||||||
var->nc_id, special->_Quantizer, special->_NSD);
|
var->nc_id, special->_Quantizer, special->_NSD);
|
||||||
CHECK_ERR(stat);
|
CHECK_ERR(stat);
|
||||||
|
@ -81,7 +81,8 @@ various C global variables
|
|||||||
#define _FILTER_FLAG 0x1000
|
#define _FILTER_FLAG 0x1000
|
||||||
#define _CODECS_FLAG 0x2000
|
#define _CODECS_FLAG 0x2000
|
||||||
#define _QUANTIZEBG_FLAG 0x4000
|
#define _QUANTIZEBG_FLAG 0x4000
|
||||||
#define _QUANTIZEGBR_FLAG 0x8000
|
#define _QUANTIZEGBR_FLAG 0x8000
|
||||||
|
#define _QUANTIZEBR_FLAG 0x10000
|
||||||
|
|
||||||
extern struct Specialtoken {
|
extern struct Specialtoken {
|
||||||
char* name;
|
char* name;
|
||||||
|
@ -140,6 +140,7 @@ struct Specialtoken specials[] = {
|
|||||||
{"_Codecs",_CODECS,_CODECS_FLAG},
|
{"_Codecs",_CODECS,_CODECS_FLAG},
|
||||||
{"_QuantizeBitGroomNumberOfSignificantDigits",_QUANTIZEBG,_QUANTIZEBG_FLAG},
|
{"_QuantizeBitGroomNumberOfSignificantDigits",_QUANTIZEBG,_QUANTIZEBG_FLAG},
|
||||||
{"_QuantizeGranularBitRoundNumberOfSignificantDigits",_QUANTIZEGBR,_QUANTIZEGBR_FLAG},
|
{"_QuantizeGranularBitRoundNumberOfSignificantDigits",_QUANTIZEGBR,_QUANTIZEGBR_FLAG},
|
||||||
|
{"_QuantizeBitRoundNumberOfSignificantDigits",_QUANTIZEBR,_QUANTIZEBR_FLAG},
|
||||||
{NULL,0} /* null terminate */
|
{NULL,0} /* null terminate */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -218,7 +219,7 @@ NUMBER [+-]?[0-9][0-9]*[Uu]?([BbSs]|[Ll]|[Ll][Ll])?
|
|||||||
DBLNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[LlDd]?|[+-]?[0-9]*{exp}[LlDd]?
|
DBLNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[LlDd]?|[+-]?[0-9]*{exp}[LlDd]?
|
||||||
FLTNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[Ff]|[+-]?[0-9]*{exp}[Ff]
|
FLTNUMBER [+-]?[0-9]*\.[0-9]*{exp}?[Ff]|[+-]?[0-9]*{exp}[Ff]
|
||||||
|
|
||||||
SPECIAL "_FillValue"|"_Format"|"_Storage"|"_ChunkSizes"|"_Fletcher32"|"_DeflateLevel"|"_Shuffle"|"_Endianness"|"_NoFill"|"_NCProperties"|"_IsNetcdf4"|"_SuperblockVersion"|"_Filter"|"_Codecs"|"_QuantizeBitgroomNumberOfSignificantDIgits"|"_QuantizeGranularBitRoundNumberOfSignificantDigits"
|
SPECIAL "_FillValue"|"_Format"|"_Storage"|"_ChunkSizes"|"_Fletcher32"|"_DeflateLevel"|"_Shuffle"|"_Endianness"|"_NoFill"|"_NCProperties"|"_IsNetcdf4"|"_SuperblockVersion"|"_Filter"|"_Codecs"|"_QuantizeBitgroomNumberOfSignificantDIgits"|"_QuantizeGranularBitRoundNumberOfSignificantDigits"|"_QuantizeBitRoundNumberOfSignificantDigits"
|
||||||
|
|
||||||
USASCII [\x01-\x7F]
|
USASCII [\x01-\x7F]
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ NCConstant* constant;
|
|||||||
_CODECS
|
_CODECS
|
||||||
_QUANTIZEBG
|
_QUANTIZEBG
|
||||||
_QUANTIZEGBR
|
_QUANTIZEGBR
|
||||||
|
_QUANTIZEBR
|
||||||
DATASETID
|
DATASETID
|
||||||
|
|
||||||
%type <sym> ident typename primtype dimd varspec
|
%type <sym> ident typename primtype dimd varspec
|
||||||
@ -778,6 +779,8 @@ attrdecl:
|
|||||||
{$$ = makespecial(_QUANTIZEBG_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
{$$ = makespecial(_QUANTIZEBG_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
||||||
| ambiguous_ref ':' _QUANTIZEGBR '=' constint
|
| ambiguous_ref ':' _QUANTIZEGBR '=' constint
|
||||||
{$$ = makespecial(_QUANTIZEGBR_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
{$$ = makespecial(_QUANTIZEGBR_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
||||||
|
| ambiguous_ref ':' _QUANTIZEBR '=' constint
|
||||||
|
{$$ = makespecial(_QUANTIZEBR_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
||||||
| ambiguous_ref ':' _NOFILL '=' constbool
|
| ambiguous_ref ':' _NOFILL '=' constbool
|
||||||
{$$ = makespecial(_NOFILL_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
{$$ = makespecial(_NOFILL_FLAG,$1,NULL,(void*)$5,ISCONST);}
|
||||||
| ':' _FORMAT '=' conststring
|
| ':' _FORMAT '=' conststring
|
||||||
@ -1248,6 +1251,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
|||||||
case _DEFLATE_FLAG:
|
case _DEFLATE_FLAG:
|
||||||
case _QUANTIZEBG_FLAG:
|
case _QUANTIZEBG_FLAG:
|
||||||
case _QUANTIZEGBR_FLAG:
|
case _QUANTIZEGBR_FLAG:
|
||||||
|
case _QUANTIZEBR_FLAG:
|
||||||
tmp = nullconst();
|
tmp = nullconst();
|
||||||
tmp->nctype = NC_INT;
|
tmp->nctype = NC_INT;
|
||||||
convert1(con,tmp);
|
convert1(con,tmp);
|
||||||
@ -1354,6 +1358,11 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
|||||||
special->_NSD = idata;
|
special->_NSD = idata;
|
||||||
special->flags |= _QUANTIZEGBR_FLAG;
|
special->flags |= _QUANTIZEGBR_FLAG;
|
||||||
break;
|
break;
|
||||||
|
case _QUANTIZEBR_FLAG:
|
||||||
|
special->_Quantizer = NC_QUANTIZE_BITROUND;
|
||||||
|
special->_NSD = idata;
|
||||||
|
special->flags |= _QUANTIZEBR_FLAG;
|
||||||
|
break;
|
||||||
case _SHUFFLE_FLAG:
|
case _SHUFFLE_FLAG:
|
||||||
special->_Shuffle = tf;
|
special->_Shuffle = tf;
|
||||||
special->flags |= _SHUFFLE_FLAG;
|
special->flags |= _SHUFFLE_FLAG;
|
||||||
|
982
ncgen/ncgenl.c
982
ncgen/ncgenl.c
File diff suppressed because it is too large
Load Diff
1299
ncgen/ncgeny.c
1299
ncgen/ncgeny.c
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,8 @@ extern int ncgdebug;
|
|||||||
_CODECS = 310, /* _CODECS */
|
_CODECS = 310, /* _CODECS */
|
||||||
_QUANTIZEBG = 311, /* _QUANTIZEBG */
|
_QUANTIZEBG = 311, /* _QUANTIZEBG */
|
||||||
_QUANTIZEGBR = 312, /* _QUANTIZEGBR */
|
_QUANTIZEGBR = 312, /* _QUANTIZEGBR */
|
||||||
DATASETID = 313 /* DATASETID */
|
_QUANTIZEBR = 313, /* _QUANTIZEBR */
|
||||||
|
DATASETID = 314 /* DATASETID */
|
||||||
};
|
};
|
||||||
typedef enum yytokentype yytoken_kind_t;
|
typedef enum yytokentype yytoken_kind_t;
|
||||||
#endif
|
#endif
|
||||||
@ -127,7 +128,7 @@ int nctype; /* for tracking attribute list type*/
|
|||||||
Datalist* datalist;
|
Datalist* datalist;
|
||||||
NCConstant* constant;
|
NCConstant* constant;
|
||||||
|
|
||||||
#line 131 "ncgeny.h"
|
#line 132 "ncgeny.h"
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef union YYSTYPE YYSTYPE;
|
typedef union YYSTYPE YYSTYPE;
|
||||||
|
Loading…
Reference in New Issue
Block a user