mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-21 08:39:46 +08:00
3ffe7be446
re: Discussion https://github.com/Unidata/netcdf-c/discussions/2214 The primary change is to support so-called "standard filters". A standard filter is one that is defined by the following netcdf-c API: ```` int nc_def_var_XXX(int ncid, int varid, size_t nparams, unsigned* params); int nc_inq_var_XXXX(int ncid, int varid, int* usefilterp, unsigned* params); ```` So for example, zstandard would be a standard filter by defining the functions *nc_def_var_zstandard* and *nc_inq_var_zstandard*. In order to define these functions, we need a new dispatch function: ```` int nc_inq_filter_avail(int ncid, unsigned filterid); ```` This function, combined with the existing filter API can be used to implement arbitrary standard filters using a simple code pattern. Note that I would have preferred that this function return a list of all available filters, but HDF5 does not support that functionality. So this PR implements the dispatch function and implements the following standard functions: + bzip2 + zstandard + blosc Specific test cases are also provided for HDF5 and NCZarr. Over time, other specific standard filters will be defined. ## Primary Changes * Add nc_inq_filter_avail() to netcdf-c API. * Add standard filter implementations to test use of *nc_inq_filter_avail*. * Bump the dispatch table version number and add to all the relevant dispatch tables (libsrc, libsrcp, etc). * Create a program to invoke nc_inq_filter_avail so that it is accessible to shell scripts. * Cleanup szip support to properly support szip when HDF5 is disabled. This involves detecting libsz separately from testing if HDF5 supports szip. * Integrate shuffle and fletcher32 into the existing filter API. This means that, for example, nc_def_var_fletcher32 is now a wrapper around nc_def_var_filter. * Extend the Codec defaulting to allow multiple default shared libraries. ## Misc. Changes * Modify configure.ac/CMakeLists.txt to look for the relevant libraries implementing standard filters. * Modify libnetcdf.settings to list available standard filters (including deflate and szip). * Add CMake test modules to locate libbz2 and libzstd. * Cleanup the HDF5 memory manager function use in the plugins. * remove unused file include//ncfilter.h * remove tests for the HDF5 memory operations e.g. H5allocate_memory. * Add flag to ncdump to force use of _Filter instead of _Deflate or _Shuffle or _Fletcher32. Used for testing.
71 lines
2.5 KiB
Makefile
71 lines
2.5 KiB
Makefile
## This is a automake file, part of Unidata's netCDF package.
|
|
# Copyright 2008, see the COPYRIGHT file for more information.
|
|
# This file builds and runs the ncgen program.
|
|
|
|
# Put together AM_CPPFLAGS and AM_LDFLAGS.
|
|
include $(top_srcdir)/lib_flags.am
|
|
LDADD = ${top_builddir}/liblib/libnetcdf.la
|
|
|
|
# Build ncgen from the listed sources.
|
|
bin_PROGRAMS = ncgen
|
|
|
|
ncgen_SOURCES = bindata.c bytebuffer.c cdata.c cvt.c data.c \
|
|
debug.c dump.c escapes.c f77data.c genbin.c \
|
|
genc.c genchar.c generate.c generr.c genf77.c \
|
|
genj.c genlib.c getfill.c jdata.c list.c \
|
|
main.c ncgeny.c semantics.c \
|
|
util.c bytebuffer.h data.h debug.h dump.h \
|
|
generate.h generr.h genlib.h includes.h list.h \
|
|
ncgen.h ncgeny.h util.h
|
|
|
|
# Obsolete
|
|
OBSOLETE = odom.c odom.h jdatastd.c jdatajni.c genjni.c cdfdata.c cmldata.c
|
|
|
|
# This is the man page.
|
|
man_MANS = ncgen.1
|
|
|
|
# These files all need to be distributed.
|
|
EXTRA_DIST = ncgen.y ncgen.l ncgenl.c $(man_MANS) internals.html \
|
|
c0.cdl c0_4.cdl ref_camrun.cdl \
|
|
ncf199.cdl CMakeLists.txt c5.cdl \
|
|
compound_datasize_test.cdl compound_datasize_test2.cdl \
|
|
tst_gattenum.cdl tst_usuffix.cdl
|
|
|
|
# This shell script causes ncgen to build a classic and a 64-bit
|
|
# offset file from a cdl file shipped with the distribution.
|
|
#if !BUILD_DLL
|
|
##
|
|
# Moved to ncdump as these tests rely on ncdump having been built.
|
|
##
|
|
#TESTS = run_tests.sh
|
|
#if USE_HDF5
|
|
#TESTS += run_nc4_tests.sh
|
|
#endif # USE_HDF5
|
|
#endif # !BUILD_DLL
|
|
|
|
CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
|
|
ncf199.nc c5.nc compound_datasize_test.nc compound_datasize_test2.nc \
|
|
tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl tst_ncf199.cdl \
|
|
tst_tst_gattenum.cdl tst_gattenum.nc \
|
|
tst_tst_usuffix.cdl tst_usuffix.nc \
|
|
tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl
|
|
|
|
# These rules are used if someone wants to rebuild ncgenl.c or ncgeny.c
|
|
# Otherwise never invoked, but records how to do it.
|
|
# BTW: note that renaming is essential because otherwise
|
|
# autoconf will forcibly delete files of the name *.tab.*
|
|
# Note also that this should be built under linux or cygwin
|
|
# using bison version 3 or later.
|
|
# Note also that this code is in a shell script if you do
|
|
# not want to other to ./configure.
|
|
|
|
makeparser::
|
|
rm -f ncgenl.c lex.ncg.c
|
|
flex -L -Pncg -8 ncgen.l
|
|
sed -e s/lex.ncg.c/ncgenl.c/g <lex.ncg.c >ncgenl.c
|
|
bison -pncg -t -d ncgen.y
|
|
rm -f ncgeny.c ncgeny.h
|
|
sed -e s/ncgen.tab.c/ncgeny.c/g -e s/ncgen.tab.h/ncgeny.h/g <ncgen.tab.c >ncgeny.c
|
|
sed -e s/ncgen.tab.c/ncgeny.c/g -e s/ncgen.tab.h/ncgeny.h/g <ncgen.tab.h >ncgeny.h
|
|
rm -f lex.ncg.c ncgen.tab.h ncgen.tab.c
|