diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 70432e5c4a..93edb15cef 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -2,6 +2,9 @@ name: NetCDF-C CMake CI - Windows on: [pull_request, workflow_dispatch] +env: + REMOTETESTDOWN: ${{ vars.REMOTETESTDOWN }} + concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true @@ -160,4 +163,4 @@ jobs: run: | cd build PATH=~/tmp/bin:$PATH ctest . --rerun-failed --output-on-failure -VV - if: ${{ failure() }} \ No newline at end of file + if: ${{ failure() }} diff --git a/.github/workflows/run_tests_cdash.yml b/.github/workflows/run_tests_cdash.yml index 1d135a1b04..dfb8572560 100644 --- a/.github/workflows/run_tests_cdash.yml +++ b/.github/workflows/run_tests_cdash.yml @@ -4,8 +4,11 @@ name: Run CDash Ubuntu/Linux netCDF Tests -on: workflow_dispatch +on: [workflow_dispatch] +env: + REMOTETESTDOWN: ${{ vars.REMOTETESTDOWN }} + concurrency: group: ${{ github.workflow}}-${{ github.head_ref }} cancel-in-progress: true diff --git a/.github/workflows/run_tests_osx.yml b/.github/workflows/run_tests_osx.yml index ba64c777c2..3ee56117ee 100644 --- a/.github/workflows/run_tests_osx.yml +++ b/.github/workflows/run_tests_osx.yml @@ -300,7 +300,7 @@ jobs: - name: Configure shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-xml2 + run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-libxml2 if: ${{ success() }} - name: Look at config.log if error diff --git a/.github/workflows/run_tests_s3.yml b/.github/workflows/run_tests_s3.yml deleted file mode 100644 index b7f9d3fe6f..0000000000 --- a/.github/workflows/run_tests_s3.yml +++ /dev/null @@ -1,157 +0,0 @@ -### -# Test S3 Support -# -- derived from run_tests_ubuntu.yml -### - -### -# Build hdf5 dependencies and cache them in a combined directory. -### - -name: Run S3 netCDF Tests (under Ubuntu Linux) - -on: [workflow_dispatch] - -concurrency: - group: ${{ github.workflow}}-${{ github.head_ref }} - cancel-in-progress: true - -jobs: - - build-deps-serial: - - runs-on: ubuntu-latest - - strategy: - matrix: - hdf5: [ 1.10.8, 1.12.2, 1.14.3 ] - - steps: - - uses: actions/checkout@v4 - - - name: Install System dependencies - shell: bash -l {0} - run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev - - ### - # Installing libhdf5 - ### - - name: Cache libhdf5-${{ matrix.hdf5 }} - id: cache-hdf5 - uses: actions/cache@v4 - with: - path: ~/environments/${{ matrix.hdf5 }} - key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }} - - - - name: Build libhdf5-${{ matrix.hdf5 }} - if: steps.cache-hdf5.outputs.cache-hit != 'true' - run: | - set -x - - wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-$(echo ${{ matrix.hdf5 }} | cut -d. -f 1,2)/hdf5-${{ matrix.hdf5 }}/src/hdf5-${{ matrix.hdf5 }}.tar.bz2 - tar -jxf hdf5-${{ matrix.hdf5 }}.tar.bz2 - pushd hdf5-${{ matrix.hdf5 }} - ./configure --disable-static --enable-shared --prefix=${HOME}/environments/${{ matrix.hdf5 }} --enable-hl --with-szlib - make -j - make install -j - popd - - - ##### - # S3 Autotools-based tests. - ##### - ## - # Serial - ## - nc-ac-tests-s3-serial: - - needs: build-deps-serial - runs-on: ubuntu-latest - - strategy: - matrix: - hdf5: [ 1.14.3 ] - steps: - - - uses: actions/checkout@v4 - - - name: Install System dependencies - shell: bash -l {0} - run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev openssl libssl-dev - - ### - # Set Environmental Variables - ### - - - run: echo "CFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}/include" >> $GITHUB_ENV - - run: echo "LDFLAGS=-L${HOME}/environments/${{ matrix.hdf5 }}/lib" >> $GITHUB_ENV - - run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}/lib" >> $GITHUB_ENV - - - ### - # Fetch Cache - ### - - - name: Fetch HDF Cache - id: cache-hdf - uses: actions/cache@v4 - with: - path: ~/environments/${{ matrix.hdf5 }} - key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }} - - - name: Check Cache - shell: bash -l {0} - run: ls ${HOME}/environments && ls ${HOME}/environments/${{ matrix.hdf5 }} && ls ${HOME}/environments/${{ matrix.hdf5}}/lib - - ### - # Configure and build - ### - - - name: Run autoconf - shell: bash -l {0} - run: autoreconf -if - - - name: Configure - shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --disable-dap --enable-external-server-tests --enable-s3 --enable-s3-internal --with-s3-testing=public - if: ${{ success() }} - - - name: Look at config.log if error - shell: bash -l {0} - run: cat config.log - if: ${{ failure() }} - - - name: Print Summary - shell: bash -l {0} - run: cat libnetcdf.settings - - - name: Build Library and Utilities - shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j - if: ${{ success() }} - - - name: Build Tests - shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check TESTS="" -j - if: ${{ success() }} - - - name: Run Tests - shell: bash -l {0} - env: - AWS_PROFILE: ${{ secrets.DEFAULT_PROFILE }} - run: | - mkdir -p ~/.aws - echo "" > ~/.aws/config - chmod go-x ~/.aws/config - echo "${AWS_PROFILE}" >> ~/.aws/config - LD_LIBRARY_PATH="/home/runner/work/netcdf-c/netcdf-c/liblib/.libs:${LD_LIBRARY_PATH}" - CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check -j - if: ${{ success() }} - - ##### - # S3 CMake-based tests. - ##### - ## - # Serial - ## - # T.B.D. nc-cmake-tests-s3-serial: diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index a755db876e..3ec6a595cd 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -4,7 +4,10 @@ name: Run Ubuntu/Linux netCDF Tests -on: [pull_request, workflow_dispatch] +on: [pull_request,workflow_dispatch] + +env: + REMOTETESTDOWN: ${{ vars.REMOTETESTDOWN }} concurrency: group: ${{ github.workflow}}-${{ github.head_ref }} @@ -171,7 +174,7 @@ jobs: - name: Configure shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-xml2 + run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-libxml2 if: ${{ success() }} - name: Look at config.log if error @@ -266,7 +269,7 @@ jobs: - name: Configure shell: bash -l {0} - run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-xml2 --disable-shared --enable-static + run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-libxml2 --disable-shared --enable-static if: ${{ success() }} - name: Look at config.log if error diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index e7a4d8002a..887a64ebbb 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -10,13 +10,14 @@ env: SHELLOPTS: igncr CHERE_INVOKING: 1 CYGWIN_NOWINPATH: 1 + REMOTETESTDOWN: ${{ vars.REMOTETESTDOWN }} jobs: build-and-test-autotools: runs-on: windows-latest defaults: run: - shell: bash -eo pipefail -o igncr "{0}" + shell: C:/cygwin/bin/bash.exe -eo pipefail -o igncr "{0}" name: Cygwin-based Autotools tests @@ -26,18 +27,20 @@ jobs: steps: - name: Fix line endings + shell: pwsh run: git config --global core.autocrlf input - uses: actions/checkout@v4 - - uses: cygwin/cygwin-install-action@v2 + - uses: cygwin/cygwin-install-action@v4 with: platform: x86_64 + install-dir: 'C:\cygwin' packages: >- git automake libtool autoconf2.5 make libhdf5-devel libhdf4-devel zipinfo libxml2-devel perl zlib-devel libzstd-devel libbz2-devel libaec-devel libzip-devel - libdeflate-devel gcc-core libcurl-devel libiconv-devel + libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel libssl-devel libcrypt-devel - name: (Autotools) Run autoconf and friends @@ -79,3 +82,72 @@ jobs: timeout-minutes: 30 run: | make check -j8 SHELL=/bin/dash + + build-and-test-cmake: + name: Cygwin-based CMake tests + runs-on: windows-latest + defaults: + run: + shell: C:/cygwin/bin/bash.exe -eo pipefail -o igncr "{0}" + + steps: + + - run: git config --global core.autocrlf input + shell: pwsh + - uses: actions/checkout@v4 + - uses: cygwin/cygwin-install-action@v4 + with: + platform: x86_64 + install-dir: 'C:\cygwin' + packages: >- + git automake libtool autoconf2.5 make libhdf5-devel + libhdf4-devel zipinfo libxml2-devel perl zlib-devel + libzstd-devel libbz2-devel libaec-devel libzip-devel + libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel + libssl-devel libcrypt-devel cmake ninja make m4 diffutils unzip + +### +# Configure and build +### + + - name: (CMake) Configure Build + env: + MAKE: "/usr/bin/make" + CXX: "/usr/bin/g++" + run: | + /usr/bin/cmake \ + -G"Unix Makefiles" \ + -B build \ + -S . \ + -DCMAKE_INSTALL_PREFIX=/tmp \ + -DBUILD_SHARED_LIBS=ON \ + -DNETCDF_ENABLE_NETCDF_4=ON \ + -DNETCDF_BUILD_UTILITIES=ON \ + -DNETCDF_ENABLE_TESTS=ON \ + -DNETCDF_ENABLE_HDF5=ON \ + -DNETCDF_ENABLE_NCZARR=TRUE \ + -DNETCDF_ENABLE_PLUGINS=ON + if: ${{ success() }} + + - name: (CMake) Look at CMakeCache.txt if error + run: cat build/CMakeCache.txt + if: ${{ failure() }} + + - name: (CMake) Print Summary + run: cat build/libnetcdf.settings + + - name: (CMake) Build All + env: + MAKE: "/usr/bin/make" + CXX: "/usr/bin/g++" + run: cmake --build build -j$(nproc) + if: ${{ success() }} + + - name: (CMake) Run Tests + run: PATH=$PWD/build:$PATH ctest --test-dir build + if: ${{ success() }} + + - name: (CMake) Verbose output of CTest failures + run: >- + PATH=$PWD/build:$PATH ctest --test-dir build --output-on-failure -j$(nproc) --rerun-failed -VV + if: ${{ failure() }} diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 55386900f2..032a31a894 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -6,6 +6,10 @@ name: Run MSYS2, MinGW64-based Tests (Not Visual Studio) +env: + CPPFLAGS: "-D_BSD_SOURCE" + REMOTETESTDOWN: ${{ vars.REMOTETESTDOWN }} + on: [pull_request,workflow_dispatch] concurrency: diff --git a/CMakeLists.txt b/CMakeLists.txt index 87781e0d78..c4c05151a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ if(UNAME) getuname(osname -s) getuname(osrel -r) getuname(cpu -m) + getuname(host -n) set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}") endif() @@ -225,6 +226,12 @@ include(GenerateExportHeader) # Compiler and Linker Configuration ################################ +# Set in support of https://github.com/Unidata/netcdf-c/issues/2700 +if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fhonor-infinities") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fhonor-infinities") +endif() + option(NETCDF_FIND_SHARED_LIBS "Find dynamically-built versions of dependent libraries" ${BUILD_SHARED_LIBS}) ## @@ -382,13 +389,13 @@ if(MSVC) endif() # Option to build netCDF Version 2 -OPTION (ENABLE_V2_API "Build netCDF Version 2." ON) -set(BUILD_V2 ${ENABLE_V2_API}) -if(NOT ENABLE_V2_API) +OPTION (NETCDF_ENABLE_V2_API "Build netCDF Version 2." ON) +set(BUILD_V2 ${NETCDF_ENABLE_V2_API}) +if(NOT NETCDF_ENABLE_V2_API) set(NO_NETCDF_2 ON) -else(NOT ENABLE_V2_API) +else(NOT NETCDF_ENABLE_V2_API) set(USE_NETCDF_2 TRUE) -endif(NOT ENABLE_V2_API) +endif(NOT NETCDF_ENABLE_V2_API) # Option to build utilities option(NETCDF_BUILD_UTILITIES "Build ncgen, ncgen3, ncdump." ON) @@ -431,40 +438,81 @@ endif() # Format Option checks ################################ -# We need to now treat enable-netcdf4 and enable-hdf5 as separate, -# but for back compatability, we need to treat enable-netcdf4 -# as equivalent to enable-hdf5. -# We detect this using these rules: -# 1. if NETCDF_ENABLE_HDF5 is off then disable hdf5 -# 2. if NETCDF_ENABLE_NETCDF_4 is off then disable hdf5 -# 3. else enable hdf5 -option(NETCDF_ENABLE_NETCDF_4 "Use HDF5." ON) -option(NETCDF_ENABLE_HDF5 "Use HDF5." ON) -if(NOT NETCDF_ENABLE_HDF5 OR NOT NETCDF_ENABLE_NETCDF_4) - set(NETCDF_ENABLE_HDF5 OFF CACHE BOOL "Use HDF5" FORCE) +# As a long term goal, and because it is now the case that +# -DNETCDF_ENABLE_NCZARR => USE_NETCDF4, so make the external options +# -DNETCDF_ENABLE-NETCDF-4 and _DNETCDF_ENABLE-NETCDF4 obsolete +# in favor of --NETCDF_ENABLE-HDF5. +# We will do the following for one more release cycle. +# 1. Make --NETCDF_ENABLE-NETCDF-4 be an alias for --NETCDF_ENABLE-NETCDF4. +# 2. Make --NETCDF_ENABLE-NETCDF4 an alias for --NETCDF_ENABLE-HDF5. +# 3. Internally, convert most (but not all) uses of USE_NETCDF_4 and USE_NETCDF4 to USE_HDF5. + +# Collect the values of -DNETCDF_ENABLE-NETCDF-4, -DNETCDF_ENABLE-NETCDF4, and -DNETCDF_ENABLE-HDF5. + +# Figure out which options are defined and process options +if(DEFINED NETCDF_ENABLE_NETCDF_4) + set(UNDEF_NETCDF_4 OFF CACHE BOOL "") + option(NETCDF_ENABLE_NETCDF_4 "" ON) +else() + set(UNDEF_NETCDF_4 ON CACHE BOOL "") +endif() +if(DEFINED NETCDF_ENABLE_NETCDF4) + set(UNDEF_NETCDF4 OFF CACHE BOOL "") + option(NETCDF_ENABLE_NETCDF4 "" ON) +else() + set(UNDEF_NETCDF4 ON CACHE BOOL "") +endif() +if(DEFINED NETCDF_ENABLE_HDF5) + set(UNDEF_HDF5 OFF CACHE BOOL "") + option(NETCDF_ENABLE_HDF5 "" ON) +else() + set(UNDEF_HDF5 ON CACHE BOOL "") +endif() + +if(NOT UNDEF_NETCDF_4) +message(WARNING "NETCDF_ENABLE_NETCDF_4 is deprecated; please use NETCDF_ENABLE_HDF5") +endif() + +if(NOT UNDEF_NETCDF4) +message(WARNING "NETCDF_ENABLE_NETCDF4 is deprecated; please use NETCDF_ENABLE_HDF5") endif() -option(NETCDF_ENABLE_HDF4 "Build netCDF-4 with HDF4 read capability(HDF4, HDF5 and Zlib required)." OFF) +# NETCDF_ENABLE_NETCDF_4 overrides NETCDF_ENABLE_NETCDF4 if latter not defined. + +if((NOT "${UNDEF_NETCDF_4}") AND UNDEF_NETCDF4) +set(NETCDF_ENABLE_NETCDF4 ${NETCDF_ENABLE_NETCDF_4} CACHE BOOL "" FORCE) +endif() +# NETCDF_ENABLE_NETCDF4 overrides NETCDF_ENABLE_HDF5 if latter not defined. +if((NOT "${UNDEF_NETCDF4}") AND UNDEF_HDF5) +set(NETCDF_ENABLE_HDF5 "${NETCDF_ENABLE_HDF5}" CACHE BOOL "" FORCE) +endif() +# Otherwise, use NETCDF_ENABLE_HDF5 default +if(UNDEF_HDF5) +set(NETCDF_ENABLE_HDF5 ON CACHE BOOL "" FORCE) +endif() +# Turn off enable_netcdf4 because it will be used +# as a shorthand for ENABLE_HDF5|ENABLE_HDF4|ENABLE_NCZARR +set(NETCDF_ENABLE_NETCDF4 OFF CACHE BOOL "" FORCE) option(NETCDF_ENABLE_DAP "Enable DAP2 and DAP4 Client." ON) option(NETCDF_ENABLE_NCZARR "Enable NCZarr Client." ON) option(NETCDF_ENABLE_PNETCDF "Build with parallel I/O for CDF-1, 2, and 5 files using PnetCDF." OFF) set(NETCDF_ENABLE_CDF5 AUTO CACHE STRING "AUTO") option(NETCDF_ENABLE_CDF5 "Enable CDF5 support" ON) - -if(DEFINED NETCDF_ENABLE_NETCDF4) - message(FATAL_ERROR "NETCDF_ENABLE_NETCDF4 is deprecated. Please use NETCDF_ENABLE_NETCDF_4 instead.") +option(NETCDF_ENABLE_HDF4 "Enable HDF4 Read Support" OFF) +option(NETCDF_ENABLE_HDF4_FILE_TESTS "Enable HDF4 File Tests" ${NETCDF_ENABLE_HDF4}) +if(NETCDF_ENABLE_HDF4) + set(USE_HDF4 ON) endif() # Netcdf-4 support (i.e. libsrc4) is required by more than just HDF5 (e.g. NCZarr) # So depending on what above formats are enabled, enable netcdf-4 if(NETCDF_ENABLE_HDF5 OR NETCDF_ENABLE_HDF4 OR NETCDF_ENABLE_NCZARR) - set(NETCDF_ENABLE_NETCDF_4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) + set(NETCDF_ENABLE_NETCDF4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) endif() # enable|disable all forms of network access option(NETCDF_ENABLE_REMOTE_FUNCTIONALITY "Enable|disable all forms remote data access (DAP, S3, etc)" ON) -message(">>> NETCDF_ENABLE_REMOTE_FUNCTIONALITY=${NETCDF_ENABLE_REMOTE_FUNCTIONALITY}") if(NOT NETCDF_ENABLE_REMOTE_FUNCTIONALITY) message(WARNING "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP[4]=NO") set(NETCDF_ENABLE_DAP OFF CACHE BOOL "NETCDF_ENABLE_REMOTE_FUNCTIONALITY=NO => NETCDF_ENABLE_DAP=NO" FORCE) @@ -484,9 +532,9 @@ endif() # Did the user specify a default minimum blocksize for posixio? set(NCIO_MINBLOCKSIZE 256 CACHE STRING "Minimum I/O Blocksize for netCDF classic and 64-bit offset format files.") -if(NETCDF_ENABLE_NETCDF_4) +if(NETCDF_ENABLE_NETCDF4) set(USE_NETCDF4 ON CACHE BOOL "") - set(NETCDF_ENABLE_NETCDF_4 ON CACHE BOOL "") + set(NETCDF_ENABLE_NETCDF4 ON CACHE BOOL "") else() set(USE_HDF4_FILE_TESTS OFF) set(USE_HDF4 OFF) @@ -494,22 +542,15 @@ else() set(NETCDF_ENABLE_HDF4 OFF) endif() -# Option Logging, only valid for netcdf4. +# Option Logging, only valid for netcdf4 dispatchers. option(NETCDF_ENABLE_LOGGING "Enable Logging." OFF) -if(NOT NETCDF_ENABLE_NETCDF_4) -set(NETCDF_ENABLE_LOGGING OFF) -endif() -if(NETCDF_ENABLE_LOGGING) - target_compile_definitions(netcdf PRIVATE LOGGING ENABLE_SET_LOG_LEVEL) - set(LOGGING ON) - set(ENABLE_SET_LOG_LEVEL ON) -endif() -option(NETCDF_ENABLE_SET_LOG_LEVEL_FUNC "Enable definition of nc_set_log_level()." ON) -if(NETCDF_ENABLE_NETCDF_4 AND NOT NETCDF_ENABLE_LOGGING AND NETCDF_ENABLE_SET_LOG_LEVEL_FUNC) - target_compile_definitions(netcdf PRIVATE -DENABLE_SET_LOG_LEVEL) - set(ENABLE_SET_LOG_LEVEL ON) +if(NOT NETCDF_ENABLE_NETCDF4) + set(NETCDF_ENABLE_LOGGING OFF) endif() +set(LOGGING ${NETCDF_ENABLE_LOGGING}) +set(NETCDF_ENABLE_SET_LOG_LEVEL ${NETCDF_ENABLE_LOGGING}) + # Option to allow for strict null file padding. # See https://github.com/Unidata/netcdf-c/issues/657 for more information option(NETCDF_ENABLE_STRICT_NULL_BYTE_HEADER_PADDING "Enable strict null byte header padding." OFF) @@ -562,6 +603,12 @@ set(NETCDF_ENABLE_EXTERNAL_SERVER_TESTS OFF CACHE BOOL "" FORCE) set(NETCDF_ENABLE_DAP_LONG_TESTS OFF CACHE BOOL "" FORCE) endif() +# Provide a global control for remotetest. +if ("$ENV{REMOTETESTDOWN}" STREQUAL "yes") +message(WARNING "ENV(REMOTETESTDOWN) => NETCDF_ENABLE_DAP_REMOTE_TESTS == OFF") +set(NETCDF_ENABLE_DAP_REMOTE_TESTS OFF CACHE BOOL "" FORCE) +endif() + set(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") set(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") @@ -760,13 +807,17 @@ if(NETCDF_ENABLE_TESTS) set(NC_CTEST_DROP_SITE "cdash.unidata.ucar.edu:443" CACHE STRING "Dashboard location for CTest-based testing purposes.") set(NC_CTEST_DROP_LOC_PREFIX "" CACHE STRING "Prefix for Dashboard location on remote server when using CTest-based testing.") set(SUBMIT_URL "https://cdash.unidata.ucar.edu:443") - find_program(HOSTNAME_CMD NAMES hostname) - if(NOT WIN32) - set(HOSTNAME_ARG "-s") - endif() - if(HOSTNAME_CMD) - execute_process(COMMAND ${HOSTNAME_CMD} "${HOSTNAME_ARG}" OUTPUT_VARIABLE HOSTNAME OUTPUT_STRIP_TRAILING_WHITESPACE) - set(NC_CTEST_SITE "${HOSTNAME}" CACHE STRING "Hostname of test machine.") + if("${host}" STREQUAL "") + find_program(HOSTNAME_CMD NAMES hostname) + if(NOT WIN32) + set(HOSTNAME_ARG "-s") + endif() + if(HOSTNAME_CMD) + execute_process(COMMAND ${HOSTNAME_CMD} "${HOSTNAME_ARG}" OUTPUT_VARIABLE HOSTNAME OUTPUT_STRIP_TRAILING_WHITESPACE) + set(NC_CTEST_SITE "${HOSTNAME}" CACHE STRING "Hostname of test machine.") + endif() + else() + set(NC_CTEST_SITE "${host}" CACHE STRING "Hostname of test machine.") endif() if(NC_CTEST_SITE) @@ -835,12 +886,6 @@ if(NETCDF_ENABLE_FSYNC) set(USE_FSYNC ON) endif() -# Temporary -OPTION (ENABLE_JNA "Enable jna bug fix code." OFF) -if(ENABLE_JNA) - set(JNA ON) -endif() - # Linux specific large file support flags. # Modelled after check in CMakeLists.txt for hdf5. option(NETCDF_ENABLE_LARGE_FILE_SUPPORT "Enable large file support." ON) @@ -958,7 +1003,7 @@ endif() option(NETCDF_ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Requires HDF5/NetCDF4 with parallel I/O Support." "${HDF5_PARALLEL}") if(NETCDF_ENABLE_PARALLEL_TESTS AND USE_PARALLEL) set(TEST_PARALLEL ON CACHE BOOL "") - if(USE_NETCDF4) + if(USE_HDF5) set(TEST_PARALLEL4 ON CACHE BOOL "") endif() endif() @@ -983,7 +1028,6 @@ if(NOT BUILD_SHARED_LIBS) endif() option(NETCDF_ENABLE_NCZARR_FILTERS "Enable NCZarr filters" ${NETCDF_ENABLE_PLUGINS}) -option(NETCDF_ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." ${NETCDF_ENABLE_NCZARR_FILTERS}) # Constraints if (NOT NETCDF_ENABLE_PLUGINS AND NETCDF_ENABLE_NCZARR_FILTERS) @@ -992,16 +1036,10 @@ if (NOT NETCDF_ENABLE_PLUGINS AND NETCDF_ENABLE_NCZARR_FILTERS) endif() IF (NOT NETCDF_ENABLE_NCZARR) - message(WARNING "NETCDF_ENABLE_NCZARR==NO => NETCDF_ENABLE_NCZARR_FILTERS==NO AND NETCDF_ENABLE_NCZARR_FILTER_TESTING==NO") + message(WARNING "NETCDF_ENABLE_NCZARR==NO => NETCDF_ENABLE_NCZARR_FILTERS==NO") set(NETCDF_ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Disable NCZARR_FILTERS" FORCE) endif() -IF (NOT NETCDF_ENABLE_NCZARR_FILTERS) - set(NETCDF_ENABLE_NCZARR_FILTER_TESTING OFF CACHE BOOL "Enable NCZarr Filter Testing" FORCE) -endif() - -set(ENABLE_CLIENTSIDE_FILTERS OFF) - # Determine whether or not to generate documentation. option(NETCDF_ENABLE_DOXYGEN "Enable generation of doxygen-based documentation." OFF) if(NETCDF_ENABLE_DOXYGEN) @@ -1248,6 +1286,7 @@ CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP) CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP) +CHECK_FUNCTION_EXISTS(strlen HAVE_STRLEN) CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL) CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) CHECK_FUNCTION_EXISTS(strtoull HAVE_STRTOULL) @@ -1391,7 +1430,6 @@ endif(USE_HDF5) if(USE_HDF4) add_subdirectory(libhdf4) - add_subdirectory(hdf4_test) endif(USE_HDF4) if(NETCDF_ENABLE_DAP2) @@ -1430,6 +1468,8 @@ if(NETCDF_ENABLE_NCZARR) DESTINATION ${netCDF_BINARY_DIR}/nczarr_test/) endif() +# Tests and files which depend on libnetcdf must be included +# *after* this line. add_subdirectory(liblib) if(NETCDF_ENABLE_PLUGINS) @@ -1446,10 +1486,13 @@ endif() # Enable tests if(NETCDF_ENABLE_TESTS) - if(ENABLE_V2_API) + if(NETCDF_ENABLE_V2_API) add_subdirectory(nctest) endif() add_subdirectory(nc_test) + if(USE_HDF4) + add_subdirectory(hdf4_test) + endif() if(USE_HDF5) include_directories(h5_test) add_subdirectory(nc_test4) @@ -1471,6 +1514,7 @@ if(NETCDF_ENABLE_TESTS) add_subdirectory(unit_test) endif(NETCDF_ENABLE_UNIT_TESTS) if(NETCDF_ENABLE_NCZARR) + include_directories(nczarr_test) add_subdirectory(nczarr_test) endif() endif() @@ -1494,12 +1538,16 @@ add_subdirectory(docs) # in the libdir. ## if(MSVC) - file(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) + foreach(CPP ${CMAKE_PREFIX_PATH}) + file(GLOB COPY_FILES ${CPP}/lib/*.lib) + endforeach() install(FILES ${COPY_FILES} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependencies) - file(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/bin/*.dll) + foreach(CPP ${CMAKE_PREFIX_PATH}) + file(GLOB COPY_FILES ${CPP}/bin/*.dll) + endforeach() string(REGEX REPLACE "msv[.*].dll" "" COPY_FILES "${COPY_FILES}") install(FILES ${COPY_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -1520,6 +1568,9 @@ configure_file( ### # Create pkgconfig files. ### +if(NOT DEFINED CMAKE_INSTALL_MANDIR) + set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man/") +endif() if(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR lib) @@ -1604,8 +1655,6 @@ ENABLE_MAKEDIST(README.md COPYRIGHT RELEASE_NOTES.md INSTALL INSTALL.cmake test_ set(host_cpu "${cpu}") set(host_vendor "${osname}") set(host_os "${osrel}") -set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}") -set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}") string(RANDOM LENGTH 3 ALPHABET "0123456789" PLATFORMUID) math(EXPR PLATFORMUID "${PLATFORMUID} + 1" OUTPUT_FORMAT DECIMAL) @@ -1619,9 +1668,10 @@ set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BU is_disabled(BUILD_SHARED_LIBS enable_static) is_enabled(BUILD_SHARED_LIBS enable_shared) -is_enabled(ENABLE_V2_API HAS_NC2) -is_enabled(NETCDF_ENABLE_NETCDF_4 HAS_NC4) +is_enabled(NETCDF_ENABLE_V2_API HAS_NC2) +is_enabled(NETCDF_ENABLE_NETCDF4 HAS_NC4) is_enabled(NETCDF_ENABLE_HDF4 HAS_HDF4) +is_enabled(USE_HDF4 HAS_HDF4) is_enabled(USE_HDF5 HAS_HDF5) is_enabled(OFF HAS_BENCHMARKS) is_enabled(STATUS_PNETCDF HAS_PNETCDF) @@ -1633,7 +1683,6 @@ is_enabled(NETCDF_ENABLE_DAP4 HAS_DAP4) is_enabled(NETCDF_ENABLE_BYTERANGE HAS_BYTERANGE) is_enabled(NETCDF_ENABLE_DISKLESS HAS_DISKLESS) is_enabled(USE_MMAP HAS_MMAP) -is_enabled(JNA HAS_JNA) is_enabled(ENABLE_ZERO_LENGTH_COORD_BOUND RELAX_COORD_BOUND) is_enabled(USE_CDF5 HAS_CDF5) is_enabled(NETCDF_ENABLE_ERANGE_FILL HAS_ERANGE_FILL) @@ -1644,7 +1693,6 @@ is_enabled(NETCDF_ENABLE_S3_INTERNAL HAS_S3_INTERNAL) is_enabled(HAS_HDF5_ROS3 HAS_HDF5_ROS3) is_enabled(NETCDF_ENABLE_NCZARR HAS_NCZARR) is_enabled(NETCDF_ENABLE_NCZARR_ZIP HAS_NCZARR_ZIP) -is_enabled(NETCDF_ENABLE_NCZARR_ZIP DO_NCZARR_ZIP_TESTS) is_enabled(NETCDF_ENABLE_QUANTIZE HAS_QUANTIZE) is_enabled(NETCDF_ENABLE_LOGGING HAS_LOGGING) is_enabled(NETCDF_ENABLE_FILTER_TESTING DO_FILTER_TESTS) @@ -1744,6 +1792,8 @@ configure_file( set(EXTRA_DIST ${EXTRA_DIST} ${CMAKE_CURRENT_SOURCE_DIR}/test_common.in) set(TOPSRCDIR "${CMAKE_CURRENT_SOURCE_DIR}") set(TOPBUILDDIR "${CMAKE_CURRENT_BINARY_DIR}") +set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}") +set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_common.in ${CMAKE_CURRENT_BINARY_DIR}/test_common.sh @ONLY NEWLINE_STYLE LF) #### @@ -1758,10 +1808,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/s3gc.in ${CMAKE_CURRENT_BINARY_DIR}/s ##### # Build and copy nc_test4/findplugin.sh to various places ##### -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/nc_test4/findplugin.sh @ONLY NEWLINE_STYLE LF) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/nczarr_test/findplugin.sh @ONLY NEWLINE_STYLE LF) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/plugins/findplugin.sh @ONLY NEWLINE_STYLE LF) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nc_test4/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/examples/C/findplugin.sh @ONLY NEWLINE_STYLE LF) +foreach(CC nc_test4 nczarr_test v3_nczarr_test plugins examples/C) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/plugins/findplugin.in ${CMAKE_CURRENT_BINARY_DIR}/${CC}/findplugin.sh @ONLY NEWLINE_STYLE LF) +endforeach() if(NETCDF_ENABLE_BENCHMARKS) if(NETCDF_ENABLE_PARALLEL4) diff --git a/INSTALL.md b/INSTALL.md index b9cf104d7d..47b5c384c5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -103,9 +103,10 @@ libraries. (And, optionally, the szlib library). Versions required are at least HDF5 1.8.9, zlib 1.2.5, and curl 7.18.0 or later. (Optionally, if building with szlib, get szip 2.0 or later.) -HDF5 1.8.9 and zlib 1.2.7 packages are available from the netCDF-4 ftp -site. If you wish to use the remote data client code, then you +These packages are available at: +https://resources.unidata.ucar.edu/netcdf/netcdf-4/ + +If you wish to use the remote data client code, then you will also need libcurl, which can be obtained from the curl website. @@ -314,7 +315,7 @@ $ make check install If parallel I/O access to netCDF classic, 64-bit offset, CDF-5 files is also needed, the PnetCDF library should also be installed. (Note: the previously recommended replacement +href="https://resources.unidata.ucar.edu/netcdf/contrib/pnetcdf.h">replacement pnetcdf.h should no longer be used.) Then configure netCDF with the "--enable-pnetcdf" option. @@ -361,7 +362,7 @@ Note: --disable prefix indicates that the option is normally enabled. --enable-netcdf-4build with netcdf-4HDF5 and zlib --enable-netcdf4synonym for enable-netcdf-4 --enable-hdf4build netcdf-4 with HDF4 read capabilityHDF4, HDF5 and zlib ---enable-hdf4-file-teststest ability to read HDF4 filesselected HDF4 files from Unidata ftp site +--enable-hdf4-file-teststest ability to read HDF4 filesselected HDF4 files from Unidata resources site --enable-pnetcdfbuild netcdf-4 with parallel I/O for classic, 64-bit offset, and CDF-5 files using PnetCDF --enable-extra-example-testsRun extra example tests--enable-netcdf-4,GNU sed --enable-parallel-tests run extra parallel IO tests--enable-netcdf-4, parallel IO support @@ -384,7 +385,7 @@ Note: --disable prefix indicates that the option is normally enabled. The benchmarks are a bunch of extra tests, which are timed. We use these tests to check netCDF performance. - sample data files from the Unidata ftp site + sample data files from the Unidata resources site --disable-extreme-numbers don't use extreme numbers during testing, such as MAX_INT - 1 --enable-dllbuild a win32 DLLmingw compiler diff --git a/Makefile.am b/Makefile.am index 5bba56998b..8ccfd6a4d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -110,7 +110,7 @@ endif # Build Cloud Storage if desired. if NETCDF_ENABLE_NCZARR -ZARR_TEST_DIR = nczarr_test +ZARR_TEST_DIRS = nczarr_test ZARR = libnczarr endif @@ -129,7 +129,7 @@ if BUILD_TESTSETS TESTDIRS = $(H5_TEST_DIR) TESTDIRS += $(UNIT_TEST) $(V2_TEST) nc_test $(NC_TEST4) TESTDIRS += $(BENCHMARKS_DIR) $(HDF4_TEST_DIR) $(NCDAP2TESTDIR) $(NCDAP4TESTDIR) -TESTDIRS += ${ZARR_TEST_DIR} +TESTDIRS += ${ZARR_TEST_DIRS} endif # This is the list of subdirs for which Makefiles will be constructed diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bfa8c58c81..623c0bc853 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,12 +7,16 @@ This file contains a high-level description of this package's evolution. Release ## 4.9.3 - TBD +* Cleanup the option code for NETCDF_ENABLE_SET_LOG_LEVEL\[_FUNC\] See [Github #2931](https://github.com/Unidata/netcdf-c/issues/2931) for more information. +* Fix duplicate definition when using aws-sdk-cpp. See [Github #2928](https://github.com/Unidata/netcdf-c/issues/2928) for more information. +* Cleanup various obsolete options and do some code refactoring. See [Github #2926](https://github.com/Unidata/netcdf-c/issues/2926) for more information. +* Convert the Zarr-related ENABLE_XXX options to NETCDF_ENABLE_XXX options (part of the cmake overhaul). See [Github #2923](https://github.com/Unidata/netcdf-c/issues/2923) for more information. * Refactor macro `_FillValue` to `NC_FillValue` to avoid conflict with libc++ headers. See [Github #2858](https://github.com/Unidata/netcdf-c/issues/2858) for more information. * Changed `cmake` build options to be prefaced with `NETCDF`, to bring things in to line with best practices. This will permit a number of overall quality of life improvements to netCDF, in terms of allowing it to be more easily integrated with upstream projects via `FetchContent()`, `subdirectory()`, etc. Currently, the naming convention in use thus far will still work, but will result in warning messages about deprecation, and instructions on how to update your workflow. See [Github #2895](https://github.com/Unidata/netcdf-c/pull/2895) for more information. -* Fix some problems in handling S3 urls with missing regions. See [Github #2819](https://github.com/Unidata/netcdf-c/pull/2819). * Incorporate a more modern look and feel to user documentation generated by Doxygen. See [Doxygen Awesome CSS](https://github.com/jothepro/doxygen-awesome-css) and [Github #2864](https://github.com/Unidata/netcdf-c/pull/2864) for more information. * Added infrastructure to allow for `CMAKE_UNITY_BUILD`, (thanks \@jschueller). See [Github #2839](https://github.com/Unidata/netcdf-c/pull/2839) for more information. * [cmake] Move dependency management out of the root-level `CMakeLists.txt` into two different files in the `cmake/` folder, `dependencies.cmake` and `netcdf_functions_macros.cmake`. See [Github #2838](https://github.com/Unidata/netcdf-c/pull/2838/) for more information. +* Fix some problems in handling S3 urls with missing regions. See [Github #2819](https://github.com/Unidata/netcdf-c/pull/2819). * Obviate a number of irrelevant warnings. See [Github #2781](https://github.com/Unidata/netcdf-c/pull/2781). * Improve the speed and data quantity for DAP4 queries. See [Github #2765](https://github.com/Unidata/netcdf-c/pull/2765). * Remove the use of execinfo to programmatically dump the stack; it never worked. See [Github #2789](https://github.com/Unidata/netcdf-c/pull/2789). diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 2294c272bc..89d1555289 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -14,8 +14,8 @@ find_package(MakeDist) ################################ # HDF4 ################################ -if(NETCDF_ENABLE_HDF4) - set(USE_HDF4 ON ) +if(USE_HDF4) + set(NETCDF_USE_HDF4 ON ) # Check for include files, libraries. find_path(MFHDF_H_INCLUDE_DIR mfhdf.h) @@ -65,11 +65,17 @@ if(NETCDF_ENABLE_HDF4) if(NOT JPEG_LIB) message(FATAL_ERROR "HDF4 Support enabled but cannot find libjpeg") endif() - set(HDF4_LIBRARIES ${JPEG_LIB} ${HDF4_LIBRARIES} ) + set(HDF4_LIBRARIES ${JPEG_LIB} ${HDF4_LIBRARIES} CACHE STRING "") message(STATUS "Found JPEG libraries: ${JPEG_LIB}") + target_link_libraries(netcdf + PRIVATE + ${HDF4_LIBRARIES} + ) + # Option to enable HDF4 file tests. - option(NETCDF_ENABLE_HDF4_FILE_TESTS "Run HDF4 file tests. This fetches sample HDF4 files from the Unidata ftp site to test with (requires curl)." ON) + #option(NETCDF_ENABLE_HDF4_FILE_TESTS "Run HDF4 file tests. This fetches sample HDF4 files from the Unidata resources site to test with (requires curl)." ON) + if(NETCDF_ENABLE_HDF4_FILE_TESTS) find_program(PROG_CURL NAMES curl) if(PROG_CURL) @@ -77,10 +83,11 @@ if(NETCDF_ENABLE_HDF4) else() message(STATUS "Unable to locate 'curl'. Disabling hdf4 file tests.") set(USE_HDF4_FILE_TESTS OFF ) + set(NETCDF_ENABLE_HDF4_FILE_TESTS OFF) endif() set(USE_HDF4_FILE_TESTS ${USE_HDF4_FILE_TESTS} ) endif() -endif() +endif(USE_HDF4) ################################ # HDF5 diff --git a/cmake/deprecated.cmake b/cmake/deprecated.cmake index caa4c61c73..9fb95e8fa7 100644 --- a/cmake/deprecated.cmake +++ b/cmake/deprecated.cmake @@ -25,13 +25,13 @@ message(STATUS "Checking for Deprecated Options") list(APPEND opts BUILD_UTILITIES ENABLE_BENCHMARKS ENABLE_BYTERANGE ENABLE_CDF5 ENABLE_CONVERSION_WARNINGS) list(APPEND opts ENABLE_DAP ENABLE_DAP2 ENABLE_DAP4 ENABLE_DISKLESS ENABLE_DOXYGEN ENABLE_ERANGE_FILL) list(APPEND opts ENABLE_EXAMPLES ENABLE_EXAMPLES_TESTS ENABLE_EXTREME_NUMBERS ENABLE_FFIO ENABLE_FILTER_BLOSC) -list(APPEND opts ENABLEFILTER_BZ2 ENABLE_FILTER_SZIP ENABLE_FILTER_TESTING ENABLE_FILTER_ZSTD ENABLE_FSYNC) +list(APPEND opts ENABLE_FILTER_BZ2 ENABLE_FILTER_SZIP ENABLE_FILTER_TESTING ENABLE_FILTER_ZSTD ENABLE_FSYNC) list(APPEND opts ENABLE_HDF4 ENABLE_HDF5 ENABLE_LARGE_FILE_SUPPORT ENABLE_LARGE_FILE_TESTS ENABLE_LIBXML2) list(APPEND opts ENABLE_LOGGING ENABLE_METADATA_PERF_TESTS ENABLE_MMAP ENABLE_NCZARR ENABLE_NCZARR_FILTERS) list(APPEND opts ENABLE_NCZARR_S3 ENABLE_NCZARR_ZIP ENABLE_NETCDF_4 ENABLE_PARALLEL4 ENABLE_PARALLEL_TESTS) list(APPEND opts ENABLE_PLUGINS ENABLE_PNETCDF ENABLE_QUANTIZE ENABLE_REMOTE_FUNCTIONALITY ENABLE_S3 ENABLE_S3_AWS) list(APPEND opts ENABLE_S3_INTERNAL ENABLE_STDIO ENABLE_STRICT_NULL_BYTE_HEADER_PADDING ENABLE_TESTS ENABLE_UNIT_TESTS) -list(APPEND opts FIND_SHARED_LIBS LIB_NAME) +list(APPEND opts FIND_SHARED_LIBS LIB_NAME ENABLE_HDF4_FILE_TESTS) foreach(opt ${opts}) #MESSAGE(STATUS "Option: ${opt}") diff --git a/cmake/netcdf_functions_macros.cmake b/cmake/netcdf_functions_macros.cmake index 064947bbba..5b7820791b 100644 --- a/cmake/netcdf_functions_macros.cmake +++ b/cmake/netcdf_functions_macros.cmake @@ -148,6 +148,7 @@ macro(build_bin_test F) add_executable(${F} "${CMAKE_CURRENT_BINARY_DIR}/${F}.c" ${ARGN}) endif() target_link_libraries(${F} netcdf ${ALL_TLL_LIBS}) + if(MSVC) set_target_properties(${F} PROPERTIES @@ -176,6 +177,8 @@ endmacro() # Binary tests which are used by a script looking for a specific name. macro(build_bin_test_no_prefix F) build_bin_test(${F}) + + if(WIN32) #SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/") set_target_properties(${F} PROPERTIES diff --git a/config.h.cmake.in b/config.h.cmake.in index 4a404781c0..a38749a920 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -130,8 +130,11 @@ are set when opening a binary file on Windows. */ /* if true, enable CDF5 Support */ #cmakedefine NETCDF_ENABLE_CDF5 1 -/* if true, enable client side filters */ -#cmakedefine ENABLE_CLIENT_FILTERS 1 +/* if true, enable filter testing */ +#cmakedefine NETCDF_ENABLE_FILTER_TESTING 1 + +/* if true, enable filter testing */ +#cmakedefine NETCDF_ENABLE_FILTER_TESTING 1 /* if true, enable strict null byte header padding. */ #cmakedefine USE_STRICT_NULL_BYTE_HEADER_PADDING 1 @@ -167,7 +170,7 @@ are set when opening a binary file on Windows. */ #cmakedefine NETCDF_ENABLE_S3_INTERNAL 1 /* if true, enable S3 testing*/ -#cmakedefine WITH_S3_TESTING "PUBLIC" +#cmakedefine WITH_S3_TESTING "${WITH_S3_TESTING}" /* S3 Test Bucket */ #define S3TESTBUCKET "${S3TESTBUCKET}" @@ -199,6 +202,9 @@ are set when opening a binary file on Windows. */ /* Define to 1 if blosc library available. */ #cmakedefine HAVE_BLOSC 1 +/* if true enable tests that access external servers */ +#cmakedefine NETCDF_ENABLE_EXTERNAL_SERVER_TESTS 1 + /* Define to 1 if you have hdf5_coll_metadata_ops */ #cmakedefine HDF5_HAS_COLL_METADATA_OPS 1 @@ -397,6 +403,9 @@ are set when opening a binary file on Windows. */ /* Define to 1 if you have the `strlcpy' function. */ #cmakedefine HAVE_STRLCPY 1 +/* Define to 1 if you have the `strlen' function. */ +#cmakedefine HAVE_STRLEN 1 + /* Define to 1 if you have the `strtoll' function. */ #cmakedefine HAVE_STRTOLL 1 @@ -459,9 +468,6 @@ with zip */ /* if true, HDF5 is at least version 1.10.5 and supports UTF8 paths */ #cmakedefine HDF5_UTF8_PATHS 1 -/* if true, include JNA bug fix */ -#cmakedefine JNA 1 - /* do large file tests */ #cmakedefine LARGE_FILE_TESTS 1 @@ -469,7 +475,8 @@ with zip */ #cmakedefine LOGGING 1 /* If true, define nc_set_log_level. */ -#cmakedefine ENABLE_SET_LOG_LEVEL 1 +#cmakedefine NETCDF_ENABLE_LOGGING 1 +#cmakedefine NETCDF_ENABLE_SET_LOG_LEVEL 1 /* min blocksize for posixio. */ #cmakedefine NCIO_MINBLOCKSIZE ${NCIO_MINBLOCKSIZE} @@ -487,7 +494,7 @@ with zip */ #cmakedefine NETCDF_ENABLE_DOXYGEN 1 #cmakedefine NETCDF_ENABLE_INTERNAL_DOCS 1 #cmakedefine VALGRIND_TESTS 1 -#cmakedefine ENABLE_CDMREMOTE 1 +#cmakedefine NETCDF_ENABLE_CDMREMOTE 1 #cmakedefine USE_HDF5 1 #cmakedefine ENABLE_FILEINFO 1 #cmakedefine TEST_PARALLEL ${TEST_PARALLEL} @@ -570,6 +577,9 @@ with zip */ /* The size of `size_t', as computed by sizeof. */ #cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T} +/* The size of `ssize_t', as computed by sizeof. */ +#cmakedefine SIZEOF_SSIZE_T ${SIZEOF_SSIZE_T} + /* The size of `uint', as computed by sizeof. */ #cmakedefine SIZEOF_UINT ${SIZEOF_UINT} @@ -635,10 +645,13 @@ with zip */ #cmakedefine USE_STDIO 1 /* if true, multi-filters enabled*/ -#cmakedefine ENABLE_MULTIFILTERS 1 +#cmakedefine NETCDF_ENABLE_MULTIFILTERS 1 /* if true, enable nczarr blosc support */ -#cmakedefine ENABLE_BLOSC 1 +#cmakedefine NETCDF_ENABLE_BLOSC 1 + +/* if true enable tests that access external servers */ +#cmakedefine NETCDF_ENABLE_EXTERNAL_SERVER_TESTS 1 /* Version number of package */ #cmakedefine VERSION "${netCDF_VERSION}" diff --git a/configure.ac b/configure.ac index da3b336268..61a4563901 100644 --- a/configure.ac +++ b/configure.ac @@ -132,30 +132,48 @@ AC_DEFINE_UNQUOTED([WINVERBUILD], [$WINVERBUILD], [windows version build]) AC_MSG_NOTICE([checking supported formats]) -# An explicit disable of netcdf-4 | netcdf4 is treated as if it was disable-hdf5 -AC_MSG_CHECKING([whether we should build with netcdf4 (alias for HDF5)]) -AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--disable-netcdf4], - [(Deprecated) Synonym for --enable-hdf5)])]) -test "x$enable_netcdf4" = xno || enable_netcdf4=yes -AC_MSG_RESULT([$enable_netcdf4 (Deprecated) Please use --disable-hdf5)]) -AC_MSG_CHECKING([whether we should build with netcdf-4 (alias for HDF5)]) -AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--disable-netcdf-4], - [(synonym for --disable-netcdf4)])]) -test "x$enable_netcdf_4" = xno || enable_netcdf_4=yes -AC_MSG_RESULT([$enable_netcdf_4]) -# Propagate the alias -if test "x$enable_netcdf_4" = xno ; then enable_netcdf4=no; fi -if test "x$enable_netcdf4" = xno ; then enable_netcdf_4=no; fi - -# Does the user want to use HDF5? +# As a long term goal, and because it is now the case that --enable-nczarr +# => USE_NETCDF4, make the external options --enable-netcdf-4 and +# --enable-netcdf4 obsolete in favor of --enable-hdf5 +# We will do the following for one more release cycle. +# 1. Make --enable-netcdf-4 be an alias for --enable-netcdf4. +# 2. Make --enable-netcdf4 an alias for --enable-hdf5. +# 3. Internally, convert most uses of USE_NETCDF_4 ad USE_NETCDF4 to USE_HDF5 + +# Collect the values of --enable-netcdf-4, --enable-netcdf4, and --enable-hdf5. +# Also determine which have been explicitly set on the command line. + +AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--enable-netcdf-4], + [(Deprecated) Synonym for --enable-hdf5; default yes])]) +AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--enable-netcdf4], + [(Deprecated) Synonym for --enable-hdf5; default yes])]) +AC_ARG_ENABLE([hdf5], [AS_HELP_STRING([--enable-hdf5],[default yes])]) + +# Complain about the use of --enable-netcdf-4/--enable-netcdf4 +if test "x$enable_netcdf_4" != x ; then + AC_MSG_WARN([--enable-netcdf-4 is deprecated; please use --enable-hdf5]) +fi +if test "x$enable_netcdf4" != x ; then + AC_MSG_WARN([--enable-netcdf4 is deprecated; please use --enable-hdf5]) +fi + +# --enable-netcdf-4 overrides --enable-netcdf4 if latter not defined +if test "x$enable_netcdf_4" != x && test "x$enable_netcdf4" == x ; then +enable_netcdf4="$enable_netcdf_4" +fi +# --enable-netcdf4 overrides --enable-hdf5 if latter not defined +if test "x$enable_netcdf4" != x && test "x$enable_hdf5" == x ; then +enable_hdf5="$enable_netcdf4" +fi +# Otherwise, use --enable-hdf5 AC_MSG_CHECKING([whether we should build with HDF5]) -AC_ARG_ENABLE([hdf5], [AS_HELP_STRING([--disable-hdf5], - [do not build with HDF5])]) test "x$enable_hdf5" = xno || enable_hdf5=yes -if test "x$enable_netcdf4" = xno ; then enable_hdf5=no ; fi -# disable-netcdf4 is synonym for disable-hdf5 AC_MSG_RESULT([$enable_hdf5]) +# Turn off enable_netcdf4 because it will be used +# as a shorthand for enable_hdf5|enable_hdf4|enable_nczarr +enable_netcdf4=no + # Check whether we want to enable CDF5 support. AC_MSG_CHECKING([whether CDF5 support should be disabled]) AC_ARG_ENABLE([cdf5], @@ -217,12 +235,8 @@ AC_MSG_RESULT($enable_nczarr) # HDF5 | HDF4 | NCZarr => netcdf-4 if test "x$enable_hdf5" = xyes || test "x$enable_hdf4" = xyes || test "x$enable_nczarr" = xyes ; then -enable_netcdf_4=yes +enable_netcdf4=yes fi -AC_MSG_CHECKING([whether netcdf-4 should be forcibly enabled]) -AC_MSG_RESULT([$enable_netcdf_4]) -# Synonym -enable_netcdf4=${enable_netcdf_4} AC_MSG_NOTICE([checking user options]) @@ -280,8 +294,8 @@ AC_SUBST([DOXYGEN_SERVER_BASED_SEARCH], ["NO"]) AC_ARG_ENABLE([doxygen-pdf-output], [AS_HELP_STRING([--enable-doxygen-pdf-output], [Build netCDF library documentation in PDF format. Experimental.])]) - AM_CONDITIONAL([NC_NETCDF_ENABLE_DOXYGEN_PDF_OUTPUT], [test "x$enable_doxygen_pdf_output" = xyes]) AC_SUBST([NC_NETCDF_ENABLE_DOXYGEN_PDF_OUTPUT], [$enable_doxygen_pdf_output]) +AM_CONDITIONAL([NC_NETCDF_ENABLE_DOXYGEN_PDF_OUTPUT], [test "x$enable_doxygen_pdf_output" = xyes]) AC_ARG_ENABLE([dot], [AS_HELP_STRING([--enable-dot], @@ -316,24 +330,6 @@ if test "x$enable_fsync" = xyes ; then AC_DEFINE([USE_FSYNC], [1], [if true, include experimental fsync code]) fi -# Temporary until JNA bug is fixed (which is probably never). -# The problem being solved is this: -# > On Windows using the microsoft runtime, it is an error -# > for one library to free memory allocated by a different library. -# This is probably only an issue when using the netcdf-c library -# via JNA under Java. -AC_MSG_CHECKING([if jna bug workaround is enabled]) -AC_ARG_ENABLE([jna], - [AS_HELP_STRING([--enable-jna], - [enable jna bug workaround])], - [], - [enable_jna=no]) -test "x$enable_jna" = xno || enable_jna=yes -AC_MSG_RESULT($enable_jna) -if test "x$enable_jna" = xyes ; then -AC_DEFINE([JNA], [1], [if true, include jna bug workaround code]) -fi - # Does the user want to turn off unit tests (useful for test coverage # analysis). AC_MSG_CHECKING([if unit tests should be enabled]) @@ -354,9 +350,9 @@ AC_MSG_RESULT([$enable_dynamic_loading]) # Does the user want to turn on extra HDF4 file tests? -AC_MSG_CHECKING([whether to fetch some sample HDF4 files from Unidata ftp site to test HDF4 reading (requires wget)]) +AC_MSG_CHECKING([whether to fetch some sample HDF4 files from Unidata resources site to test HDF4 reading (requires wget)]) AC_ARG_ENABLE([hdf4-file-tests], [AS_HELP_STRING([--enable-hdf4-file-tests], - [get some HDF4 files from Unidata ftp site and test that they can be read])]) + [get some HDF4 files from Unidata resources site and test that they can be read])]) test "x$enable_hdf4" = xyes -a "x$enable_hdf4_file_tests" = xyes || enable_hdf4_file_tests=no if test "x$enable_hdf4_file_tests" = xyes; then AC_DEFINE([USE_HDF4_FILE_TESTS], 1, [If true, use use wget to fetch some sample HDF4 data, and then test against it.]) @@ -454,17 +450,14 @@ AC_ARG_ENABLE([logging], Ignored if netCDF-4 is not enabled.])]) test "x$enable_logging" = xyes || enable_logging=no AC_MSG_RESULT([$enable_logging]) - -# Does the user want to turn off nc_set_log_level() function? (It will -# always be defined if --enable-logging is used.) -AC_MSG_CHECKING([whether nc_set_log_level() function is included (will do nothing unless enable-logging is also used)]) -AC_ARG_ENABLE([set_log_level_func], [AS_HELP_STRING([--disable-set-log-level-func], - [disable the nc_set_log_level function])]) -test "x$enable_set_log_level_func" = xno -a "x$enable_logging" = xno || enable_set_log_level_func=yes -if test "x$enable_set_log_level_func" = xyes -a "x$enable_netcdf_4" = xyes; then - AC_DEFINE([ENABLE_SET_LOG_LEVEL], 1, [If true, define nc_set_log_level.]) +if test "x$enable_logging" = xyes; then + enable_set_log_level_func=yes + enable_set_log_level=yes + AC_DEFINE([NETCDF_ENABLE_SET_LOG_LEVEL], 1, [If true, enable nc_set_log_level function.]) +else + enable_set_log_level_func=no + enable_set_log_level=no fi -AC_MSG_RESULT($enable_set_log_level_func) # CURLOPT_USERNAME is not defined until curl version 7.19.1 @@ -633,6 +626,12 @@ if test "x$enable_dap" = "xno" ; then fi AC_MSG_RESULT($enable_dap_remote_tests) +# Provide a global control for remotetest. +if test "xREMOTETESTDOWN" = xyes ; then + AC_MSG_WARN("ENV(REMOTETESTDOWN) => netcdf_enable_dap_remote_tests == no") + enable_dap_remote_tests=no +fi + AC_MSG_CHECKING([whether use of external (non-unidata) servers should be enabled]) AC_ARG_ENABLE([external-server-tests], [AS_HELP_STRING([--enable-external-server-tests (default off)], @@ -703,14 +702,6 @@ if test "x$enable_dap_remote_tests" = "xno" || test "x$enable_external_server_te enable_dap_long_tests=no fi -# Control zarr storage -if test "x$enable_nczarr" = xyes ; then - if test "x$enable_netcdf_4" = xno ; then - AC_MSG_WARN([netCDF-4 disabled, so you must not enable nczarr]) - enable_nczarr=no - fi -fi - if test "x$enable_nczarr" = xyes; then AC_DEFINE([NETCDF_ENABLE_NCZARR], [1], [if true, build NCZarr Client]) AC_SUBST(NETCDF_ENABLE_NCZARR) @@ -1096,7 +1087,7 @@ fi AC_MSG_CHECKING([whether benchmarks should be run]) AC_ARG_ENABLE([benchmarks], [AS_HELP_STRING([--enable-benchmarks], - [Run benchmarks. This will cause sample data files from the Unidata ftp + [Run benchmarks. This will cause sample data files from the Unidata resources site to be fetched. The benchmarks are a bunch of extra tests, which are timed. We use these tests to check netCDF performance.])]) test "x$enable_benchmarks" = xyes || enable_benchmarks=no @@ -1325,7 +1316,7 @@ AC_CHECK_TYPES([struct timespec]) # disable dap4 if hdf5 is disabled if test "x$enable_hdf5" = "xno" ; then - AC_MSG_WARN([netcdf-4 not enabled; disabling DAP4]) + AC_MSG_WARN([hdf5 not enabled; disabling DAP4]) enable_dap4=no fi @@ -1585,7 +1576,7 @@ fi AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([Can't find or link to the math library.])]) -if test "x$enable_netcdf_4" = xyes; then +if test "x$enable_netcdf4" = xyes; then AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4]) fi @@ -1765,7 +1756,7 @@ if test "x$enable_pnetcdf" = xyes -o "x$enable_parallel4" = xyes; then else enable_parallel=no fi -AM_CONDITIONAL(ENABLE_PARALLEL, [test x$enable_parallel = xyes ]) +AM_CONDITIONAL(NETCDF_ENABLE_PARALLEL, [test x$enable_parallel = xyes ]) if test "x$hdf5_parallel" = xyes; then # Provide more precise parallel control @@ -1841,7 +1832,7 @@ fi AC_SUBST(M4FLAGS) # No logging for netcdf-3. -if test "x$enable_netcdf_4" = xno; then +if test "x$enable_netcdf4" = xno; then enable_logging=no fi if test "x$enable_logging" = xyes; then @@ -1875,25 +1866,15 @@ AC_MSG_WARN([--disable-plugins => --disable-filter-testing]) enable_filter_testing=no fi -if test "x$enable_filter_testing" = xno; then -AC_MSG_WARN([--disable-filter-testing => --disable-nczarr-filter-testing]) -enable_nczarr_filter_testing=no -fi - if test "x$enable_nczarr" = xno; then AC_MSG_WARN([--disable-nczarr => --disable-nczarr-filters]) enable_nczarr_filters=no -enable_nczarr_filter_testing=no fi if test "x$enable_nczarr_filters" = xyes; then AC_DEFINE([NETCDF_ENABLE_NCZARR_FILTERS], [1], [if true, enable NCZarr filters]) fi -# Client side filter registration is permanently disabled -enable_clientside_filters=no - -AM_CONDITIONAL(ENABLE_CLIENTSIDE_FILTERS, [test x$enable_clientside_filters = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_FILTER_TESTING, [test x$enable_filter_testing = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_NCZARR_FILTERS, [test x$enable_nczarr_filters = xyes]) @@ -1915,20 +1896,21 @@ AM_CONDITIONAL(NETCDF_ENABLE_DAP_LONG_TESTS, [test "x$enable_dap_long_tests" = x AM_CONDITIONAL(USE_PNETCDF_DIR, [test ! "x$PNETCDFDIR" = x]) AM_CONDITIONAL(USE_LOGGING, [test "x$enable_logging" = xyes]) AM_CONDITIONAL(CROSS_COMPILING, [test "x$cross_compiling" = xyes]) -AM_CONDITIONAL(USE_NETCDF4, [test x$enable_netcdf_4 = xyes]) +AM_CONDITIONAL(USE_NETCDF4, [test x$enable_netcdf4 = xyes]) AM_CONDITIONAL(USE_HDF5, [test x$enable_hdf5 = xyes]) AM_CONDITIONAL(USE_HDF4, [test x$enable_hdf4 = xyes]) AM_CONDITIONAL(USE_HDF4_FILE_TESTS, [test x$enable_hdf4_file_tests = xyes]) -AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf_4 = xyes -o x$enable_dap = xyes]) +AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf4 = xyes -o x$enable_dap = xyes]) AM_CONDITIONAL(USE_PNETCDF, [test x$enable_pnetcdf = xyes]) AM_CONDITIONAL(USE_DISPATCH, [test x$enable_dispatch = xyes]) AM_CONDITIONAL(BUILD_MMAP, [test x$enable_mmap = xyes]) AM_CONDITIONAL(BUILD_DOCS, [test x$enable_doxygen = xyes]) AM_CONDITIONAL(SHOW_DOXYGEN_TAG_LIST, [test x$enable_doxygen_tasks = xyes]) -AM_CONDITIONAL(ENABLE_METADATA_PERF, [test x$enable_metadata_perf = xyes]) +AM_CONDITIONAL(NETCDF_ENABLE_METADATA_PERF, [test x$enable_metadata_perf = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_BYTERANGE, [test "x$enable_byterange" = xyes]) AM_CONDITIONAL(RELAX_COORD_BOUND, [test "xyes" = xyes]) AM_CONDITIONAL(HAS_PAR_FILTERS, [test x$hdf5_supports_par_filters = xyes ]) +AM_CONDITIONAL(NETCDF_ENABLE_NCZARR_FILTERS, [test x$enable_nczarr_filters = xyes]) # We need to simplify the set of S3 and Zarr flag combinations AM_CONDITIONAL(NETCDF_ENABLE_S3, [test "x$enable_s3" = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_S3_AWS, [test "x$enable_s3_aws" = xyes]) @@ -1946,7 +1928,7 @@ AM_CONDITIONAL(HAVE_ZSTD, [test "x$have_zstd" = xyes]) # If the machine doesn't have a long long, and we want netCDF-4, then # we've got problems! -if test "x$enable_netcdf_4" = xyes; then +if test "x$enable_netcdf4" = xyes; then AC_TYPE_LONG_LONG_INT AC_TYPE_UNSIGNED_LONG_LONG_INT dnl if test ! "x$ac_cv_type_long_long_int" = xyes -o ! "x$ac_cv_type_unsigned_long_long_int" = xyes; then @@ -1963,7 +1945,7 @@ fi # meteor strike. AC_MSG_CHECKING([what to call the output of the ftpbin target]) BINFILE_NAME=binary-netcdf-$PACKAGE_VERSION -test "x$enable_netcdf_4" = xno && BINFILE_NAME=${BINFILE_NAME}_nc3 +test "x$enable_netcdf4" = xno && BINFILE_NAME=${BINFILE_NAME}_nc3 BINFILE_NAME=${BINFILE_NAME}.tar AC_SUBST(BINFILE_NAME) AC_MSG_RESULT([$BINFILE_NAME $FC $CXX]) @@ -2024,7 +2006,6 @@ AC_SUBST(HAS_DAP,[$enable_dap]) AC_SUBST(HAS_DAP2,[$enable_dap]) AC_SUBST(HAS_DAP4,[$enable_dap4]) AC_SUBST(HAS_NC2,[$nc_build_v2]) -AC_SUBST(HAS_NC4,[$enable_netcdf_4]) AC_SUBST(HAS_CDF5,[$enable_cdf5]) AC_SUBST(HAS_HDF4,[$enable_hdf4]) AC_SUBST(HAS_BENCHMARKS,[$enable_benchmarks]) @@ -2035,7 +2016,6 @@ AC_SUBST(HAS_PARALLEL,[$enable_parallel]) AC_SUBST(HAS_PARALLEL4,[$enable_parallel4]) AC_SUBST(HAS_DISKLESS,[yes]) AC_SUBST(HAS_MMAP,[$enable_mmap]) -AC_SUBST(HAS_JNA,[$enable_jna]) AC_SUBST(HAS_ERANGE_FILL,[$enable_erange_fill]) AC_SUBST(HAS_BYTERANGE,[$enable_byterange]) AC_SUBST(RELAX_COORD_BOUND,[yes]) @@ -2047,7 +2027,6 @@ AC_SUBST(HAS_HDF5_ROS3,[$has_hdf5_ros3]) AC_SUBST(HAS_NCZARR,[$enable_nczarr]) AC_SUBST(NETCDF_ENABLE_S3_TESTING,[$with_s3_testing]) AC_SUBST(HAS_NCZARR_ZIP,[$enable_nczarr_zip]) -AC_SUBST(DO_NCZARR_ZIP_TESTS,[$enable_nczarr_zip]) AC_SUBST(HAS_QUANTIZE,[$enable_quantize]) AC_SUBST(HAS_LOGGING,[$enable_logging]) AC_SUBST(DO_FILTER_TESTS,[$enable_filter_testing]) @@ -2190,7 +2169,6 @@ AC_DEFUN([AX_SET_META],[ ##### AC_SUBST([NC_VERSION]) NC_VERSION=$VERSION AX_SET_META([NC_HAS_NC2],[$nc_build_v2],[yes]) -AX_SET_META([NC_HAS_NC4],[$enable_netcdf_4],[yes]) AX_SET_META([NC_HAS_HDF4],[$enable_hdf4],[yes]) AX_SET_META([NC_HAS_BENCHMARKS],[$enable_benchmarks],[yes]) AX_SET_META([NC_HAS_HDF5],[$enable_hdf5],[yes]) @@ -2198,7 +2176,6 @@ AX_SET_META([NC_HAS_DAP2],[$enable_dap],[yes]) AX_SET_META([NC_HAS_DAP4],[$enable_dap4],[yes]) AX_SET_META([NC_HAS_DISKLESS],[yes],[yes]) AX_SET_META([NC_HAS_MMAP],[$enable_mmap],[yes]) -AX_SET_META([NC_HAS_JNA],[$enable_jna],[yes]) AX_SET_META([NC_HAS_PNETCDF],[$enable_pnetcdf],[yes]) AX_SET_META([NC_HAS_PARALLEL],[$enable_parallel],[yes]) AX_SET_META([NC_HAS_PARALLEL4],[$enable_parallel4],[yes]) @@ -2243,10 +2220,9 @@ AC_MSG_NOTICE([generating header files and makefiles]) AC_CONFIG_FILES(test_common.sh:test_common.in) AC_CONFIG_FILES(s3cleanup.sh:s3cleanup.in, [chmod ugo+x s3cleanup.sh]) AC_CONFIG_FILES(s3gc.sh:s3gc.in, [chmod ugo+x s3gc.sh]) -AC_CONFIG_FILES(nc_test4/findplugin.sh:nc_test4/findplugin.in, [chmod ugo+x nc_test4/findplugin.sh]) -AC_CONFIG_FILES(nczarr_test/findplugin.sh:nc_test4/findplugin.in, [chmod ugo+x nczarr_test/findplugin.sh]) -AC_CONFIG_FILES(plugins/findplugin.sh:nc_test4/findplugin.in, [chmod ugo+x plugins/findplugin.sh]) -AC_CONFIG_FILES(examples/C/findplugin.sh:nc_test4/findplugin.in, [chmod ugo+x examples/C/findplugin.sh]) +for FP in plugins nc_test4 nczarr_test examples/C ; do +AC_CONFIG_FILES(${FP}/findplugin.sh:plugins/findplugin.in, [chmod ugo+x ${FP}/findplugin.sh]) +done AC_CONFIG_FILES(ncdap_test/findtestserver.c:ncdap_test/findtestserver.c.in, [chmod ugo+x ncdap_test/findtestserver.c]) AC_CONFIG_FILES([nc_test/run_pnetcdf_tests.sh:nc_test/run_pnetcdf_tests.sh.in],[chmod ugo+x nc_test/run_pnetcdf_tests.sh]) AC_CONFIG_FILES(dap4_test/findtestserver4.c:ncdap_test/findtestserver.c.in) diff --git a/dap4_test/Makefile.am b/dap4_test/Makefile.am index 36d74d3731..a6b1c9f566 100644 --- a/dap4_test/Makefile.am +++ b/dap4_test/Makefile.am @@ -93,8 +93,8 @@ clean-local: clean-local-check .PHONY: clean-local-check clean-local-check: - -rm -rf results results_* - -rm -f .dodsrc .daprc .ncrc .netrc + rm -rf results results_* + rm -f .dodsrc .daprc .ncrc .netrc # The shell file maketests.sh is used to build the testdata # for dap4 testing. It creates and fills the directories diff --git a/dap4_test/baseline/test_vlen4.nc.d4d b/dap4_test/baseline/test_vlen4.nc.d4d index fbab1e8fd1..ec42762fc5 100644 --- a/dap4_test/baseline/test_vlen4.nc.d4d +++ b/dap4_test/baseline/test_vlen4.nc.d4d @@ -8,7 +8,7 @@ types: v1_f1_t f1(2) ; }; // v1_t dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: v1_t v1 ; data: diff --git a/dap4_test/baseline/test_vlen4.nc.d4m b/dap4_test/baseline/test_vlen4.nc.d4m index 9eba21f8e7..fb75ed4d63 100644 --- a/dap4_test/baseline/test_vlen4.nc.d4m +++ b/dap4_test/baseline/test_vlen4.nc.d4m @@ -8,7 +8,7 @@ types: v1_f1_t f1(2) ; }; // v1_t dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: v1_t v1 ; } diff --git a/dap4_test/baseline/test_vlen4.nc.d4p b/dap4_test/baseline/test_vlen4.nc.d4p index f8d9db7c28..a1dec4d327 100644 --- a/dap4_test/baseline/test_vlen4.nc.d4p +++ b/dap4_test/baseline/test_vlen4.nc.d4p @@ -5,12 +5,12 @@ xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dap="http://xml.opendap.org/ns/DAP/4.0#"> - + - + diff --git a/dap4_test/baselinehyrax/amsre_20060131v5.dat.hyrax b/dap4_test/baselinehyrax/amsre_20060131v5.dat.hyrax index 5e25c524e3..d3a23c9961 100644 --- a/dap4_test/baselinehyrax/amsre_20060131v5.dat.hyrax +++ b/dap4_test/baselinehyrax/amsre_20060131v5.dat.hyrax @@ -1,9 +1,9 @@ netcdf amsre_20060131v5 { dimensions: - _AnonymousDim3 = 3 ; - _AnonymousDim6 = 6 ; + _Anonymous_Dim_3 = 3 ; + _Anonymous_Dim_6 = 6 ; variables: - byte time_a(_AnonymousDim3, _AnonymousDim6) ; + byte time_a(_Anonymous_Dim_3, _Anonymous_Dim_6) ; string time_a:Equator_Crossing_Time = "1:30 PM" ; data: diff --git a/dap4_test/baselineraw/test_vlen4.nc.ncdump b/dap4_test/baselineraw/test_vlen4.nc.ncdump index fbab1e8fd1..ec42762fc5 100644 --- a/dap4_test/baselineraw/test_vlen4.nc.ncdump +++ b/dap4_test/baselineraw/test_vlen4.nc.ncdump @@ -8,7 +8,7 @@ types: v1_f1_t f1(2) ; }; // v1_t dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: v1_t v1 ; data: diff --git a/dap4_test/baselineremote/test_atomic_array.1.nc.ncdump b/dap4_test/baselineremote/test_atomic_array.1.nc.ncdump index 024e4533ce..e1b3f2bf27 100644 --- a/dap4_test/baselineremote/test_atomic_array.1.nc.ncdump +++ b/dap4_test/baselineremote/test_atomic_array.1.nc.ncdump @@ -2,13 +2,13 @@ netcdf test_atomic_array { types: opaque(16) opaque16_t ; dimensions: - _AnonymousDim1 = 1 ; - _AnonymousDim2 = 2 ; + _Anonymous_Dim_1 = 1 ; + _Anonymous_Dim_2 = 2 ; variables: - ubyte vu8(_AnonymousDim1, _AnonymousDim2) ; - double vd(_AnonymousDim1) ; - string vs(_AnonymousDim1, _AnonymousDim1) ; - opaque16_t vo(_AnonymousDim1, _AnonymousDim1) ; + ubyte vu8(_Anonymous_Dim_1, _Anonymous_Dim_2) ; + double vd(_Anonymous_Dim_1) ; + string vs(_Anonymous_Dim_1, _Anonymous_Dim_1) ; + opaque16_t vo(_Anonymous_Dim_1, _Anonymous_Dim_1) ; // global attributes: string :_dap4.ce = "/vu8[1][0:2:2];/vd[1];/vs[1][0];/vo[0][1]" ; diff --git a/dap4_test/baselineremote/test_atomic_array.2.nc.ncdump b/dap4_test/baselineremote/test_atomic_array.2.nc.ncdump index 5efb61a484..edafe8627f 100644 --- a/dap4_test/baselineremote/test_atomic_array.2.nc.ncdump +++ b/dap4_test/baselineremote/test_atomic_array.2.nc.ncdump @@ -1,8 +1,8 @@ netcdf test_atomic_array { dimensions: - _AnonymousDim3 = 3 ; + _Anonymous_Dim_3 = 3 ; variables: - short v16(_AnonymousDim3) ; + short v16(_Anonymous_Dim_3) ; // global attributes: string :_dap4.ce = "/v16[0:1,3]" ; diff --git a/dap4_test/baselineremote/test_atomic_array.3.nc.ncdump b/dap4_test/baselineremote/test_atomic_array.3.nc.ncdump index c7fd968ab1..35c76c0ca9 100644 --- a/dap4_test/baselineremote/test_atomic_array.3.nc.ncdump +++ b/dap4_test/baselineremote/test_atomic_array.3.nc.ncdump @@ -1,8 +1,8 @@ netcdf test_atomic_array { dimensions: - _AnonymousDim3 = 3 ; + _Anonymous_Dim_3 = 3 ; variables: - short v16(_AnonymousDim3) ; + short v16(_Anonymous_Dim_3) ; // global attributes: string :_dap4.ce = "/v16[3,0:1]" ; diff --git a/dap4_test/baselineremote/test_enum_array.6.nc.ncdump b/dap4_test/baselineremote/test_enum_array.6.nc.ncdump index 833f9bbdcd..63b1c11359 100644 --- a/dap4_test/baselineremote/test_enum_array.6.nc.ncdump +++ b/dap4_test/baselineremote/test_enum_array.6.nc.ncdump @@ -5,9 +5,9 @@ types: Altocumulus = 7, Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 127} ; dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: - cloud_class_t primary_cloud(_AnonymousDim2) ; + cloud_class_t primary_cloud(_Anonymous_Dim_2) ; cloud_class_t primary_cloud:_FillValue = Missing ; // global attributes: diff --git a/dap4_test/baselineremote/test_one_vararray.4.nc.ncdump b/dap4_test/baselineremote/test_one_vararray.4.nc.ncdump index 6a7731d58a..fcc7fe68b3 100644 --- a/dap4_test/baselineremote/test_one_vararray.4.nc.ncdump +++ b/dap4_test/baselineremote/test_one_vararray.4.nc.ncdump @@ -1,8 +1,8 @@ netcdf test_one_vararray { dimensions: - _AnonymousDim1 = 1 ; + _Anonymous_Dim_1 = 1 ; variables: - int t(_AnonymousDim1) ; + int t(_Anonymous_Dim_1) ; // global attributes: string :_dap4.ce = "/t[1]" ; diff --git a/dap4_test/baselineremote/test_one_vararray.5.nc.ncdump b/dap4_test/baselineremote/test_one_vararray.5.nc.ncdump index 133fd050f7..3dd5922d06 100644 --- a/dap4_test/baselineremote/test_one_vararray.5.nc.ncdump +++ b/dap4_test/baselineremote/test_one_vararray.5.nc.ncdump @@ -1,8 +1,8 @@ netcdf test_one_vararray { dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: - int t(_AnonymousDim2) ; + int t(_Anonymous_Dim_2) ; // global attributes: string :_dap4.ce = "/t[0:1]" ; diff --git a/dap4_test/baselineremote/test_opaque_array.7.nc.ncdump b/dap4_test/baselineremote/test_opaque_array.7.nc.ncdump index f7dfccd836..9db782b87e 100644 --- a/dap4_test/baselineremote/test_opaque_array.7.nc.ncdump +++ b/dap4_test/baselineremote/test_opaque_array.7.nc.ncdump @@ -2,10 +2,10 @@ netcdf test_opaque_array { types: opaque(16) opaque16_t ; dimensions: - _AnonymousDim1 = 1 ; - _AnonymousDim2 = 2 ; + _Anonymous_Dim_1 = 1 ; + _Anonymous_Dim_2 = 2 ; variables: - opaque16_t vo2(_AnonymousDim1, _AnonymousDim2) ; + opaque16_t vo2(_Anonymous_Dim_1, _Anonymous_Dim_2) ; // global attributes: string :_dap4.ce = "/vo2[1][0:1]" ; diff --git a/dap4_test/baselineremote/test_struct_array.8.nc.ncdump b/dap4_test/baselineremote/test_struct_array.8.nc.ncdump index fc2536e442..98ea806da1 100644 --- a/dap4_test/baselineremote/test_struct_array.8.nc.ncdump +++ b/dap4_test/baselineremote/test_struct_array.8.nc.ncdump @@ -5,9 +5,9 @@ types: int y ; }; // s_t dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: - s_t s(_AnonymousDim2, _AnonymousDim2) ; + s_t s(_Anonymous_Dim_2, _Anonymous_Dim_2) ; // global attributes: string :_dap4.ce = "/s[0:2:3][0:1]" ; diff --git a/dap4_test/baselineremote/test_vlen4.nc.ncdump b/dap4_test/baselineremote/test_vlen4.nc.ncdump index fbab1e8fd1..ec42762fc5 100644 --- a/dap4_test/baselineremote/test_vlen4.nc.ncdump +++ b/dap4_test/baselineremote/test_vlen4.nc.ncdump @@ -8,7 +8,7 @@ types: v1_f1_t f1(2) ; }; // v1_t dimensions: - _AnonymousDim2 = 2 ; + _Anonymous_Dim_2 = 2 ; variables: v1_t v1 ; data: diff --git a/dap4_test/baselinethredds/2004050300_eta_211.nc.thredds b/dap4_test/baselinethredds/2004050300_eta_211.nc.thredds index 5f4ca16075..0715c7bdf6 100644 --- a/dap4_test/baselinethredds/2004050300_eta_211.nc.thredds +++ b/dap4_test/baselinethredds/2004050300_eta_211.nc.thredds @@ -1,9 +1,9 @@ netcdf \2004050300_eta_211 { dimensions: record = UNLIMITED ; // (1 currently) - _AnonymousDim1 = 1 ; - _AnonymousDim4 = 4 ; - _AnonymousDim15 = 15 ; + _Anonymous_Dim_1 = 1 ; + _Anonymous_Dim_4 = 4 ; + _Anonymous_Dim_15 = 15 ; variables: double reftime(record) ; string reftime:units = "hours since 1992-1-1" ; @@ -11,7 +11,7 @@ variables: double valtime(record) ; string valtime:units = "hours since 1992-1-1" ; string valtime:long_name = "valid time" ; - float Z_sfc(_AnonymousDim1, _AnonymousDim4, _AnonymousDim15) ; + float Z_sfc(_Anonymous_Dim_1, _Anonymous_Dim_4, _Anonymous_Dim_15) ; string Z_sfc:navigation = "nav" ; float Z_sfc:_FillValue = -9999.006f ; string Z_sfc:units = "gp m" ; diff --git a/docs/attribute_conventions.md b/docs/attribute_conventions.md index b13ec4d693..ed75a88f81 100644 --- a/docs/attribute_conventions.md +++ b/docs/attribute_conventions.md @@ -115,7 +115,7 @@ It is strongly recommended that applicable conventions be followed unless there `Conventions` -> If present, 'Conventions' is a global attribute that is a character array for the name of the conventions followed by the dataset. Originally, these conventions were named by a string that was interpreted as a directory name relative to the directory /pub/netcdf/Conventions/ on the now defunct host ftp.unidata.ucar.edu. The web page https://www.unidata.ucar.edu/netcdf/conventions.html is now the preferred and authoritative location for registering a URI reference to a set of conventions maintained elsewhere. Authors of new conventions should submit a request to support-netcdf@unidata.ucar.edu for listing on the Unidata conventions web page. +> If present, 'Conventions' is a global attribute that is a character array for the name of the conventions followed by the dataset. Originally, these conventions were named by a string that was interpreted as a directory name relative to the directory /pub/netcdf/Conventions/ on the now defunct ftp host. The web page https://www.unidata.ucar.edu/netcdf/conventions.html is now the preferred and authoritative location for registering a URI reference to a set of conventions maintained elsewhere. Authors of new conventions should submit a request to support-netcdf@unidata.ucar.edu for listing on the Unidata conventions web page.

diff --git a/docs/static-pages/usage.html b/docs/static-pages/usage.html index 2c159cfaf4..6acc16269b 100644 --- a/docs/static-pages/usage.html +++ b/docs/static-pages/usage.html @@ -28,7 +28,7 @@

Where is NetCDF Used?

recently made some use of netCDF, based on
  1. - downloads from the Unidata site (ftp and http) + downloads from the Unidata downloads site
  2. subscribers and posters to netCDF mailing lists diff --git a/hdf4_test/CMakeLists.txt b/hdf4_test/CMakeLists.txt index d935d9d6f3..24afa184f9 100644 --- a/hdf4_test/CMakeLists.txt +++ b/hdf4_test/CMakeLists.txt @@ -6,18 +6,20 @@ # See netcdf-c/COPYRIGHT file for more info. # Copy some test files from current source dir to out-of-tree build dir. -FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4) -FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) -IF(WIN32) - FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/) -ENDIF() +file(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4) +file(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +if(WIN32) + file(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/) +endif() -IF(USE_HDF4_FILE_TESTS AND NOT WIN32) +if(USE_HDF4_FILE_TESTS AND NOT WIN32) build_bin_test_no_prefix(tst_interops2) + target_link_libraries(tst_interops2 netcdf ${ALL_TLL_LIBS}) build_bin_test_no_prefix(tst_interops3) add_bin_test(hdf4_test tst_chunk_hdf4) add_bin_test(hdf4_test tst_h4_lendian) add_bin_test(hdf4_test tst_hdf4_extra) add_sh_test(hdf4_test run_get_hdf4_files) add_sh_test(hdf4_test run_formatx_hdf4) -ENDIF() +endif() + diff --git a/hdf4_test/run_get_hdf4_files.sh b/hdf4_test/run_get_hdf4_files.sh index faf1206a67..df286d48ea 100755 --- a/hdf4_test/run_get_hdf4_files.sh +++ b/hdf4_test/run_get_hdf4_files.sh @@ -14,7 +14,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi # Get a file from the resources site; retry several times getfile() { - DATAFILE="https://resources.unidata.ucar.edu/sample_data/hdf4/$1.gz" + DATAFILE="https://resources.unidata.ucar.edu/netcdf/sample_data/hdf4/$1.gz" for try in 1 2 3 4 ; do # try 4 times @@ -30,7 +30,7 @@ getfile() { set -e echo "" -echo "Getting HDF4 sample files from Unidata FTP site..." +echo "Getting HDF4 sample files from Unidata resources site..." file_list="AMSR_E_L2_Rain_V10_200905312326_A.hdf AMSR_E_L3_DailyLand_V06_20020619.hdf \ MYD29.A2009152.0000.005.2009153124331.hdf MYD29.A2002185.0000.005.2007160150627.hdf \ diff --git a/include/Makefile.am b/include/Makefile.am index 69d64efef5..c20841344c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,7 +7,10 @@ # Ed Hartnett, Dennis Heimbigner, Ward Fisher include_HEADERS = netcdf.h netcdf_meta.h netcdf_mem.h netcdf_aux.h \ -netcdf_filter.h netcdf_filter_build.h netcdf_filter_hdf5_build.h netcdf_dispatch.h netcdf_json.h +netcdf_filter.h netcdf_filter_build.h netcdf_filter_hdf5_build.h netcdf_dispatch.h + +# Built source +include_HEADERS += netcdf_json.h if BUILD_PARALLEL include_HEADERS += netcdf_par.h @@ -32,6 +35,8 @@ endif EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in netcdf_dispatch.h.in +BUILT_SOURCES = netcdf_json.h + # netcdf_json.h is constructed as a header-only file for use by # nczarr code wrappers in the plugin directory. It is # constructed by joining libdispatch/ncjson.c with @@ -40,7 +45,9 @@ EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in netcdf_dispatch.h.in # static inside netcdf_json.h. This is an ugly hack to avoid # having to reference libnetcdf in the nczarr code wrappers. -# Give the recipe for rebuilding netcdf_json.h -makepluginjson:: - sed -e 's/NCJSON_H/NETCDF_JSON_H/' -e '/ncjson.h/d' <${srcdir}/ncjson.h > netcdf_json.h +# Give the recipe for building netcdf_json.h +netcdf_json.h: ${top_srcdir}/libdispatch/ncjson.c ${top_srcdir}/include/ncjson.h + sed -e 's/NCJSON_H/NETCDF_JSON_H/' -e '/ncjson.h/d' -e '/#endif[^!]*!NETCDF_JSON_H!/d' <${srcdir}/ncjson.h > netcdf_json.h + echo '#ifdef NETCDF_JSON_H' >> netcdf_json.h sed -e '/ncjson.h/d' < ${srcdir}/../libdispatch/ncjson.c >> netcdf_json.h + echo '#endif /*NETCDF_JSON_H*/' >> netcdf_json.h diff --git a/include/hdf5internal.h b/include/hdf5internal.h index b693112820..5925421d8b 100644 --- a/include/hdf5internal.h +++ b/include/hdf5internal.h @@ -220,4 +220,9 @@ EXTERNL hid_t nc4_H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, int hdf5set_format_compatibility(hid_t fapl_id); +/* HDF5 initialization/finalization */ +extern int nc4_hdf5_initialized; +extern void nc4_hdf5_initialize(void); +extern void nc4_hdf5_finalize(void); + #endif /* _HDF5INTERNAL_ */ diff --git a/include/nc.h b/include/nc.h index 0879476849..a73e499e80 100644 --- a/include/nc.h +++ b/include/nc.h @@ -137,4 +137,12 @@ EXTERNL int NC_copy_data_all(NC* nc, nc_type xtypeid, const void* memory, size_t #define USED2INFO(nc) ((1<<(nc->dispatch->model)) & (1<dispatch->model)) & (1< where n is the size + and NCDIMANON is a prefix defined here. +*/ +#define NCDIMANON "_Anonymous_Dim" + #endif /* _NC_H_ */ diff --git a/include/nc3internal.h b/include/nc3internal.h index dbd4625ace..f7a3b2549e 100644 --- a/include/nc3internal.h +++ b/include/nc3internal.h @@ -15,7 +15,6 @@ #else # include #endif /* HAVE_STDINT_H */ -#include /* off_t */ #include "netcdf.h" #ifdef USE_PARALLEL #include "netcdf_par.h" diff --git a/include/nc4internal.h b/include/nc4internal.h index e8ae210fd1..56be310865 100644 --- a/include/nc4internal.h +++ b/include/nc4internal.h @@ -13,7 +13,6 @@ #include "netcdf.h" #include "config.h" -#include #include #include #include @@ -55,9 +54,6 @@ typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP, NCFIL} NC_SORT; /** One mega-byte. */ #define MEGABYTE 1048576 -/** The HDF5 ID for the szip filter. */ -#define HDF5_FILTER_SZIP 4 - #define X_SCHAR_MIN (-128) /**< Minimum signed char value. */ #define X_SCHAR_MAX 127 /**< Maximum signed char value. */ #define X_UCHAR_MAX 255U /**< Maximum unsigned char value. */ @@ -84,9 +80,6 @@ typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP, NCFIL} NC_SORT; #define X_DOUBLE_MAX 1.7976931348623157e+308 /**< Maximum double value. */ #define X_DOUBLE_MIN (-X_DOUBLE_MAX) /**< Minimum double value. */ -/** This is the number of netCDF atomic types. */ -#define NUM_ATOMIC_TYPES (NC_MAX_ATOMIC_TYPE + 1) - /** Number of parameters needed for ZLIB filter. */ #define CD_NELEMS_ZLIB 1 @@ -97,17 +90,16 @@ typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP, NCFIL} NC_SORT; #define NC4_DATA_SET(nc,data) ((nc)->dispatchdata = (void *)(data)) /* Reserved attribute flags: must be powers of 2. */ -/** Hidden attributes; immutable and unreadable thru API. */ -#define HIDDENATTRFLAG 1 - -/** Readonly attributes; readable, but immutable thru the API. */ -#define READONLYFLAG 2 - -/** Subset of readonly flags; readable by name only thru the API. */ -#define NAMEONLYFLAG 4 - -/** Per-variable attribute, as opposed to global */ -#define VARFLAG 16 + /** Hidden attributes; immutable and unreadable thru API. */ +# define HIDDENATTRFLAG 1 + /** Readonly attributes; readable, but immutable thru the API. */ +# define READONLYFLAG 2 + /** Subset of readonly flags; readable by name only thru the API. */ +# define NAMEONLYFLAG 4 + /** Mark reserved attributes that are constructed on the fly when accessed */ +# define VIRTUALFLAG 8 + /** Per-variable attribute, as opposed to global */ +# define VARFLAG 16 /** Boolean type, to make the code easier to read. */ typedef enum {NC_FALSE = 0, NC_TRUE = 1} nc_bool_t; @@ -238,7 +230,7 @@ typedef struct NC_TYPE_INFO size_t size; /**< Size of the type in memory, in bytes */ nc_bool_t committed; /**< True when datatype is committed in the file */ nc_type nc_type_class; /**< NC_VLEN, NC_COMPOUND, NC_OPAQUE, NC_ENUM, NC_INT, NC_FLOAT, or NC_STRING. */ - void *format_type_info; /**< HDF5-specific type info. */ + void *format_type_info; /**< dispatcher-specific type info. */ int varsized; /**< threshold and alignment explicitly set */ - int threshold; - int alignment; - } alignment; - struct ChunkCache chunkcache; -} NCglobalstate; - /** Variable Length Datatype struct in memory. Must be identical to * HDF5 hvl_t. (This is only used for VL sequences, not VL strings, * which are stored in char *'s) */ @@ -356,18 +323,14 @@ typedef struct void *p; /**< Pointer to VL data */ } nc_hvl_t; -/* Misc functions */ -extern int NC4_inq_atomic_type(nc_type typeid1, char *name, size_t *size); -extern int NC4_lookup_atomic_type(const char *name, nc_type* idp, size_t *sizep); - -/* These functions convert between netcdf and HDF5 types. */ +/* These functions convert between different netcdf types. */ extern int nc4_get_typelen_mem(NC_FILE_INFO_T *h5, nc_type xtype, size_t *len); extern int nc4_convert_type(const void *src, void *dest, const nc_type src_type, const nc_type dest_type, const size_t len, int *range_error, const void *fill_value, int strict_nc3, int quantize_mode, int nsd); -/* These functions do HDF5 things. */ +/* These functions do netcdf-4 things. */ extern int nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var); extern int nc4_read_atts(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var); @@ -467,27 +430,70 @@ extern int nc4_close_netcdf4_file(NC_FILE_INFO_T *h5, int abort, NC_memio *memio extern int nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var); extern int nc4_check_chunksizes(NC_GRP_INFO_T* grp, NC_VAR_INFO_T* var, const size_t* chunksizes); -/* HDF5 initialization/finalization */ -extern int nc4_hdf5_initialized; -extern void nc4_hdf5_initialize(void); -extern void nc4_hdf5_finalize(void); - /* This is only included if --enable-logging is used for configure; it prints info about the metadata to stderr. */ #ifdef LOGGING extern int log_metadata_nc(NC_FILE_INFO_T *h5); #endif +/**************************************************/ +/* Atomic types constants and functions */ + +/** This is the number of netCDF atomic types (as opposed to max) . */ +#define NUM_ATOMIC_TYPES (NC_MAX_ATOMIC_TYPE + 1) + /** @internal Names of atomic types. */ extern const char* nc4_atomic_name[NUM_ATOMIC_TYPES]; -/* Binary searcher for reserved attributes */ -extern const NC_reservedatt* NC_findreserved(const char* name); +/* Misc functions */ +extern int NC4_inq_atomic_type(nc_type typeid1, char *name, size_t *size); +extern int NC4_lookup_atomic_type(const char *name, nc_type* idp, size_t *sizep); +extern int NC4_inq_atomic_typeid(int ncid, const char *name, nc_type *typeidp); +extern int NC4_get_atomic_typeclass(nc_type xtype, int *type_class); + +/**************************************************/ +/* Type alignment related functions */ + +extern int nc_set_alignment(int threshold, int alignment); +extern int nc_get_alignment(int* thresholdp, int* alignmentp); -/* Global State Management */ -extern NCglobalstate* NC_getglobalstate(void); +/**************************************************/ +/* Begin to collect global state info in one place (more to do) */ + +typedef struct NCglobalstate { + int initialized; + char* tempdir; /* track a usable temp dir */ + char* home; /* track $HOME */ + char* cwd; /* track getcwd */ + struct NCRCinfo* rcinfo; /* Currently only one rc file per session */ + struct GlobalZarr { /* Zarr specific parameters */ + char dimension_separator; + int default_zarrformat; + } zarr; + struct GlobalAWS { /* AWS S3 specific parameters/defaults */ + char* default_region; + char* config_file; + char* profile; + char* access_key_id; + char* secret_access_key; + } aws; + struct Alignment { /* H5Pset_alignment parameters */ + int defined; /* 1 => threshold and alignment explicitly set */ + int threshold; + int alignment; + } alignment; + struct ChunkCache chunkcache; +} NCglobalstate; + +extern struct NCglobalstate* NC_getglobalstate(void); extern void NC_freeglobalstate(void); +/**************************************************/ +/* Binary searcher for reserved attributes */ +extern const NC_reservedatt* NC_findreserved(const char* name); +/* reserved attribute initializer */ +extern void NC_initialize_reserved(void); + /* Generic reserved Attributes */ #define NC_ATT_REFERENCE_LIST "REFERENCE_LIST" #define NC_ATT_CLASS "CLASS" @@ -500,9 +506,12 @@ extern void NC_freeglobalstate(void); #define NC_ATT_NC3_STRICT_NAME "_nc3_strict" #define NC_XARRAY_DIMS "_ARRAY_DIMENSIONS" #define NC_ATT_CODECS "_Codecs" + +/* Must match values in libnczarr/zinternal.h */ +#define NC_NCZARR_SUPERBLOCK "_nczarr_superblock" +#define NC_NCZARR_GROUP "_nczarr_group" +#define NC_NCZARR_ARRAY "_nczarr_array" #define NC_NCZARR_ATTR "_nczarr_attr" -#define NC_NCZARR_ATTR_UC "_NCZARR_ATTR" -#define NC_NCZARR_MAXSTRLEN_ATTR "_nczarr_maxstrlen" -#define NC_NCZARR_DEFAULT_MAXSTRLEN_ATTR "_nczarr_default_maxstrlen" +#define NC_NCZARR_ATTR_UC "_NCZARR_ATTR" /* deprecated */ #endif /* _NC4INTERNAL_ */ diff --git a/include/nc_logging.h b/include/nc_logging.h index 663e2c7b74..7d1f5f45e2 100644 --- a/include/nc_logging.h +++ b/include/nc_logging.h @@ -52,12 +52,10 @@ void nc_log(int severity, const char *fmt, ...); #define BAIL_QUIET BAIL -#ifdef USE_NETCDF4 -#ifndef ENABLE_SET_LOG_LEVEL +#ifndef NETCDF_ENABLE_SET_LOG_LEVEL /* Define away any calls to nc_set_log_level(), if its not enabled. */ #define nc_set_log_level(e) -#endif /* ENABLE_SET_LOG_LEVEL */ -#endif +#endif /* NETCDF_ENABLE_SET_LOG_LEVEL */ #endif /* LOGGING */ diff --git a/include/ncdap.h b/include/ncdap.h index 735d818101..27dd3450de 100644 --- a/include/ncdap.h +++ b/include/ncdap.h @@ -17,9 +17,9 @@ affect the operation of the system. */ typedef unsigned int NCFLAGS; -# define SETFLAG(controls,flag) (((controls).flags) |= (flag)) -# define CLRFLAG(controls,flag) (((controls).flags) &= ~(flag)) -# define FLAGSET(controls,flag) (((controls.flags) & (flag)) != 0) +#define SETFLAG(controls,flag) (((controls).flags) |= (NCFLAGS)(flag)) +#define CLRFLAG(controls,flag) (((controls).flags) &= ~(NCFLAGS)(flag)) +#define FLAGSET(controls,flag) ((((controls).flags) & (NCFLAGS)(flag)) != 0) /* Defined flags */ #define NCF_NC3 (0x0001) /* DAP->netcdf-3 */ diff --git a/include/ncjson.h b/include/ncjson.h index 8f2e33d69f..df24c0a569 100644 --- a/include/ncjson.h +++ b/include/ncjson.h @@ -31,7 +31,7 @@ and do the command: /* Override for plugins */ #ifdef NETCDF_JSON_H #define OPTEXPORT static -#else +#else /*NETCDF_JSON_H*/ #define OPTEXPORT MSC_EXTRA #endif /*NETCDF_JSON_H*/ @@ -121,7 +121,7 @@ OPTEXPORT int NCJclone(const NCjson* json, NCjson** clonep); OPTEXPORT void NCJdump(const NCjson* json, unsigned flags, FILE*); /* convert NCjson* object to output string */ OPTEXPORT const char* NCJtotext(const NCjson* json); -#endif +#endif /*NETCDF_JSON_H*/ #if defined(__cplusplus) } @@ -147,3 +147,4 @@ OPTEXPORT const char* NCJtotext(const NCjson* json); #endif /*NCJSON_H*/ + diff --git a/include/nclog.h b/include/nclog.h index 51e3f12055..be3f4b0e01 100644 --- a/include/nclog.h +++ b/include/nclog.h @@ -10,7 +10,7 @@ #include #include "ncexternl.h" -#define NCCATCH +#undef NCCATCH #define NCENVLOGGING "NCLOGGING" #define NCENVTRACING "NCTRACING" diff --git a/include/ncs3sdk.h b/include/ncs3sdk.h index 7be09da337..50f2ad2708 100644 --- a/include/ncs3sdk.h +++ b/include/ncs3sdk.h @@ -45,6 +45,7 @@ struct NCglobalstate; extern "C" { #endif +/* API for ncs3sdk_XXX.[c|cpp] */ EXTERNL int NC_s3sdkinitialize(void); EXTERNL int NC_s3sdkfinalize(void); EXTERNL void* NC_s3sdkcreateclient(NCS3INFO* context); @@ -60,8 +61,7 @@ EXTERNL int NC_s3sdksearch(void* s3client0, const char* bucket, const char* pref EXTERNL int NC_s3sdkdeletekey(void* client0, const char* bucket, const char* pathkey, char** errmsgp); /* From ds3util.c */ -EXTERNL int NC_s3sdkinitialize(void); -EXTERNL int NC_s3sdkfinalize(void); +EXTERNL void NC_s3sdkenvironment(void); EXTERNL int NC_getdefaults3region(NCURI* uri, const char** regionp); EXTERNL int NC_s3urlprocess(NCURI* url, NCS3INFO* s3, NCURI** newurlp); diff --git a/include/netcdf.h b/include/netcdf.h index 5b856d2799..ceaeed2b03 100644 --- a/include/netcdf.h +++ b/include/netcdf.h @@ -119,6 +119,7 @@ extern "C" { 0x0002 All upper 16 bits are unused except 0x20000 + 0x40000 */ /* Lower 16 bits */ diff --git a/include/netcdf_json.h b/include/netcdf_json.h index 24128732da..6879edf899 100644 --- a/include/netcdf_json.h +++ b/include/netcdf_json.h @@ -31,7 +31,7 @@ and do the command: /* Override for plugins */ #ifdef NETCDF_JSON_H #define OPTEXPORT static -#else +#else /*NETCDF_JSON_H*/ #define OPTEXPORT MSC_EXTRA #endif /*NETCDF_JSON_H*/ @@ -121,7 +121,7 @@ OPTEXPORT int NCJclone(const NCjson* json, NCjson** clonep); OPTEXPORT void NCJdump(const NCjson* json, unsigned flags, FILE*); /* convert NCjson* object to output string */ OPTEXPORT const char* NCJtotext(const NCjson* json); -#endif +#endif /*NETCDF_JSON_H*/ #if defined(__cplusplus) } @@ -147,6 +147,8 @@ OPTEXPORT const char* NCJtotext(const NCjson* json); #endif /*NETCDF_JSON_H*/ + +#ifdef NETCDF_JSON_H /* Copyright 2018, UCAR/Unidata. See the COPYRIGHT file for more information. */ @@ -219,7 +221,7 @@ typedef struct NCJparser { } NCJparser; typedef struct NCJbuf { - int len; /* |text|; does not include nul terminator */ + size_t len; /* |text|; does not include nul terminator */ char* text; /* NULL || nul terminated */ } NCJbuf; @@ -257,7 +259,7 @@ static int NCJyytext(NCJparser*, char* start, size_t pdlen); static void NCJreclaimArray(struct NCjlist*); static void NCJreclaimDict(struct NCjlist*); static int NCJunescape(NCJparser* parser); -static int unescape1(int c); +static char unescape1(char c); static int listappend(struct NCjlist* list, NCjson* element); static int NCJcloneArray(const NCjson* array, NCjson** clonep); @@ -265,7 +267,7 @@ static int NCJcloneDict(const NCjson* dict, NCjson** clonep); static int NCJunparseR(const NCjson* json, NCJbuf* buf, unsigned flags); static int bytesappendquoted(NCJbuf* buf, const char* s); static int bytesappend(NCJbuf* buf, const char* s); -static int bytesappendc(NCJbuf* bufp, const char c); +static int bytesappendc(NCJbuf* bufp, char c); /* Hide everything for plugins */ #ifdef NETCDF_JSON_H @@ -516,13 +518,12 @@ NCJparseDict(NCJparser* parser, struct NCjlist* dictp) static int NCJlex(NCJparser* parser) { - int c; int token = NCJ_UNDEF; char* start; size_t count; while(token == 0) { /* avoid need to goto when retrying */ - c = *parser->pos; + char c = *parser->pos; if(c == '\0') { token = NCJ_EOF; } else if(c <= ' ' || c == '\177') {/* ignore whitespace */ @@ -541,7 +542,7 @@ NCJlex(NCJparser* parser) } /* Pushback c */ parser->pos--; - count = ((parser->pos) - start); + count = (size_t)((parser->pos) - start); if(NCJyytext(parser,start,count)) goto done; /* Discriminate the word string to get the proper sort */ if(testbool(parser->yytext) == NCJ_OK) @@ -568,7 +569,7 @@ NCJlex(NCJparser* parser) token = NCJ_UNDEF; goto done; } - count = ((parser->pos) - start) - 1; /* -1 for trailing quote */ + count = (size_t)((parser->pos) - start) - 1; /* -1 for trailing quote */ if(NCJyytext(parser,start,count)==NCJ_ERR) goto done; if(NCJunescape(parser)==NCJ_ERR) goto done; token = NCJ_STRING; @@ -789,7 +790,7 @@ NCJunescape(NCJparser* parser) { char* p = parser->yytext; char* q = p; - int c; + char c; for(;(c=*p++);) { if(c == NCJ_ESCAPE) { c = *p++; @@ -799,9 +800,9 @@ NCJunescape(NCJparser* parser) case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; - case NCJ_QUOTE: c = c; break; - case NCJ_ESCAPE: c = c; break; - default: c = c; break;/* technically not Json conformant */ + case NCJ_QUOTE: break; + case NCJ_ESCAPE: break; + default: break;/* technically not Json conformant */ } } *q++ = c; @@ -811,8 +812,8 @@ NCJunescape(NCJparser* parser) } /* Unescape a single character */ -static int -unescape1(int c) +static char +unescape1(char c) { switch (c) { case 'b': c = '\b'; break; @@ -820,7 +821,7 @@ unescape1(int c) case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; - default: c = c; break;/* technically not Json conformant */ + default: break;/* technically not Json conformant */ } return c; } @@ -1155,7 +1156,7 @@ static int escape(const char* text, NCJbuf* buf) { const char* p = text; - int c; + char c; for(;(c=*p++);) { char replace = 0; switch (c) { @@ -1265,3 +1266,4 @@ netcdf_supresswarnings(void) ignore = (void*)NCJtotext; ignore = ignore; } +#endif /*NETCDF_JSON_H*/ diff --git a/include/netcdf_meta.h.in b/include/netcdf_meta.h.in index c3e45a063c..74bf29fed4 100644 --- a/include/netcdf_meta.h.in +++ b/include/netcdf_meta.h.in @@ -40,7 +40,6 @@ #define NC_VERSION "@NC_VERSION@" #define NC_HAS_NC2 @NC_HAS_NC2@ /*!< API version 2 support. */ -#define NC_HAS_NC4 @NC_HAS_NC4@ /*!< API version 4 support. */ #define NC_HAS_HDF4 @NC_HAS_HDF4@ /*!< HDF4 support. */ #define NC_HAS_HDF5 @NC_HAS_HDF5@ /*!< HDF5 support. */ #define NC_HAS_SZIP @NC_HAS_SZIP@ /*!< szip support */ @@ -50,7 +49,6 @@ #define NC_HAS_BYTERANGE @NC_HAS_BYTERANGE@ /*!< Byterange support. */ #define NC_HAS_DISKLESS @NC_HAS_DISKLESS@ /*!< diskless support. */ #define NC_HAS_MMAP @NC_HAS_MMAP@ /*!< mmap support. */ -#define NC_HAS_JNA @NC_HAS_JNA@ /*!< jna support. */ #define NC_HAS_PNETCDF @NC_HAS_PNETCDF@ /*!< PnetCDF support. */ #define NC_HAS_PARALLEL4 @NC_HAS_PARALLEL4@ /*!< parallel IO support via HDF5 */ #define NC_HAS_PARALLEL @NC_HAS_PARALLEL@ /*!< parallel IO support via HDF5 and/or PnetCDF. */ diff --git a/libdap2/dcetab.c b/libdap2/dcetab.c index 4b4adf465b..72361d9abd 100644 --- a/libdap2/dcetab.c +++ b/libdap2/dcetab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -66,9 +71,8 @@ #define yydebug dcedebug #define yynerrs dcenerrs - -/* Copy the first part of user declarations. */ -#line 11 "dce.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 11 "dce.y" #ifdef HAVE_CONFIG_H #include "config.h" @@ -80,90 +84,176 @@ #include "dceconstraints.h" #include "dceparselex.h" -#line 84 "dcetab.c" /* yacc.c:339 */ +#line 88 "dcetab.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "dcetab.h". */ -#ifndef YY_DCE_DCE_TAB_H_INCLUDED -# define YY_DCE_DCE_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int dcedebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - SCAN_WORD = 258, - SCAN_STRINGCONST = 259, - SCAN_NUMBERCONST = 260 - }; -#endif +#include "dcetab.h" +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_SCAN_WORD = 3, /* SCAN_WORD */ + YYSYMBOL_SCAN_STRINGCONST = 4, /* SCAN_STRINGCONST */ + YYSYMBOL_SCAN_NUMBERCONST = 5, /* SCAN_NUMBERCONST */ + YYSYMBOL_6_ = 6, /* '?' */ + YYSYMBOL_7_ = 7, /* ',' */ + YYSYMBOL_8_ = 8, /* '(' */ + YYSYMBOL_9_ = 9, /* ')' */ + YYSYMBOL_10_ = 10, /* '.' */ + YYSYMBOL_11_ = 11, /* '[' */ + YYSYMBOL_12_ = 12, /* ']' */ + YYSYMBOL_13_ = 13, /* ':' */ + YYSYMBOL_14_ = 14, /* '&' */ + YYSYMBOL_15_ = 15, /* '{' */ + YYSYMBOL_16_ = 16, /* '}' */ + YYSYMBOL_17_ = 17, /* '=' */ + YYSYMBOL_18_ = 18, /* '>' */ + YYSYMBOL_19_ = 19, /* '<' */ + YYSYMBOL_20_ = 20, /* '!' */ + YYSYMBOL_21_ = 21, /* '~' */ + YYSYMBOL_YYACCEPT = 22, /* $accept */ + YYSYMBOL_constraints = 23, /* constraints */ + YYSYMBOL_optquestionmark = 24, /* optquestionmark */ + YYSYMBOL_projections = 25, /* projections */ + YYSYMBOL_selections = 26, /* selections */ + YYSYMBOL_projectionlist = 27, /* projectionlist */ + YYSYMBOL_projection = 28, /* projection */ + YYSYMBOL_function = 29, /* function */ + YYSYMBOL_segmentlist = 30, /* segmentlist */ + YYSYMBOL_segment = 31, /* segment */ + YYSYMBOL_rangelist = 32, /* rangelist */ + YYSYMBOL_range = 33, /* range */ + YYSYMBOL_range1 = 34, /* range1 */ + YYSYMBOL_clauselist = 35, /* clauselist */ + YYSYMBOL_sel_clause = 36, /* sel_clause */ + YYSYMBOL_value_list = 37, /* value_list */ + YYSYMBOL_value = 38, /* value */ + YYSYMBOL_constant = 39, /* constant */ + YYSYMBOL_var = 40, /* var */ + YYSYMBOL_indexpath = 41, /* indexpath */ + YYSYMBOL_index = 42, /* index */ + YYSYMBOL_array_indices = 43, /* array_indices */ + YYSYMBOL_boolfunction = 44, /* boolfunction */ + YYSYMBOL_arg_list = 45, /* arg_list */ + YYSYMBOL_rel_op = 46, /* rel_op */ + YYSYMBOL_ident = 47, /* ident */ + YYSYMBOL_word = 48, /* word */ + YYSYMBOL_number = 49, /* number */ + YYSYMBOL_string = 50 /* string */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif -int dceparse (DCEparsestate* parsestate); +#ifdef short +# undef short +#endif -#endif /* !YY_DCE_DCE_TAB_H_INCLUDED */ +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ -/* Copy the second part of user declarations. */ +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif -#line 140 "dcetab.c" /* yacc.c:358 */ +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ -#ifdef short -# undef short +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned char yytype_uint8; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_uint8; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; #else -typedef short int yytype_int16; +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -171,15 +261,28 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -193,47 +296,43 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif #ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #endif #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -246,8 +345,22 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif -#if ! defined yyoverflow || YYERROR_VERBOSE + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -312,8 +425,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -322,17 +434,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -345,11 +457,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -361,12 +473,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -389,17 +501,20 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 87 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 +/* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 260 -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -431,7 +546,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 34, 34, 35, 36, 37, 40, 40, 43, 47, @@ -443,46 +558,48 @@ static const yytype_uint8 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "SCAN_WORD", "SCAN_STRINGCONST", - "SCAN_NUMBERCONST", "'?'", "','", "'('", "')'", "'.'", "'['", "']'", - "':'", "'&'", "'{'", "'}'", "'='", "'>'", "'<'", "'!'", "'~'", "$accept", - "constraints", "optquestionmark", "projections", "selections", - "projectionlist", "projection", "function", "segmentlist", "segment", - "rangelist", "range", "range1", "clauselist", "sel_clause", "value_list", - "value", "constant", "var", "indexpath", "index", "array_indices", - "boolfunction", "arg_list", "rel_op", "ident", "word", "number", - "string", YY_NULLPTR + "\"end of file\"", "error", "\"invalid token\"", "SCAN_WORD", + "SCAN_STRINGCONST", "SCAN_NUMBERCONST", "'?'", "','", "'('", "')'", + "'.'", "'['", "']'", "':'", "'&'", "'{'", "'}'", "'='", "'>'", "'<'", + "'!'", "'~'", "$accept", "constraints", "optquestionmark", "projections", + "selections", "projectionlist", "projection", "function", "segmentlist", + "segment", "rangelist", "range", "range1", "clauselist", "sel_clause", + "value_list", "value", "constant", "var", "indexpath", "index", + "array_indices", "boolfunction", "arg_list", "rel_op", "ident", "word", + "number", "string", YY_NULLPTR }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) { - 0, 256, 257, 258, 259, 260, 63, 44, 40, 41, - 46, 91, 93, 58, 38, 123, 125, 61, 62, 60, - 33, 126 -}; -# endif + return yytname[yysymbol]; +} +#endif -#define YYPACT_NINF -36 +#define YYPACT_NINF (-36) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-36))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -57 +#define YYTABLE_NINF (-57) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { 10, -36, 8, 4, -36, -36, 46, 12, -36, 23, @@ -496,10 +613,10 @@ static const yytype_int8 yypact[] = 46, -36, -36, 53, -36, 63, -36 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = { 7, 6, 0, 0, 1, 57, 0, 2, 3, 8, 10, 13, 12, 16, 9, 26, 0, 18, 59, 58, @@ -512,7 +629,7 @@ static const yytype_uint8 yydefact[] = 0, 28, 23, 0, 32, 0, 24 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -36, -36, -36, -36, 56, -36, 47, 1, -36, 28, @@ -520,17 +637,17 @@ static const yytype_int8 yypgoto[] = 33, -36, -36, 37, -36, 77, -1, -35, -36 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 2, 3, 7, 8, 9, 10, 20, 12, 13, + 0, 2, 3, 7, 8, 9, 10, 20, 12, 13, 37, 38, 47, 14, 15, 53, 54, 22, 23, 24, 25, 48, 26, 55, 43, 16, 28, 29, 30 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { 21, 56, 17, -45, 11, -46, -56, 5, 4, 36, @@ -544,7 +661,7 @@ static const yytype_int8 yytable[] = 69, 34, 67, 27 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { 6, 36, 3, 0, 3, 0, 8, 3, 0, 11, 0, 46, 3, 4, 5, 8, 6, 14, 14, 14, @@ -557,9 +674,9 @@ static const yytype_uint8 yycheck[] = 48, 14, 45, 6 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = { 0, 6, 23, 24, 0, 3, 14, 25, 26, 27, 28, 29, 30, 31, 35, 36, 47, 48, 4, 5, @@ -572,8 +689,8 @@ static const yytype_uint8 yystos[] = 7, 16, 12, 13, 38, 49, 12 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = { 0, 22, 23, 23, 23, 23, 24, 24, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, @@ -583,8 +700,8 @@ static const yytype_uint8 yyr1[] = 46, 46, 46, 46, 46, 46, 47, 48, 49, 50 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = { 0, 2, 2, 2, 3, 0, 1, 0, 1, 1, 1, 3, 1, 1, 3, 4, 1, 3, 1, 2, @@ -595,39 +712,39 @@ static const yytype_uint8 yyr2[] = }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (parsestate, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (parsestate, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -644,56 +761,53 @@ do { \ YYFPRINTF Args; \ } while (0) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value, parsestate); \ + Kind, Value, parsestate); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DCEparsestate* parsestate) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, DCEparsestate* parsestate) { - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (parsestate); + FILE *yyoutput = yyo; + YY_USE (yyoutput); + YY_USE (parsestate); if (!yyvaluep) return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DCEparsestate* parsestate) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, DCEparsestate* parsestate) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep, parsestate); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -702,7 +816,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DCE `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -725,21 +839,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, DCEparsestate* parsestate) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule, DCEparsestate* parsestate) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , parsestate); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], parsestate); YYFPRINTF (stderr, "\n"); } } @@ -754,8 +868,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -778,249 +892,34 @@ int yydebug; #endif -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - /* Avoid snprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DCEparsestate* parsestate) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep, DCEparsestate* parsestate) { - YYUSE (yyvaluep); - YYUSE (parsestate); + YY_USE (yyvaluep); + YY_USE (parsestate); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } + + /*----------. | yyparse. | `----------*/ @@ -1028,7 +927,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DCEparsestate* par int yyparse (DCEparsestate* parsestate) { -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; @@ -1039,45 +938,38 @@ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ - int yynerrs; + int yynerrs = 0; - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - YYSIZE_T yystacksize; + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1085,71 +977,75 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE @@ -1157,30 +1053,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1191,18 +1088,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, parsestate); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1230,15 +1138,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1253,7 +1159,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1273,320 +1179,321 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YY_REDUCE_PRINT (yyn); switch (yyn) { - case 8: -#line 43 "dce.y" /* yacc.c:1646 */ - {projections(parsestate,(yyvsp[0]));} -#line 1280 "dcetab.c" /* yacc.c:1646 */ + case 8: /* projections: projectionlist */ +#line 43 "dce.y" + {projections(parsestate,yyvsp[0]);} +#line 1186 "dcetab.c" break; - case 9: -#line 47 "dce.y" /* yacc.c:1646 */ - {selections(parsestate,(yyvsp[0]));} -#line 1286 "dcetab.c" /* yacc.c:1646 */ + case 9: /* selections: clauselist */ +#line 47 "dce.y" + {selections(parsestate,yyvsp[0]);} +#line 1192 "dcetab.c" break; - case 10: -#line 52 "dce.y" /* yacc.c:1646 */ - {(yyval)=projectionlist(parsestate,(Object)null,(yyvsp[0]));} -#line 1292 "dcetab.c" /* yacc.c:1646 */ + case 10: /* projectionlist: projection */ +#line 52 "dce.y" + {yyval=projectionlist(parsestate,(Object)null,yyvsp[0]);} +#line 1198 "dcetab.c" break; - case 11: -#line 54 "dce.y" /* yacc.c:1646 */ - {(yyval)=projectionlist(parsestate,(yyvsp[-2]),(yyvsp[0]));} -#line 1298 "dcetab.c" /* yacc.c:1646 */ + case 11: /* projectionlist: projectionlist ',' projection */ +#line 54 "dce.y" + {yyval=projectionlist(parsestate,yyvsp[-2],yyvsp[0]);} +#line 1204 "dcetab.c" break; - case 12: -#line 59 "dce.y" /* yacc.c:1646 */ - {(yyval)=projection(parsestate,(yyvsp[0]));} -#line 1304 "dcetab.c" /* yacc.c:1646 */ + case 12: /* projection: segmentlist */ +#line 59 "dce.y" + {yyval=projection(parsestate,yyvsp[0]);} +#line 1210 "dcetab.c" break; - case 13: -#line 61 "dce.y" /* yacc.c:1646 */ - {(yyval)=projection(parsestate,(yyvsp[0]));} -#line 1310 "dcetab.c" /* yacc.c:1646 */ + case 13: /* projection: function */ +#line 61 "dce.y" + {yyval=projection(parsestate,yyvsp[0]);} +#line 1216 "dcetab.c" break; - case 14: -#line 66 "dce.y" /* yacc.c:1646 */ - {(yyval)=function(parsestate,(yyvsp[-2]),null);} -#line 1316 "dcetab.c" /* yacc.c:1646 */ + case 14: /* function: ident '(' ')' */ +#line 66 "dce.y" + {yyval=function(parsestate,yyvsp[-2],null);} +#line 1222 "dcetab.c" break; - case 15: -#line 68 "dce.y" /* yacc.c:1646 */ - {(yyval)=function(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1322 "dcetab.c" /* yacc.c:1646 */ + case 15: /* function: ident '(' arg_list ')' */ +#line 68 "dce.y" + {yyval=function(parsestate,yyvsp[-3],yyvsp[-1]);} +#line 1228 "dcetab.c" break; - case 16: -#line 73 "dce.y" /* yacc.c:1646 */ - {(yyval)=segmentlist(parsestate,null,(yyvsp[0]));} -#line 1328 "dcetab.c" /* yacc.c:1646 */ + case 16: /* segmentlist: segment */ +#line 73 "dce.y" + {yyval=segmentlist(parsestate,null,yyvsp[0]);} +#line 1234 "dcetab.c" break; - case 17: -#line 75 "dce.y" /* yacc.c:1646 */ - {(yyval)=segmentlist(parsestate,(yyvsp[-2]),(yyvsp[0]));} -#line 1334 "dcetab.c" /* yacc.c:1646 */ + case 17: /* segmentlist: segmentlist '.' segment */ +#line 75 "dce.y" + {yyval=segmentlist(parsestate,yyvsp[-2],yyvsp[0]);} +#line 1240 "dcetab.c" break; - case 18: -#line 80 "dce.y" /* yacc.c:1646 */ - {(yyval)=segment(parsestate,(yyvsp[0]),null);} -#line 1340 "dcetab.c" /* yacc.c:1646 */ + case 18: /* segment: word */ +#line 80 "dce.y" + {yyval=segment(parsestate,yyvsp[0],null);} +#line 1246 "dcetab.c" break; - case 19: -#line 82 "dce.y" /* yacc.c:1646 */ - {(yyval)=segment(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1346 "dcetab.c" /* yacc.c:1646 */ + case 19: /* segment: word rangelist */ +#line 82 "dce.y" + {yyval=segment(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1252 "dcetab.c" break; - case 20: -#line 87 "dce.y" /* yacc.c:1646 */ - {(yyval)=rangelist(parsestate,null,(yyvsp[0]));} -#line 1352 "dcetab.c" /* yacc.c:1646 */ + case 20: /* rangelist: range */ +#line 87 "dce.y" + {yyval=rangelist(parsestate,null,yyvsp[0]);} +#line 1258 "dcetab.c" break; - case 21: -#line 89 "dce.y" /* yacc.c:1646 */ - {(yyval)=rangelist(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1358 "dcetab.c" /* yacc.c:1646 */ + case 21: /* rangelist: rangelist range */ +#line 89 "dce.y" + {yyval=rangelist(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1264 "dcetab.c" break; - case 22: -#line 94 "dce.y" /* yacc.c:1646 */ - {(yyval)=range(parsestate,(yyvsp[-1]),null,null);} -#line 1364 "dcetab.c" /* yacc.c:1646 */ + case 22: /* range: '[' number ']' */ +#line 94 "dce.y" + {yyval=range(parsestate,yyvsp[-1],null,null);} +#line 1270 "dcetab.c" break; - case 23: -#line 96 "dce.y" /* yacc.c:1646 */ - {(yyval)=range(parsestate,(yyvsp[-3]),null,(yyvsp[-1]));} -#line 1370 "dcetab.c" /* yacc.c:1646 */ + case 23: /* range: '[' number ':' number ']' */ +#line 96 "dce.y" + {yyval=range(parsestate,yyvsp[-3],null,yyvsp[-1]);} +#line 1276 "dcetab.c" break; - case 24: -#line 98 "dce.y" /* yacc.c:1646 */ - {(yyval)=range(parsestate,(yyvsp[-5]),(yyvsp[-3]),(yyvsp[-1]));} -#line 1376 "dcetab.c" /* yacc.c:1646 */ + case 24: /* range: '[' number ':' number ':' number ']' */ +#line 98 "dce.y" + {yyval=range(parsestate,yyvsp[-5],yyvsp[-3],yyvsp[-1]);} +#line 1282 "dcetab.c" break; - case 25: -#line 102 "dce.y" /* yacc.c:1646 */ - {(yyval) = range1(parsestate,(yyvsp[-1]));} -#line 1382 "dcetab.c" /* yacc.c:1646 */ + case 25: /* range1: '[' number ']' */ +#line 102 "dce.y" + {yyval = range1(parsestate,yyvsp[-1]);} +#line 1288 "dcetab.c" break; - case 26: -#line 108 "dce.y" /* yacc.c:1646 */ - {(yyval)=clauselist(parsestate,null,(yyvsp[0]));} -#line 1388 "dcetab.c" /* yacc.c:1646 */ + case 26: /* clauselist: sel_clause */ +#line 108 "dce.y" + {yyval=clauselist(parsestate,null,yyvsp[0]);} +#line 1294 "dcetab.c" break; - case 27: -#line 110 "dce.y" /* yacc.c:1646 */ - {(yyval)=clauselist(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1394 "dcetab.c" /* yacc.c:1646 */ + case 27: /* clauselist: clauselist sel_clause */ +#line 110 "dce.y" + {yyval=clauselist(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1300 "dcetab.c" break; - case 28: -#line 115 "dce.y" /* yacc.c:1646 */ - {(yyval)=sel_clause(parsestate,1,(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-1]));} -#line 1400 "dcetab.c" /* yacc.c:1646 */ + case 28: /* sel_clause: '&' value rel_op '{' value_list '}' */ +#line 115 "dce.y" + {yyval=sel_clause(parsestate,1,yyvsp[-4],yyvsp[-3],yyvsp[-1]);} +#line 1306 "dcetab.c" break; - case 29: -#line 117 "dce.y" /* yacc.c:1646 */ - {(yyval)=sel_clause(parsestate,2,(yyvsp[-2]),(yyvsp[-1]),(yyvsp[0]));} -#line 1406 "dcetab.c" /* yacc.c:1646 */ + case 29: /* sel_clause: '&' value rel_op value */ +#line 117 "dce.y" + {yyval=sel_clause(parsestate,2,yyvsp[-2],yyvsp[-1],yyvsp[0]);} +#line 1312 "dcetab.c" break; - case 30: -#line 119 "dce.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]);} -#line 1412 "dcetab.c" /* yacc.c:1646 */ + case 30: /* sel_clause: '&' boolfunction */ +#line 119 "dce.y" + {yyval=yyvsp[-1];} +#line 1318 "dcetab.c" break; - case 31: -#line 124 "dce.y" /* yacc.c:1646 */ - {(yyval)=value_list(parsestate,null,(yyvsp[0]));} -#line 1418 "dcetab.c" /* yacc.c:1646 */ + case 31: /* value_list: value */ +#line 124 "dce.y" + {yyval=value_list(parsestate,null,yyvsp[0]);} +#line 1324 "dcetab.c" break; - case 32: -#line 126 "dce.y" /* yacc.c:1646 */ - {(yyval)=value_list(parsestate,(yyvsp[-2]),(yyvsp[0]));} -#line 1424 "dcetab.c" /* yacc.c:1646 */ + case 32: /* value_list: value_list ',' value */ +#line 126 "dce.y" + {yyval=value_list(parsestate,yyvsp[-2],yyvsp[0]);} +#line 1330 "dcetab.c" break; - case 33: -#line 131 "dce.y" /* yacc.c:1646 */ - {(yyval)=value(parsestate,(yyvsp[0]));} -#line 1430 "dcetab.c" /* yacc.c:1646 */ + case 33: /* value: var */ +#line 131 "dce.y" + {yyval=value(parsestate,yyvsp[0]);} +#line 1336 "dcetab.c" break; - case 34: -#line 133 "dce.y" /* yacc.c:1646 */ - {(yyval)=value(parsestate,(yyvsp[0]));} -#line 1436 "dcetab.c" /* yacc.c:1646 */ + case 34: /* value: function */ +#line 133 "dce.y" + {yyval=value(parsestate,yyvsp[0]);} +#line 1342 "dcetab.c" break; - case 35: -#line 135 "dce.y" /* yacc.c:1646 */ - {(yyval)=value(parsestate,(yyvsp[0]));} -#line 1442 "dcetab.c" /* yacc.c:1646 */ + case 35: /* value: constant */ +#line 135 "dce.y" + {yyval=value(parsestate,yyvsp[0]);} +#line 1348 "dcetab.c" break; - case 36: -#line 140 "dce.y" /* yacc.c:1646 */ - {(yyval)=constant(parsestate,(yyvsp[0]),SCAN_NUMBERCONST);} -#line 1448 "dcetab.c" /* yacc.c:1646 */ + case 36: /* constant: number */ +#line 140 "dce.y" + {yyval=constant(parsestate,yyvsp[0],SCAN_NUMBERCONST);} +#line 1354 "dcetab.c" break; - case 37: -#line 142 "dce.y" /* yacc.c:1646 */ - {(yyval)=constant(parsestate,(yyvsp[0]),SCAN_STRINGCONST);} -#line 1454 "dcetab.c" /* yacc.c:1646 */ + case 37: /* constant: string */ +#line 142 "dce.y" + {yyval=constant(parsestate,yyvsp[0],SCAN_STRINGCONST);} +#line 1360 "dcetab.c" break; - case 38: -#line 147 "dce.y" /* yacc.c:1646 */ - {(yyval)=var(parsestate,(yyvsp[0]));} -#line 1460 "dcetab.c" /* yacc.c:1646 */ + case 38: /* var: indexpath */ +#line 147 "dce.y" + {yyval=var(parsestate,yyvsp[0]);} +#line 1366 "dcetab.c" break; - case 39: -#line 152 "dce.y" /* yacc.c:1646 */ - {(yyval)=indexpath(parsestate,null,(yyvsp[0]));} -#line 1466 "dcetab.c" /* yacc.c:1646 */ + case 39: /* indexpath: index */ +#line 152 "dce.y" + {yyval=indexpath(parsestate,null,yyvsp[0]);} +#line 1372 "dcetab.c" break; - case 40: -#line 154 "dce.y" /* yacc.c:1646 */ - {(yyval)=indexpath(parsestate,(yyvsp[-2]),(yyvsp[0]));} -#line 1472 "dcetab.c" /* yacc.c:1646 */ + case 40: /* indexpath: indexpath '.' index */ +#line 154 "dce.y" + {yyval=indexpath(parsestate,yyvsp[-2],yyvsp[0]);} +#line 1378 "dcetab.c" break; - case 41: -#line 159 "dce.y" /* yacc.c:1646 */ - {(yyval)=indexer(parsestate,(yyvsp[0]),null);} -#line 1478 "dcetab.c" /* yacc.c:1646 */ + case 41: /* index: word */ +#line 159 "dce.y" + {yyval=indexer(parsestate,yyvsp[0],null);} +#line 1384 "dcetab.c" break; - case 42: -#line 161 "dce.y" /* yacc.c:1646 */ - {(yyval)=indexer(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1484 "dcetab.c" /* yacc.c:1646 */ + case 42: /* index: word array_indices */ +#line 161 "dce.y" + {yyval=indexer(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1390 "dcetab.c" break; - case 43: -#line 166 "dce.y" /* yacc.c:1646 */ - {(yyval)=array_indices(parsestate,null,(yyvsp[0]));} -#line 1490 "dcetab.c" /* yacc.c:1646 */ + case 43: /* array_indices: range1 */ +#line 166 "dce.y" + {yyval=array_indices(parsestate,null,yyvsp[0]);} +#line 1396 "dcetab.c" break; - case 44: -#line 168 "dce.y" /* yacc.c:1646 */ - {(yyval)=array_indices(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1496 "dcetab.c" /* yacc.c:1646 */ + case 44: /* array_indices: array_indices range1 */ +#line 168 "dce.y" + {yyval=array_indices(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1402 "dcetab.c" break; - case 45: -#line 173 "dce.y" /* yacc.c:1646 */ - {(yyval)=function(parsestate,(yyvsp[-2]),null);} -#line 1502 "dcetab.c" /* yacc.c:1646 */ + case 45: /* boolfunction: ident '(' ')' */ +#line 173 "dce.y" + {yyval=function(parsestate,yyvsp[-2],null);} +#line 1408 "dcetab.c" break; - case 46: -#line 175 "dce.y" /* yacc.c:1646 */ - {(yyval)=function(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1508 "dcetab.c" /* yacc.c:1646 */ + case 46: /* boolfunction: ident '(' arg_list ')' */ +#line 175 "dce.y" + {yyval=function(parsestate,yyvsp[-3],yyvsp[-1]);} +#line 1414 "dcetab.c" break; - case 47: -#line 180 "dce.y" /* yacc.c:1646 */ - {(yyval)=arg_list(parsestate,null,(yyvsp[0]));} -#line 1514 "dcetab.c" /* yacc.c:1646 */ + case 47: /* arg_list: value */ +#line 180 "dce.y" + {yyval=arg_list(parsestate,null,yyvsp[0]);} +#line 1420 "dcetab.c" break; - case 48: -#line 182 "dce.y" /* yacc.c:1646 */ - {(yyval)=arg_list(parsestate,(yyvsp[-2]),(yyvsp[0]));} -#line 1520 "dcetab.c" /* yacc.c:1646 */ + case 48: /* arg_list: value_list ',' value */ +#line 182 "dce.y" + {yyval=arg_list(parsestate,yyvsp[-2],yyvsp[0]);} +#line 1426 "dcetab.c" break; - case 49: -#line 186 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_EQ);} -#line 1526 "dcetab.c" /* yacc.c:1646 */ + case 49: /* rel_op: '=' */ +#line 186 "dce.y" + {yyval=makeselectiontag(CEO_EQ);} +#line 1432 "dcetab.c" break; - case 50: -#line 187 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_GT);} -#line 1532 "dcetab.c" /* yacc.c:1646 */ + case 50: /* rel_op: '>' */ +#line 187 "dce.y" + {yyval=makeselectiontag(CEO_GT);} +#line 1438 "dcetab.c" break; - case 51: -#line 188 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_LT);} -#line 1538 "dcetab.c" /* yacc.c:1646 */ + case 51: /* rel_op: '<' */ +#line 188 "dce.y" + {yyval=makeselectiontag(CEO_LT);} +#line 1444 "dcetab.c" break; - case 52: -#line 189 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_NEQ);} -#line 1544 "dcetab.c" /* yacc.c:1646 */ + case 52: /* rel_op: '!' '=' */ +#line 189 "dce.y" + {yyval=makeselectiontag(CEO_NEQ);} +#line 1450 "dcetab.c" break; - case 53: -#line 190 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_GE);} -#line 1550 "dcetab.c" /* yacc.c:1646 */ + case 53: /* rel_op: '>' '=' */ +#line 190 "dce.y" + {yyval=makeselectiontag(CEO_GE);} +#line 1456 "dcetab.c" break; - case 54: -#line 191 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_LE);} -#line 1556 "dcetab.c" /* yacc.c:1646 */ + case 54: /* rel_op: '<' '=' */ +#line 191 "dce.y" + {yyval=makeselectiontag(CEO_LE);} +#line 1462 "dcetab.c" break; - case 55: -#line 192 "dce.y" /* yacc.c:1646 */ - {(yyval)=makeselectiontag(CEO_RE);} -#line 1562 "dcetab.c" /* yacc.c:1646 */ + case 55: /* rel_op: '=' '~' */ +#line 192 "dce.y" + {yyval=makeselectiontag(CEO_RE);} +#line 1468 "dcetab.c" break; - case 56: -#line 196 "dce.y" /* yacc.c:1646 */ - {(yyval) = (yyvsp[0]);} -#line 1568 "dcetab.c" /* yacc.c:1646 */ + case 56: /* ident: word */ +#line 196 "dce.y" + {yyval = yyvsp[0];} +#line 1474 "dcetab.c" break; - case 57: -#line 200 "dce.y" /* yacc.c:1646 */ - {(yyval) = checkobject((yyvsp[0]));} -#line 1574 "dcetab.c" /* yacc.c:1646 */ + case 57: /* word: SCAN_WORD */ +#line 200 "dce.y" + {yyval = checkobject(yyvsp[0]);} +#line 1480 "dcetab.c" break; - case 58: -#line 204 "dce.y" /* yacc.c:1646 */ - {(yyval) = checkobject((yyvsp[0]));} -#line 1580 "dcetab.c" /* yacc.c:1646 */ + case 58: /* number: SCAN_NUMBERCONST */ +#line 204 "dce.y" + {yyval = checkobject(yyvsp[0]);} +#line 1486 "dcetab.c" break; - case 59: -#line 208 "dce.y" /* yacc.c:1646 */ - {(yyval) = checkobject((yyvsp[0]));} -#line 1586 "dcetab.c" /* yacc.c:1646 */ + case 59: /* string: SCAN_STRINGCONST */ +#line 208 "dce.y" + {yyval = checkobject(yyvsp[0]);} +#line 1492 "dcetab.c" break; -#line 1590 "dcetab.c" /* yacc.c:1646 */ +#line 1496 "dcetab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1600,25 +1507,23 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -1629,50 +1534,14 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE yyerror (parsestate, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (parsestate, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif } - - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -1701,12 +1570,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1723,13 +1591,14 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -1743,7 +1612,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yydestruct ("Error: popping", - yystos[yystate], yyvsp, parsestate); + YY_ACCESSING_SYMBOL (yystate), yyvsp, parsestate); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1755,7 +1624,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1766,26 +1635,30 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; + -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (parsestate, YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ -#endif + goto yyreturnlab; + -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -1801,18 +1674,16 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, parsestate); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parsestate); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif + return yyresult; } -#line 211 "dce.y" /* yacc.c:1906 */ + +#line 211 "dce.y" diff --git a/libdap2/dcetab.h b/libdap2/dcetab.h index b399b6446d..fe0ce56fbb 100644 --- a/libdap2/dcetab.h +++ b/libdap2/dcetab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -30,6 +31,10 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + #ifndef YY_DCE_DCE_TAB_H_INCLUDED # define YY_DCE_DCE_TAB_H_INCLUDED /* Debug traces. */ @@ -40,15 +45,20 @@ extern int dcedebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - SCAN_WORD = 258, - SCAN_STRINGCONST = 259, - SCAN_NUMBERCONST = 260 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + SCAN_WORD = 258, /* SCAN_WORD */ + SCAN_STRINGCONST = 259, /* SCAN_STRINGCONST */ + SCAN_NUMBERCONST = 260 /* SCAN_NUMBERCONST */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ @@ -60,6 +70,8 @@ typedef int YYSTYPE; + int dceparse (DCEparsestate* parsestate); + #endif /* !YY_DCE_DCE_TAB_H_INCLUDED */ diff --git a/libdap4/d4curlfunctions.c b/libdap4/d4curlfunctions.c index b1f949b9f4..1519040c80 100644 --- a/libdap4/d4curlfunctions.c +++ b/libdap4/d4curlfunctions.c @@ -363,8 +363,8 @@ NCD4_get_rcproperties(NCD4INFO* state) unsigned long interval=0; if(sscanf(option,"%lu/%lu",&idle,&interval) != 2) fprintf(stderr,"Illegal KEEPALIVE VALUE: %s\n",option); - state->curl->keepalive.idle = idle; - state->curl->keepalive.interval = interval; + state->curl->keepalive.idle = (long)idle; + state->curl->keepalive.interval = (long)interval; state->curl->keepalive.active = 1; } } diff --git a/libdap4/d4data.c b/libdap4/d4data.c index d1e28b4092..309ffa6a75 100644 --- a/libdap4/d4data.c +++ b/libdap4/d4data.c @@ -36,7 +36,7 @@ static unsigned NCD4_computeChecksum(NCD4meta* meta, NCD4node* topvar); /* Macro define procedures */ #ifdef D4DUMPCSUM -static unsigned int debugcrc32(unsigned int crc, const void *buf, size_t size) +static unsigned int debugcrc32(unsigned int crc, const void *buf, unsigned int size) { int i; fprintf(stderr,"crc32: "); @@ -309,7 +309,7 @@ fillopfixed(NCD4meta* meta, d4size_t opaquesize, NCD4offset* offset, void** dstp SKIPCOUNTER(offset); /* verify that it is the correct size */ actual = count; - delta = actual - opaquesize; + delta = (int)actual - (int)opaquesize; if(delta != 0) { #ifdef FIXEDOPAQUE nclog(NCLOGWARN,"opaque changed from %lu to %lu",actual,opaquesize); @@ -443,7 +443,7 @@ NCD4_computeChecksum(NCD4meta* meta, NCD4node* topvar) ASSERT((ISTOPLEVEL(topvar))); #ifndef HYRAXCHECKSUM - csum = CRC32(csum,topvar->data.dap4data.memory,topvar->data.dap4data.size); + csum = CRC32(csum,topvar->data.dap4data.memory, (unsigned int)topvar->data.dap4data.size); #else if(topvar->basetype->subsort != NC_STRING) { csum = CRC32(csum,topvar->data.dap4data.memory,topvar->data.dap4data.size); diff --git a/libdap4/d4file.c b/libdap4/d4file.c index 9f48cbc45f..03970ecad5 100644 --- a/libdap4/d4file.c +++ b/libdap4/d4file.c @@ -3,6 +3,7 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ +#include "config.h" #include "ncdispatch.h" #include "ncd4dispatch.h" #include "d4includes.h" @@ -160,7 +161,7 @@ NCD4_open(const char * path, int mode, {ret = NC_ENOMEM; goto done;} dmrresp->controller = d4info; - if((ret=NCD4_readDMR(d4info, d4info->controls.flags.flags, d4info->dmruri, dmrresp))) goto done; + if((ret=NCD4_readDMR(d4info, d4info->dmruri, dmrresp))) goto done; /* set serial.rawdata */ len = ncbyteslength(d4info->curl->packet); diff --git a/libdap4/d4fix.c b/libdap4/d4fix.c index af47ea88e3..9cf1ba1cfa 100644 --- a/libdap4/d4fix.c +++ b/libdap4/d4fix.c @@ -231,7 +231,6 @@ static int delimitAtomicVar(NCD4meta* compiler, NCD4node* var, NCD4offset* offset) { int ret = NC_NOERR; - int typesize; d4size_t i; d4size_t dimproduct; nc_type tid; @@ -249,7 +248,7 @@ delimitAtomicVar(NCD4meta* compiler, NCD4node* var, NCD4offset* offset) truetype = basetype->basetype; tid = truetype->subsort; - typesize = NCD4_typesize(tid); + size_t typesize = NCD4_typesize(tid); if(tid != NC_STRING) { INCR(offset,(typesize*dimproduct)); } else if(tid == NC_STRING) { /* walk the counts */ @@ -448,13 +447,13 @@ skipAtomicInstance(NCD4meta* compiler, NCD4node* type, NCD4offset* offset) { int ret = NC_NOERR; d4size_t count; - int typesize; + size_t typesize; switch (type->subsort) { default: /* fixed size atomic type */ typesize = NCD4_typesize(type->meta.id); - INCR(offset,typesize); - break; + INCR(offset,typesize); + break; case NC_STRING: /* Get string count */ count = GETCOUNTER(offset); diff --git a/libdap4/d4http.c b/libdap4/d4http.c index 13cb82a193..eb144c93ba 100644 --- a/libdap4/d4http.c +++ b/libdap4/d4http.c @@ -70,7 +70,7 @@ NCD4_fetchurl(CURL* curl, const char* url, NCbytes* buf, long* filetime, int* ht if(cstat != CURLE_OK) goto done; httpcode = NCD4_fetchhttpcode(curl); - if(httpcodep) *httpcodep = httpcode; + if(httpcodep) *httpcodep = (int)httpcode; /* Get the last modified time */ if(filetime != NULL) diff --git a/libdap4/d4meta.c b/libdap4/d4meta.c index 57d030f77a..6b84b88773 100644 --- a/libdap4/d4meta.c +++ b/libdap4/d4meta.c @@ -39,7 +39,7 @@ static int convertString(union ATOMICS* converter, NCD4node* type, const char* s static void* copyAtomic(union ATOMICS* converter, nc_type type, size_t len, void* dst, NClist* blobs); static int decodeEconst(NCD4meta* builder, NCD4node* enumtype, const char* nameorval, union ATOMICS* converter); static int downConvert(union ATOMICS* converter, NCD4node* type); -static void freeStringMemory(char** mem, int count); +static void freeStringMemory(char** mem, size_t count); static size_t getDimrefs(NCD4node* var, int* dimids); static size_t getDimsizes(NCD4node* var, int* dimsizes); static d4size_t getpadding(d4size_t offset, size_t alignment); @@ -255,7 +255,7 @@ buildDimension(NCD4meta* builder, NCD4node* dim) if(dim->dim.isunlimited) { NCCHECK((nc_def_dim(group->meta.id,dim->name,NC_UNLIMITED,&dim->meta.id))); } else { - NCCHECK((nc_def_dim(group->meta.id,dim->name,(size_t)dim->dim.size,&dim->meta.id))); + NCCHECK((nc_def_dim(group->meta.id,dim->name,dim->dim.size,&dim->meta.id))); } done: return THROW(ret); @@ -535,7 +535,7 @@ buildAtomicVar(NCD4meta* builder, NCD4node* var) #endif rank = getDimrefs(var,dimids); - NCCHECK((nc_def_var(group->meta.id,var->name,var->basetype->meta.id,rank,dimids,&var->meta.id))); + NCCHECK((nc_def_var(group->meta.id,var->name,var->basetype->meta.id,(int)rank,dimids,&var->meta.id))); /* Tag the var */ savevarbyid(group,var); @@ -705,11 +705,10 @@ getDimsizes(NCD4node* var, int* dimsizes) /* Utilities */ static void -freeStringMemory(char** mem, int count) +freeStringMemory(char** mem, size_t count) { - int i; if(mem == NULL) return; - for(i=0;irank <= NC_MAX_VAR_DIMS); for(i=0;irank;i++) { size_t istart,icount,istop,ideclsize; - ptrdiff_t istride; + size_t istride; istart = (start != NULL ? start[i] : 0); icount = (count != NULL ? count[i] : (size != NULL ? size[i] : 1)); istride = (size_t)(stride != NULL ? stride[i] : 1); @@ -98,14 +98,13 @@ d4odom_more(D4odometer* odom) d4size_t d4odom_next(D4odometer* odom) { - int i; /* do not make unsigned */ d4size_t count; if(odom->rank == 0) { /*scalar*/ odom->index[0]++; return 0; } count = d4odom_offset(odom); /* convenience */ - for(i=odom->rank-1;i>=0;i--) { + for(size_t i=odom->rank; i-- >0;) { odom->index[i] += odom->stride[i]; if(odom->index[i] < odom->stop[i]) break; if(i == 0) break; /* leave the 0th entry if it overflows*/ diff --git a/libdap4/d4odom.h b/libdap4/d4odom.h index ae37997e19..f0261b0dfc 100644 --- a/libdap4/d4odom.h +++ b/libdap4/d4odom.h @@ -7,7 +7,7 @@ #define D4ODOM_H 1 typedef struct D4odometer { - int rank; + size_t rank; size_t index[NC_MAX_VAR_DIMS]; size_t start[NC_MAX_VAR_DIMS]; #if 0 diff --git a/libdap4/d4parser.c b/libdap4/d4parser.c index 895e88e2a0..a557ce1177 100644 --- a/libdap4/d4parser.c +++ b/libdap4/d4parser.c @@ -288,7 +288,7 @@ parseDimensions(NCD4parser* parser, NCD4node* group, ncxml_t xml) if((ret = parseULL(sizestr,&size))) goto done; nullfree(sizestr); if((ret=makeNode(parser,group,x,NCD4_DIM,NC_NULL,&dimnode))) goto done; - dimnode->dim.size = (long long)size; + dimnode->dim.size = size; dimnode->dim.isunlimited = (unlimstr != NULL); nullfree(unlimstr); /* Process attributes */ @@ -881,7 +881,7 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group) { size_t i; int ret = NC_NOERR; - long long len; + size_t len; NCD4node* opaquetype = NULL; char* xattr; @@ -894,11 +894,11 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group) /* See if this var has UCARTAGOPAQUE attribute */ xattr = ncxml_attr(varxml,UCARTAGOPAQUE); if(xattr != NULL) { - long long tmp = 0; + long long tmp = 0; if((ret = parseLL(xattr,&tmp)) || (tmp < 0)) - FAIL(NC_EINVAL,"Illegal opaque len: %s",xattr); - len = tmp; - nullfree(xattr); + FAIL(NC_EINVAL,"Illegal opaque len: %s",xattr); + len = (size_t)tmp; + nullfree(xattr); } } #ifndef FIXEDOPAQUE @@ -920,7 +920,7 @@ getOpaque(NCD4parser* parser, ncxml_t varxml, NCD4node* group) if(opaquetype == NULL) {/* create it */ char name[NC_MAX_NAME+1]; /* Make name be "opaqueN" */ - snprintf(name,NC_MAX_NAME,"opaque%lld_t",len); + snprintf(name,NC_MAX_NAME,"opaque%zu_t",len); /* Opaque types are always created in the current group */ if((ret=makeNode(parser,group,NULL,NCD4_TYPE,NC_OPAQUE,&opaquetype))) goto done; @@ -1098,14 +1098,13 @@ lookupFQNList(NCD4parser* parser, NClist* fqn, NCD4sort sort, NCD4node** result) { int ret = NC_NOERR; size_t i; - int nsteps; NCD4node* current; char* name = NULL; NCD4node* node = NULL; /* Step 1: walk thru groups until can go no further */ current = parser->metadata->root; - nsteps = nclistlength(fqn); + size_t nsteps = nclistlength(fqn); for(i=1;isort)); name = (char*)nclistget(fqn,i); @@ -1282,17 +1281,17 @@ defineAtomicTypes(NCD4meta* meta, NClist* list) static NCD4node* lookupAtomicType(NClist* atomictypes, const char* name) { - int n = nclistlength(atomictypes); - int L = 0; - int R = (n - 1); - int m, cmp; + size_t n = nclistlength(atomictypes); + if (n == 0) return NULL; + size_t L = 0; + size_t R = n - 1; NCD4node* p; for(;;) { if(L > R) break; - m = (L + R) / 2; + size_t m = (L + R) / 2; p = (NCD4node*)nclistget(atomictypes,m); - cmp = strcasecmp(p->name,name); + int cmp = strcasecmp(p->name,name); if(cmp == 0) return p; if(cmp < 0) @@ -1364,13 +1363,13 @@ makeAnonDim(NCD4parser* parser, const char* sizestr) ret = parseLL(sizestr,&size); if(ret) return NULL; - snprintf(name,NC_MAX_NAME,"/_AnonymousDim%lld",size); + snprintf(name,NC_MAX_NAME,"/%s_%lld",NCDIMANON,size); /* See if it exists already */ dim = lookupFQN(parser,name,NCD4_DIM); if(dim == NULL) {/* create it */ if((ret=makeNode(parser,root,NULL,NCD4_DIM,NC_NULL,&dim))) goto done; SETNAME(dim,name+1); /* leave out the '/' separator */ - dim->dim.size = (long long)size; + dim->dim.size = (size_t)size; dim->dim.isanonymous = 1; classify(root,dim); } diff --git a/libdap4/d4read.c b/libdap4/d4read.c index 3a24b08ff0..7cc3ba070d 100644 --- a/libdap4/d4read.c +++ b/libdap4/d4read.c @@ -37,7 +37,7 @@ deltatime(struct timeval time0,struct timeval time1) #endif int -NCD4_readDMR(NCD4INFO* state, int flags, NCURI* url, NCD4response* resp) +NCD4_readDMR(NCD4INFO* state, NCURI* url, NCD4response* resp) { int stat = NC_NOERR; ncbytesclear(state->curl->packet); @@ -46,7 +46,7 @@ NCD4_readDMR(NCD4INFO* state, int flags, NCURI* url, NCD4response* resp) } int -NCD4_readDAP(NCD4INFO* state, int flags, NCURI* url, NCD4response* resp) +NCD4_readDAP(NCD4INFO* state, NCURI* url, NCD4response* resp) { int stat = NC_NOERR; diff --git a/libdap4/d4swap.c b/libdap4/d4swap.c index 1d76a55b7b..27d91f50b9 100644 --- a/libdap4/d4swap.c +++ b/libdap4/d4swap.c @@ -7,6 +7,7 @@ #include #include #include "d4includes.h" +#include "d4util.h" /* The primary purpose of this code is to recursively traverse @@ -51,7 +52,7 @@ NCD4_swapdata(NCD4response* resp, NCD4node* var, int doswap) if((ret=walkSeqArray(resp,var,var,offset,doswap))) goto done; break; } - var->data.dap4data.size = DELTA(offset,var->data.dap4data.memory); + var->data.dap4data.size = (d4size_t)DELTA(offset,var->data.dap4data.memory); /* skip checksum, if there is one */ if(resp->inferredchecksumming) INCR(offset,CHECKSUMSIZE); @@ -77,8 +78,8 @@ walkAtomicVar(NCD4response* resp, NCD4node* topvar, NCD4node* var, NCD4offset* o subsort = var->basetype->basetype->subsort; /* Only need to swap multi-byte integers and floats */ if(subsort != NC_STRING) { - int typesize = NCD4_typesize(subsort); - d4size_t totalsize = typesize*dimproduct; + size_t typesize = NCD4_typesize(subsort); + d4size_t totalsize = typesize*dimproduct; if(typesize == 1) { INCR(offset,totalsize); } else { /*(typesize > 1)*/ diff --git a/libdap4/d4util.h b/libdap4/d4util.h index 38cda6a179..a094e68f84 100644 --- a/libdap4/d4util.h +++ b/libdap4/d4util.h @@ -23,7 +23,7 @@ typedef struct D4blob {d4size_t size; void* memory;} D4blob; /* Empty blob constant */ #define NULLBLOB(blob) {blob.size = 0; blob.memory = NULL;} -#define OFFSET2BLOB(blob,offset) do{(blob).size = ((offset)->limit - (offset)->base); (blob).memory = (offset)->base; }while(0) +#define OFFSET2BLOB(blob,offset) do{(blob).size = (d4size_t)((offset)->limit - (offset)->base); (blob).memory = (offset)->base; }while(0) #define BLOB2OFFSET(offset,blob) do{\ (offset)->base = (blob).memory; \ (offset)->limit = ((char*)(blob).memory) + (blob).size; \ diff --git a/libdap4/d4varx.c b/libdap4/d4varx.c index e42bd98558..12172c173c 100644 --- a/libdap4/d4varx.c +++ b/libdap4/d4varx.c @@ -69,7 +69,7 @@ NCD4_get_vars(int gid, int varid, /* build size vector */ for(i=0;idims,i); - dimsizes[i] = (size_t)dim->dim.size; + dimsizes[i] = dim->dim.size; } /* Extract and desired subset of data */ @@ -195,7 +195,7 @@ getvarx(int gid, int varid, NCD4INFO** infop, NCD4node** varp, if((ret=NCD4_newResponse(info,&dapresp))) goto done; dapresp->mode = NCD4_DAP; nclistpush(info->responses,dapresp); - if((ret=NCD4_readDAP(info, info->controls.flags.flags, ceuri, dapresp))) goto done; + if((ret=NCD4_readDAP(info, ceuri, dapresp))) goto done; /* Extract DMR and dechunk the data part */ if((ret=NCD4_dechunk(dapresp))) goto done; diff --git a/libdap4/ncd4.h b/libdap4/ncd4.h index 286406d771..d72cef395c 100644 --- a/libdap4/ncd4.h +++ b/libdap4/ncd4.h @@ -84,8 +84,8 @@ EXTERNL int NCD4_fetchlastmodified(CURL* curl, char* url, long* filetime); EXTERNL int NCD4_ping(const char* url); /* From d4read.c */ -EXTERNL int NCD4_readDMR(NCD4INFO* state, int flags, NCURI* url, NCD4response*); -EXTERNL int NCD4_readDAP(NCD4INFO* state, int flags, NCURI* ceuri, NCD4response*); +EXTERNL int NCD4_readDMR(NCD4INFO* state, NCURI* url, NCD4response*); +EXTERNL int NCD4_readDAP(NCD4INFO* state, NCURI* ceuri, NCD4response*); EXTERNL int NCD4_seterrormessage(NCD4response*, size_t len, char* msg); /* From d4parser.c */ diff --git a/libdap4/ncd4types.h b/libdap4/ncd4types.h index 7bed38a845..995ed56f61 100644 --- a/libdap4/ncd4types.h +++ b/libdap4/ncd4types.h @@ -13,6 +13,7 @@ are defined here. #undef COMPILEBYDEFAULT +#include "ncdap.h" #include "ncrc.h" #include "ncauth.h" @@ -206,10 +207,10 @@ struct NCD4node { NClist* values; } attr; struct { /* sort == NCD4_OPAQUE */ - long long size; /* 0 => var length */ + size_t size; /* 0 => var length */ } opaque; struct { /* sort == NCD4_DIMENSION */ - long long size; + size_t size; int isunlimited; int isanonymous; } dim; diff --git a/libdispatch/daux.c b/libdispatch/daux.c index 77fddaffef..a95dd8977a 100644 --- a/libdispatch/daux.c +++ b/libdispatch/daux.c @@ -56,6 +56,8 @@ static int computefieldinfo(struct NCAUX_CMPD* cmpd); static int filterspec_cvt(const char* txt, size_t* nparamsp, unsigned int* params); +EXTERNL int nc_dump_data(int ncid, nc_type xtype, void* memory, size_t count, char** bufp); + /**************************************************/ /* This code is a variant of the H5detect.c code from HDF5. @@ -922,6 +924,7 @@ ncaux_inq_any_type(int ncid, nc_type typeid, char *name, size_t *sizep, nc_type return NC_inq_any_type(ncid, typeid, name, sizep, basetypep, nfieldsp, classp); } +#ifdef USE_NETCDF4 /** @param ncid - only needed for a compound type @param xtype - type for which alignment is requested @@ -932,6 +935,7 @@ ncaux_type_alignment(int xtype, int ncid, size_t* alignp) /* Defer to the internal version */ return NC_type_alignment(ncid, xtype, alignp); } +#endif /** Dump the output tree of data from a call @@ -948,6 +952,6 @@ This function is just a wrapper around nc_dump__data. EXTERNL int ncaux_dump_data(int ncid, int xtype, void* memory, size_t count, char** bufp) { -EXTERNL int nc_dump_data(int ncid, nc_type xtype, void* memory, size_t count, char** bufp); return nc_dump_data(ncid, xtype, memory, count, bufp); } + diff --git a/libdispatch/dcopy.c b/libdispatch/dcopy.c index a1bf5c714d..f431cce2b5 100644 --- a/libdispatch/dcopy.c +++ b/libdispatch/dcopy.c @@ -12,11 +12,17 @@ #include "nc_logging.h" #include "nclist.h" +static int NC_find_equal_type(int ncid1, nc_type xtype1, int ncid2, nc_type *xtype2); + #ifdef USE_NETCDF4 static int searchgroup(int ncid1, int tid1, int grp, int* tid2); static int searchgrouptree(int ncid1, int tid1, int grp, int* tid2); +#endif /*USE_NETCDF4*/ + + +#ifdef USE_NETCDF4 /** * @internal Compare two netcdf types for equality. Must have the * ncids as well, to find user-defined types. @@ -203,6 +209,8 @@ NC_rec_find_nc_type(int ncid1, nc_type tid1, int ncid2, nc_type* tid2) return ret; } +#endif /* USE_NETCDF4 */ + /** * @internal Given a type in one file, find its equal (if any) in * another file. It sounds so simple, but it's a real pain! @@ -232,15 +240,15 @@ NC_find_equal_type(int ncid1, nc_type xtype1, int ncid2, nc_type *xtype2) return NC_NOERR; } +#ifdef USE_NETCDF4 /* Recursively search group ncid2 and its children to find a type that is equal (using compare_type) to xtype1. */ ret = NC_rec_find_nc_type(ncid1, xtype1 , ncid2, xtype2); +#endif /* USE_NETCDF4 */ return ret; } -#endif /* USE_NETCDF4 */ - /** * This will copy a variable that is an array of primitive type and * its attributes from one file to another, assuming dimensions in the @@ -726,4 +734,5 @@ searchgrouptree(int ncid1, int tid1, int grp, int* tid2) return ret; } -#endif +#endif /* USE_NETCDF4 */ + diff --git a/libdispatch/ddispatch.c b/libdispatch/ddispatch.c index 1a541ab0ae..bdb42fceb4 100644 --- a/libdispatch/ddispatch.c +++ b/libdispatch/ddispatch.c @@ -34,8 +34,6 @@ See LICENSE.txt for license information. #define MAXPATH 1024 - - /* Define vectors of zeros and ones for use with various nc_get_varX functions */ /* Note, this form of initialization fails under Cygwin */ size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0}; @@ -143,3 +141,335 @@ NCDISPATCH_finalize(void) NC_freeglobalstate(); /* should be one of the last things done */ return status; } + +/**************************************************/ +/* Global State constants and state */ + +/* The singleton global state object */ +static NCglobalstate* nc_globalstate = NULL; + +/* Forward */ +static int NC_createglobalstate(void); + +/** \defgroup global_state Global state functions. */ +/** \{ + +\ingroup global state +*/ + +/* NCglobal state management */ + +static int +NC_createglobalstate(void) +{ + int stat = NC_NOERR; + const char* tmp = NULL; + + if(nc_globalstate == NULL) { + nc_globalstate = calloc(1,sizeof(NCglobalstate)); + } + /* Initialize struct pointers */ + if((nc_globalstate->rcinfo = calloc(1,sizeof(struct NCRCinfo)))==NULL) + {stat = NC_ENOMEM; goto done;} + if((nc_globalstate->rcinfo->entries = nclistnew())==NULL) + {stat = NC_ENOMEM; goto done;} + if((nc_globalstate->rcinfo->s3profiles = nclistnew())==NULL) + {stat = NC_ENOMEM; goto done;} + + /* Get environment variables */ + if(getenv(NCRCENVIGNORE) != NULL) + nc_globalstate->rcinfo->ignore = 1; + tmp = getenv(NCRCENVRC); + if(tmp != NULL && strlen(tmp) > 0) + nc_globalstate->rcinfo->rcfile = strdup(tmp); + /* Initialize chunk cache defaults */ + nc_globalstate->chunkcache.size = DEFAULT_CHUNK_CACHE_SIZE; /**< Default chunk cache size. */ + nc_globalstate->chunkcache.nelems = DEFAULT_CHUNKS_IN_CACHE; /**< Default chunk cache number of elements. */ + nc_globalstate->chunkcache.preemption = DEFAULT_CHUNK_CACHE_PREEMPTION; /**< Default chunk cache preemption. */ + +done: + return stat; +} + +/* Get global state */ +NCglobalstate* +NC_getglobalstate(void) +{ + if(nc_globalstate == NULL) + NC_createglobalstate(); + return nc_globalstate; +} + +void +NC_freeglobalstate(void) +{ + if(nc_globalstate != NULL) { + nullfree(nc_globalstate->tempdir); + nullfree(nc_globalstate->home); + nullfree(nc_globalstate->cwd); + nullfree(nc_globalstate->aws.default_region); + nullfree(nc_globalstate->aws.config_file); + nullfree(nc_globalstate->aws.profile); + nullfree(nc_globalstate->aws.access_key_id); + nullfree(nc_globalstate->aws.secret_access_key); + if(nc_globalstate->rcinfo) { + NC_rcclear(nc_globalstate->rcinfo); + free(nc_globalstate->rcinfo); + } + free(nc_globalstate); + nc_globalstate = NULL; + } +} + +/** \} */ + +/**************************************************/ +/** \defgroup atomic_types Atomic Type functions */ +/** \{ + +\ingroup atomic_types +*/ + +/* The sizes of types may vary from platform to platform, but within + * netCDF files, type sizes are fixed. */ +#define NC_CHAR_LEN sizeof(char) /**< @internal Size of char. */ +#define NC_STRING_LEN sizeof(char *) /**< @internal Size of char *. */ +#define NC_BYTE_LEN 1 /**< @internal Size of byte. */ +#define NC_SHORT_LEN 2 /**< @internal Size of short. */ +#define NC_INT_LEN 4 /**< @internal Size of int. */ +#define NC_FLOAT_LEN 4 /**< @internal Size of float. */ +#define NC_DOUBLE_LEN 8 /**< @internal Size of double. */ +#define NC_INT64_LEN 8 /**< @internal Size of int64. */ + +/** @internal Names of atomic types. */ +const char* nc4_atomic_name[NUM_ATOMIC_TYPES] = {"none", "byte", "char", + "short", "int", "float", + "double", "ubyte", + "ushort", "uint", + "int64", "uint64", "string"}; +static const size_t nc4_atomic_size[NUM_ATOMIC_TYPES] = {0, NC_BYTE_LEN, NC_CHAR_LEN, NC_SHORT_LEN, + NC_INT_LEN, NC_FLOAT_LEN, NC_DOUBLE_LEN, + NC_BYTE_LEN, NC_SHORT_LEN, NC_INT_LEN, NC_INT64_LEN, + NC_INT64_LEN, NC_STRING_LEN}; + +/** + * @internal Get the name and size of an atomic type. For strings, 1 is + * returned. + * + * @param typeid1 Type ID. + * @param name Gets the name of the type. + * @param size Gets the size of one element of the type in bytes. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_EBADTYPE Type not found. + * @author Dennis Heimbigner + */ +int +NC4_inq_atomic_type(nc_type typeid1, char *name, size_t *size) +{ + if (typeid1 >= NUM_ATOMIC_TYPES) + return NC_EBADTYPE; + if (name) + strcpy(name, nc4_atomic_name[typeid1]); + if (size) + *size = nc4_atomic_size[typeid1]; + return NC_NOERR; +} + +/** + * @internal Get the id and size of an atomic type by name. + * + * @param name [in] the name of the type. + * @param idp [out] the type index of the type. + * @param sizep [out] the size of one element of the type in bytes. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_EBADTYPE Type not found. + * @author Dennis Heimbigner + */ +int +NC4_lookup_atomic_type(const char *name, nc_type* idp, size_t *sizep) +{ + int i; + + if (name == NULL || strlen(name) == 0) + return NC_EBADTYPE; + for(i=0;ialignment.threshold = threshold; + gs->alignment.alignment = alignment; + gs->alignment.defined = 1; + return NC_NOERR; +} + +/** +Provide get function to retrieve global data alignment +information. + +The nc_get_alignment function return the last values set by +nc_set_alignment. If nc_set_alignment has not been called, then +it returns the value 0 for both threshold and alignment. + +@param thresholdp Return the current minimum size to which alignment is applied or zero. +@param alignmentp Return the current alignment value or zero. + +@return ::NC_NOERR No error. +@return ::NC_EINVAL Invalid input. +@author Dennis Heimbigner +@ingroup datasets +*/ + +int +nc_get_alignment(int* thresholdp, int* alignmentp) +{ + NCglobalstate* gs = NC_getglobalstate(); + if(thresholdp) *thresholdp = gs->alignment.threshold; + if(alignmentp) *alignmentp = gs->alignment.alignment; + return NC_NOERR; +} + +/** \} */ diff --git a/libdispatch/dfilter.c b/libdispatch/dfilter.c index 760815270c..206515a850 100644 --- a/libdispatch/dfilter.c +++ b/libdispatch/dfilter.c @@ -218,98 +218,6 @@ nc_inq_filter_avail(int ncid, unsigned id) return stat; } -/**************************************************/ -/* Support direct user defined filters */ - -#ifdef ENABLE_CLIENTSIDE_FILTERS - -/** Register filer client. - * @note Use void* to avoid having to include hdf.h - * - * @param id Filter ID - * @param info Pointer that gets info. - * - * @return NC_NOERR if the filter is available - * @return NC_EBADID if ncid is invalid - * @return NC_ENOFILTER if filter is not available. - * @author Dennis Heimbigner -*/ -EXTERNL int -nc_filter_client_register(unsigned int id, void* info) -{ - int stat = NC_NOERR; -#ifdef USE_HDF5 - NC_FILTER_OBJ_HDF5 client; - if(id == 0 ||info == NULL) - return NC_EINVAL; - memset(&client,0,sizeof(client)); - client.hdr.format = NC_FILTER_FORMAT_HDF5; - client.sort = NC_FILTER_SORT_CLIENT; - client.u.client.id = id; - client.u.client.info = info; - /* Note use of a global function, not part of the dispatch table */ - stat = nc4_global_filter_action(NCFILTER_CLIENT_REG, id, &client); -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} - -/** Unregister filer client. - * @note Use void* to avoid having to include hdf.h - * - * @param id Filter ID - * - * @return NC_NOERR if the filter is available - * @author Dennis Heimbigner -*/ -EXTERNL int -nc_filter_client_unregister(unsigned int id) -{ -int stat = NC_NOERR; -#ifdef USE_HDF5 - stat = nc4_global_filter_action(NCFILTER_CLIENT_UNREG, id, NULL); -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} - -/** Inquire about filer client. - * @note Use void* to avoid having to include hdf.h - * - * @param id Filter ID - * @param infop Pointer that gets info. - * - * @return NC_NOERR if the filter is available - * @author Dennis Heimbigner -*/ -EXTERNL int -nc_filter_client_inq(unsigned int id, void* infop) -{ -int stat = NC_NOERR; -#ifdef USE_HDF5 - H5Z_class2_t* hct = (H5Z_class2_t*)infop; - NC_FILTER_OBJ_HDF5 client; - if(id == 0 ||infop == NULL) - return NC_EINVAL; - memset(&client,0,sizeof(client)); - client.hdr.format = NC_FILTER_FORMAT_HDF5; - client.sort = NC_FILTER_SORT_CLIENT; - client.u.client.id = id; - client.u.client.info = hct; - /* Note use of a global function, not part of the dispatch table */ - stat = nc4_global_filter_action(NCFILTER_CLIENT_INQ, id, &client); - if(stat == NC_NOERR) { - *hct = *(H5Z_class2_t*)client.u.client.info; - } -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} -#endif /*ENABLE_CLIENTSIDE_FILTERS*/ - /**************************************************/ /* Functions for accessing standardized filters */ diff --git a/libdispatch/dfilterx.c b/libdispatch/dfilterx.c deleted file mode 100644 index bc90a02c12..0000000000 --- a/libdispatch/dfilterx.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright 2018, University Corporation for Atmospheric Research - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - */ - -#include "config.h" -#include -#include -#include -#ifdef _MSC_VER -#include -#endif - -#include "netcdf.h" -#include "netcdf_filter.h" -#include "ncdispatch.h" -#include "nc4internal.h" - -#include "ncjson.h" - -/* -NCZarr filter API -*/ - -/**************************************************/ -/* Per-variable filters */ - -/** -Find the set of filters (if any) associated with a variable. -Assumes NCZarr format using json - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -\param varid Variable ID -\param jsonp a JSON formatted string is returned in this argument - -\returns ::NC_NOERR No error. -\returns ::NC_ENOTNC4 Not a netCDF-4 file. -\returns ::NC_EBADID Bad ncid -\returns ::NC_ENOTVAR Invalid variable ID. -\returns ::NC_EINVAL Invalid arguments -\ingroup variables -\author Dennis Heimbigner -*/ -EXTERNL int -nc_inq_var_filterx_ids(int ncid, int varid, char** textp) -{ - NC* ncp; - int stat = NC_NOERR; - - TRACE(nc_inq_var_filterx_ids); - if((stat = NC_check_id(ncid,&ncp))) return stat; - if((stat = ncp->dispatch->inq_var_filterx_ids(ncid,varid,textp))) goto done; - -done: - return stat; -} - -/** -Find the the param info about filter (if any) -associated with a variable and with specified id. -Assumes HDF5 format using unsigned ints. - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -nc_create(), nc_def_grp(), or associated inquiry functions such as -nc_inq_ncid(). - -\param varid Variable ID -\param id The filter id of interest -\param nparamsp (Out) Storage which will get the number of parameters to the filter -\param params (Out) Storage which will get associated parameters. -Note: the caller must allocate and free. - -\returns ::NC_NOERR No error. -\returns ::NC_ENOTNC4 Not a netCDF-4 file. -\returns ::NC_EBADID Bad ncid. -\returns ::NC_ENOTVAR Invalid variable ID. -\returns ::NC_ENOFILTER Specified filter not defined for this variable. -\ingroup variables -\author Dennis Heimbigner -*/ -EXTERNL int -nc_inq_var_filterx_info(int ncid, int varid, const char* id, char** textp) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - - TRACE(nc_inq_var_filterx_info); - if(stat != NC_NOERR) return stat; - if((stat = ncp->dispatch->inq_var_filterx_info(ncid,varid,id,textp))) goto done; - -done: - return stat; -} - -/** - Define a new variable filter - Assumes HDF5 format using unsigned ints. - Only variables with chunked storage can use filters. - - @param ncid File and group ID. - @param varid Variable ID. - @param id Filter ID. - @param nparams Number of filter parameters. - @param parms Filter parameters. - - @return ::NC_NOERR No error. - @return ::NC_EINVAL Variable must be chunked. - @return ::NC_EBADID Bad ID. - @author Dennis Heimbigner -*/ - -EXTERNL int -nc_def_var_filterx(int ncid, int varid, const char* json) -{ - NC* ncp; - int stat = NC_check_id(ncid,&ncp); - - TRACE(nc_def_var_filterx); - if(stat != NC_NOERR) return stat; - if((stat = ncp->dispatch->def_var_filterx(ncid,varid,json))) goto done; - -done: - return stat; -} - -/** -Find the first filter (if any) associated with a variable. - -\param ncid NetCDF or group ID, from a previous call to nc_open(), -nc_create(), nc_def_grp(), or associated inquiry functions such as -nc_inq_ncid(). - -\param varid Variable ID - -\param textp Storage which will get the filter info (id + parameters) in json format - -This is redundant over the multi-filter API, so -it can be implemented in terms of those functions. - -\returns ::NC_NOERR No error. -\returns ::NC_ENOTNC4 Not a netCDF-4 file. -\returns ::NC_EBADID Bad ncid. -\returns ::NC_ENOTVAR Invalid variable ID. - -\ingroup variables -\author Dennis Heimbigner -*/ -EXTERNL int -nc_inq_var_filterx(int ncid, int varid, char** textp) -{ - NC* ncp; - int stat = NC_NOERR; - char* text = NULL; - NCjson* json = NULL; - NCjson* jid = NULL; - - TRACE(nc_inq_var_filterx); - if((stat = NC_check_id(ncid,&ncp))) goto done; - - /* Get the filters on this variable */ - if((stat = nc_inq_var_filterx_ids(ncid,varid,&text))) goto done; - /* Parse it */ - if((stat = NCJparse(text,0,&json))) goto done; - if(json->sort != NCJ_ARRAY) - {stat = NC_EFILTER; goto done;} - if(NCJlength(json) == 0 || NCJcontents(json) == NULL) - {stat = NC_ENOFILTER; goto done;} - jid = NCJith(json,0); - if(jid->sort == NCJ_DICT || jid->sort == NCJ_ARRAY) - {stat = NC_EFILTER; goto done;} - /* Get info about the first filter */ - if((stat = nc_inq_var_filterx_info(ncid,varid,NCJstring(jid),textp))) - {stat = NC_ENOFILTER; goto done;} - done: - NCJreclaim(json); - return stat; -} - -/**************************************************/ -/* Support direct user defined filters */ - -#ifdef ENABLE_CLIENTSIDE_FILTERS - -/* Use void* to avoid having to include hdf.h*/ -EXTERNL int -nc_filterx_client_register(unsigned int id, void* info) -{ - int stat = NC_NOERR; -#ifdef USE_HDF5 - NC_FILTERX_OBJ_HDF5 client; - if(id == 0 ||info == NULL) - return NC_EINVAL; - memset(&client,0,sizeof(client)); - client.hdr.format = NC_FILTERX_FORMAT_HDF5; - client.sort = NC_FILTERX_SORT_CLIENT; - client.u.client.id = id; - client.u.client.info = info; - /* Note use of a global function, not part of the dispatch table */ - stat = nc4_global_filterx_action(NCFILTER_CLIENT_REG, id, &client); -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} - -EXTERNL int -nc_filterx_client_unregister(unsigned int id) -{ -int stat = NC_NOERR; -#ifdef USE_HDF5 - stat = nc4_global_filterx_action(NCFILTER_CLIENT_UNREG, id, NULL); -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} - -/* Use void* to avoid having to include hdf.h*/ -EXTERNL int -nc_filterx_client_inq(unsigned int id, void* infop) -{ -int stat = NC_NOERR; -#ifdef USE_HDF5 - H5Z_class2_t* hct = (H5Z_class2_t*)infop; - NC_FILTERX_OBJ_HDF5 client; - if(id == 0 ||infop == NULL) - return NC_EINVAL; - memset(&client,0,sizeof(client)); - client.hdr.format = NC_FILTERX_FORMAT_HDF5; - client.sort = NC_FILTERX_SORT_CLIENT; - client.u.client.id = id; - client.u.client.info = hct; - /* Note use of a global function, not part of the dispatch table */ - stat = nc4_global_filterx_action(NCFILTER_CLIENT_INQ, id, &client); - if(stat == NC_NOERR) { - *hct = *(H5Z_class2_t*)client.u.client.info; - } -#else - stat = NC_ENOTBUILT; -#endif - return stat; -} -#endif /*ENABLE_CLIENTSIDE_FILTERS*/ diff --git a/libdispatch/dinstance.c b/libdispatch/dinstance.c index 52b1d21bb0..ad9141474c 100644 --- a/libdispatch/dinstance.c +++ b/libdispatch/dinstance.c @@ -52,8 +52,8 @@ DAPSUBSTRATE(NC* nc) typedef struct Position{char* memory; ptrdiff_t offset;} Position; /* Forward */ -#ifdef USE_NETCDF4 static int dump_datar(int ncid, nc_type xtype, Position*, NCbytes* buf); +#ifdef USE_NETCDF4 static int dump_compound(int ncid, nc_type xtype, size_t size, size_t nfields, Position* offset, NCbytes* buf); static int dump_vlen(int ncid, nc_type xtype, nc_type basetype, Position* offset, NCbytes* buf); static int dump_enum(int ncid, nc_type xtype, nc_type basetype, Position* offset, NCbytes* buf); diff --git a/libdispatch/ds3util.c b/libdispatch/ds3util.c index 8db08d2e82..aab8fe987b 100644 --- a/libdispatch/ds3util.c +++ b/libdispatch/ds3util.c @@ -43,9 +43,6 @@ enum URLFORMAT {UF_NONE=0, UF_VIRTUAL=1, UF_PATH=2, UF_S3=3, UF_OTHER=4}; static const char* awsconfigfiles[] = {".aws/config",".aws/credentials",NULL}; #define NCONFIGFILES (sizeof(awsconfigfiles)/sizeof(char*)) -static int ncs3_initialized = 0; -static int ncs3_finalized = 0; - /**************************************************/ /* Forward */ @@ -56,38 +53,21 @@ static int awsparse(const char* text, NClist* profiles); /**************************************************/ /* Capture environmental Info */ -EXTERNL int -NC_s3sdkinitialize(void) -{ - if(!ncs3_initialized) { - ncs3_initialized = 1; - ncs3_finalized = 0; - } - { - /* Get various environment variables as defined by the AWS sdk */ - NCglobalstate* gs = NC_getglobalstate(); - if(getenv("AWS_REGION")!=NULL) - gs->aws.default_region = nulldup(getenv("AWS_REGION")); - else if(getenv("AWS_DEFAULT_REGION")!=NULL) - gs->aws.default_region = nulldup(getenv("AWS_DEFAULT_REGION")); - else if(gs->aws.default_region == NULL) - gs->aws.default_region = nulldup(AWS_GLOBAL_DEFAULT_REGION); - gs->aws.access_key_id = nulldup(getenv("AWS_ACCESS_KEY_ID")); - gs->aws.config_file = nulldup(getenv("AWS_CONFIG_FILE")); - gs->aws.profile = nulldup(getenv("AWS_PROFILE")); - gs->aws.secret_access_key = nulldup(getenv("AWS_SECRET_ACCESS_KEY")); - } - return NC_NOERR; -} - -EXTERNL int -NC_s3sdkfinalize(void) +EXTERNL void +NC_s3sdkenvironment(void) { - if(!ncs3_finalized) { - ncs3_initialized = 0; - ncs3_finalized = 1; - } - return NC_NOERR; + /* Get various environment variables as defined by the AWS sdk */ + NCglobalstate* gs = NC_getglobalstate(); + if(getenv("AWS_REGION")!=NULL) + gs->aws.default_region = nulldup(getenv("AWS_REGION")); + else if(getenv("AWS_DEFAULT_REGION")!=NULL) + gs->aws.default_region = nulldup(getenv("AWS_DEFAULT_REGION")); + else if(gs->aws.default_region == NULL) + gs->aws.default_region = nulldup(AWS_GLOBAL_DEFAULT_REGION); + gs->aws.access_key_id = nulldup(getenv("AWS_ACCESS_KEY_ID")); + gs->aws.config_file = nulldup(getenv("AWS_CONFIG_FILE")); + gs->aws.profile = nulldup(getenv("AWS_PROFILE")); + gs->aws.secret_access_key = nulldup(getenv("AWS_SECRET_ACCESS_KEY")); } /**************************************************/ diff --git a/libdispatch/dvar.c b/libdispatch/dvar.c index 5b2b80954b..8ddcb4ad84 100644 --- a/libdispatch/dvar.c +++ b/libdispatch/dvar.c @@ -868,7 +868,7 @@ nc_def_var_szip(int ncid, int varid, int options_mask, int pixels_per_block) /* This will cause H5Pset_szip to be called when the var is * created. */ unsigned int params[2] = {(unsigned int)options_mask, (unsigned int)pixels_per_block}; - if ((ret = nc_def_var_filter(ncid, varid, HDF5_FILTER_SZIP, 2, params))) + if ((ret = nc_def_var_filter(ncid, varid, H5Z_FILTER_SZIP, 2, params))) return ret; return NC_NOERR; @@ -1312,7 +1312,7 @@ NC_check_nulls(int ncid, int varid, const size_t *start, size_t **count, int nc_free_string(size_t len, char **data) { - int i; + size_t i; for (i = 0; i < len; i++) free(data[i]); return NC_NOERR; diff --git a/libdispatch/ncrandom.c b/libdispatch/ncrandom.c index 7575aa72ad..bd6e7746b8 100644 --- a/libdispatch/ncrandom.c +++ b/libdispatch/ncrandom.c @@ -13,13 +13,16 @@ #include #endif +#if defined(_WIN32) || defined(_MSC_VER) +extern errno_t rand_s(unsigned int *randomValue); +#endif /* Support platform independent generation of 32-bit unsigned int random numbers */ int main() { unsigned int urnd = 0; /* range 0..2147483647 */ -#if defined(WIN32) || defined(_MSC_VER) +#if defined(_WIN32) || defined(_MSC_VER) (void)rand_s(&urnd); #else long rnd; diff --git a/libdispatch/ncs3sdk_aws.cpp b/libdispatch/ncs3sdk_aws.cpp index 806edae8a8..e1bceb7835 100644 --- a/libdispatch/ncs3sdk_aws.cpp +++ b/libdispatch/ncs3sdk_aws.cpp @@ -133,10 +133,9 @@ NC_s3sdkinitialize(void) if(!ncs3_initialized) { ncs3_initialized = 1; ncs3_finalized = 0; - #ifdef DEBUG - //ncs3options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; + //ncs3options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; ncs3options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace; ncs3options.httpOptions.installSigPipeHandler = true; ncs3options.loggingOptions.logger_create_fn = [] { return std::make_shared(Aws::Utils::Logging::LogLevel::Trace); }; @@ -144,6 +143,9 @@ NC_s3sdkinitialize(void) #endif Aws::InitAPI(ncs3options); + /* Get environment information */ + NC_s3sdkenvironment(); + } return NCUNTRACE(NC_NOERR); } @@ -500,7 +502,6 @@ NC_s3sdkwriteobject(void* s3client0, const char* bucket, const char* pathkey, s int stat = NC_NOERR; const char* key = NULL; - const char* mcontent = (char*)content; NCTRACE(11,"bucket=%s pathkey=%s count=%lld content=%p",bucket,pathkey,count,content); AWSS3CLIENT s3client = (AWSS3CLIENT)s3client0; @@ -535,7 +536,7 @@ NC_s3sdkwriteobject(void* s3client0, const char* bucket, const char* pathkey, s put_request.SetContentLength((long long)count); std::shared_ptr data = std::shared_ptr(new Aws::StringStream()); - data->rdbuf()->pubsetbuf((char*)content,count); + data->rdbuf()->pubsetbuf((char*)content,(std::streamsize)count); put_request.SetBody(data); auto put_result = AWSS3GET(s3client)->PutObject(put_request); if(!put_result.IsSuccess()) { diff --git a/libdispatch/ncs3sdk_h5.c b/libdispatch/ncs3sdk_h5.c index 5f7f223db9..f8263293b7 100644 --- a/libdispatch/ncs3sdk_h5.c +++ b/libdispatch/ncs3sdk_h5.c @@ -108,6 +108,37 @@ static int queryinsert(NClist* list, char* ekey, char* evalue); #define NT(x) ((x)==NULL?"null":x) +/**************************************************/ + +static int ncs3_initialized = 0; +static int ncs3_finalized = 0; + +EXTERNL int +NC_s3sdkinitialize(void) +{ + if(!ncs3_initialized) { + ncs3_initialized = 1; + ncs3_finalized = 0; + } + + /* Get environment information */ + NC_s3sdkenvironment(void); + + return NC_NOERR; +} + +EXTERNL int +NC_s3sdkfinalize(void) +{ + if(!ncs3_finalized) { + ncs3_initialized = 0; + ncs3_finalized = 1; + } + return NC_NOERR; +} + +/**************************************************/ + #if 0 static void dumps3info(NCS3INFO* s3info, const char* tag) diff --git a/libhdf4/CMakeLists.txt b/libhdf4/CMakeLists.txt index cbb3507717..4d8878ca6d 100644 --- a/libhdf4/CMakeLists.txt +++ b/libhdf4/CMakeLists.txt @@ -22,5 +22,7 @@ if (NETCDF_ENABLE_DLL) target_compile_definitions(netcdfhdf4 PRIVATE DLL_NETCDF DLL_EXPORT) endif() +target_link_libraries(netcdfhdf4 PUBLIC ${HDF4_LIBRARIES}) + # Remember to package this file for CMake builds. ADD_EXTRA_DIST(${libhdf4_SOURCES} CMakeLists.txt) diff --git a/libhdf5/hdf5create.c b/libhdf5/hdf5create.c index 78fe558ddb..02cd1b92ed 100644 --- a/libhdf5/hdf5create.c +++ b/libhdf5/hdf5create.c @@ -11,7 +11,6 @@ #include "config.h" #include "netcdf.h" #include "ncpathmgr.h" -#include "ncpathmgr.h" #include "hdf5internal.h" /** @internal These flags may not be set for create. */ diff --git a/libhdf5/hdf5filter.c b/libhdf5/hdf5filter.c index 2cd840aac2..734a9ef285 100644 --- a/libhdf5/hdf5filter.c +++ b/libhdf5/hdf5filter.c @@ -20,7 +20,7 @@ #include "netcdf.h" #include "netcdf_filter.h" -#ifdef ENABLE_BLOSC +#ifdef NETCDF_ENABLE_BLOSC #include #endif @@ -29,135 +29,6 @@ /* Forward */ static int NC4_hdf5_filter_free(struct NC_HDF5_Filter* spec); -/**************************************************/ -/* Filter registration support */ - -#ifdef ENABLE_CLIENTSIDE_FILTERS - -/* Mnemonic */ -#define FILTERACTIVE 1 - -/* WARNING: GLOBAL VARIABLE */ -/* Define list of registered filters */ -static NClist* NC4_registeredfilters = NULL; /** List */ - -/**************************************************/ -/* Filter registration support */ - -static int -clientfilterlookup(unsigned int id) -{ - int i; - if(NC4_registeredfilters == NULL) - NC4_registeredfilters = nclistnew(); - for(i=0;iid == id) { - return i; /* return position */ - } - } - return -1; -} - -static void -reclaiminfo(NC_FILTER_CLIENT_HDF5* info) -{ - nullfree(info); -} - -static int -filterremove(int pos) -{ - NC_FILTER_CLIENT_HDF5* info = NULL; - if(NC4_registeredfilters == NULL) - return THROW(NC_EINVAL); - if(pos < 0 || pos >= nclistlength(NC4_registeredfilters)) - return THROW(NC_EINVAL); - info = nclistget(NC4_registeredfilters,pos); - reclaiminfo(info); - nclistremove(NC4_registeredfilters,pos); - return NC_NOERR; -} - -static NC_FILTER_CLIENT_HDF5* -dupfilterinfo(NC_FILTER_CLIENT_HDF5* info) -{ - NC_FILTER_CLIENT_HDF5* dup = NULL; - if(info == NULL) goto fail; - if((dup = calloc(1,sizeof(NC_FILTER_CLIENT_HDF5))) == NULL) goto fail; - *dup = *info; - return dup; -fail: - reclaiminfo(dup); - return NULL; -} - -int -nc4_global_filter_action(int op, unsigned int id, NC_FILTER_OBJ_HDF5* infop) -{ - int stat = NC_NOERR; - H5Z_class2_t* h5filterinfo = NULL; - herr_t herr; - int pos = -1; - NC_FILTER_CLIENT_HDF5* dup = NULL; - NC_FILTER_CLIENT_HDF5* elem = NULL; - NC_FILTER_CLIENT_HDF5 ncf; - - NC_UNUSED(format); - - switch (op) { - case NCFILTER_CLIENT_REG: /* Ignore id argument */ - if(infop == NULL) {stat = NC_EINVAL; goto done;} - assert(NC_FILTER_FORMAT_HDF5 == infop->hdr.format); - assert(NC_FILTER_SORT_CLIENT == infop->sort); - elem = (NC_FILTER_CLIENT_HDF5*)&infop->u.client; - h5filterinfo = elem->info; - /* Another sanity check */ - if(id != h5filterinfo->id) - {stat = NC_EINVAL; goto done;} - /* See if this filter is already defined */ - if((pos = clientfilterlookup(id)) >= 0) - {stat = NC_ENAMEINUSE; goto done;} /* Already defined */ - if((herr = H5Zregister(h5filterinfo)) < 0) - {stat = NC_EFILTER; goto done;} - /* Save a copy of the passed in info */ - ncf.id = id; - ncf.info = elem->info; - if((dup=dupfilterinfo(&ncf)) == NULL) - {stat = NC_ENOMEM; goto done;} - nclistpush(NC4_registeredfilters,dup); - break; - case NCFILTER_CLIENT_UNREG: - if(id <= 0) - {stat = NC_ENOTNC4; goto done;} - /* See if this filter is already defined */ - if((pos = clientfilterlookup(id)) < 0) - {stat = NC_ENOFILTER; goto done;} /* Not defined */ - if((herr = H5Zunregister(id)) < 0) - {stat = NC_EFILTER; goto done;} - if((stat=filterremove(pos))) goto done; - break; - case NCFILTER_CLIENT_INQ: - if(infop == NULL) goto done; - /* Look up the id in our local table */ - if((pos = clientfilterlookup(id)) < 0) - {stat = NC_ENOFILTER; goto done;} /* Not defined */ - elem = (NC_FILTER_CLIENT_HDF5*)nclistget(NC4_registeredfilters,pos); - if(elem == NULL) {stat = NC_EINTERNAL; goto done;} - if(infop != NULL) { - infop->u.client = *elem; - } - break; - default: - {stat = NC_EINTERNAL; goto done;} - } -done: - return THROW(stat); -} - -#endif /*ENABLE_CLIENTSIDE_FILTERS*/ - -/**************************************************/ /**************************************************/ /** * @file diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index 085d0d7681..c30d4e7997 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -930,7 +930,7 @@ nc4_open_file(const char *path, int mode, void* parameters, int ncid) if(H5Pset_fapl_ros3(fapl_id, &fa) < 0) BAIL(NC_EHDFERR); } else -#endif /*ENABLE_ROS3*/ +#endif /*NETCDF_ENABLE_ROS3*/ {/* Configure FAPL to use our byte-range file driver */ if (H5Pset_fapl_http(fapl_id) < 0) BAIL(NC_EHDFERR); @@ -1965,11 +1965,9 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att) static void hdf5free(void* memory) { -#ifndef JNA /* On Windows using the microsoft runtime, it is an error for one library to free memory allocated by a different library.*/ if(memory != NULL) H5free_memory(memory); -#endif } /** @@ -2073,9 +2071,6 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name) int nmembers; unsigned int m; char* member_name = NULL; -#ifdef JNA - char jna[1001]; -#endif type->nc_type_class = NC_COMPOUND; if((retval = NC4_set_varsize(type))) return retval; @@ -2108,12 +2103,6 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name) retval = NC_EBADNAME; break; } -#ifdef JNA - else { - strncpy(jna,member_name,1000); - member_name = jna; - } -#endif /* Offset in bytes on *this* platform. */ member_offset = H5Tget_member_offset(native_typeid, m); @@ -2220,9 +2209,6 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name) nc_type base_nc_type = NC_NAT; void *value; char *member_name = NULL; -#ifdef JNA - char jna[1001]; -#endif type->nc_type_class = NC_ENUM; if((retval = NC4_set_varsize(type))) return retval; @@ -2261,11 +2247,6 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name) if (!(member_name = H5Tget_member_name(hdf_typeid, i))) return NC_EHDFERR; -#ifdef JNA - strncpy(jna,member_name,1000); - member_name = jna; -#endif - if (strlen(member_name) > NC_MAX_NAME) return NC_EBADNAME; diff --git a/liblib/nc_initialize.c b/liblib/nc_initialize.c index b7756041d0..ed7fea893b 100644 --- a/liblib/nc_initialize.c +++ b/liblib/nc_initialize.c @@ -42,7 +42,7 @@ extern int NC_HDF4_initialize(void); extern int NC_HDF4_finalize(void); #endif -#ifdef ENABLE_S3 +#ifdef NETCDF_ENABLE_S3 EXTERNL int NC_s3sdkinitialize(void); EXTERNL int NC_s3sdkfinalize(void); #endif @@ -105,7 +105,7 @@ nc_initialize() #ifdef USE_HDF4 if((stat = NC_HDF4_initialize())) goto done; #endif -#ifdef ENABLE_S3 +#ifdef NETCDF_ENABLE_S3 if((stat = NC_s3sdkinitialize())) goto done; #endif #ifdef NETCDF_ENABLE_NCZARR @@ -170,7 +170,7 @@ nc_finalize(void) if((stat = NCZ_finalize())) failed = stat; #endif -#ifdef ENABLE_S3 +#ifdef NETCDF_ENABLE_S3 if((stat = NC_s3sdkfinalize())) failed = stat; #endif diff --git a/libncpoco/cp_win32.c b/libncpoco/cp_win32.c index 896344f638..a768b82427 100644 --- a/libncpoco/cp_win32.c +++ b/libncpoco/cp_win32.c @@ -104,7 +104,7 @@ load(NCPSharedLib* lib , const char* path0, int flags) int errcode = GetLastError(); char* msg = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &msg, 0, NULL); + NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (char*)&msg, 0, NULL); memset(lib->err.msg,0,sizeof(lib->err.msg)); if(msg) strncpy(lib->err.msg,msg,sizeof(lib->err.msg)); diff --git a/libnczarr/zinternal.h b/libnczarr/zinternal.h index 14c8079f0f..3c3f706f91 100644 --- a/libnczarr/zinternal.h +++ b/libnczarr/zinternal.h @@ -72,11 +72,11 @@ Inserted into any .zarray \"storage\": \"scalar\"|\"contiguous\"|\"compact\"|\"chunked\" }" Inserted into any .zattrs ? or should it go into the container? -"_nczarr_attrs": "{ +"_nczarr_attr": "{ \"types\": {\"attr1\": \" NC_CHAR. ++Note: _nczarr_attr type include non-standard use of a zarr type "|U1" => NC_CHAR. + */ @@ -96,6 +96,9 @@ Inserted into any .zattrs ? or should it go into the container? #define NOXARRAYCONTROL "noxarray" #define XARRAYSCALAR "_scalar_" +#define NC_NCZARR_MAXSTRLEN_ATTR "_nczarr_maxstrlen" +#define NC_NCZARR_DEFAULT_MAXSTRLEN_ATTR "_nczarr_default_maxstrlen" + #define LEGAL_DIM_SEPARATORS "./" #define DFALT_DIM_SEPARATOR '.' diff --git a/libnczarr/zmap_s3sdk.c b/libnczarr/zmap_s3sdk.c index 0acdaf8e99..552a73473d 100644 --- a/libnczarr/zmap_s3sdk.c +++ b/libnczarr/zmap_s3sdk.c @@ -499,20 +499,21 @@ s3clear(void* s3client, const char* bucket, const char* rootkey) { int stat = NC_NOERR; char** list = NULL; - char** p; size_t nkeys = 0; if(s3client && bucket && rootkey) { if((stat = NC_s3sdksearch(s3client, bucket, rootkey, &nkeys, &list, NULL))) goto done; if(list != NULL) { - for(p=list;*p;p++) { + size_t i; + for(i=0;i "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) - - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" DESTINATION "share/man/man3" COMPONENT documentation) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" DESTINATION "${CMAKE_INSTALL_MANDIR}/man3" COMPONENT documentation) endif(NOT MSVC) -endif() \ No newline at end of file +endif() diff --git a/libsrc4/nc4dispatch.c b/libsrc4/nc4dispatch.c index 7c4f839528..2aa5987824 100644 --- a/libsrc4/nc4dispatch.c +++ b/libsrc4/nc4dispatch.c @@ -56,10 +56,13 @@ NC4_initialize(void) if(getenv(NCLOGLEVELENV) != NULL) { char* slevel = getenv(NCLOGLEVELENV); long level = atol(slevel); +#ifdef USE_NETCDF4 if(level >= 0) nc_set_log_level((int)level); } #endif +#endif + NC_initialize_reserved(); return ret; } diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index 5508e8612d..f7f32c7ca8 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -36,30 +36,35 @@ */ /** @internal List of reserved attributes. - WARNING: This list must be in (strcmp) sorted order for binary search. */ -static const NC_reservedatt NC_reserved[] = { + WARNING: This list will be sorted in (strcmp) sorted order for binary search. + So order here does not matter; the table will be modified by sorting. +*/ +static NC_reservedatt NC_reserved[] = { {NC_ATT_CLASS, READONLYFLAG|HIDDENATTRFLAG}, /*CLASS*/ {NC_ATT_DIMENSION_LIST, READONLYFLAG|HIDDENATTRFLAG}, /*DIMENSION_LIST*/ {NC_ATT_NAME, READONLYFLAG|HIDDENATTRFLAG}, /*NAME*/ {NC_ATT_REFERENCE_LIST, READONLYFLAG|HIDDENATTRFLAG}, /*REFERENCE_LIST*/ - {NC_XARRAY_DIMS, READONLYFLAG|NAMEONLYFLAG|HIDDENATTRFLAG}, /*_ARRAY_DIMENSIONS*/ + {NC_XARRAY_DIMS, READONLYFLAG|HIDDENATTRFLAG}, /*_ARRAY_DIMENSIONS*/ {NC_ATT_CODECS, VARFLAG|READONLYFLAG|NAMEONLYFLAG}, /*_Codecs*/ {NC_ATT_FORMAT, READONLYFLAG}, /*_Format*/ - {ISNETCDF4ATT, READONLYFLAG|NAMEONLYFLAG}, /*_IsNetcdf4*/ + {ISNETCDF4ATT, READONLYFLAG|NAMEONLYFLAG|VIRTUALFLAG}, /*_IsNetcdf4*/ {NCPROPS,READONLYFLAG|NAMEONLYFLAG|HIDDENATTRFLAG}, /*_NCProperties*/ - {NC_NCZARR_ATTR_UC, READONLYFLAG|HIDDENATTRFLAG}, /*_NCZARR_ATTR */ + {NC_NCZARR_ATTR_UC, READONLYFLAG|NAMEONLYFLAG|HIDDENATTRFLAG}, /*_NCZARR_ATTR */ {NC_ATT_COORDINATES, READONLYFLAG|HIDDENATTRFLAG}, /*_Netcdf4Coordinates*/ {NC_ATT_DIMID_NAME, READONLYFLAG|HIDDENATTRFLAG}, /*_Netcdf4Dimid*/ - {SUPERBLOCKATT, READONLYFLAG|NAMEONLYFLAG}, /*_SuperblockVersion*/ + {SUPERBLOCKATT, READONLYFLAG|NAMEONLYFLAG|VIRTUALFLAG}, /*_SuperblockVersion*/ {NC_ATT_NC3_STRICT_NAME, READONLYFLAG}, /*_nc3_strict*/ {NC_ATT_NC3_STRICT_NAME, READONLYFLAG}, /*_nc3_strict*/ {NC_NCZARR_ATTR, READONLYFLAG|HIDDENATTRFLAG}, /*_nczarr_attr */ }; -#define NRESERVED (sizeof(NC_reserved) / sizeof(NC_reservedatt)) /*|NC_reservedatt|*/ +#define NRESERVED (sizeof(NC_reserved) / sizeof(NC_reservedatt)) /*|NC_reservedatt*/ +/*Forward */ static int NC4_move_in_NCList(NC* nc, int new_id); +static int bincmp(const void* arg1, const void* arg2); +static int sortcmp(const void* arg1, const void* arg2); -#if NC_HAS_LOGGING +#if LOGGING /* This is the severity level of messages which will be logged. Use severity 0 for errors, 1 for important log messages, 2 for less important, etc. */ @@ -129,7 +134,7 @@ nc_log(int severity, const char *fmt, ...) fprintf(f, "\n"); fflush(f); } -#endif /* NC_HAS_LOGGING */ +#endif /* LOGGING */ /** * @internal Check and normalize and name. @@ -1706,7 +1711,7 @@ nc4_normalize_name(const char *name, char *norm_name) return NC_NOERR; } -#ifdef ENABLE_SET_LOG_LEVEL +#ifdef NETCDF_ENABLE_SET_LOG_LEVEL /** * Initialize parallel I/O logging. For parallel I/O builds, open log @@ -1719,7 +1724,7 @@ nc4_init_logging(void) { int ret = NC_NOERR; -#if NC_HAS_LOGGING +#if LOGGING #if NC_HAS_PARALLEL4 if (!LOG_FILE && nc_log_level >= 0) { @@ -1745,7 +1750,7 @@ nc4_init_logging(void) return NC_EINTERNAL; } #endif /* NC_HAS_PARALLEL4 */ -#endif /* NC_HAS_LOGGING */ +#endif /* LOGGING */ return ret; } @@ -1759,7 +1764,7 @@ nc4_init_logging(void) void nc4_finalize_logging(void) { -#if NC_HAS_LOGGING +#if LOGGING #if NC_HAS_PARALLEL4 if (LOG_FILE) { @@ -1767,7 +1772,7 @@ nc4_finalize_logging(void) LOG_FILE = NULL; } #endif /* NC_HAS_PARALLEL4 */ -#endif /* NC_HAS_LOGGING */ +#endif /* LOGGING */ } /** @@ -1786,7 +1791,7 @@ nc4_finalize_logging(void) int nc_set_log_level(int new_level) { -#if NC_HAS_LOGGING +#if LOGGING /* Remember the new level. */ nc_log_level = new_level; @@ -1803,13 +1808,13 @@ nc_set_log_level(int new_level) #endif /* NC_HAS_PARALLEL4 */ LOG((1, "log_level changed to %d", nc_log_level)); -#endif /*NC_HAS_LOGGING */ +#endif /* LOGGING */ return NC_NOERR; } -#endif /* ENABLE_SET_LOG_LEVEL */ +#endif /* NETCDF_ENABLE_SET_LOG_LEVEL */ -#if NC_HAS_LOGGING +#if LOGGING #define MAX_NESTS 10 /** * @internal Recursively print the metadata of a group. @@ -1978,7 +1983,7 @@ log_metadata_nc(NC_FILE_INFO_T *h5) return NC_NOERR; } -#endif /*NC_HAS_LOGGING */ +#endif /*LOGGING */ /** * @internal Show the in-memory metadata for a netcdf file. This @@ -1995,7 +2000,7 @@ int NC4_show_metadata(int ncid) { int retval = NC_NOERR; -#if NC_HAS_LOGGING +#if LOGGING NC_FILE_INFO_T *h5; int old_log_level = nc_log_level; @@ -2007,7 +2012,7 @@ NC4_show_metadata(int ncid) nc_log_level = 2; retval = log_metadata_nc(h5); nc_log_level = old_log_level; -#endif /*NC_HAS_LOGGING*/ +#endif /*LOGGING*/ return retval; } @@ -2021,6 +2026,7 @@ NC4_show_metadata(int ncid) const NC_reservedatt* NC_findreserved(const char* name) { +#if 0 int n = NRESERVED; int L = 0; int R = (n - 1); @@ -2037,8 +2043,12 @@ NC_findreserved(const char* name) R = (m - 1); } return NULL; +#else + return (const NC_reservedatt*)bsearch(name,NC_reserved,NRESERVED,sizeof(NC_reservedatt),bincmp); +#endif } +/* Ed Hartness requires this function */ static int NC4_move_in_NCList(NC* nc, int new_id) { @@ -2051,153 +2061,25 @@ NC4_move_in_NCList(NC* nc, int new_id) return stat; } -/**************************************************/ -/* NCglobal state management */ - -static NCglobalstate* nc_globalstate = NULL; - static int -NC_createglobalstate(void) +sortcmp(const void* arg1, const void* arg2) { - int stat = NC_NOERR; - const char* tmp = NULL; - - if(nc_globalstate == NULL) { - nc_globalstate = calloc(1,sizeof(NCglobalstate)); - } - /* Initialize struct pointers */ - if((nc_globalstate->rcinfo = calloc(1,sizeof(struct NCRCinfo)))==NULL) - {stat = NC_ENOMEM; goto done;} - if((nc_globalstate->rcinfo->entries = nclistnew())==NULL) - {stat = NC_ENOMEM; goto done;} - if((nc_globalstate->rcinfo->s3profiles = nclistnew())==NULL) - {stat = NC_ENOMEM; goto done;} - - /* Get environment variables */ - if(getenv(NCRCENVIGNORE) != NULL) - nc_globalstate->rcinfo->ignore = 1; - tmp = getenv(NCRCENVRC); - if(tmp != NULL && strlen(tmp) > 0) - nc_globalstate->rcinfo->rcfile = strdup(tmp); - /* Initialize chunk cache defaults */ - nc_globalstate->chunkcache.size = DEFAULT_CHUNK_CACHE_SIZE; /**< Default chunk cache size. */ - nc_globalstate->chunkcache.nelems = DEFAULT_CHUNKS_IN_CACHE; /**< Default chunk cache number of elements. */ - nc_globalstate->chunkcache.preemption = DEFAULT_CHUNK_CACHE_PREEMPTION; /**< Default chunk cache preemption. */ - -done: - return stat; + NC_reservedatt* r1 = (NC_reservedatt*)arg1; + NC_reservedatt* r2 = (NC_reservedatt*)arg2; + return strcmp(r1->name,r2->name); } -/* Get global state */ -NCglobalstate* -NC_getglobalstate(void) +static int +bincmp(const void* arg1, const void* arg2) { - if(nc_globalstate == NULL) - NC_createglobalstate(); - return nc_globalstate; + const char* name = (const char*)arg1; + NC_reservedatt* ra = (NC_reservedatt*)arg2; + return strcmp(name,ra->name); } void -NC_freeglobalstate(void) -{ - if(nc_globalstate != NULL) { - nullfree(nc_globalstate->tempdir); - nullfree(nc_globalstate->home); - nullfree(nc_globalstate->cwd); - nullfree(nc_globalstate->aws.default_region); - nullfree(nc_globalstate->aws.config_file); - nullfree(nc_globalstate->aws.profile); - nullfree(nc_globalstate->aws.access_key_id); - nullfree(nc_globalstate->aws.secret_access_key); - if(nc_globalstate->rcinfo) { - NC_rcclear(nc_globalstate->rcinfo); - free(nc_globalstate->rcinfo); - } - free(nc_globalstate); - nc_globalstate = NULL; - } -} -/**************************************************/ -/* Specific property functions */ - -/** -Provide a function to store global data alignment -information. -Repeated calls to nc_set_alignment will overwrite any existing values. - -If defined, then for every file created or opened after the call to -nc_set_alignment, and for every new variable added to the file, the -most recently set threshold and alignment values will be applied -to that variable. - -The nc_set_alignment function causes new data written to a -netCDF-4 file to be aligned on disk to a specified block -size. To be effective, alignment should be the system disk block -size, or a multiple of it. This setting is effective with MPI -I/O and other parallel systems. - -This is a trade-off of write speed versus file size. Alignment -leaves holes between file objects. The default of no alignment -writes file objects contiguously, without holes. Alignment has -no impact on file readability. - -Alignment settings apply only indirectly, through the file open -functions. Call nc_set_alignment first, then nc_create or -nc_open for one or more files. Current alignment settings are -locked in when each file is opened, then forgotten when the same -file is closed. For illustration, it is possible to write -different files at the same time with different alignments, by -interleaving nc_set_alignment and nc_open calls. - -Alignment applies to all newly written low-level file objects at -or above the threshold size, including chunks of variables, -attributes, and internal infrastructure. Alignment is not locked -in to a data variable. It can change between data chunks of the -same variable, based on a file's history. - -Refer to H5Pset_alignment in HDF5 documentation for more -specific details, interactions, and additional rules. - -@param threshold The minimum size to which alignment is applied. -@param alignment The alignment value. - -@return ::NC_NOERR No error. -@return ::NC_EINVAL Invalid input. -@author Dennis Heimbigner -@ingroup datasets -*/ -int -nc_set_alignment(int threshold, int alignment) -{ - NCglobalstate* gs = NC_getglobalstate(); - gs->alignment.threshold = threshold; - gs->alignment.alignment = alignment; - gs->alignment.defined = 1; - return NC_NOERR; -} - -/** -Provide get function to retrieve global data alignment -information. - -The nc_get_alignment function return the last values set by -nc_set_alignment. If nc_set_alignment has not been called, then -it returns the value 0 for both threshold and alignment. - -@param thresholdp Return the current minimum size to which alignment is applied or zero. -@param alignmentp Return the current alignment value or zero. - -@return ::NC_NOERR No error. -@return ::NC_EINVAL Invalid input. -@author Dennis Heimbigner -@ingroup datasets -*/ - -int -nc_get_alignment(int* thresholdp, int* alignmentp) +NC_initialize_reserved(void) { - NCglobalstate* gs = NC_getglobalstate(); - if(thresholdp) *thresholdp = gs->alignment.threshold; - if(alignmentp) *alignmentp = gs->alignment.alignment; - return NC_NOERR; + /* Guarantee the reserved attribute list is sorted */ + qsort((void*)NC_reserved,NRESERVED,sizeof(NC_reservedatt),sortcmp); } diff --git a/libsrc4/nc4type.c b/libsrc4/nc4type.c index 0b45518963..e6136ca110 100644 --- a/libsrc4/nc4type.c +++ b/libsrc4/nc4type.c @@ -15,34 +15,6 @@ #include "nc4dispatch.h" #include -#if 0 -#ifdef NETCDF_ENABLE_DAP4 -EXTERNL NC* NCD4_get_substrate_nc(int ncid); -#endif -#endif - -/* The sizes of types may vary from platform to platform, but within - * netCDF files, type sizes are fixed. */ -#define NC_CHAR_LEN sizeof(char) /**< @internal Size of char. */ -#define NC_STRING_LEN sizeof(char *) /**< @internal Size of char *. */ -#define NC_BYTE_LEN 1 /**< @internal Size of byte. */ -#define NC_SHORT_LEN 2 /**< @internal Size of short. */ -#define NC_INT_LEN 4 /**< @internal Size of int. */ -#define NC_FLOAT_LEN 4 /**< @internal Size of float. */ -#define NC_DOUBLE_LEN 8 /**< @internal Size of double. */ -#define NC_INT64_LEN 8 /**< @internal Size of int64. */ - -/** @internal Names of atomic types. */ -const char* nc4_atomic_name[NUM_ATOMIC_TYPES] = {"none", "byte", "char", - "short", "int", "float", - "double", "ubyte", - "ushort", "uint", - "int64", "uint64", "string"}; -static const size_t nc4_atomic_size[NUM_ATOMIC_TYPES] = {0, NC_BYTE_LEN, NC_CHAR_LEN, NC_SHORT_LEN, - NC_INT_LEN, NC_FLOAT_LEN, NC_DOUBLE_LEN, - NC_BYTE_LEN, NC_SHORT_LEN, NC_INT_LEN, NC_INT64_LEN, - NC_INT64_LEN, NC_STRING_LEN}; - /** * @internal Find all user-defined types for a location. This finds * all user-defined types in a group. @@ -90,64 +62,6 @@ NC4_inq_typeids(int ncid, int *ntypes, int *typeids) return NC_NOERR; } -/** - * @internal Get the name and size of an atomic type. For strings, 1 is - * returned. - * - * @param typeid1 Type ID. - * @param name Gets the name of the type. - * @param size Gets the size of one element of the type in bytes. - * - * @return ::NC_NOERR No error. - * @return ::NC_EBADID Bad ncid. - * @return ::NC_EBADTYPE Type not found. - * @author Dennis Heimbigner - */ -int -NC4_inq_atomic_type(nc_type typeid1, char *name, size_t *size) -{ - LOG((2, "nc_inq_atomic_type: typeid %d", typeid1)); - - if (typeid1 >= NUM_ATOMIC_TYPES) - return NC_EBADTYPE; - if (name) - strcpy(name, nc4_atomic_name[typeid1]); - if (size) - *size = nc4_atomic_size[typeid1]; - return NC_NOERR; -} - -/** - * @internal Get the id and size of an atomic type by name. - * - * @param name [in] the name of the type. - * @param idp [out] the type index of the type. - * @param sizep [out] the size of one element of the type in bytes. - * - * @return ::NC_NOERR No error. - * @return ::NC_EBADID Bad ncid. - * @return ::NC_EBADTYPE Type not found. - * @author Dennis Heimbigner - */ -int -NC4_lookup_atomic_type(const char *name, nc_type* idp, size_t *sizep) -{ - int i; - - LOG((2, "nc_lookup_atomic_type: name %s ", name)); - - if (name == NULL || strlen(name) == 0) - return NC_EBADTYPE; - for(i=0;inc_type_class == NC_VLEN) *size = sizeof(nc_vlen_t); - else if (type->nc_type_class == NC_STRING) - *size = NC_STRING_LEN; else *size = type->size; } @@ -256,9 +165,9 @@ NC4_inq_user_type(int ncid, nc_type typeid1, char *name, size_t *size, { if (type->nc_type_class == NC_VLEN) *size = sizeof(nc_vlen_t); - else if (type->nc_type_class == NC_STRING) - *size = NC_STRING_LEN; - else + else if (type->nc_type_class == NC_STRING) { + if((retval=NC4_inq_type(ncid,typeid1,NULL,size))) return retval; + } else *size = type->size; } if (name) diff --git a/nc-config.in b/nc-config.in index 8288d27edc..99e1d47a9c 100644 --- a/nc-config.in +++ b/nc-config.in @@ -23,7 +23,6 @@ libsprivate="@LIBS@" has_dap="@HAS_DAP@" has_dap4="@HAS_DAP4@" has_nc2="@HAS_NC2@" -has_nc4="@HAS_NC4@" has_hdf4="@HAS_HDF4@" has_pnetcdf="@HAS_PNETCDF@" has_hdf5="@HAS_HDF5@" @@ -57,8 +56,7 @@ Available values for OPTION include: --has-dap4 whether DAP4 is enabled in this build --has-dap same as --has-dap2 (Deprecated) --has-nc2 whether NetCDF-2 API is enabled - --has-nc4 whether NetCDF-4/HDF-5 is enabled in this build - --has-hdf5 whether HDF5 is used in build (always the same as --has-nc4) + --has-hdf5 whether HDF5 is used in build --has-hdf4 whether HDF4 was used in build --has-logging whether logging is enabled with --enable-logging. --has-pnetcdf whether PnetCDF was used in build @@ -100,7 +98,6 @@ all() echo " --has-dap2 -> $has_dap" echo " --has-dap4 -> $has_dap4" echo " --has-nc2 -> $has_nc2" - echo " --has-nc4 -> $has_nc4" echo " --has-hdf5 -> $has_hdf5" echo " --has-hdf4 -> $has_hdf4" echo " --has-logging -> $has_logging" @@ -189,10 +186,6 @@ while test $# -gt 0; do echo $has_nc2 ;; - --has-nc4) - echo $has_nc4 - ;; - --has-hdf5) echo $has_hdf5 ;; diff --git a/nc_perf/run_knmi_bm.sh b/nc_perf/run_knmi_bm.sh index 36d4ad590f..5d33e274a1 100755 --- a/nc_perf/run_knmi_bm.sh +++ b/nc_perf/run_knmi_bm.sh @@ -15,7 +15,7 @@ echo "Getting KNMI test files $file_list" for f1 in $file_list do if ! test -f $f1; then - wget https://resources.unidata.ucar.edu/sample_data/$f1.gz + wget https://resources.unidata.ucar.edu/netcdf/sample_data/$f1.gz gunzip $f1.gz fi done diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am index 903e74351a..6654119acd 100644 --- a/nc_test/Makefile.am +++ b/nc_test/Makefile.am @@ -87,7 +87,7 @@ endif TESTS += run_diskless.sh run_diskless5.sh run_inmemory.sh if LARGE_FILE_TESTS -if ! ENABLE_PARALLEL +if ! NETCDF_ENABLE_PARALLEL TESTS += run_diskless2.sh endif endif diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index f190c9c212..33a105f5b2 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -49,7 +49,7 @@ IF(USE_HDF5 AND NETCDF_ENABLE_FILTER_TESTING) build_bin_test(test_filter_order) build_bin_test(test_filter_repeat) build_bin_test(tst_filter_vlen) - if(NOT MINGW) + if(NOT MINGW AND NOT CYGWIN) ADD_SH_TEST(nc_test4 tst_filter) endif() ADD_SH_TEST(nc_test4 tst_specific_filters) diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 22ac5f394b..6d1c0e2e44 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -79,6 +79,7 @@ endif # Filter Tests (requires ncdump and ncgen and HDF5) if USE_HDF5 +if NETCDF_ENABLE_PLUGINS if NETCDF_ENABLE_FILTER_TESTING extradir = check_PROGRAMS += test_filter test_filter_misc test_filter_order test_filter_repeat @@ -108,6 +109,7 @@ TESTS += tst_filterinstall.sh endif endif # NETCDF_ENABLE_FILTER_TESTING +endif # NETCDF_ENABLE_PLUGINS endif # USE_HDF5 endif # NETCDF_BUILD_UTILITIES @@ -127,7 +129,7 @@ ref_tst_interops4.nc CMakeLists.txt run_grp_rename.sh \ run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc \ ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_szip.sh ref_szip.h5 \ ref_szip.cdl tst_filter.sh bzip2.cdl noop.cdl ref_filtered.cdl \ -ref_unfiltered.cdl ref_bzip2.c findplugin.in ref_unfilteredvv.cdl \ +ref_unfiltered.cdl ref_bzip2.c ref_unfilteredvv.cdl \ ref_filteredvv.cdl ref_multi.cdl \ ref_ncgenF.cdl ref_nccopyF.cdl \ ref_filter_repeat.txt ref_fillonly.cdl test_fillonly.sh \ diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt index dcd1c83b26..40189f4720 100644 --- a/ncdap_test/CMakeLists.txt +++ b/ncdap_test/CMakeLists.txt @@ -39,6 +39,7 @@ IF(NETCDF_ENABLE_TESTS) add_bin_env_test(ncdap test_vara) ENDIF() + IF(NETCDF_ENABLE_EXTERNAL_SERVER_TESTS) IF(NETCDF_ENABLE_DAP_REMOTE_TESTS) IF(NETCDF_BUILD_UTILITIES) @@ -64,6 +65,7 @@ IF(NETCDF_ENABLE_TESTS) add_bin_test(ncdap test_manyurls) SET_TESTS_PROPERTIES(ncdap_test_manyurls PROPERTIES RUN_SERIAL TRUE) ENDIF() + ENDIF() IF(NETCDF_ENABLE_DAP_AUTH_TESTS) ##obsolete add_bin_test(ncdap t_auth) diff --git a/ncdap_test/Makefile.am b/ncdap_test/Makefile.am index d7576677aa..1e121db17c 100644 --- a/ncdap_test/Makefile.am +++ b/ncdap_test/Makefile.am @@ -47,6 +47,10 @@ if NETCDF_BUILD_UTILITIES TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh testurl.sh tst_fillmismatch.sh tst_zero_len_var.sh endif +if NETCDF_ENABLE_EXTERNAL_SERVER_TESTS +if NETCDF_ENABLE_DAP_REMOTE_TESTS + +if NETCDF_BUILD_UTILITIES # Remote servers # iridl.ldeo.columbia.edu TESTS += tst_encode.sh @@ -55,16 +59,17 @@ TESTS += tst_hyrax.sh TESTS += test_partvar -if NETCDF_ENABLE_DAP_LONG_TESTS +# Various TESTS += tst_longremote3.sh tst_longremote3.log: tst_remote3.log -if NETCDF_ENABLE_EXTERNAL_SERVER_TESTS +endif + +if NETCDF_ENABLE_DAP_LONG_TESTS test_manyurls_SOURCES = test_manyurls.c manyurls.h check_PROGRAMS += test_manyurls test_manyurls.log: tst_longremote3.log TESTS += test_manyurls endif -endif test_partvar_SOURCES = test_partvar.c @@ -84,6 +89,9 @@ check_PROGRAMS += test_partvar check_PROGRAMS += t_misc check_PROGRAMS += t_ncf330 +endif +endif + if NETCDF_ENABLE_DAP_AUTH_TESTS TESTS += testauth.sh endif diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt index d97b2f0802..74f3fbf653 100644 --- a/ncdump/CMakeLists.txt +++ b/ncdump/CMakeLists.txt @@ -355,5 +355,5 @@ add_subdirectory(expected) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}") if(NOT MSVC) - install(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation) + install(FILES ${MAN_FILES} DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT documentation) endif() diff --git a/ncdump/tst_bom.sh b/ncdump/tst_bom.sh index 9b11b9ab70..d4cddaf9bc 100755 --- a/ncdump/tst_bom.sh +++ b/ncdump/tst_bom.sh @@ -6,7 +6,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi # This shell script tests BOM support in ncgen set -e -set -x + # add hack for sunos export srcdir; diff --git a/ncdump/vardata.c b/ncdump/vardata.c index 8e9a524f7a..62e512500c 100644 --- a/ncdump/vardata.c +++ b/ncdump/vardata.c @@ -20,6 +20,12 @@ #include "vardata.h" #include "netcdf_aux.h" +/* If set, then print char variables as utf-8. + If not set, then print non-printable characters as octal. + The latter was the default before this change. +*/ +#define UTF8CHARS + /* maximum len of string needed for one value of a primitive type */ #define MAX_OUTPUT_LEN 100 @@ -340,6 +346,7 @@ pr_tvals( sp = vals + len; while (len != 0 && *--sp == '\0') len--; + /* Walk the sequence of characters and write control characters in escape form. */ for (iel = 0; iel < len; iel++) { unsigned char uc; switch (uc = (unsigned char)(*vals++ & 0377)) { @@ -371,10 +378,12 @@ pr_tvals( printf("\\\""); break; default: - if (isprint(uc)) - printf("%c",uc); - else +#ifdef UTF8CHARS + if (!isprint(uc)) printf("\\%.3o",uc); + else +#endif /*UTF8CHARS*/ + printf("%c",uc); break; } } diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt index d8c2e61ec5..0ee650dda8 100644 --- a/ncgen/CMakeLists.txt +++ b/ncgen/CMakeLists.txt @@ -70,7 +70,7 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.l ${CMAKE_CURRENT_SOURCE_DIR} FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) # Stuff to build if tests are enabled. -IF(ENABLE_TESTS) +IF(NETCDF_ENABLE_TESTS) FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh) FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) @@ -86,7 +86,7 @@ ENDIF() SET(MAN_FILES ncgen.1) IF(NOT MSVC) - INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" + INSTALL(FILES ${MAN_FILES} DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT documentation) ENDIF() SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c) diff --git a/ncgen/generr.c b/ncgen/generr.c index 2235bfec53..ae37d5e2f1 100644 --- a/ncgen/generr.c +++ b/ncgen/generr.c @@ -82,8 +82,10 @@ void markcdf4(const char* msg) { enhanced_flag = 1; - if(markcdf4_msg == NULL) + + if(markcdf4_msg == NULL) { markcdf4_msg = (char*)msg; + } } char* diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y index 29f0819830..5f21b84f5d 100644 --- a/ncgen/ncgen.y +++ b/ncgen/ncgen.y @@ -128,10 +128,10 @@ static Symbol* makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int static int containsfills(Datalist* list); static void vercheck(int ncid); static long long extractint(NCConstant* con); +static Symbol* identkeyword(const Symbol*); #ifdef USE_NETCDF4 static int parsefilterflag(const char* sdata0, Specialdata* special); static int parsecodecsflag(const char* sdata0, Specialdata* special); -static Symbol* identkeyword(const Symbol*); #ifdef GENDEBUG1 static void printfilters(int nfilters, NC_H5_Filterspec** filters); diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index b37d9a2c36..95ab09e2b3 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -20,7 +20,7 @@ #define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng -#define yyncgenllex +#define yylex ncglex #define yylineno ncglineno #define yyout ncgout #define yyrestart ncgrestart @@ -113,7 +113,7 @@ #ifdef yylex #define ncglex_ALREADY_DEFINED #else -#define yyncgenllex +#define yylex ncglex #endif #ifdef yyrestart @@ -1584,8 +1584,8 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "ncgen/ncgen.l" -#line 2 "ncgen/ncgen.l" +#line 1 "ncgen.l" +#line 2 "ncgen.l" /********************************************************************* * Copyright 1993, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. @@ -1993,7 +1993,7 @@ YY_DECL } { -#line 226 "ncgen/ncgen.l" +#line 226 "ncgen.l" #line 1998 "ncgenl.c" @@ -2054,14 +2054,14 @@ YY_DECL case 1: YY_RULE_SETUP -#line 227 "ncgen/ncgen.l" +#line 227 "ncgen.l" { /* whitespace */ break; } YY_BREAK case 2: YY_RULE_SETUP -#line 231 "ncgen/ncgen.l" +#line 231 "ncgen.l" { /* comment */ break; } @@ -2069,7 +2069,7 @@ YY_RULE_SETUP case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 235 "ncgen/ncgen.l" +#line 235 "ncgen.l" {int len; char* s = NULL; /* In netcdf4, this will be used in a variety of places, so only remove escapes */ @@ -2093,7 +2093,7 @@ yytext[MAXTRST-1] = '\0'; YY_BREAK case 4: YY_RULE_SETUP -#line 256 "ncgen/ncgen.l" +#line 256 "ncgen.l" { /* drop leading 0x; pad to even number of chars */ char* p = yytext+2; int len = yyleng - 2; @@ -2108,143 +2108,143 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 268 "ncgen/ncgen.l" +#line 268 "ncgen.l" {return lexdebug(COMPOUND);} YY_BREAK case 6: YY_RULE_SETUP -#line 269 "ncgen/ncgen.l" +#line 269 "ncgen.l" {return lexdebug(ENUM);} YY_BREAK case 7: YY_RULE_SETUP -#line 270 "ncgen/ncgen.l" +#line 270 "ncgen.l" {return lexdebug(OPAQUE_);} YY_BREAK case 8: YY_RULE_SETUP -#line 272 "ncgen/ncgen.l" +#line 272 "ncgen.l" {return lexdebug(FLOAT_K);} YY_BREAK case 9: YY_RULE_SETUP -#line 273 "ncgen/ncgen.l" +#line 273 "ncgen.l" {return lexdebug(DOUBLE_K);} YY_BREAK case 10: YY_RULE_SETUP -#line 274 "ncgen/ncgen.l" +#line 274 "ncgen.l" {return lexdebug(CHAR_K);} YY_BREAK case 11: YY_RULE_SETUP -#line 275 "ncgen/ncgen.l" +#line 275 "ncgen.l" {return lexdebug(BYTE_K);} YY_BREAK case 12: YY_RULE_SETUP -#line 276 "ncgen/ncgen.l" +#line 276 "ncgen.l" {return lexdebug(SHORT_K);} YY_BREAK case 13: YY_RULE_SETUP -#line 277 "ncgen/ncgen.l" +#line 277 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 14: YY_RULE_SETUP -#line 278 "ncgen/ncgen.l" +#line 278 "ncgen.l" {return lexdebug(identcheck(UBYTE_K));} YY_BREAK case 15: YY_RULE_SETUP -#line 279 "ncgen/ncgen.l" +#line 279 "ncgen.l" {return lexdebug(identcheck(USHORT_K));} YY_BREAK case 16: YY_RULE_SETUP -#line 280 "ncgen/ncgen.l" +#line 280 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 17: YY_RULE_SETUP -#line 281 "ncgen/ncgen.l" +#line 281 "ncgen.l" {return lexdebug(identcheck(INT64_K));} YY_BREAK case 18: YY_RULE_SETUP -#line 282 "ncgen/ncgen.l" +#line 282 "ncgen.l" {return lexdebug(identcheck(UINT64_K));} YY_BREAK case 19: YY_RULE_SETUP -#line 283 "ncgen/ncgen.l" +#line 283 "ncgen.l" {return lexdebug(identcheck(STRING_K));} YY_BREAK case 20: YY_RULE_SETUP -#line 285 "ncgen/ncgen.l" +#line 285 "ncgen.l" {return lexdebug(FLOAT_K);} YY_BREAK case 21: YY_RULE_SETUP -#line 286 "ncgen/ncgen.l" +#line 286 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 22: YY_RULE_SETUP -#line 287 "ncgen/ncgen.l" +#line 287 "ncgen.l" {return lexdebug(INT_K);} YY_BREAK case 23: YY_RULE_SETUP -#line 288 "ncgen/ncgen.l" +#line 288 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 24: YY_RULE_SETUP -#line 289 "ncgen/ncgen.l" +#line 289 "ncgen.l" {return lexdebug(identcheck(UINT_K));} YY_BREAK case 25: YY_RULE_SETUP -#line 292 "ncgen/ncgen.l" +#line 292 "ncgen.l" {int32_val = -1; return lexdebug(NC_UNLIMITED_K);} YY_BREAK case 26: YY_RULE_SETUP -#line 295 "ncgen/ncgen.l" +#line 295 "ncgen.l" {return lexdebug(TYPES);} YY_BREAK case 27: YY_RULE_SETUP -#line 296 "ncgen/ncgen.l" +#line 296 "ncgen.l" {return lexdebug(DIMENSIONS);} YY_BREAK case 28: YY_RULE_SETUP -#line 297 "ncgen/ncgen.l" +#line 297 "ncgen.l" {return lexdebug(VARIABLES);} YY_BREAK case 29: YY_RULE_SETUP -#line 298 "ncgen/ncgen.l" +#line 298 "ncgen.l" {return lexdebug(DATA);} YY_BREAK case 30: YY_RULE_SETUP -#line 299 "ncgen/ncgen.l" +#line 299 "ncgen.l" {return lexdebug(GROUP);} YY_BREAK case 31: YY_RULE_SETUP -#line 301 "ncgen/ncgen.l" +#line 301 "ncgen.l" {BEGIN(TEXT);return lexdebug(NETCDF);} YY_BREAK case 32: YY_RULE_SETUP -#line 303 "ncgen/ncgen.l" +#line 303 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ if (yytext[0] == '-') { double_val = -INFINITY; @@ -2257,7 +2257,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 312 "ncgen/ncgen.l" +#line 312 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ double_val = NAN; specialconstants = 1; @@ -2266,7 +2266,7 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 318 "ncgen/ncgen.l" +#line 318 "ncgen.l" {/* missing value (pre-2.4 backward compatibility)*/ if (yytext[0] == '-') { float_val = -INFINITYF; @@ -2279,7 +2279,7 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 327 "ncgen/ncgen.l" +#line 327 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ float_val = NANF; specialconstants = 1; @@ -2288,7 +2288,7 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 333 "ncgen/ncgen.l" +#line 333 "ncgen.l" { #ifdef USE_NETCDF4 if(l_flag == L_C || l_flag == L_BINARY) @@ -2301,7 +2301,7 @@ YY_RULE_SETUP YY_BREAK case 37: YY_RULE_SETUP -#line 343 "ncgen/ncgen.l" +#line 343 "ncgen.l" { bbClear(lextext); bbAppendn(lextext,(char*)yytext,(size_t)yyleng+1); /* include null */ @@ -2312,7 +2312,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 352 "ncgen/ncgen.l" +#line 352 "ncgen.l" {struct Specialtoken* st; bbClear(lextext); bbAppendn(lextext,(char*)yytext,(size_t)yyleng+1); /* include null */ @@ -2326,7 +2326,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 362 "ncgen/ncgen.l" +#line 362 "ncgen.l" { char c; char* p; char* q; @@ -2346,7 +2346,7 @@ YY_RULE_SETUP YY_BREAK case 40: YY_RULE_SETUP -#line 379 "ncgen/ncgen.l" +#line 379 "ncgen.l" { char* id = NULL; size_t len; len = strlen(yytext); len = (size_t)unescape(yytext,len,ISIDENT,&id); @@ -2361,7 +2361,7 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 391 "ncgen/ncgen.l" +#line 391 "ncgen.l" { /* We need to try to see what size of integer ((u)int). @@ -2442,7 +2442,7 @@ done: return 0; YY_BREAK case 42: YY_RULE_SETUP -#line 469 "ncgen/ncgen.l" +#line 469 "ncgen.l" { int c; int token = 0; @@ -2494,7 +2494,7 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 517 "ncgen/ncgen.l" +#line 517 "ncgen.l" { if (sscanf((char*)yytext, "%le", &double_val) != 1) { snprintf(errstr, sizeof(errstr),"bad long or double constant: %s",(char*)yytext); @@ -2505,7 +2505,7 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 524 "ncgen/ncgen.l" +#line 524 "ncgen.l" { if (sscanf((char*)yytext, "%e", &float_val) != 1) { snprintf(errstr, sizeof(errstr),"bad float constant: %s",(char*)yytext); @@ -2517,7 +2517,7 @@ YY_RULE_SETUP case 45: /* rule 45 can match eol */ YY_RULE_SETUP -#line 531 "ncgen/ncgen.l" +#line 531 "ncgen.l" { (void) sscanf((char*)&yytext[1],"%c",&byte_val); return lexdebug(BYTE_CONST); @@ -2525,7 +2525,7 @@ YY_RULE_SETUP YY_BREAK case 46: YY_RULE_SETUP -#line 535 "ncgen/ncgen.l" +#line 535 "ncgen.l" { int oct = unescapeoct(&yytext[2]); if(oct < 0) { @@ -2538,7 +2538,7 @@ YY_RULE_SETUP YY_BREAK case 47: YY_RULE_SETUP -#line 544 "ncgen/ncgen.l" +#line 544 "ncgen.l" { int hex = unescapehex(&yytext[3]); if(byte_val < 0) { @@ -2551,7 +2551,7 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 553 "ncgen/ncgen.l" +#line 553 "ncgen.l" { switch ((char)yytext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- @@ -2574,7 +2574,7 @@ YY_RULE_SETUP case 49: /* rule 49 can match eol */ YY_RULE_SETUP -#line 572 "ncgen/ncgen.l" +#line 572 "ncgen.l" { lineno++ ; break; @@ -2582,7 +2582,7 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 577 "ncgen/ncgen.l" +#line 577 "ncgen.l" {/*initial*/ BEGIN(ST_C_COMMENT); break; @@ -2591,21 +2591,21 @@ YY_RULE_SETUP case 51: /* rule 51 can match eol */ YY_RULE_SETUP -#line 582 "ncgen/ncgen.l" +#line 582 "ncgen.l" {/* continuation */ break; } YY_BREAK case 52: YY_RULE_SETUP -#line 586 "ncgen/ncgen.l" +#line 586 "ncgen.l" {/* final */ BEGIN(INITIAL); break; } YY_BREAK case YY_STATE_EOF(ST_C_COMMENT): -#line 591 "ncgen/ncgen.l" +#line 591 "ncgen.l" {/* final, error */ fprintf(stderr,"unterminated /**/ comment"); BEGIN(INITIAL); @@ -2614,14 +2614,14 @@ case YY_STATE_EOF(ST_C_COMMENT): YY_BREAK case 53: YY_RULE_SETUP -#line 597 "ncgen/ncgen.l" +#line 597 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ return lexdebug(yytext[0]) ; } YY_BREAK case 54: YY_RULE_SETUP -#line 600 "ncgen/ncgen.l" +#line 600 "ncgen.l" ECHO; YY_BREAK #line 2627 "ncgenl.c" @@ -3630,7 +3630,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 600 "ncgen/ncgen.l" +#line 600 "ncgen.l" static int lexdebug(int token) diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c index 57538182bf..3a37ff971f 100644 --- a/ncgen/ncgeny.c +++ b/ncgen/ncgeny.c @@ -74,7 +74,7 @@ #define yychar ncgchar /* First part of user prologue. */ -#line 11 "ncgen/ncgen.y" +#line 11 "ncgen.y" /* static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $"; @@ -195,10 +195,10 @@ static Symbol* makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int static int containsfills(Datalist* list); static void vercheck(int ncid); static long long extractint(NCConstant* con); +static Symbol* identkeyword(const Symbol*); #ifdef USE_NETCDF4 static int parsefilterflag(const char* sdata0, Specialdata* special); static int parsecodecsflag(const char* sdata0, Specialdata* special); -static Symbol* identkeyword(const Symbol*); #ifdef GENDEBUG1 static void printfilters(int nfilters, NC_H5_Filterspec** filters); @@ -1845,19 +1845,19 @@ yyparse (void) switch (yyn) { case 2: /* ncdesc: NETCDF datasetid rootgroup */ -#line 246 "ncgen/ncgen.y" +#line 246 "ncgen.y" {if (error_count > 0) YYABORT;} #line 1851 "ncgeny.c" break; case 3: /* datasetid: DATASETID */ -#line 249 "ncgen/ncgen.y" +#line 249 "ncgen.y" {createrootgroup(datasetname);} #line 1857 "ncgeny.c" break; case 8: /* $@1: %empty */ -#line 268 "ncgen/ncgen.y" +#line 268 "ncgen.y" { Symbol* id = (yyvsp[-1].sym); markcdf4("Group specification"); @@ -1869,25 +1869,25 @@ yyparse (void) break; case 9: /* $@2: %empty */ -#line 277 "ncgen/ncgen.y" +#line 277 "ncgen.y" {listpop(groupstack);} #line 1875 "ncgeny.c" break; case 12: /* typesection: TYPES */ -#line 283 "ncgen/ncgen.y" +#line 283 "ncgen.y" {} #line 1881 "ncgeny.c" break; case 13: /* typesection: TYPES typedecls */ -#line 285 "ncgen/ncgen.y" +#line 285 "ncgen.y" {markcdf4("Type specification");} #line 1887 "ncgeny.c" break; case 16: /* typename: ident */ -#line 291 "ncgen/ncgen.y" +#line 291 "ncgen.y" { /* Use when defining a type */ (yyvsp[0].sym)->objectclass = NC_TYPE; if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym))) @@ -1899,19 +1899,19 @@ yyparse (void) break; case 17: /* type_or_attr_decl: typedecl */ -#line 300 "ncgen/ncgen.y" +#line 300 "ncgen.y" {} #line 1905 "ncgeny.c" break; case 18: /* type_or_attr_decl: attrdecl ';' */ -#line 300 "ncgen/ncgen.y" +#line 300 "ncgen.y" {} #line 1911 "ncgeny.c" break; case 25: /* enumdecl: primtype ENUM typename '{' enumidlist '}' */ -#line 314 "ncgen/ncgen.y" +#line 314 "ncgen.y" { size_t i; addtogroup((yyvsp[-3].sym)); /* sets prefix*/ @@ -1942,13 +1942,13 @@ yyparse (void) break; case 26: /* enumidlist: enumid */ -#line 343 "ncgen/ncgen.y" +#line 343 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} #line 1948 "ncgeny.c" break; case 27: /* enumidlist: enumidlist ',' enumid */ -#line 345 "ncgen/ncgen.y" +#line 345 "ncgen.y" { size_t i; (yyval.mark)=(yyvsp[-2].mark); @@ -1967,7 +1967,7 @@ yyparse (void) break; case 28: /* enumid: ident '=' constint */ -#line 362 "ncgen/ncgen.y" +#line 362 "ncgen.y" { (yyvsp[-2].sym)->objectclass=NC_TYPE; (yyvsp[-2].sym)->subclass=NC_ECONST; @@ -1978,7 +1978,7 @@ yyparse (void) break; case 29: /* opaquedecl: OPAQUE_ '(' INT_CONST ')' typename */ -#line 371 "ncgen/ncgen.y" +#line 371 "ncgen.y" { vercheck(NC_OPAQUE); addtogroup((yyvsp[0].sym)); /*sets prefix*/ @@ -1992,7 +1992,7 @@ yyparse (void) break; case 30: /* vlendecl: typeref '(' '*' ')' typename */ -#line 383 "ncgen/ncgen.y" +#line 383 "ncgen.y" { Symbol* basetype = (yyvsp[-4].sym); vercheck(NC_VLEN); @@ -2008,7 +2008,7 @@ yyparse (void) break; case 31: /* compounddecl: COMPOUND typename '{' fields '}' */ -#line 397 "ncgen/ncgen.y" +#line 397 "ncgen.y" { size_t i,j; vercheck(NC_COMPOUND); @@ -2042,19 +2042,19 @@ yyparse (void) break; case 32: /* fields: field ';' */ -#line 429 "ncgen/ncgen.y" +#line 429 "ncgen.y" {(yyval.mark)=(yyvsp[-1].mark);} #line 2048 "ncgeny.c" break; case 33: /* fields: fields field ';' */ -#line 430 "ncgen/ncgen.y" +#line 430 "ncgen.y" {(yyval.mark)=(yyvsp[-2].mark);} #line 2054 "ncgeny.c" break; case 34: /* field: typeref fieldlist */ -#line 434 "ncgen/ncgen.y" +#line 434 "ncgen.y" { size_t i; (yyval.mark)=(yyvsp[0].mark); @@ -2070,103 +2070,103 @@ yyparse (void) break; case 35: /* primtype: CHAR_K */ -#line 447 "ncgen/ncgen.y" +#line 447 "ncgen.y" { (yyval.sym) = primsymbols[NC_CHAR]; } #line 2076 "ncgeny.c" break; case 36: /* primtype: BYTE_K */ -#line 448 "ncgen/ncgen.y" +#line 448 "ncgen.y" { (yyval.sym) = primsymbols[NC_BYTE]; } #line 2082 "ncgeny.c" break; case 37: /* primtype: SHORT_K */ -#line 449 "ncgen/ncgen.y" +#line 449 "ncgen.y" { (yyval.sym) = primsymbols[NC_SHORT]; } #line 2088 "ncgeny.c" break; case 38: /* primtype: INT_K */ -#line 450 "ncgen/ncgen.y" +#line 450 "ncgen.y" { (yyval.sym) = primsymbols[NC_INT]; } #line 2094 "ncgeny.c" break; case 39: /* primtype: FLOAT_K */ -#line 451 "ncgen/ncgen.y" +#line 451 "ncgen.y" { (yyval.sym) = primsymbols[NC_FLOAT]; } #line 2100 "ncgeny.c" break; case 40: /* primtype: DOUBLE_K */ -#line 452 "ncgen/ncgen.y" +#line 452 "ncgen.y" { (yyval.sym) = primsymbols[NC_DOUBLE]; } #line 2106 "ncgeny.c" break; case 41: /* primtype: UBYTE_K */ -#line 453 "ncgen/ncgen.y" +#line 453 "ncgen.y" { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; } #line 2112 "ncgeny.c" break; case 42: /* primtype: USHORT_K */ -#line 454 "ncgen/ncgen.y" +#line 454 "ncgen.y" { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; } #line 2118 "ncgeny.c" break; case 43: /* primtype: UINT_K */ -#line 455 "ncgen/ncgen.y" +#line 455 "ncgen.y" { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; } #line 2124 "ncgeny.c" break; case 44: /* primtype: INT64_K */ -#line 456 "ncgen/ncgen.y" +#line 456 "ncgen.y" { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; } #line 2130 "ncgeny.c" break; case 45: /* primtype: UINT64_K */ -#line 457 "ncgen/ncgen.y" +#line 457 "ncgen.y" { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; } #line 2136 "ncgeny.c" break; case 46: /* primtype: STRING_K */ -#line 458 "ncgen/ncgen.y" +#line 458 "ncgen.y" { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; } #line 2142 "ncgeny.c" break; case 48: /* dimsection: DIMENSIONS */ -#line 462 "ncgen/ncgen.y" +#line 462 "ncgen.y" {} #line 2148 "ncgeny.c" break; case 49: /* dimsection: DIMENSIONS dimdecls */ -#line 463 "ncgen/ncgen.y" +#line 463 "ncgen.y" {} #line 2154 "ncgeny.c" break; case 52: /* dim_or_attr_decl: dimdeclist */ -#line 470 "ncgen/ncgen.y" +#line 470 "ncgen.y" {} #line 2160 "ncgeny.c" break; case 53: /* dim_or_attr_decl: attrdecl */ -#line 470 "ncgen/ncgen.y" +#line 470 "ncgen.y" {} #line 2166 "ncgeny.c" break; case 56: /* dimdecl: dimd '=' constint */ -#line 478 "ncgen/ncgen.y" +#line 478 "ncgen.y" { (yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant)); #ifdef GENDEBUG1 @@ -2178,7 +2178,7 @@ fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long lon break; case 57: /* dimdecl: dimd '=' NC_UNLIMITED_K */ -#line 486 "ncgen/ncgen.y" +#line 486 "ncgen.y" { (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED; (yyvsp[-2].sym)->dim.isunlimited = 1; @@ -2190,7 +2190,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 58: /* dimd: ident */ -#line 496 "ncgen/ncgen.y" +#line 496 "ncgen.y" { (yyvsp[0].sym)->objectclass=NC_DIM; if(dupobjectcheck(NC_DIM,(yyvsp[0].sym))) @@ -2204,31 +2204,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 60: /* vasection: VARIABLES */ -#line 508 "ncgen/ncgen.y" +#line 508 "ncgen.y" {} #line 2210 "ncgeny.c" break; case 61: /* vasection: VARIABLES vadecls */ -#line 509 "ncgen/ncgen.y" +#line 509 "ncgen.y" {} #line 2216 "ncgeny.c" break; case 64: /* vadecl_or_attr: vardecl */ -#line 516 "ncgen/ncgen.y" +#line 516 "ncgen.y" {} #line 2222 "ncgeny.c" break; case 65: /* vadecl_or_attr: attrdecl */ -#line 516 "ncgen/ncgen.y" +#line 516 "ncgen.y" {} #line 2228 "ncgeny.c" break; case 66: /* vardecl: typeref varlist */ -#line 519 "ncgen/ncgen.y" +#line 519 "ncgen.y" { size_t i; stackbase=(yyvsp[0].mark); @@ -2252,7 +2252,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 67: /* varlist: varspec */ -#line 541 "ncgen/ncgen.y" +#line 541 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym)); } @@ -2260,13 +2260,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 68: /* varlist: varlist ',' varspec */ -#line 545 "ncgen/ncgen.y" +#line 545 "ncgen.y" {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} #line 2266 "ncgeny.c" break; case 69: /* varspec: varident dimspec */ -#line 549 "ncgen/ncgen.y" +#line 549 "ncgen.y" { size_t i; Dimset dimset; @@ -2297,31 +2297,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 70: /* dimspec: %empty */ -#line 577 "ncgen/ncgen.y" +#line 577 "ncgen.y" {(yyval.mark)=listlength(stack);} #line 2303 "ncgeny.c" break; case 71: /* dimspec: '(' dimlist ')' */ -#line 578 "ncgen/ncgen.y" +#line 578 "ncgen.y" {(yyval.mark)=(yyvsp[-1].mark);} #line 2309 "ncgeny.c" break; case 72: /* dimlist: dimref */ -#line 581 "ncgen/ncgen.y" +#line 581 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} #line 2315 "ncgeny.c" break; case 73: /* dimlist: dimlist ',' dimref */ -#line 583 "ncgen/ncgen.y" +#line 583 "ncgen.y" {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} #line 2321 "ncgeny.c" break; case 74: /* dimref: path */ -#line 587 "ncgen/ncgen.y" +#line 587 "ncgen.y" {Symbol* dimsym = (yyvsp[0].sym); dimsym->objectclass = NC_DIM; /* Find the actual dimension*/ @@ -2336,7 +2336,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 75: /* fieldlist: fieldspec */ -#line 601 "ncgen/ncgen.y" +#line 601 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym)); } @@ -2344,13 +2344,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 76: /* fieldlist: fieldlist ',' fieldspec */ -#line 605 "ncgen/ncgen.y" +#line 605 "ncgen.y" {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} #line 2350 "ncgeny.c" break; case 77: /* fieldspec: ident fielddimspec */ -#line 610 "ncgen/ncgen.y" +#line 610 "ncgen.y" { size_t i; Dimset dimset; @@ -2381,31 +2381,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 78: /* fielddimspec: %empty */ -#line 638 "ncgen/ncgen.y" +#line 638 "ncgen.y" {(yyval.mark)=listlength(stack);} #line 2387 "ncgeny.c" break; case 79: /* fielddimspec: '(' fielddimlist ')' */ -#line 639 "ncgen/ncgen.y" +#line 639 "ncgen.y" {(yyval.mark)=(yyvsp[-1].mark);} #line 2393 "ncgeny.c" break; case 80: /* fielddimlist: fielddim */ -#line 643 "ncgen/ncgen.y" +#line 643 "ncgen.y" {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));} #line 2399 "ncgeny.c" break; case 81: /* fielddimlist: fielddimlist ',' fielddim */ -#line 645 "ncgen/ncgen.y" +#line 645 "ncgen.y" {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));} #line 2405 "ncgeny.c" break; case 82: /* fielddim: UINT_CONST */ -#line 650 "ncgen/ncgen.y" +#line 650 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2419,7 +2419,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 83: /* fielddim: INT_CONST */ -#line 660 "ncgen/ncgen.y" +#line 660 "ncgen.y" { /* Anonymous integer dimension. Can only occur in type definitions*/ char anon[32]; @@ -2437,7 +2437,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 84: /* varref: ambiguous_ref */ -#line 680 "ncgen/ncgen.y" +#line 680 "ncgen.y" {Symbol* vsym = (yyvsp[0].sym); if(vsym->objectclass != NC_VAR) { derror("Undefined or forward referenced variable: %s",vsym->name); @@ -2449,7 +2449,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 85: /* typeref: ambiguous_ref */ -#line 691 "ncgen/ncgen.y" +#line 691 "ncgen.y" {Symbol* tsym = (yyvsp[0].sym); if(tsym->objectclass != NC_TYPE) { derror("Undefined or forward referenced type: %s",tsym->name); @@ -2461,7 +2461,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 86: /* ambiguous_ref: path */ -#line 702 "ncgen/ncgen.y" +#line 702 "ncgen.y" {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym; /* disambiguate*/ tvsym->objectclass = NC_VAR; @@ -2484,49 +2484,49 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 87: /* ambiguous_ref: primtype */ -#line 720 "ncgen/ncgen.y" +#line 720 "ncgen.y" {(yyval.sym)=(yyvsp[0].sym);} #line 2490 "ncgeny.c" break; case 88: /* attrdecllist: %empty */ -#line 727 "ncgen/ncgen.y" +#line 727 "ncgen.y" {} #line 2496 "ncgeny.c" break; case 89: /* attrdecllist: attrdecl ';' attrdecllist */ -#line 727 "ncgen/ncgen.y" +#line 727 "ncgen.y" {} #line 2502 "ncgeny.c" break; case 90: /* attrdecl: ':' _NCPROPS '=' conststring */ -#line 731 "ncgen/ncgen.y" +#line 731 "ncgen.y" {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2508 "ncgeny.c" break; case 91: /* attrdecl: ':' _ISNETCDF4 '=' constbool */ -#line 733 "ncgen/ncgen.y" +#line 733 "ncgen.y" {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2514 "ncgeny.c" break; case 92: /* attrdecl: ':' _SUPERBLOCK '=' constint */ -#line 735 "ncgen/ncgen.y" +#line 735 "ncgen.y" {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2520 "ncgeny.c" break; case 93: /* attrdecl: ':' ident '=' datalist */ -#line 737 "ncgen/ncgen.y" +#line 737 "ncgen.y" { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);} #line 2526 "ncgeny.c" break; case 94: /* attrdecl: typeref ambiguous_ref ':' ident '=' datalist */ -#line 739 "ncgen/ncgen.y" +#line 739 "ncgen.y" {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(vsym->objectclass == NC_VAR) { (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR); @@ -2539,7 +2539,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 95: /* attrdecl: ambiguous_ref ':' ident '=' datalist */ -#line 748 "ncgen/ncgen.y" +#line 748 "ncgen.y" {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym); if(sym->objectclass == NC_VAR) { (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR); @@ -2554,97 +2554,97 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 96: /* attrdecl: ambiguous_ref ':' _FILLVALUE '=' datalist */ -#line 759 "ncgen/ncgen.y" +#line 759 "ncgen.y" {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} #line 2560 "ncgeny.c" break; case 97: /* attrdecl: typeref ambiguous_ref ':' _FILLVALUE '=' datalist */ -#line 761 "ncgen/ncgen.y" +#line 761 "ncgen.y" {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),ISLIST);} #line 2566 "ncgeny.c" break; case 98: /* attrdecl: ambiguous_ref ':' _STORAGE '=' conststring */ -#line 763 "ncgen/ncgen.y" +#line 763 "ncgen.y" {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2572 "ncgeny.c" break; case 99: /* attrdecl: ambiguous_ref ':' _CHUNKSIZES '=' intlist */ -#line 765 "ncgen/ncgen.y" +#line 765 "ncgen.y" {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),ISLIST);} #line 2578 "ncgeny.c" break; case 100: /* attrdecl: ambiguous_ref ':' _FLETCHER32 '=' constbool */ -#line 767 "ncgen/ncgen.y" +#line 767 "ncgen.y" {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2584 "ncgeny.c" break; case 101: /* attrdecl: ambiguous_ref ':' _DEFLATELEVEL '=' constint */ -#line 769 "ncgen/ncgen.y" +#line 769 "ncgen.y" {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2590 "ncgeny.c" break; case 102: /* attrdecl: ambiguous_ref ':' _SHUFFLE '=' constbool */ -#line 771 "ncgen/ncgen.y" +#line 771 "ncgen.y" {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2596 "ncgeny.c" break; case 103: /* attrdecl: ambiguous_ref ':' _ENDIANNESS '=' conststring */ -#line 773 "ncgen/ncgen.y" +#line 773 "ncgen.y" {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2602 "ncgeny.c" break; case 104: /* attrdecl: ambiguous_ref ':' _FILTER '=' conststring */ -#line 775 "ncgen/ncgen.y" +#line 775 "ncgen.y" {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2608 "ncgeny.c" break; case 105: /* attrdecl: ambiguous_ref ':' _CODECS '=' conststring */ -#line 777 "ncgen/ncgen.y" +#line 777 "ncgen.y" {(yyval.sym) = makespecial(_CODECS_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2614 "ncgeny.c" break; case 106: /* attrdecl: ambiguous_ref ':' _QUANTIZEBG '=' constint */ -#line 779 "ncgen/ncgen.y" +#line 779 "ncgen.y" {(yyval.sym) = makespecial(_QUANTIZEBG_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2620 "ncgeny.c" break; case 107: /* attrdecl: ambiguous_ref ':' _QUANTIZEGBR '=' constint */ -#line 781 "ncgen/ncgen.y" +#line 781 "ncgen.y" {(yyval.sym) = makespecial(_QUANTIZEGBR_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2626 "ncgeny.c" break; case 108: /* attrdecl: ambiguous_ref ':' _QUANTIZEBR '=' constint */ -#line 783 "ncgen/ncgen.y" +#line 783 "ncgen.y" {(yyval.sym) = makespecial(_QUANTIZEBR_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2632 "ncgeny.c" break; case 109: /* attrdecl: ambiguous_ref ':' _NOFILL '=' constbool */ -#line 785 "ncgen/ncgen.y" +#line 785 "ncgen.y" {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2638 "ncgeny.c" break; case 110: /* attrdecl: ':' _FORMAT '=' conststring */ -#line 787 "ncgen/ncgen.y" +#line 787 "ncgen.y" {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)(yyvsp[0].constant),ISCONST);} #line 2644 "ncgeny.c" break; case 111: /* path: ident */ -#line 792 "ncgen/ncgen.y" +#line 792 "ncgen.y" { (yyval.sym)=(yyvsp[0].sym); (yyvsp[0].sym)->ref.is_ref=1; @@ -2655,7 +2655,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 112: /* path: PATH */ -#line 799 "ncgen/ncgen.y" +#line 799 "ncgen.y" { (yyval.sym)=(yyvsp[0].sym); (yyvsp[0].sym)->ref.is_ref=1; @@ -2666,259 +2666,259 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); break; case 114: /* datasection: DATA */ -#line 808 "ncgen/ncgen.y" +#line 808 "ncgen.y" {} #line 2672 "ncgeny.c" break; case 115: /* datasection: DATA datadecls */ -#line 809 "ncgen/ncgen.y" +#line 809 "ncgen.y" {} #line 2678 "ncgeny.c" break; case 118: /* datadecl: varref '=' datalist */ -#line 817 "ncgen/ncgen.y" +#line 817 "ncgen.y" {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);} #line 2684 "ncgeny.c" break; case 119: /* datalist: datalist0 */ -#line 820 "ncgen/ncgen.y" +#line 820 "ncgen.y" {(yyval.datalist) = (yyvsp[0].datalist);} #line 2690 "ncgeny.c" break; case 120: /* datalist: datalist1 */ -#line 821 "ncgen/ncgen.y" +#line 821 "ncgen.y" {(yyval.datalist) = (yyvsp[0].datalist);} #line 2696 "ncgeny.c" break; case 121: /* datalist0: %empty */ -#line 825 "ncgen/ncgen.y" +#line 825 "ncgen.y" {(yyval.datalist) = builddatalist(0);} #line 2702 "ncgeny.c" break; case 122: /* datalist1: dataitem */ -#line 829 "ncgen/ncgen.y" +#line 829 "ncgen.y" {(yyval.datalist) = const2list((yyvsp[0].constant));} #line 2708 "ncgeny.c" break; case 123: /* datalist1: datalist ',' dataitem */ -#line 831 "ncgen/ncgen.y" +#line 831 "ncgen.y" {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist); } #line 2714 "ncgeny.c" break; case 124: /* dataitem: constdata */ -#line 835 "ncgen/ncgen.y" +#line 835 "ncgen.y" {(yyval.constant)=(yyvsp[0].constant);} #line 2720 "ncgeny.c" break; case 125: /* dataitem: '{' datalist '}' */ -#line 836 "ncgen/ncgen.y" +#line 836 "ncgen.y" {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));} #line 2726 "ncgeny.c" break; case 126: /* constdata: simpleconstant */ -#line 840 "ncgen/ncgen.y" +#line 840 "ncgen.y" {(yyval.constant)=(yyvsp[0].constant);} #line 2732 "ncgeny.c" break; case 127: /* constdata: OPAQUESTRING */ -#line 841 "ncgen/ncgen.y" +#line 841 "ncgen.y" {(yyval.constant)=makeconstdata(NC_OPAQUE);} #line 2738 "ncgeny.c" break; case 128: /* constdata: FILLMARKER */ -#line 842 "ncgen/ncgen.y" +#line 842 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FILLVALUE);} #line 2744 "ncgeny.c" break; case 129: /* constdata: NIL */ -#line 843 "ncgen/ncgen.y" +#line 843 "ncgen.y" {(yyval.constant)=makeconstdata(NC_NIL);} #line 2750 "ncgeny.c" break; case 130: /* constdata: econstref */ -#line 844 "ncgen/ncgen.y" +#line 844 "ncgen.y" {(yyval.constant)=(yyvsp[0].constant);} #line 2756 "ncgeny.c" break; case 132: /* econstref: path */ -#line 849 "ncgen/ncgen.y" +#line 849 "ncgen.y" {(yyval.constant) = makeenumconstref((yyvsp[0].sym));} #line 2762 "ncgeny.c" break; case 133: /* function: ident '(' arglist ')' */ -#line 853 "ncgen/ncgen.y" +#line 853 "ncgen.y" {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));} #line 2768 "ncgeny.c" break; case 134: /* arglist: simpleconstant */ -#line 858 "ncgen/ncgen.y" +#line 858 "ncgen.y" {(yyval.datalist) = const2list((yyvsp[0].constant));} #line 2774 "ncgeny.c" break; case 135: /* arglist: arglist ',' simpleconstant */ -#line 860 "ncgen/ncgen.y" +#line 860 "ncgen.y" {dlappend((yyvsp[-2].datalist),((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);} #line 2780 "ncgeny.c" break; case 136: /* simpleconstant: CHAR_CONST */ -#line 864 "ncgen/ncgen.y" +#line 864 "ncgen.y" {(yyval.constant)=makeconstdata(NC_CHAR);} #line 2786 "ncgeny.c" break; case 137: /* simpleconstant: BYTE_CONST */ -#line 865 "ncgen/ncgen.y" +#line 865 "ncgen.y" {(yyval.constant)=makeconstdata(NC_BYTE);} #line 2792 "ncgeny.c" break; case 138: /* simpleconstant: SHORT_CONST */ -#line 866 "ncgen/ncgen.y" +#line 866 "ncgen.y" {(yyval.constant)=makeconstdata(NC_SHORT);} #line 2798 "ncgeny.c" break; case 139: /* simpleconstant: INT_CONST */ -#line 867 "ncgen/ncgen.y" +#line 867 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} #line 2804 "ncgeny.c" break; case 140: /* simpleconstant: INT64_CONST */ -#line 868 "ncgen/ncgen.y" +#line 868 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} #line 2810 "ncgeny.c" break; case 141: /* simpleconstant: UBYTE_CONST */ -#line 869 "ncgen/ncgen.y" +#line 869 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UBYTE);} #line 2816 "ncgeny.c" break; case 142: /* simpleconstant: USHORT_CONST */ -#line 870 "ncgen/ncgen.y" +#line 870 "ncgen.y" {(yyval.constant)=makeconstdata(NC_USHORT);} #line 2822 "ncgeny.c" break; case 143: /* simpleconstant: UINT_CONST */ -#line 871 "ncgen/ncgen.y" +#line 871 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} #line 2828 "ncgeny.c" break; case 144: /* simpleconstant: UINT64_CONST */ -#line 872 "ncgen/ncgen.y" +#line 872 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} #line 2834 "ncgeny.c" break; case 145: /* simpleconstant: FLOAT_CONST */ -#line 873 "ncgen/ncgen.y" +#line 873 "ncgen.y" {(yyval.constant)=makeconstdata(NC_FLOAT);} #line 2840 "ncgeny.c" break; case 146: /* simpleconstant: DOUBLE_CONST */ -#line 874 "ncgen/ncgen.y" +#line 874 "ncgen.y" {(yyval.constant)=makeconstdata(NC_DOUBLE);} #line 2846 "ncgeny.c" break; case 147: /* simpleconstant: TERMSTRING */ -#line 875 "ncgen/ncgen.y" +#line 875 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} #line 2852 "ncgeny.c" break; case 148: /* intlist: constint */ -#line 879 "ncgen/ncgen.y" +#line 879 "ncgen.y" {(yyval.datalist) = const2list((yyvsp[0].constant));} #line 2858 "ncgeny.c" break; case 149: /* intlist: intlist ',' constint */ -#line 880 "ncgen/ncgen.y" +#line 880 "ncgen.y" {(yyval.datalist)=(yyvsp[-2].datalist); dlappend((yyvsp[-2].datalist),((yyvsp[0].constant)));} #line 2864 "ncgeny.c" break; case 150: /* constint: INT_CONST */ -#line 885 "ncgen/ncgen.y" +#line 885 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT);} #line 2870 "ncgeny.c" break; case 151: /* constint: UINT_CONST */ -#line 887 "ncgen/ncgen.y" +#line 887 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT);} #line 2876 "ncgeny.c" break; case 152: /* constint: INT64_CONST */ -#line 889 "ncgen/ncgen.y" +#line 889 "ncgen.y" {(yyval.constant)=makeconstdata(NC_INT64);} #line 2882 "ncgeny.c" break; case 153: /* constint: UINT64_CONST */ -#line 891 "ncgen/ncgen.y" +#line 891 "ncgen.y" {(yyval.constant)=makeconstdata(NC_UINT64);} #line 2888 "ncgeny.c" break; case 154: /* conststring: TERMSTRING */ -#line 895 "ncgen/ncgen.y" +#line 895 "ncgen.y" {(yyval.constant)=makeconstdata(NC_STRING);} #line 2894 "ncgeny.c" break; case 155: /* constbool: conststring */ -#line 899 "ncgen/ncgen.y" +#line 899 "ncgen.y" {(yyval.constant)=(yyvsp[0].constant);} #line 2900 "ncgeny.c" break; case 156: /* constbool: constint */ -#line 900 "ncgen/ncgen.y" +#line 900 "ncgen.y" {(yyval.constant)=(yyvsp[0].constant);} #line 2906 "ncgeny.c" break; case 157: /* varident: IDENT */ -#line 908 "ncgen/ncgen.y" +#line 908 "ncgen.y" {(yyval.sym)=(yyvsp[0].sym);} #line 2912 "ncgeny.c" break; case 158: /* varident: DATA */ -#line 909 "ncgen/ncgen.y" +#line 909 "ncgen.y" {(yyval.sym)=identkeyword((yyvsp[0].sym));} #line 2918 "ncgeny.c" break; case 159: /* ident: IDENT */ -#line 913 "ncgen/ncgen.y" +#line 913 "ncgen.y" {(yyval.sym)=(yyvsp[0].sym);} #line 2924 "ncgeny.c" break; @@ -3148,7 +3148,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name); return yyresult; } -#line 916 "ncgen/ncgen.y" +#line 916 "ncgen.y" #ifndef NO_STDARG @@ -3403,11 +3403,11 @@ truefalse(NCConstant* con, int tag) { if(con->nctype == NC_STRING) { char* sdata = con->value.stringv.stringv; - if(strcmp(sdata,"false") == 0 - || strcmp(sdata,"0") == 0) + if(strncmp(sdata,"false",NC_MAX_NAME) == 0 + || strncmp(sdata,"0",NC_MAX_NAME) == 0) return 0; - else if(strcmp(sdata,"true") == 0 - || strcmp(sdata,"1") == 0) + else if(strncmp(sdata,"true",NC_MAX_NAME) == 0 + || strncmp(sdata,"1",NC_MAX_NAME) == 0) return 1; else goto fail; } else if(con->value.int32v < 0 || con->value.int32v > 1) diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h index 09ce4d2aae..eb71a91e65 100644 --- a/ncgen/ncgeny.h +++ b/ncgen/ncgeny.h @@ -119,7 +119,7 @@ extern int ncgdebug; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 156 "ncgen/ncgen.y" +#line 156 "ncgen.y" Symbol* sym; unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/ diff --git a/ncgen3/CMakeLists.txt b/ncgen3/CMakeLists.txt index a1ca6abf27..ee70e724fb 100644 --- a/ncgen3/CMakeLists.txt +++ b/ncgen3/CMakeLists.txt @@ -75,7 +75,7 @@ INSTALL(TARGETS ncgen3 DESTINATION bin COMPONENT utilities) SET(MAN_FILES ncgen3.1) IF(NOT MSVC) - INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation) + INSTALL(FILES ${MAN_FILES} DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT documentation) ENDIF() ## Specify files to be distributed by 'make dist' diff --git a/ncgen3/ncgen.y b/ncgen3/ncgen.y index c388e562bd..ad254fd15a 100644 --- a/ncgen3/ncgen.y +++ b/ncgen3/ncgen.y @@ -802,13 +802,13 @@ void equalatt(void) /* shrink space down to what was really needed */ att_space = erealloc(att_space, valnum*nctypesize(valtype)); atts[natts].val = att_space; - if (STREQ(atts[natts].name, _FillValue) && + if (STREQ(atts[natts].name, NC_FillValue) && atts[natts].var != NC_GLOBAL) { nc_putfill(atts[natts].type,atts[natts].val, &vars[atts[natts].var].fill_value); if(atts[natts].type != vars[atts[natts].var].type) { derror("variable %s: %s type mismatch", - vars[atts[natts].var].name, _FillValue); + vars[atts[natts].var].name, NC_FillValue); } } natts++; diff --git a/ncgen3/ncgenl.c b/ncgen3/ncgenl.c index 936f5fc14d..8f7f8287f3 100644 --- a/ncgen3/ncgenl.c +++ b/ncgen3/ncgenl.c @@ -20,7 +20,7 @@ #define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng -#define yyncgenllex +#define yylex ncglex #define yylineno ncglineno #define yyout ncgout #define yyrestart ncgrestart @@ -113,7 +113,7 @@ #ifdef yylex #define ncglex_ALREADY_DEFINED #else -#define yyncgenllex +#define yylex ncglex #endif #ifdef yyrestart @@ -1053,8 +1053,8 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "ncgen3/ncgen.l" -#line 2 "ncgen3/ncgen.l" +#line 1 "ncgen.l" +#line 2 "ncgen.l" /********************************************************************* * Copyright 2018, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. @@ -1359,7 +1359,7 @@ YY_DECL } { -#line 107 "ncgen3/ncgen.l" +#line 107 "ncgen.l" #line 1364 "ncgenl.c" @@ -1420,7 +1420,7 @@ YY_DECL case 1: YY_RULE_SETUP -#line 108 "ncgen3/ncgen.l" +#line 108 "ncgen.l" { /* comment */ break; } @@ -1428,7 +1428,7 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 112 "ncgen3/ncgen.l" +#line 112 "ncgen.l" { if(yyleng > MAXTRST) { yyerror("string too long, truncated\n"); @@ -1440,59 +1440,59 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 121 "ncgen3/ncgen.l" +#line 121 "ncgen.l" {return (FLOAT_K);} YY_BREAK case 4: YY_RULE_SETUP -#line 122 "ncgen3/ncgen.l" +#line 122 "ncgen.l" {return (CHAR_K);} YY_BREAK case 5: YY_RULE_SETUP -#line 123 "ncgen3/ncgen.l" +#line 123 "ncgen.l" {return (BYTE_K);} YY_BREAK case 6: YY_RULE_SETUP -#line 124 "ncgen3/ncgen.l" +#line 124 "ncgen.l" {return (SHORT_K);} YY_BREAK case 7: YY_RULE_SETUP -#line 125 "ncgen3/ncgen.l" +#line 125 "ncgen.l" {return (INT_K);} YY_BREAK case 8: YY_RULE_SETUP -#line 126 "ncgen3/ncgen.l" +#line 126 "ncgen.l" {return (DOUBLE_K);} YY_BREAK case 9: YY_RULE_SETUP -#line 127 "ncgen3/ncgen.l" +#line 127 "ncgen.l" {int_val = -1; return (NC_UNLIMITED_K);} YY_BREAK case 10: YY_RULE_SETUP -#line 130 "ncgen3/ncgen.l" +#line 130 "ncgen.l" {return (DIMENSIONS);} YY_BREAK case 11: YY_RULE_SETUP -#line 131 "ncgen3/ncgen.l" +#line 131 "ncgen.l" {return (VARIABLES);} YY_BREAK case 12: YY_RULE_SETUP -#line 132 "ncgen3/ncgen.l" +#line 132 "ncgen.l" {return (DATA);} YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 133 "ncgen3/ncgen.l" +#line 133 "ncgen.l" { char *s = (char*)yytext+strlen("netcdf"); char *t = (char*)yytext+yyleng-1; @@ -1514,7 +1514,7 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 151 "ncgen3/ncgen.l" +#line 151 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ if (yytext[0] == '-') { double_val = -NC_FILL_DOUBLE; @@ -1526,7 +1526,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 159 "ncgen3/ncgen.l" +#line 159 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ if (yytext[0] == '-') { float_val = -NC_FILL_FLOAT; @@ -1538,7 +1538,7 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 167 "ncgen3/ncgen.l" +#line 167 "ncgen.l" { if (STREQ((char *)yytext, FILL_STRING)) return (FILLVALUE); @@ -1551,7 +1551,7 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 176 "ncgen3/ncgen.l" +#line 176 "ncgen.l" { lineno++ ; break; @@ -1559,7 +1559,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 181 "ncgen3/ncgen.l" +#line 181 "ncgen.l" { int ii; if (sscanf((char*)yytext, "%d", &ii) != 1) { @@ -1576,7 +1576,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 195 "ncgen3/ncgen.l" +#line 195 "ncgen.l" { if (sscanf((char*)yytext, "%le", &double_val) != 1) { snprintf(errstr, sizeof(errstr),"bad long or double constant: %s",(char*)yytext); @@ -1587,7 +1587,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 202 "ncgen3/ncgen.l" +#line 202 "ncgen.l" { if (sscanf((char*)yytext, "%e", &float_val) != 1) { snprintf(errstr, sizeof(errstr),"bad float constant: %s",(char*)yytext); @@ -1598,7 +1598,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 209 "ncgen3/ncgen.l" +#line 209 "ncgen.l" { int tmp = 0; if (sscanf((char*)yytext, "%d", &tmp) != 1) { @@ -1611,7 +1611,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 218 "ncgen3/ncgen.l" +#line 218 "ncgen.l" { char *ptr; errno = 0; @@ -1630,7 +1630,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 233 "ncgen3/ncgen.l" +#line 233 "ncgen.l" { char *ptr; long long_val; @@ -1652,7 +1652,7 @@ YY_RULE_SETUP case 24: /* rule 24 can match eol */ YY_RULE_SETUP -#line 250 "ncgen3/ncgen.l" +#line 250 "ncgen.l" { (void) sscanf((char*)&yytext[1],"%c",&byte_val); return (BYTE_CONST); @@ -1660,7 +1660,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 254 "ncgen3/ncgen.l" +#line 254 "ncgen.l" { byte_val = (char) strtol((char*)&yytext[2], (char **) 0, 8); return (BYTE_CONST); @@ -1668,7 +1668,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 258 "ncgen3/ncgen.l" +#line 258 "ncgen.l" { byte_val = (char) strtol((char*)&yytext[3], (char **) 0, 16); return (BYTE_CONST); @@ -1676,7 +1676,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 262 "ncgen3/ncgen.l" +#line 262 "ncgen.l" { switch ((char)yytext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- @@ -1697,21 +1697,21 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 280 "ncgen3/ncgen.l" +#line 280 "ncgen.l" { /* whitespace */ break; } YY_BREAK case 29: YY_RULE_SETUP -#line 283 "ncgen3/ncgen.l" +#line 283 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ return (yytext[0]) ; } YY_BREAK case 30: YY_RULE_SETUP -#line 287 "ncgen3/ncgen.l" +#line 287 "ncgen.l" ECHO; YY_BREAK #line 1717 "ncgenl.c" @@ -2719,7 +2719,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 287 "ncgen3/ncgen.l" +#line 287 "ncgen.l" /* Hack to keep compile quiet */ diff --git a/ncgen3/ncgeny.c b/ncgen3/ncgeny.c index 99a2ed64fc..bbd85085f4 100644 --- a/ncgen3/ncgeny.c +++ b/ncgen3/ncgeny.c @@ -74,7 +74,7 @@ #define yychar ncgchar /* First part of user prologue. */ -#line 9 "ncgen3/ncgen.y" +#line 9 "ncgen.y" #ifdef sccs static char SccsId[] = "$Id: ncgen.y,v 1.34 2010/03/31 18:18:41 dmh Exp $"; @@ -1281,13 +1281,13 @@ yyparse (void) switch (yyn) { case 2: /* $@1: %empty */ -#line 117 "ncgen3/ncgen.y" +#line 117 "ncgen.y" { init_netcdf(); } #line 1287 "ncgeny.c" break; case 3: /* $@2: %empty */ -#line 120 "ncgen3/ncgen.y" +#line 120 "ncgen.y" { if (derror_count == 0) define_netcdf(netcdfname); @@ -1298,7 +1298,7 @@ yyparse (void) break; case 4: /* ncdesc: NETCDF '{' $@1 dimsection vasection $@2 datasection '}' */ -#line 128 "ncgen3/ncgen.y" +#line 128 "ncgen.y" { if (derror_count == 0) close_netcdf(); @@ -1307,7 +1307,7 @@ yyparse (void) break; case 11: /* dimdecl: dimd '=' INT_CONST */ -#line 143 "ncgen3/ncgen.y" +#line 143 "ncgen.y" { if (int_val <= 0) derror("dimension length must be positive"); dims[ndims].size = (size_t)int_val; @@ -1317,7 +1317,7 @@ yyparse (void) break; case 12: /* dimdecl: dimd '=' DOUBLE_CONST */ -#line 149 "ncgen3/ncgen.y" +#line 149 "ncgen.y" { /* for rare case where 2^31 < dimsize < 2^32 */ if (double_val <= 0) derror("dimension length must be positive"); @@ -1332,7 +1332,7 @@ yyparse (void) break; case 13: /* dimdecl: dimd '=' NC_UNLIMITED_K */ -#line 160 "ncgen3/ncgen.y" +#line 160 "ncgen.y" { if (rec_dim != -1) derror("only one NC_UNLIMITED dimension allowed"); rec_dim = ndims; /* the unlimited (record) dimension */ @@ -1343,7 +1343,7 @@ yyparse (void) break; case 14: /* dimd: dim */ -#line 168 "ncgen3/ncgen.y" +#line 168 "ncgen.y" { if (yyvsp[0]->is_dim == 1) { derror( "duplicate dimension declaration for %s", @@ -1363,43 +1363,43 @@ yyparse (void) break; case 27: /* type: BYTE_K */ -#line 200 "ncgen3/ncgen.y" +#line 200 "ncgen.y" { type_code = NC_BYTE; } #line 1369 "ncgeny.c" break; case 28: /* type: CHAR_K */ -#line 201 "ncgen3/ncgen.y" +#line 201 "ncgen.y" { type_code = NC_CHAR; } #line 1375 "ncgeny.c" break; case 29: /* type: SHORT_K */ -#line 202 "ncgen3/ncgen.y" +#line 202 "ncgen.y" { type_code = NC_SHORT; } #line 1381 "ncgeny.c" break; case 30: /* type: INT_K */ -#line 203 "ncgen3/ncgen.y" +#line 203 "ncgen.y" { type_code = NC_INT; } #line 1387 "ncgeny.c" break; case 31: /* type: FLOAT_K */ -#line 204 "ncgen3/ncgen.y" +#line 204 "ncgen.y" { type_code = NC_FLOAT; } #line 1393 "ncgeny.c" break; case 32: /* type: DOUBLE_K */ -#line 205 "ncgen3/ncgen.y" +#line 205 "ncgen.y" { type_code = NC_DOUBLE; } #line 1399 "ncgeny.c" break; case 35: /* $@3: %empty */ -#line 211 "ncgen3/ncgen.y" +#line 211 "ncgen.y" { static struct vars dummyvar; @@ -1436,7 +1436,7 @@ yyparse (void) break; case 36: /* varspec: var $@3 dimspec */ -#line 244 "ncgen3/ncgen.y" +#line 244 "ncgen.y" { vars[nvars].ndims = nvdims; nvars++; @@ -1445,7 +1445,7 @@ yyparse (void) break; case 42: /* vdim: dim */ -#line 258 "ncgen3/ncgen.y" +#line 258 "ncgen.y" { if (nvdims >= NC_MAX_VAR_DIMS) { derror("%s has too many dimensions",vars[nvars].name); @@ -1469,7 +1469,7 @@ yyparse (void) break; case 43: /* $@4: %empty */ -#line 279 "ncgen3/ncgen.y" +#line 279 "ncgen.y" { defatt(); } @@ -1477,7 +1477,7 @@ yyparse (void) break; case 44: /* attdecl: att $@4 '=' attvallist */ -#line 283 "ncgen3/ncgen.y" +#line 283 "ncgen.y" { equalatt(); } @@ -1485,7 +1485,7 @@ yyparse (void) break; case 45: /* $@5: %empty */ -#line 288 "ncgen3/ncgen.y" +#line 288 "ncgen.y" { defatt(); } @@ -1493,7 +1493,7 @@ yyparse (void) break; case 46: /* gattdecl: gatt $@5 '=' attvallist */ -#line 292 "ncgen3/ncgen.y" +#line 292 "ncgen.y" { equalatt(); } @@ -1501,7 +1501,7 @@ yyparse (void) break; case 48: /* gatt: ':' attr */ -#line 300 "ncgen3/ncgen.y" +#line 300 "ncgen.y" { varnum = NC_GLOBAL; /* handle of "global" attribute */ } @@ -1509,7 +1509,7 @@ yyparse (void) break; case 49: /* avar: var */ -#line 306 "ncgen3/ncgen.y" +#line 306 "ncgen.y" { if (yyvsp[0]->is_var == 1) varnum = yyvsp[0]->vnum; else { @@ -1522,7 +1522,7 @@ yyparse (void) break; case 50: /* attr: IDENT */ -#line 316 "ncgen3/ncgen.y" +#line 316 "ncgen.y" { /* make sure atts array will hold attributes */ grow_aarray(natts, /* must hold natts+1 atts */ @@ -1536,7 +1536,7 @@ yyparse (void) break; case 53: /* aconst: attconst */ -#line 330 "ncgen3/ncgen.y" +#line 330 "ncgen.y" { if (valtype == NC_UNSPECIFIED) valtype = atype_code; @@ -1547,7 +1547,7 @@ yyparse (void) break; case 54: /* attconst: CHAR_CONST */ -#line 339 "ncgen3/ncgen.y" +#line 339 "ncgen.y" { atype_code = NC_CHAR; *char_valp++ = char_val; @@ -1557,7 +1557,7 @@ yyparse (void) break; case 55: /* attconst: TERMSTRING */ -#line 345 "ncgen3/ncgen.y" +#line 345 "ncgen.y" { atype_code = NC_CHAR; { @@ -1574,7 +1574,7 @@ yyparse (void) break; case 56: /* attconst: BYTE_CONST */ -#line 358 "ncgen3/ncgen.y" +#line 358 "ncgen.y" { atype_code = NC_BYTE; *byte_valp++ = byte_val; @@ -1584,7 +1584,7 @@ yyparse (void) break; case 57: /* attconst: SHORT_CONST */ -#line 364 "ncgen3/ncgen.y" +#line 364 "ncgen.y" { atype_code = NC_SHORT; *short_valp++ = short_val; @@ -1594,7 +1594,7 @@ yyparse (void) break; case 58: /* attconst: INT_CONST */ -#line 370 "ncgen3/ncgen.y" +#line 370 "ncgen.y" { atype_code = NC_INT; *int_valp++ = int_val; @@ -1604,7 +1604,7 @@ yyparse (void) break; case 59: /* attconst: FLOAT_CONST */ -#line 376 "ncgen3/ncgen.y" +#line 376 "ncgen.y" { atype_code = NC_FLOAT; *float_valp++ = float_val; @@ -1614,7 +1614,7 @@ yyparse (void) break; case 60: /* attconst: DOUBLE_CONST */ -#line 382 "ncgen3/ncgen.y" +#line 382 "ncgen.y" { atype_code = NC_DOUBLE; *double_valp++ = double_val; @@ -1624,7 +1624,7 @@ yyparse (void) break; case 66: /* $@6: %empty */ -#line 398 "ncgen3/ncgen.y" +#line 398 "ncgen.y" { valtype = vars[varnum].type; /* variable type */ valnum = 0; /* values accumulated for variable */ @@ -1679,7 +1679,7 @@ yyparse (void) break; case 67: /* datadecl: avar $@6 '=' constlist */ -#line 449 "ncgen3/ncgen.y" +#line 449 "ncgen.y" { if (valnum < var_len) { /* leftovers */ nc_fill(valtype, @@ -1698,7 +1698,7 @@ yyparse (void) break; case 70: /* $@7: %empty */ -#line 468 "ncgen3/ncgen.y" +#line 468 "ncgen.y" { if(valnum >= var_len) { if (vars[varnum].dims[0] != rec_dim) { /* not recvar */ @@ -1727,7 +1727,7 @@ yyparse (void) break; case 71: /* dconst: $@7 const */ -#line 493 "ncgen3/ncgen.y" +#line 493 "ncgen.y" { if (not_a_string) { switch (valtype) { @@ -1757,7 +1757,7 @@ yyparse (void) break; case 72: /* const: CHAR_CONST */ -#line 521 "ncgen3/ncgen.y" +#line 521 "ncgen.y" { atype_code = NC_CHAR; switch (valtype) { @@ -1787,7 +1787,7 @@ yyparse (void) break; case 73: /* const: TERMSTRING */ -#line 547 "ncgen3/ncgen.y" +#line 547 "ncgen.y" { not_a_string = 0; atype_code = NC_CHAR; @@ -1846,7 +1846,7 @@ yyparse (void) break; case 74: /* const: BYTE_CONST */ -#line 602 "ncgen3/ncgen.y" +#line 602 "ncgen.y" { atype_code = NC_BYTE; switch (valtype) { @@ -1876,7 +1876,7 @@ yyparse (void) break; case 75: /* const: SHORT_CONST */ -#line 628 "ncgen3/ncgen.y" +#line 628 "ncgen.y" { atype_code = NC_SHORT; switch (valtype) { @@ -1906,7 +1906,7 @@ yyparse (void) break; case 76: /* const: INT_CONST */ -#line 654 "ncgen3/ncgen.y" +#line 654 "ncgen.y" { atype_code = NC_INT; switch (valtype) { @@ -1936,7 +1936,7 @@ yyparse (void) break; case 77: /* const: FLOAT_CONST */ -#line 680 "ncgen3/ncgen.y" +#line 680 "ncgen.y" { atype_code = NC_FLOAT; switch (valtype) { @@ -1966,7 +1966,7 @@ yyparse (void) break; case 78: /* const: DOUBLE_CONST */ -#line 706 "ncgen3/ncgen.y" +#line 706 "ncgen.y" { atype_code = NC_DOUBLE; switch (valtype) { @@ -1999,7 +1999,7 @@ yyparse (void) break; case 79: /* const: FILLVALUE */ -#line 735 "ncgen3/ncgen.y" +#line 735 "ncgen.y" { /* store fill_value */ switch (valtype) { @@ -2228,7 +2228,7 @@ yyparse (void) return yyresult; } -#line 770 "ncgen3/ncgen.y" +#line 770 "ncgen.y" /* HELPER PROGRAMS */ diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 166516c2eb..5415267807 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -21,7 +21,7 @@ TEST_EXTENSIONS = .sh AM_CPPFLAGS += -I${top_srcdir} -I${top_srcdir}/libnczarr AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la -LDADD = ${top_builddir}/liblib/libnetcdf.la +LDADD += ${top_builddir}/liblib/libnetcdf.la AM_CXXFLAGS = # Set up the tests; do the .sh first, then .c check_PROGRAMS = diff --git a/nczarr_test/run_corrupt.sh b/nczarr_test/run_corrupt.sh index e9ddc67d57..eb34f02e75 100755 --- a/nczarr_test/run_corrupt.sh +++ b/nczarr_test/run_corrupt.sh @@ -32,4 +32,7 @@ testnoshape2() { } testnoshape1 -if test "x$FEATURE_S3TESTS" = xyes ; then testnoshape2; fi +if test "x$FEATURE_S3TESTS" = xyes && test "x$FEATURE_S3_INTERNAL" = xyes ; then + # The aws-sdk-cpp driver does not support google storage + testnoshape2 +fi diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in index 0b0e31f019..987b2adc4a 100644 --- a/netCDFConfig.cmake.in +++ b/netCDFConfig.cmake.in @@ -40,7 +40,6 @@ set(netCDF_HAS_DAP2 @HAS_DAP2@) set(netCDF_HAS_DAP4 @HAS_DAP4@) set(netCDF_HAS_DISKLESS @HAS_DISKLESS@) set(netCDF_HAS_MMAP @HAS_MMAP@) -set(netCDF_HAS_JNA @HAS_JNA@) if (netCDF_HAS_HDF4 OR netCDF_HAS_HDF5) include(CMakeFindDependencyMacro) find_dependency(HDF5) diff --git a/oc2/dapy.c b/oc2/dapy.c index c9883f9802..0569194036 100644 --- a/oc2/dapy.c +++ b/oc2/dapy.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -66,121 +71,203 @@ #define yydebug dapdebug #define yynerrs dapnerrs - -/* Copy the first part of user declarations. */ -#line 11 "dap.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 11 "dap.y" #include "config.h" #include "dapparselex.h" #include "dapy.h" int dapdebug = 0; -#line 79 "dapy.c" /* yacc.c:339 */ +#line 83 "dapy.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "dapy.h". */ -#ifndef YY_DAP_DAP_TAB_H_INCLUDED -# define YY_DAP_DAP_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int dapdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - SCAN_ALIAS = 258, - SCAN_ARRAY = 259, - SCAN_ATTR = 260, - SCAN_BYTE = 261, - SCAN_CODE = 262, - SCAN_DATASET = 263, - SCAN_DATA = 264, - SCAN_ERROR = 265, - SCAN_FLOAT32 = 266, - SCAN_FLOAT64 = 267, - SCAN_GRID = 268, - SCAN_INT16 = 269, - SCAN_INT32 = 270, - SCAN_MAPS = 271, - SCAN_MESSAGE = 272, - SCAN_SEQUENCE = 273, - SCAN_STRING = 274, - SCAN_STRUCTURE = 275, - SCAN_UINT16 = 276, - SCAN_UINT32 = 277, - SCAN_URL = 278, - SCAN_PTYPE = 279, - SCAN_PROG = 280, - WORD_WORD = 281, - WORD_STRING = 282 - }; -#endif +#include "dapy.h" +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_SCAN_ALIAS = 3, /* SCAN_ALIAS */ + YYSYMBOL_SCAN_ARRAY = 4, /* SCAN_ARRAY */ + YYSYMBOL_SCAN_ATTR = 5, /* SCAN_ATTR */ + YYSYMBOL_SCAN_BYTE = 6, /* SCAN_BYTE */ + YYSYMBOL_SCAN_CODE = 7, /* SCAN_CODE */ + YYSYMBOL_SCAN_DATASET = 8, /* SCAN_DATASET */ + YYSYMBOL_SCAN_DATA = 9, /* SCAN_DATA */ + YYSYMBOL_SCAN_ERROR = 10, /* SCAN_ERROR */ + YYSYMBOL_SCAN_FLOAT32 = 11, /* SCAN_FLOAT32 */ + YYSYMBOL_SCAN_FLOAT64 = 12, /* SCAN_FLOAT64 */ + YYSYMBOL_SCAN_GRID = 13, /* SCAN_GRID */ + YYSYMBOL_SCAN_INT16 = 14, /* SCAN_INT16 */ + YYSYMBOL_SCAN_INT32 = 15, /* SCAN_INT32 */ + YYSYMBOL_SCAN_MAPS = 16, /* SCAN_MAPS */ + YYSYMBOL_SCAN_MESSAGE = 17, /* SCAN_MESSAGE */ + YYSYMBOL_SCAN_SEQUENCE = 18, /* SCAN_SEQUENCE */ + YYSYMBOL_SCAN_STRING = 19, /* SCAN_STRING */ + YYSYMBOL_SCAN_STRUCTURE = 20, /* SCAN_STRUCTURE */ + YYSYMBOL_SCAN_UINT16 = 21, /* SCAN_UINT16 */ + YYSYMBOL_SCAN_UINT32 = 22, /* SCAN_UINT32 */ + YYSYMBOL_SCAN_URL = 23, /* SCAN_URL */ + YYSYMBOL_SCAN_PTYPE = 24, /* SCAN_PTYPE */ + YYSYMBOL_SCAN_PROG = 25, /* SCAN_PROG */ + YYSYMBOL_WORD_WORD = 26, /* WORD_WORD */ + YYSYMBOL_WORD_STRING = 27, /* WORD_STRING */ + YYSYMBOL_28_ = 28, /* '{' */ + YYSYMBOL_29_ = 29, /* '}' */ + YYSYMBOL_30_ = 30, /* ';' */ + YYSYMBOL_31_ = 31, /* ':' */ + YYSYMBOL_32_ = 32, /* '[' */ + YYSYMBOL_33_ = 33, /* ']' */ + YYSYMBOL_34_ = 34, /* '=' */ + YYSYMBOL_35_ = 35, /* ',' */ + YYSYMBOL_YYACCEPT = 36, /* $accept */ + YYSYMBOL_start = 37, /* start */ + YYSYMBOL_dataset = 38, /* dataset */ + YYSYMBOL_attr = 39, /* attr */ + YYSYMBOL_err = 40, /* err */ + YYSYMBOL_datasetbody = 41, /* datasetbody */ + YYSYMBOL_declarations = 42, /* declarations */ + YYSYMBOL_declaration = 43, /* declaration */ + YYSYMBOL_base_type = 44, /* base_type */ + YYSYMBOL_array_decls = 45, /* array_decls */ + YYSYMBOL_array_decl = 46, /* array_decl */ + YYSYMBOL_datasetname = 47, /* datasetname */ + YYSYMBOL_var_name = 48, /* var_name */ + YYSYMBOL_attributebody = 49, /* attributebody */ + YYSYMBOL_attr_list = 50, /* attr_list */ + YYSYMBOL_attribute = 51, /* attribute */ + YYSYMBOL_bytes = 52, /* bytes */ + YYSYMBOL_int16 = 53, /* int16 */ + YYSYMBOL_uint16 = 54, /* uint16 */ + YYSYMBOL_int32 = 55, /* int32 */ + YYSYMBOL_uint32 = 56, /* uint32 */ + YYSYMBOL_float32 = 57, /* float32 */ + YYSYMBOL_float64 = 58, /* float64 */ + YYSYMBOL_strs = 59, /* strs */ + YYSYMBOL_urls = 60, /* urls */ + YYSYMBOL_url = 61, /* url */ + YYSYMBOL_str_or_id = 62, /* str_or_id */ + YYSYMBOL_alias = 63, /* alias */ + YYSYMBOL_errorbody = 64, /* errorbody */ + YYSYMBOL_errorcode = 65, /* errorcode */ + YYSYMBOL_errormsg = 66, /* errormsg */ + YYSYMBOL_errorptype = 67, /* errorptype */ + YYSYMBOL_errorprog = 68, /* errorprog */ + YYSYMBOL_name = 69 /* name */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif -int dapparse (DAPparsestate* parsestate); +#ifdef short +# undef short +#endif -#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */ +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ -/* Copy the second part of user declarations. */ +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif -#line 157 "dapy.c" /* yacc.c:358 */ +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ -#ifdef short -# undef short +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned char yytype_uint8; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_uint8; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; #else -typedef short int yytype_int16; +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -188,15 +275,28 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -210,47 +310,43 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif #ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #endif #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -263,8 +359,22 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) -#if ! defined yyoverflow || YYERROR_VERBOSE +#if 1 /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -329,8 +439,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* 1 */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -339,17 +448,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -362,11 +471,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -378,12 +487,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -406,17 +515,20 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 201 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 +/* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 282 -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -450,8 +562,8 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = { 0, 54, 54, 55, 56, 57, 58, 62, 66, 70, 75, 81, 82, 88, 90, 92, 94, 97, 103, 104, @@ -467,50 +579,52 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if 1 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "SCAN_ALIAS", "SCAN_ARRAY", "SCAN_ATTR", - "SCAN_BYTE", "SCAN_CODE", "SCAN_DATASET", "SCAN_DATA", "SCAN_ERROR", - "SCAN_FLOAT32", "SCAN_FLOAT64", "SCAN_GRID", "SCAN_INT16", "SCAN_INT32", - "SCAN_MAPS", "SCAN_MESSAGE", "SCAN_SEQUENCE", "SCAN_STRING", - "SCAN_STRUCTURE", "SCAN_UINT16", "SCAN_UINT32", "SCAN_URL", "SCAN_PTYPE", - "SCAN_PROG", "WORD_WORD", "WORD_STRING", "'{'", "'}'", "';'", "':'", - "'['", "']'", "'='", "','", "$accept", "start", "dataset", "attr", "err", - "datasetbody", "declarations", "declaration", "base_type", "array_decls", - "array_decl", "datasetname", "var_name", "attributebody", "attr_list", - "attribute", "bytes", "int16", "uint16", "int32", "uint32", "float32", - "float64", "strs", "urls", "url", "str_or_id", "alias", "errorbody", - "errorcode", "errormsg", "errorptype", "errorprog", "name", YY_NULLPTR + "\"end of file\"", "error", "\"invalid token\"", "SCAN_ALIAS", + "SCAN_ARRAY", "SCAN_ATTR", "SCAN_BYTE", "SCAN_CODE", "SCAN_DATASET", + "SCAN_DATA", "SCAN_ERROR", "SCAN_FLOAT32", "SCAN_FLOAT64", "SCAN_GRID", + "SCAN_INT16", "SCAN_INT32", "SCAN_MAPS", "SCAN_MESSAGE", "SCAN_SEQUENCE", + "SCAN_STRING", "SCAN_STRUCTURE", "SCAN_UINT16", "SCAN_UINT32", + "SCAN_URL", "SCAN_PTYPE", "SCAN_PROG", "WORD_WORD", "WORD_STRING", "'{'", + "'}'", "';'", "':'", "'['", "']'", "'='", "','", "$accept", "start", + "dataset", "attr", "err", "datasetbody", "declarations", "declaration", + "base_type", "array_decls", "array_decl", "datasetname", "var_name", + "attributebody", "attr_list", "attribute", "bytes", "int16", "uint16", + "int32", "uint32", "float32", "float64", "strs", "urls", "url", + "str_or_id", "alias", "errorbody", "errorcode", "errormsg", "errorptype", + "errorprog", "name", YY_NULLPTR }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 123, 125, - 59, 58, 91, 93, 61, 44 -}; -# endif + return yytname[yysymbol]; +} +#endif -#define YYPACT_NINF -91 +#define YYPACT_NINF (-91) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-91))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -1 +#define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 6, -91, -91, -91, -91, 9, -22, 7, -16, -91, @@ -536,10 +650,10 @@ static const yytype_int16 yypact[] = -91 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = { 0, 6, 8, 7, 9, 0, 0, 0, 0, 1, 11, 2, 37, 38, 4, 75, 5, 0, 3, 0, @@ -564,7 +678,7 @@ static const yytype_uint8 yydefact[] = 16 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -91, -91, -91, -91, -91, -91, -69, -15, -91, -17, @@ -573,18 +687,18 @@ static const yytype_int8 yypgoto[] = -91, -91, -91, -18 }; - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_uint8 yydefgoto[] = { - -1, 5, 6, 7, 8, 11, 17, 36, 37, 108, + 0, 5, 6, 7, 8, 11, 17, 36, 37, 108, 143, 84, 85, 14, 19, 64, 111, 117, 125, 119, 127, 113, 115, 121, 128, 129, 130, 65, 16, 21, 69, 103, 136, 86 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 87, 66, 105, 106, 122, 140, 10, 1, 12, 9, @@ -667,9 +781,9 @@ static const yytype_int16 yycheck[] = 14, 15, -1, -1, 18, 19, 20, 21, 22, 23 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = { 0, 1, 5, 8, 10, 37, 38, 39, 40, 0, 28, 41, 1, 28, 49, 28, 64, 42, 9, 50, @@ -694,8 +808,8 @@ static const yytype_uint8 yystos[] = 30 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = { 0, 36, 37, 37, 37, 37, 37, 38, 39, 40, 41, 42, 42, 43, 43, 43, 43, 43, 44, 44, @@ -710,8 +824,8 @@ static const yytype_uint8 yyr1[] = 69, 69, 69, 69, 69, 69, 69 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = { 0, 2, 2, 3, 2, 2, 1, 1, 1, 1, 5, 0, 2, 4, 7, 6, 11, 1, 1, 1, @@ -727,39 +841,39 @@ static const yytype_uint8 yyr2[] = }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (parsestate, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (parsestate, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -776,56 +890,53 @@ do { \ YYFPRINTF Args; \ } while (0) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value, parsestate); \ + Kind, Value, parsestate); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) { - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (parsestate); + FILE *yyoutput = yyo; + YY_USE (yyoutput); + YY_USE (parsestate); if (!yyvaluep) return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, DAPparsestate* parsestate) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, parsestate); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep, parsestate); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -834,7 +945,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, DAP `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -857,21 +968,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, DAPparsestate* parsestate) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule, DAPparsestate* parsestate) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , parsestate); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], parsestate); YYFPRINTF (stderr, "\n"); } } @@ -886,8 +997,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -910,28 +1021,76 @@ int yydebug; #endif -#if YYERROR_VERBOSE +/* Context of a parse error. */ +typedef struct +{ + yy_state_t *yyssp; + yysymbol_kind_t yytoken; +} yypcontext_t; + +/* Put in YYARG at most YYARGN of the expected tokens given the + current YYCTX, and return the number of tokens stored in YYARG. If + YYARG is null, return the number of expected tokens (guaranteed to + be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. + Return 0 if there are more than YYARGN expected tokens, yet fill + YYARG up to YYARGN. */ +static int +yypcontext_expected_tokens (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) +{ + /* Actual size of YYARG. */ + int yycount = 0; + int yyn = yypact[+*yyctx->yyssp]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); + } + } + if (yyarg && yycount == 0 && 0 < yyargn) + yyarg[0] = YYSYMBOL_YYEMPTY; + return yycount; +} -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else + + + +#ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } -# endif # endif +#endif -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else +#ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * @@ -945,10 +1104,10 @@ yystpcpy (char *yydest, const char *yysrc) return yyd - 1; } -# endif # endif +#endif -# ifndef yytnamerr +#ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string @@ -956,14 +1115,13 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; - for (;;) switch (*++yyp) { @@ -974,7 +1132,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -989,36 +1150,20 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } -# endif +#endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yy_syntax_error_arguments (const yypcontext_t *yyctx, + yysymbol_kind_t yyarg[], int yyargn) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; - /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action @@ -1042,63 +1187,78 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ - if (yytoken != YYEMPTY) + if (yyctx->yytoken != YYSYMBOL_YYEMPTY) { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } + int yyn; + if (yyarg) + yyarg[yycount] = yyctx->yytoken; + ++yycount; + yyn = yypcontext_expected_tokens (yyctx, + yyarg ? yyarg + 1 : yyarg, yyargn - 1); + if (yyn == YYENOMEM) + return YYENOMEM; + else + yycount += yyn; } + return yycount; +} + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + const yypcontext_t *yyctx) +{ + enum { YYARGS_MAX = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + yysymbol_kind_t yyarg[YYARGS_MAX]; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* Actual size of YYARG. */ + int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); + if (yycount == YYENOMEM) + return YYENOMEM; switch (yycount) { -# define YYCASE_(N, S) \ +#define YYCASE_(N, S) \ case N: \ yyformat = S; \ - break + break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ +#undef YYCASE_ } + /* Compute error message size. Don't count the "%s"s, but reserve + room for the terminator. */ + yysize = yystrlen (yyformat) - 2 * yycount + 1; { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + int yyi; + for (yyi = 0; yyi < yycount; ++yyi) + { + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return YYENOMEM; + } } if (*yymsg_alloc < yysize) @@ -1107,10 +1267,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; + return -1; } - /* Avoid snprintf, as that infringes on the user's name space. + /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { @@ -1119,40 +1279,43 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { - yyp += yytnamerr (yyp, yyarg[yyi++]); + yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); yyformat += 2; } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; } -#endif /* YYERROR_VERBOSE */ + /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DAPparsestate* parsestate) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep, DAPparsestate* parsestate) { - YYUSE (yyvaluep); - YYUSE (parsestate); + YY_USE (yyvaluep); + YY_USE (parsestate); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } + + /*----------. | yyparse. | `----------*/ @@ -1160,7 +1323,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, DAPparsestate* par int yyparse (DAPparsestate* parsestate) { -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; @@ -1171,45 +1334,41 @@ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ - int yynerrs; + int yynerrs = 0; - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - YYSIZE_T yystacksize; + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1217,71 +1376,75 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE @@ -1289,30 +1452,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1323,18 +1487,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, parsestate); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1362,15 +1537,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1385,7 +1558,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1405,614 +1578,615 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YY_REDUCE_PRINT (yyn); switch (yyn) { - case 6: -#line 58 "dap.y" /* yacc.c:1646 */ - {dap_unrecognizedresponse(parsestate); YYABORT;} -#line 1412 "dapy.c" /* yacc.c:1646 */ + case 6: /* start: error */ +#line 58 "dap.y" + {dap_unrecognizedresponse(parsestate); YYABORT;} +#line 1585 "dapy.c" break; - case 7: -#line 63 "dap.y" /* yacc.c:1646 */ - {dap_tagparse(parsestate,SCAN_DATASET);} -#line 1418 "dapy.c" /* yacc.c:1646 */ + case 7: /* dataset: SCAN_DATASET */ +#line 63 "dap.y" + {dap_tagparse(parsestate,SCAN_DATASET);} +#line 1591 "dapy.c" break; - case 8: -#line 67 "dap.y" /* yacc.c:1646 */ - {dap_tagparse(parsestate,SCAN_ATTR);} -#line 1424 "dapy.c" /* yacc.c:1646 */ + case 8: /* attr: SCAN_ATTR */ +#line 67 "dap.y" + {dap_tagparse(parsestate,SCAN_ATTR);} +#line 1597 "dapy.c" break; - case 9: -#line 71 "dap.y" /* yacc.c:1646 */ - {dap_tagparse(parsestate,SCAN_ERROR);} -#line 1430 "dapy.c" /* yacc.c:1646 */ + case 9: /* err: SCAN_ERROR */ +#line 71 "dap.y" + {dap_tagparse(parsestate,SCAN_ERROR);} +#line 1603 "dapy.c" break; - case 10: -#line 76 "dap.y" /* yacc.c:1646 */ - {dap_datasetbody(parsestate,(yyvsp[-1]),(yyvsp[-3]));} -#line 1436 "dapy.c" /* yacc.c:1646 */ + case 10: /* datasetbody: '{' declarations '}' datasetname ';' */ +#line 76 "dap.y" + {dap_datasetbody(parsestate,yyvsp[-1],yyvsp[-3]);} +#line 1609 "dapy.c" break; - case 11: -#line 81 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_declarations(parsestate,null,null);} -#line 1442 "dapy.c" /* yacc.c:1646 */ + case 11: /* declarations: %empty */ +#line 81 "dap.y" + {yyval=dap_declarations(parsestate,null,null);} +#line 1615 "dapy.c" break; - case 12: -#line 82 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_declarations(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1448 "dapy.c" /* yacc.c:1646 */ + case 12: /* declarations: declarations declaration */ +#line 82 "dap.y" + {yyval=dap_declarations(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1621 "dapy.c" break; - case 13: -#line 89 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_makebase(parsestate,(yyvsp[-2]),(yyvsp[-3]),(yyvsp[-1]));} -#line 1454 "dapy.c" /* yacc.c:1646 */ + case 13: /* declaration: base_type var_name array_decls ';' */ +#line 89 "dap.y" + {yyval=dap_makebase(parsestate,yyvsp[-2],yyvsp[-3],yyvsp[-1]);} +#line 1627 "dapy.c" break; - case 14: -#line 91 "dap.y" /* yacc.c:1646 */ - {if(((yyval)=dap_makestructure(parsestate,(yyvsp[-2]),(yyvsp[-1]),(yyvsp[-4])))==null) {YYABORT;}} -#line 1460 "dapy.c" /* yacc.c:1646 */ + case 14: /* declaration: SCAN_STRUCTURE '{' declarations '}' var_name array_decls ';' */ +#line 91 "dap.y" + {if((yyval=dap_makestructure(parsestate,yyvsp[-2],yyvsp[-1],yyvsp[-4]))==null) {YYABORT;}} +#line 1633 "dapy.c" break; - case 15: -#line 93 "dap.y" /* yacc.c:1646 */ - {if(((yyval)=dap_makesequence(parsestate,(yyvsp[-1]),(yyvsp[-3])))==null) {YYABORT;}} -#line 1466 "dapy.c" /* yacc.c:1646 */ + case 15: /* declaration: SCAN_SEQUENCE '{' declarations '}' var_name ';' */ +#line 93 "dap.y" + {if((yyval=dap_makesequence(parsestate,yyvsp[-1],yyvsp[-3]))==null) {YYABORT;}} +#line 1639 "dapy.c" break; - case 16: -#line 96 "dap.y" /* yacc.c:1646 */ - {if(((yyval)=dap_makegrid(parsestate,(yyvsp[-1]),(yyvsp[-6]),(yyvsp[-3])))==null) {YYABORT;}} -#line 1472 "dapy.c" /* yacc.c:1646 */ + case 16: /* declaration: SCAN_GRID '{' SCAN_ARRAY ':' declaration SCAN_MAPS ':' declarations '}' var_name ';' */ +#line 96 "dap.y" + {if((yyval=dap_makegrid(parsestate,yyvsp[-1],yyvsp[-6],yyvsp[-3]))==null) {YYABORT;}} +#line 1645 "dapy.c" break; - case 17: -#line 98 "dap.y" /* yacc.c:1646 */ - {dapsemanticerror(parsestate,OC_EBADTYPE,"Unrecognized type"); YYABORT;} -#line 1478 "dapy.c" /* yacc.c:1646 */ + case 17: /* declaration: error */ +#line 98 "dap.y" + {dapsemanticerror(parsestate,OC_EBADTYPE,"Unrecognized type"); YYABORT;} +#line 1651 "dapy.c" break; - case 18: -#line 103 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_BYTE;} -#line 1484 "dapy.c" /* yacc.c:1646 */ + case 18: /* base_type: SCAN_BYTE */ +#line 103 "dap.y" + {yyval=(Object)SCAN_BYTE;} +#line 1657 "dapy.c" break; - case 19: -#line 104 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_INT16;} -#line 1490 "dapy.c" /* yacc.c:1646 */ + case 19: /* base_type: SCAN_INT16 */ +#line 104 "dap.y" + {yyval=(Object)SCAN_INT16;} +#line 1663 "dapy.c" break; - case 20: -#line 105 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_UINT16;} -#line 1496 "dapy.c" /* yacc.c:1646 */ + case 20: /* base_type: SCAN_UINT16 */ +#line 105 "dap.y" + {yyval=(Object)SCAN_UINT16;} +#line 1669 "dapy.c" break; - case 21: -#line 106 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_INT32;} -#line 1502 "dapy.c" /* yacc.c:1646 */ + case 21: /* base_type: SCAN_INT32 */ +#line 106 "dap.y" + {yyval=(Object)SCAN_INT32;} +#line 1675 "dapy.c" break; - case 22: -#line 107 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_UINT32;} -#line 1508 "dapy.c" /* yacc.c:1646 */ + case 22: /* base_type: SCAN_UINT32 */ +#line 107 "dap.y" + {yyval=(Object)SCAN_UINT32;} +#line 1681 "dapy.c" break; - case 23: -#line 108 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_FLOAT32;} -#line 1514 "dapy.c" /* yacc.c:1646 */ + case 23: /* base_type: SCAN_FLOAT32 */ +#line 108 "dap.y" + {yyval=(Object)SCAN_FLOAT32;} +#line 1687 "dapy.c" break; - case 24: -#line 109 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_FLOAT64;} -#line 1520 "dapy.c" /* yacc.c:1646 */ + case 24: /* base_type: SCAN_FLOAT64 */ +#line 109 "dap.y" + {yyval=(Object)SCAN_FLOAT64;} +#line 1693 "dapy.c" break; - case 25: -#line 110 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_URL;} -#line 1526 "dapy.c" /* yacc.c:1646 */ + case 25: /* base_type: SCAN_URL */ +#line 110 "dap.y" + {yyval=(Object)SCAN_URL;} +#line 1699 "dapy.c" break; - case 26: -#line 111 "dap.y" /* yacc.c:1646 */ - {(yyval)=(Object)SCAN_STRING;} -#line 1532 "dapy.c" /* yacc.c:1646 */ + case 26: /* base_type: SCAN_STRING */ +#line 111 "dap.y" + {yyval=(Object)SCAN_STRING;} +#line 1705 "dapy.c" break; - case 27: -#line 115 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_arraydecls(parsestate,null,null);} -#line 1538 "dapy.c" /* yacc.c:1646 */ + case 27: /* array_decls: %empty */ +#line 115 "dap.y" + {yyval=dap_arraydecls(parsestate,null,null);} +#line 1711 "dapy.c" break; - case 28: -#line 116 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_arraydecls(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1544 "dapy.c" /* yacc.c:1646 */ + case 28: /* array_decls: array_decls array_decl */ +#line 116 "dap.y" + {yyval=dap_arraydecls(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1717 "dapy.c" break; - case 29: -#line 120 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} -#line 1550 "dapy.c" /* yacc.c:1646 */ + case 29: /* array_decl: '[' WORD_WORD ']' */ +#line 120 "dap.y" + {yyval=dap_arraydecl(parsestate,null,yyvsp[-1]);} +#line 1723 "dapy.c" break; - case 30: -#line 121 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} -#line 1556 "dapy.c" /* yacc.c:1646 */ + case 30: /* array_decl: '[' '=' WORD_WORD ']' */ +#line 121 "dap.y" + {yyval=dap_arraydecl(parsestate,null,yyvsp[-1]);} +#line 1729 "dapy.c" break; - case 31: -#line 122 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_arraydecl(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1562 "dapy.c" /* yacc.c:1646 */ + case 31: /* array_decl: '[' name '=' WORD_WORD ']' */ +#line 122 "dap.y" + {yyval=dap_arraydecl(parsestate,yyvsp[-3],yyvsp[-1]);} +#line 1735 "dapy.c" break; - case 32: -#line 124 "dap.y" /* yacc.c:1646 */ - {dapsemanticerror(parsestate,OC_EDIMSIZE,"Illegal dimension declaration"); YYABORT;} -#line 1568 "dapy.c" /* yacc.c:1646 */ + case 32: /* array_decl: error */ +#line 124 "dap.y" + {dapsemanticerror(parsestate,OC_EDIMSIZE,"Illegal dimension declaration"); YYABORT;} +#line 1741 "dapy.c" break; - case 33: -#line 128 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[0]);} -#line 1574 "dapy.c" /* yacc.c:1646 */ + case 33: /* datasetname: var_name */ +#line 128 "dap.y" + {yyval=yyvsp[0];} +#line 1747 "dapy.c" break; - case 34: -#line 130 "dap.y" /* yacc.c:1646 */ - {dapsemanticerror(parsestate,OC_EDDS,"Illegal dataset declaration"); YYABORT;} -#line 1580 "dapy.c" /* yacc.c:1646 */ + case 34: /* datasetname: error */ +#line 130 "dap.y" + {dapsemanticerror(parsestate,OC_EDDS,"Illegal dataset declaration"); YYABORT;} +#line 1753 "dapy.c" break; - case 35: -#line 133 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[0]);} -#line 1586 "dapy.c" /* yacc.c:1646 */ + case 35: /* var_name: name */ +#line 133 "dap.y" + {yyval=yyvsp[0];} +#line 1759 "dapy.c" break; - case 36: -#line 136 "dap.y" /* yacc.c:1646 */ - {dap_attributebody(parsestate,(yyvsp[-1]));} -#line 1592 "dapy.c" /* yacc.c:1646 */ + case 36: /* attributebody: '{' attr_list '}' */ +#line 136 "dap.y" + {dap_attributebody(parsestate,yyvsp[-1]);} +#line 1765 "dapy.c" break; - case 37: -#line 138 "dap.y" /* yacc.c:1646 */ - {dapsemanticerror(parsestate,OC_EDAS,"Illegal DAS body"); YYABORT;} -#line 1598 "dapy.c" /* yacc.c:1646 */ + case 37: /* attributebody: error */ +#line 138 "dap.y" + {dapsemanticerror(parsestate,OC_EDAS,"Illegal DAS body"); YYABORT;} +#line 1771 "dapy.c" break; - case 38: -#line 142 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrlist(parsestate,null,null);} -#line 1604 "dapy.c" /* yacc.c:1646 */ + case 38: /* attr_list: %empty */ +#line 142 "dap.y" + {yyval=dap_attrlist(parsestate,null,null);} +#line 1777 "dapy.c" break; - case 39: -#line 143 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrlist(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1610 "dapy.c" /* yacc.c:1646 */ + case 39: /* attr_list: attr_list attribute */ +#line 143 "dap.y" + {yyval=dap_attrlist(parsestate,yyvsp[-1],yyvsp[0]);} +#line 1783 "dapy.c" break; - case 40: -#line 147 "dap.y" /* yacc.c:1646 */ - {(yyval)=null;} -#line 1616 "dapy.c" /* yacc.c:1646 */ + case 40: /* attribute: alias ';' */ +#line 147 "dap.y" + {yyval=null;} +#line 1789 "dapy.c" break; - case 41: -#line 149 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_BYTE);} -#line 1622 "dapy.c" /* yacc.c:1646 */ + case 41: /* attribute: SCAN_BYTE name bytes ';' */ +#line 149 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_BYTE);} +#line 1795 "dapy.c" break; - case 42: -#line 151 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT16);} -#line 1628 "dapy.c" /* yacc.c:1646 */ + case 42: /* attribute: SCAN_INT16 name int16 ';' */ +#line 151 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_INT16);} +#line 1801 "dapy.c" break; - case 43: -#line 153 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT16);} -#line 1634 "dapy.c" /* yacc.c:1646 */ + case 43: /* attribute: SCAN_UINT16 name uint16 ';' */ +#line 153 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_UINT16);} +#line 1807 "dapy.c" break; - case 44: -#line 155 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT32);} -#line 1640 "dapy.c" /* yacc.c:1646 */ + case 44: /* attribute: SCAN_INT32 name int32 ';' */ +#line 155 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_INT32);} +#line 1813 "dapy.c" break; - case 45: -#line 157 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT32);} -#line 1646 "dapy.c" /* yacc.c:1646 */ + case 45: /* attribute: SCAN_UINT32 name uint32 ';' */ +#line 157 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_UINT32);} +#line 1819 "dapy.c" break; - case 46: -#line 159 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT32);} -#line 1652 "dapy.c" /* yacc.c:1646 */ + case 46: /* attribute: SCAN_FLOAT32 name float32 ';' */ +#line 159 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_FLOAT32);} +#line 1825 "dapy.c" break; - case 47: -#line 161 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT64);} -#line 1658 "dapy.c" /* yacc.c:1646 */ + case 47: /* attribute: SCAN_FLOAT64 name float64 ';' */ +#line 161 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_FLOAT64);} +#line 1831 "dapy.c" break; - case 48: -#line 163 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_STRING);} -#line 1664 "dapy.c" /* yacc.c:1646 */ + case 48: /* attribute: SCAN_STRING name strs ';' */ +#line 163 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_STRING);} +#line 1837 "dapy.c" break; - case 49: -#line 165 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_URL);} -#line 1670 "dapy.c" /* yacc.c:1646 */ + case 49: /* attribute: SCAN_URL name urls ';' */ +#line 165 "dap.y" + {yyval=dap_attribute(parsestate,yyvsp[-2],yyvsp[-1],(Object)SCAN_URL);} +#line 1843 "dapy.c" break; - case 50: -#line 166 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrset(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1676 "dapy.c" /* yacc.c:1646 */ + case 50: /* attribute: name '{' attr_list '}' */ +#line 166 "dap.y" + {yyval=dap_attrset(parsestate,yyvsp[-3],yyvsp[-1]);} +#line 1849 "dapy.c" break; - case 51: -#line 168 "dap.y" /* yacc.c:1646 */ - {dapsemanticerror(parsestate,OC_EDAS,"Illegal attribute"); YYABORT;} -#line 1682 "dapy.c" /* yacc.c:1646 */ + case 51: /* attribute: error */ +#line 168 "dap.y" + {dapsemanticerror(parsestate,OC_EDAS,"Illegal attribute"); YYABORT;} +#line 1855 "dapy.c" break; - case 52: -#line 172 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_BYTE);} -#line 1688 "dapy.c" /* yacc.c:1646 */ + case 52: /* bytes: WORD_WORD */ +#line 172 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_BYTE);} +#line 1861 "dapy.c" break; - case 53: -#line 174 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_BYTE);} -#line 1694 "dapy.c" /* yacc.c:1646 */ + case 53: /* bytes: bytes ',' WORD_WORD */ +#line 174 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_BYTE);} +#line 1867 "dapy.c" break; - case 54: -#line 177 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT16);} -#line 1700 "dapy.c" /* yacc.c:1646 */ + case 54: /* int16: WORD_WORD */ +#line 177 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_INT16);} +#line 1873 "dapy.c" break; - case 55: -#line 179 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT16);} -#line 1706 "dapy.c" /* yacc.c:1646 */ + case 55: /* int16: int16 ',' WORD_WORD */ +#line 179 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_INT16);} +#line 1879 "dapy.c" break; - case 56: -#line 182 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT16);} -#line 1712 "dapy.c" /* yacc.c:1646 */ + case 56: /* uint16: WORD_WORD */ +#line 182 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_UINT16);} +#line 1885 "dapy.c" break; - case 57: -#line 184 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT16);} -#line 1718 "dapy.c" /* yacc.c:1646 */ + case 57: /* uint16: uint16 ',' WORD_WORD */ +#line 184 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_UINT16);} +#line 1891 "dapy.c" break; - case 58: -#line 187 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT32);} -#line 1724 "dapy.c" /* yacc.c:1646 */ + case 58: /* int32: WORD_WORD */ +#line 187 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_INT32);} +#line 1897 "dapy.c" break; - case 59: -#line 189 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT32);} -#line 1730 "dapy.c" /* yacc.c:1646 */ + case 59: /* int32: int32 ',' WORD_WORD */ +#line 189 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_INT32);} +#line 1903 "dapy.c" break; - case 60: -#line 192 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT32);} -#line 1736 "dapy.c" /* yacc.c:1646 */ + case 60: /* uint32: WORD_WORD */ +#line 192 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_UINT32);} +#line 1909 "dapy.c" break; - case 61: -#line 193 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT32);} -#line 1742 "dapy.c" /* yacc.c:1646 */ + case 61: /* uint32: uint32 ',' WORD_WORD */ +#line 193 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_UINT32);} +#line 1915 "dapy.c" break; - case 62: -#line 196 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT32);} -#line 1748 "dapy.c" /* yacc.c:1646 */ + case 62: /* float32: WORD_WORD */ +#line 196 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_FLOAT32);} +#line 1921 "dapy.c" break; - case 63: -#line 197 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT32);} -#line 1754 "dapy.c" /* yacc.c:1646 */ + case 63: /* float32: float32 ',' WORD_WORD */ +#line 197 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_FLOAT32);} +#line 1927 "dapy.c" break; - case 64: -#line 200 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT64);} -#line 1760 "dapy.c" /* yacc.c:1646 */ + case 64: /* float64: WORD_WORD */ +#line 200 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_FLOAT64);} +#line 1933 "dapy.c" break; - case 65: -#line 201 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT64);} -#line 1766 "dapy.c" /* yacc.c:1646 */ + case 65: /* float64: float64 ',' WORD_WORD */ +#line 201 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_FLOAT64);} +#line 1939 "dapy.c" break; - case 66: -#line 204 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_STRING);} -#line 1772 "dapy.c" /* yacc.c:1646 */ + case 66: /* strs: str_or_id */ +#line 204 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_STRING);} +#line 1945 "dapy.c" break; - case 67: -#line 205 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_STRING);} -#line 1778 "dapy.c" /* yacc.c:1646 */ + case 67: /* strs: strs ',' str_or_id */ +#line 205 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_STRING);} +#line 1951 "dapy.c" break; - case 68: -#line 209 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_URL);} -#line 1784 "dapy.c" /* yacc.c:1646 */ + case 68: /* urls: url */ +#line 209 "dap.y" + {yyval=dap_attrvalue(parsestate,null,yyvsp[0],(Object)SCAN_URL);} +#line 1957 "dapy.c" break; - case 69: -#line 210 "dap.y" /* yacc.c:1646 */ - {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_URL);} -#line 1790 "dapy.c" /* yacc.c:1646 */ + case 69: /* urls: urls ',' url */ +#line 210 "dap.y" + {yyval=dap_attrvalue(parsestate,yyvsp[-2],yyvsp[0],(Object)SCAN_URL);} +#line 1963 "dapy.c" break; - case 70: -#line 214 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[0]);} -#line 1796 "dapy.c" /* yacc.c:1646 */ + case 70: /* url: str_or_id */ +#line 214 "dap.y" + {yyval=yyvsp[0];} +#line 1969 "dapy.c" break; - case 71: -#line 218 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[0]);} -#line 1802 "dapy.c" /* yacc.c:1646 */ + case 71: /* str_or_id: name */ +#line 218 "dap.y" + {yyval=yyvsp[0];} +#line 1975 "dapy.c" break; - case 72: -#line 219 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[0]);} -#line 1808 "dapy.c" /* yacc.c:1646 */ + case 72: /* str_or_id: WORD_STRING */ +#line 219 "dap.y" + {yyval=yyvsp[0];} +#line 1981 "dapy.c" break; - case 73: -#line 230 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]); (yyval)=(yyvsp[0]); (yyval)=null;} -#line 1814 "dapy.c" /* yacc.c:1646 */ + case 73: /* alias: SCAN_ALIAS WORD_WORD WORD_WORD */ +#line 230 "dap.y" + {yyval=yyvsp[-1]; yyval=yyvsp[0]; yyval=null;} +#line 1987 "dapy.c" break; - case 74: -#line 235 "dap.y" /* yacc.c:1646 */ - {dap_errorbody(parsestate,(yyvsp[-5]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-2]));} -#line 1820 "dapy.c" /* yacc.c:1646 */ + case 74: /* errorbody: '{' errorcode errormsg errorptype errorprog '}' ';' */ +#line 235 "dap.y" + {dap_errorbody(parsestate,yyvsp[-5],yyvsp[-4],yyvsp[-3],yyvsp[-2]);} +#line 1993 "dapy.c" break; - case 75: -#line 238 "dap.y" /* yacc.c:1646 */ - {(yyval)=null;} -#line 1826 "dapy.c" /* yacc.c:1646 */ + case 75: /* errorcode: %empty */ +#line 238 "dap.y" + {yyval=null;} +#line 1999 "dapy.c" break; - case 76: -#line 238 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]);} -#line 1832 "dapy.c" /* yacc.c:1646 */ + case 76: /* errorcode: SCAN_CODE '=' WORD_WORD ';' */ +#line 238 "dap.y" + {yyval=yyvsp[-1];} +#line 2005 "dapy.c" break; - case 77: -#line 239 "dap.y" /* yacc.c:1646 */ - {(yyval)=null;} -#line 1838 "dapy.c" /* yacc.c:1646 */ + case 77: /* errormsg: %empty */ +#line 239 "dap.y" + {yyval=null;} +#line 2011 "dapy.c" break; - case 78: -#line 239 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]);} -#line 1844 "dapy.c" /* yacc.c:1646 */ + case 78: /* errormsg: SCAN_MESSAGE '=' WORD_STRING ';' */ +#line 239 "dap.y" + {yyval=yyvsp[-1];} +#line 2017 "dapy.c" break; - case 79: -#line 240 "dap.y" /* yacc.c:1646 */ - {(yyval)=null;} -#line 1850 "dapy.c" /* yacc.c:1646 */ + case 79: /* errorptype: %empty */ +#line 240 "dap.y" + {yyval=null;} +#line 2023 "dapy.c" break; - case 80: -#line 240 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]);} -#line 1856 "dapy.c" /* yacc.c:1646 */ + case 80: /* errorptype: SCAN_PTYPE '=' WORD_WORD ';' */ +#line 240 "dap.y" + {yyval=yyvsp[-1];} +#line 2029 "dapy.c" break; - case 81: -#line 241 "dap.y" /* yacc.c:1646 */ - {(yyval)=null;} -#line 1862 "dapy.c" /* yacc.c:1646 */ + case 81: /* errorprog: %empty */ +#line 241 "dap.y" + {yyval=null;} +#line 2035 "dapy.c" break; - case 82: -#line 241 "dap.y" /* yacc.c:1646 */ - {(yyval)=(yyvsp[-1]);} -#line 1868 "dapy.c" /* yacc.c:1646 */ + case 82: /* errorprog: SCAN_PROG '=' WORD_WORD ';' */ +#line 241 "dap.y" + {yyval=yyvsp[-1];} +#line 2041 "dapy.c" break; - case 83: -#line 247 "dap.y" /* yacc.c:1646 */ - {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[0]));} -#line 1874 "dapy.c" /* yacc.c:1646 */ + case 83: /* name: WORD_WORD */ +#line 247 "dap.y" + {yyval=dapdecode(parsestate->lexstate,yyvsp[0]);} +#line 2047 "dapy.c" break; - case 84: -#line 248 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1880 "dapy.c" /* yacc.c:1646 */ + case 84: /* name: SCAN_ALIAS */ +#line 248 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2053 "dapy.c" break; - case 85: -#line 249 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1886 "dapy.c" /* yacc.c:1646 */ + case 85: /* name: SCAN_ARRAY */ +#line 249 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2059 "dapy.c" break; - case 86: -#line 250 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1892 "dapy.c" /* yacc.c:1646 */ + case 86: /* name: SCAN_ATTR */ +#line 250 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2065 "dapy.c" break; - case 87: -#line 251 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1898 "dapy.c" /* yacc.c:1646 */ + case 87: /* name: SCAN_BYTE */ +#line 251 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2071 "dapy.c" break; - case 88: -#line 252 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1904 "dapy.c" /* yacc.c:1646 */ + case 88: /* name: SCAN_DATASET */ +#line 252 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2077 "dapy.c" break; - case 89: -#line 253 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1910 "dapy.c" /* yacc.c:1646 */ + case 89: /* name: SCAN_DATA */ +#line 253 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2083 "dapy.c" break; - case 90: -#line 254 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1916 "dapy.c" /* yacc.c:1646 */ + case 90: /* name: SCAN_ERROR */ +#line 254 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2089 "dapy.c" break; - case 91: -#line 255 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1922 "dapy.c" /* yacc.c:1646 */ + case 91: /* name: SCAN_FLOAT32 */ +#line 255 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2095 "dapy.c" break; - case 92: -#line 256 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1928 "dapy.c" /* yacc.c:1646 */ + case 92: /* name: SCAN_FLOAT64 */ +#line 256 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2101 "dapy.c" break; - case 93: -#line 257 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1934 "dapy.c" /* yacc.c:1646 */ + case 93: /* name: SCAN_GRID */ +#line 257 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2107 "dapy.c" break; - case 94: -#line 258 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1940 "dapy.c" /* yacc.c:1646 */ + case 94: /* name: SCAN_INT16 */ +#line 258 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2113 "dapy.c" break; - case 95: -#line 259 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1946 "dapy.c" /* yacc.c:1646 */ + case 95: /* name: SCAN_INT32 */ +#line 259 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2119 "dapy.c" break; - case 96: -#line 260 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1952 "dapy.c" /* yacc.c:1646 */ + case 96: /* name: SCAN_MAPS */ +#line 260 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2125 "dapy.c" break; - case 97: -#line 261 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1958 "dapy.c" /* yacc.c:1646 */ + case 97: /* name: SCAN_SEQUENCE */ +#line 261 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2131 "dapy.c" break; - case 98: -#line 262 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1964 "dapy.c" /* yacc.c:1646 */ + case 98: /* name: SCAN_STRING */ +#line 262 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2137 "dapy.c" break; - case 99: -#line 263 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1970 "dapy.c" /* yacc.c:1646 */ + case 99: /* name: SCAN_STRUCTURE */ +#line 263 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2143 "dapy.c" break; - case 100: -#line 264 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1976 "dapy.c" /* yacc.c:1646 */ + case 100: /* name: SCAN_UINT16 */ +#line 264 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2149 "dapy.c" break; - case 101: -#line 265 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1982 "dapy.c" /* yacc.c:1646 */ + case 101: /* name: SCAN_UINT32 */ +#line 265 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2155 "dapy.c" break; - case 102: -#line 266 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1988 "dapy.c" /* yacc.c:1646 */ + case 102: /* name: SCAN_URL */ +#line 266 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2161 "dapy.c" break; - case 103: -#line 267 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 1994 "dapy.c" /* yacc.c:1646 */ + case 103: /* name: SCAN_CODE */ +#line 267 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2167 "dapy.c" break; - case 104: -#line 268 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 2000 "dapy.c" /* yacc.c:1646 */ + case 104: /* name: SCAN_MESSAGE */ +#line 268 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2173 "dapy.c" break; - case 105: -#line 269 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 2006 "dapy.c" /* yacc.c:1646 */ + case 105: /* name: SCAN_PROG */ +#line 269 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2179 "dapy.c" break; - case 106: -#line 270 "dap.y" /* yacc.c:1646 */ - {(yyval)=strdup((yyvsp[0]));} -#line 2012 "dapy.c" /* yacc.c:1646 */ + case 106: /* name: SCAN_PTYPE */ +#line 270 "dap.y" + {yyval=strdup(yyvsp[0]);} +#line 2185 "dapy.c" break; -#line 2016 "dapy.c" /* yacc.c:1646 */ +#line 2189 "dapy.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2026,25 +2200,23 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2055,50 +2227,44 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (parsestate, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { + yypcontext_t yyctx + = {yyssp, yytoken}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; + yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); if (yysyntax_error_status == 0) yymsgp = yymsg; - else if (yysyntax_error_status == 1) + else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) + yymsg = YY_CAST (char *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (yymsg) { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; + yysyntax_error_status + = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); + yymsgp = yymsg; } else { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = YYENOMEM; } } yyerror (parsestate, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; + if (yysyntax_error_status == YYENOMEM) + YYNOMEM; } -# undef YYSYNTAX_ERROR -#endif } - - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -2127,12 +2293,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2149,13 +2314,14 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -2169,7 +2335,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yydestruct ("Error: popping", - yystos[yystate], yyvsp, parsestate); + YY_ACCESSING_SYMBOL (yystate), yyvsp, parsestate); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2181,7 +2347,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2192,26 +2358,30 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; + -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (parsestate, YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ -#endif + goto yyreturnlab; + -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -2227,18 +2397,17 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, parsestate); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parsestate); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); -#endif return yyresult; } -#line 273 "dap.y" /* yacc.c:1906 */ + +#line 273 "dap.y" diff --git a/oc2/dapy.h b/oc2/dapy.h index d11cfc9876..00f7aa1c47 100644 --- a/oc2/dapy.h +++ b/oc2/dapy.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -30,6 +31,10 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + #ifndef YY_DAP_DAP_TAB_H_INCLUDED # define YY_DAP_DAP_TAB_H_INCLUDED /* Debug traces. */ @@ -40,37 +45,42 @@ extern int dapdebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - SCAN_ALIAS = 258, - SCAN_ARRAY = 259, - SCAN_ATTR = 260, - SCAN_BYTE = 261, - SCAN_CODE = 262, - SCAN_DATASET = 263, - SCAN_DATA = 264, - SCAN_ERROR = 265, - SCAN_FLOAT32 = 266, - SCAN_FLOAT64 = 267, - SCAN_GRID = 268, - SCAN_INT16 = 269, - SCAN_INT32 = 270, - SCAN_MAPS = 271, - SCAN_MESSAGE = 272, - SCAN_SEQUENCE = 273, - SCAN_STRING = 274, - SCAN_STRUCTURE = 275, - SCAN_UINT16 = 276, - SCAN_UINT32 = 277, - SCAN_URL = 278, - SCAN_PTYPE = 279, - SCAN_PROG = 280, - WORD_WORD = 281, - WORD_STRING = 282 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + SCAN_ALIAS = 258, /* SCAN_ALIAS */ + SCAN_ARRAY = 259, /* SCAN_ARRAY */ + SCAN_ATTR = 260, /* SCAN_ATTR */ + SCAN_BYTE = 261, /* SCAN_BYTE */ + SCAN_CODE = 262, /* SCAN_CODE */ + SCAN_DATASET = 263, /* SCAN_DATASET */ + SCAN_DATA = 264, /* SCAN_DATA */ + SCAN_ERROR = 265, /* SCAN_ERROR */ + SCAN_FLOAT32 = 266, /* SCAN_FLOAT32 */ + SCAN_FLOAT64 = 267, /* SCAN_FLOAT64 */ + SCAN_GRID = 268, /* SCAN_GRID */ + SCAN_INT16 = 269, /* SCAN_INT16 */ + SCAN_INT32 = 270, /* SCAN_INT32 */ + SCAN_MAPS = 271, /* SCAN_MAPS */ + SCAN_MESSAGE = 272, /* SCAN_MESSAGE */ + SCAN_SEQUENCE = 273, /* SCAN_SEQUENCE */ + SCAN_STRING = 274, /* SCAN_STRING */ + SCAN_STRUCTURE = 275, /* SCAN_STRUCTURE */ + SCAN_UINT16 = 276, /* SCAN_UINT16 */ + SCAN_UINT32 = 277, /* SCAN_UINT32 */ + SCAN_URL = 278, /* SCAN_URL */ + SCAN_PTYPE = 279, /* SCAN_PTYPE */ + SCAN_PROG = 280, /* SCAN_PROG */ + WORD_WORD = 281, /* WORD_WORD */ + WORD_STRING = 282 /* WORD_STRING */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ @@ -82,6 +92,8 @@ typedef int YYSTYPE; + int dapparse (DAPparsestate* parsestate); + #endif /* !YY_DAP_DAP_TAB_H_INCLUDED */ diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 6d0b20a416..ac2fec4194 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -8,7 +8,10 @@ set(CMAKE_BUILD_TYPE "") if(WIN32) set(PLUGINEXT "dll") - set(PLUGINPRE "__nc") + set(PLUGINPRE "__nc") +elseif(CYGWIN) + set(PLUGINEXT "dll") + set(PLUGINPRE "lib__nc") else() set(PLUGINPRE "lib__nc") if(APPLE) @@ -89,12 +92,12 @@ buildplugin(nczmisc "zmisc") buildplugin(nczhdf5filters "zhdf5filters" netcdf) buildplugin(nczstdfilters "zstdfilters" netcdf) -if(ENABLE_BLOSC) +if(NETCDF_ENABLE_BLOSC) set(h5blosc_SOURCES H5Zblosc.c) buildplugin(h5blosc "h5blosc" netcdf;${Blosc_LIBRARIES}) endif() -if(ENABLE_ZSTD) +if(NETCDF_ENABLE_ZSTD) set(h5zstd_SOURCES H5Zzstd.c H5Zzstd.h) buildplugin(h5zstd "h5zstd" netcdf;${Zstd_LIBRARIES}) endif() diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 9c4072e135..b9fc2d177c 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -39,7 +39,7 @@ LDADD = $(top_builddir)/liblib/libnetcdf.la LIBADD = $(top_builddir)/liblib/libnetcdf.la endif -EXTRA_DIST = CMakeLists.txt +EXTRA_DIST = CMakeLists.txt findplugin.in # The HDF5 filter wrappers EXTRA_DIST += \ @@ -125,8 +125,9 @@ else check_LTLIBRARIES += $(plugins_to_install) endif +DISTCLEANFILES = H5Znoop1.c H5Znoop2.c ncjson.h findplugin.sh + BUILT_SOURCES = H5Znoop1.c -DISTCLEANFILES = H5Znoop1.c H5Znoop2.c ncjson.h H5Znoop1.c: Makefile H5Znoop.c echo '#define NOOP_INSTANCE 1' > $@ cat ${srcdir}/H5Znoop.c >> $@ diff --git a/nc_test4/findplugin.in b/plugins/findplugin.in similarity index 100% rename from nc_test4/findplugin.in rename to plugins/findplugin.in diff --git a/test_common.in b/test_common.in index 38d6e5b341..5afb5e5449 100644 --- a/test_common.in +++ b/test_common.in @@ -12,8 +12,10 @@ export TEST_COMMON_SH=1 # Define various global constants # Define location of execution -TOPSRCDIR='@abs_top_srcdir@' -TOPBUILDDIR='@abs_top_builddir@' +abs_top_srcdir=@abs_top_srcdir@ +abs_top_builddir=@abs_top_builddir@ +TOPSRCDIR="${abs_top_srcdir}" +TOPBUILDDIR="${abs_top_builddir}" FP_ISCMAKE=@ISCMAKE@ FP_ISMSVC=@ISMSVC@ FP_WINVERMAJOR=@WINVERMAJOR@ @@ -41,7 +43,7 @@ FEATURE_S3_INTERNAL=@HAS_S3_INTERNAL@ FEATURE_S3=@HAS_S3@ FEATURE_NCZARR=@HAS_NCZARR@ FEATURE_S3TESTS=@NETCDF_ENABLE_S3_TESTING@ -FEATURE_NCZARR_ZIP=@DO_NCZARR_ZIP_TESTS@ +FEATURE_NCZARR_ZIP=@HAS_NCZARR_ZIP@ FEATURE_LARGE_TESTS=@DO_LARGE_TESTS@ # Thredds-test server is currently disabled @@ -146,7 +148,7 @@ fi # We also assume we are executing in builddir builddir=`pwd` -# execdir is an alias for builddir +# execdir is usually an alias for builddir execdir="${builddir}" # pick off the last component as the relative name of this directory @@ -172,17 +174,17 @@ fi # We need to locate certain executables (and other things), # capture absolute paths, and make visible -export NCDUMP="${top_builddir}/ncdump${VS}/${DL}ncdump${ext}" -export NCCOPY="${top_builddir}/ncdump${VS}/${DL}nccopy${ext}" -export NCGEN="${top_builddir}/ncgen${VS}/${DL}ncgen${ext}" -export NCGEN3="${top_builddir}/ncgen3${VS}/${DL}ncgen3${ext}" -export NCPATHCVT="${top_builddir}/ncdump${VS}/${DL}ncpathcvt${ext}" +export NCDUMP="${abs_top_builddir}/ncdump${VS}/${DL}ncdump${ext}" +export NCCOPY="${abs_top_builddir}/ncdump${VS}/${DL}nccopy${ext}" +export NCGEN="${abs_top_builddir}/ncgen${VS}/${DL}ncgen${ext}" +export NCGEN3="${abs_top_builddir}/ncgen3${VS}/${DL}ncgen3${ext}" +export NCPATHCVT="${abs_top_builddir}/ncdump${VS}/${DL}ncpathcvt${ext}" # Temporary hacks (until we have a test_utils directory) # to locate certain specific test files -ncgen3c0="${top_srcdir}/ncgen3/c0.cdl" -ncgenc0="${top_srcdir}/ncgen/c0.cdl" -ncgenc04="${top_srcdir}/ncgen/c0_4.cdl" +ncgen3c0="${abs_top_srcdir}/ncgen3/c0.cdl" +ncgenc0="${abs_top_srcdir}/ncgen/c0.cdl" +ncgenc04="${abs_top_srcdir}/ncgen/c0_4.cdl" # Set LC_ALL if test "x$FP_ISMSVC" = xyes || test "x$FP_ISCYGWIN" = xyes; then export LC_ALL="en_US.utf8"; fi