mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-12 18:10:24 +08:00
Merge branch 'master' into ncf-177
This commit is contained in:
commit
5ccb8a24b5
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ html
|
||||
doxygen*.tmp
|
||||
\#*.*\#
|
||||
autom4te.cache
|
||||
myhtml
|
||||
|
281
CMakeLists.txt
281
CMakeLists.txt
@ -1,9 +1,14 @@
|
||||
## This is a CMake file, part of Unidata's netCDF package.
|
||||
# Copyright 2012-2013, see the COPYRIGHT file for more information.
|
||||
|
||||
|
||||
##################################
|
||||
# Set Project Properties
|
||||
##################################
|
||||
|
||||
#Minimum required CMake Version
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
|
||||
|
||||
#Project Name
|
||||
project(netCDF C)
|
||||
set(PACKAGE "netCDF" CACHE STRING "")
|
||||
@ -11,23 +16,15 @@ set(PACKAGE "netCDF" CACHE STRING "")
|
||||
SET(netCDF_VERSION_MAJOR 4)
|
||||
SET(netCDF_VERSION_MINOR 3)
|
||||
SET(netCDF_VERSION_PATCH 1)
|
||||
SET(netCDF_VERSION_NOTE "-rc4")
|
||||
SET(netCDF_VERSION_NOTE "-rc5")
|
||||
SET(netCDF_VERSION ${netCDF_VERSION_MAJOR}.${netCDF_VERSION_MINOR}.${netCDF_VERSION_PATCH}${netCDF_VERSION_NOTE})
|
||||
SET(VERSION ${netCDF_VERSION})
|
||||
#Library .so version.
|
||||
SET(netCDF_SO_VERSION 7.2.0)
|
||||
|
||||
# Set some default C Flags if we are using GCC
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_C_FLAGS "-g -O2")
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Get system configuration,
|
||||
# Use it to determine osname,
|
||||
# os release, cpu. These will be used
|
||||
# when committing to CDash.
|
||||
|
||||
find_program(UNAME NAMES uname)
|
||||
IF(UNAME)
|
||||
macro(getuname name flag)
|
||||
@ -38,46 +35,20 @@ getuname(osrel -r)
|
||||
getuname(cpu -m)
|
||||
set(BUILDNAME "${osname}-${osrel}-${cpu}" CACHE STRING "Build name variable for CDash")
|
||||
ENDIF()
|
||||
ENABLE_TESTING()
|
||||
INCLUDE(CTest)
|
||||
|
||||
# Copy the CTest customization file into binary directory, as required.
|
||||
FILE(COPY ${CMAKE_SOURCE_DIR}/CTestCustom.cmake DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
# For CMAKE_INSTALL_LIBDIR
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
IF(MSVC)
|
||||
SET(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
SET(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
ENDIF()
|
||||
|
||||
# CTest configuration
|
||||
IF(NOT MSVC)
|
||||
SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "")
|
||||
ENDIF()
|
||||
|
||||
# Default to shared libs on
|
||||
OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
|
||||
# Set variable to define the build type.
|
||||
INCLUDE(GenerateExportHeader)
|
||||
SET (LIB_TYPE STATIC)
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
SET(LIB_TYPE SHARED)
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ADD_DEFINITIONS()
|
||||
|
||||
### Verbose make, for debugging.
|
||||
#SET(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
#Add custom CMake Module
|
||||
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
|
||||
CACHE INTERNAL "Location of our custom CMake modules.")
|
||||
|
||||
# Configure-type checks
|
||||
# auto-configure style checks, other CMake modules.
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
|
||||
@ -88,12 +59,77 @@ INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)
|
||||
FIND_PACKAGE(PkgConfig QUIET)
|
||||
|
||||
|
||||
## Enable 'dist and distcheck'.
|
||||
## File taken from http://ensc.de/cmake/FindMakeDist.cmake
|
||||
# Enable 'dist and distcheck'.
|
||||
# File adapted from http://ensc.de/cmake/FindMakeDist.cmake
|
||||
FIND_PACKAGE(MakeDist)
|
||||
## End 'enable dist and distcheck'
|
||||
# End 'enable dist and distcheck'
|
||||
|
||||
# Set the build type.
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET (CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None, Debug, Release."
|
||||
FORCE)
|
||||
ENDIF()
|
||||
|
||||
################################
|
||||
# End Project Properties
|
||||
################################
|
||||
|
||||
|
||||
################################
|
||||
# Set CTest Properties
|
||||
################################
|
||||
|
||||
ENABLE_TESTING()
|
||||
INCLUDE(CTest)
|
||||
|
||||
# Copy the CTest customization file into binary directory, as required.
|
||||
FILE(COPY ${CMAKE_SOURCE_DIR}/CTestCustom.cmake DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Set Memory test program for non-MSVC based builds.
|
||||
# Assume valgrind for now.
|
||||
IF(NOT MSVC)
|
||||
SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "")
|
||||
ENDIF()
|
||||
|
||||
# Set variable to define the build type.
|
||||
INCLUDE(GenerateExportHeader)
|
||||
|
||||
################################
|
||||
# End CTest Properties
|
||||
################################
|
||||
|
||||
|
||||
################################
|
||||
# Compiler Configuration
|
||||
################################
|
||||
|
||||
|
||||
# Default to shared libs on.
|
||||
OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
|
||||
SET (LIB_TYPE STATIC)
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
SET(LIB_TYPE SHARED)
|
||||
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Supress unused variable and parameter warnings, for the time being,
|
||||
# on GCC.
|
||||
#
|
||||
# Also, set some other default compiler flags.
|
||||
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wno-unused-variable -Wno-unused-parameter")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wno-unused-variable -Wno-unused-parameter")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ENABLE_COVERAGE_TESTS)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||
ENDIF()
|
||||
|
||||
|
||||
ADD_DEFINITIONS()
|
||||
|
||||
# Supress CRT Warnings.
|
||||
# Only necessary for Windows
|
||||
@ -101,15 +137,17 @@ IF(MSVC)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
||||
ENDIF()
|
||||
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET (CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None, Debug, Release."
|
||||
FORCE)
|
||||
ENDIF()
|
||||
#####
|
||||
# Some utility macros/scripts.
|
||||
#####
|
||||
|
||||
################################
|
||||
# End Compiler Configuration
|
||||
################################
|
||||
|
||||
|
||||
################################
|
||||
# Define Utility Macros
|
||||
################################
|
||||
|
||||
# Macro to append files to the EXTRA_DIST files.
|
||||
#####
|
||||
SET(EXTRA_DIST "")
|
||||
MACRO(ADD_EXTRA_DIST files)
|
||||
FOREACH(F ${files})
|
||||
@ -271,6 +309,11 @@ MACRO(specify_static_crt_flag)
|
||||
|
||||
ENDMACRO()
|
||||
|
||||
################################
|
||||
# End Macro Definitions
|
||||
################################
|
||||
|
||||
|
||||
##
|
||||
# Configuration for post-install RPath
|
||||
# Adapted from http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
@ -308,9 +351,11 @@ ENDIF()
|
||||
##
|
||||
|
||||
|
||||
#####
|
||||
################################
|
||||
# Option checks
|
||||
#####
|
||||
################################
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# HDF5 cache variables.
|
||||
SET (DEFAULT_CHUNK_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
|
||||
@ -376,14 +421,6 @@ IF(ENABLE_DISKLESS)
|
||||
SET(USE_DISKLESS ON)
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLE_COVERAGE_TESTS)
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
OPTION(ENABLE_CONVERSION_WARNINGS "Enable warnings for implicit conversion from 64 to 32-bit datatypes." ON)
|
||||
IF(ENABLE_CONVERSION_WARNINGS)
|
||||
IF(NOT MSVC)
|
||||
@ -406,29 +443,61 @@ OPTION (ENABLE_HDF4 "Build netCDF-4 with HDF5 read capability (HDF4, HDF5 and Zl
|
||||
IF (ENABLE_HDF4)
|
||||
SET(USE_HDF4 ON)
|
||||
# Check for include files, libraries.
|
||||
CHECK_INCLUDE_FILE("mfhdf.h" HAVE_MFHDF_H)
|
||||
IF(NOT HAVE_MFHDF_H)
|
||||
|
||||
FIND_PATH(MFHDF_H_INCLUDE_DIR mfhdf.h)
|
||||
IF(NOT MFHDF_H_INCLUDE_DIR)
|
||||
MESSAGE(FATAL_ERROR "HDF4 Support specified, cannot find file mfhdf.h")
|
||||
ENDIF(NOT HAVE_MFHDF_H)
|
||||
ELSE()
|
||||
SET(HAVE_MFHDF_H ON CACHE BOOL "")
|
||||
INCLUDE_DIRECTORIES(${MFHDF_H_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(HDF4_DF_LIB NAMES df libdf)
|
||||
IF(NOT HDF4_DF_LIB)
|
||||
MESSAGE(FATAL_ERROR "HDF4 Support enabled, but cannot find df lib.")
|
||||
MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 df library.")
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(HDF4_MFHDF_LIB NAMES mfhdf libmfhdf)
|
||||
IF(NOT HDF4_MFHDF_LIB)
|
||||
MESSAGE(FATAL_ERROR "HDF4 Support enabled, but cannot find mfhdf lib.")
|
||||
MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 mfhdf library.")
|
||||
ENDIF()
|
||||
|
||||
SET(HDF4_LIBRARIES ${HDF4_MFHDF_LIB} ${HDF4_DF_LIB})
|
||||
# End include files, libraries.
|
||||
MESSAGE(STATUS "HDF4 Libraries: ${HDF4_DF_LIB}, ${HDF4_MFHDF_LIB}")
|
||||
OPTION(ENABLE_HDF4_FILE_TESTS "Run HDF4 File Tests." OFF)
|
||||
IF(ENABLE_HDF4_FILE_TESTS)
|
||||
SET(USE_HDF4_FILE_TESTS ON)
|
||||
MESSAGE(STATUS "HDF4 libraries: ${HDF4_DF_LIB}, ${HDF4_MFHDF_LIB}")
|
||||
|
||||
MESSAGE(STATUS "Seeking HDF4 jpeg dependency.")
|
||||
|
||||
# Look for the jpeglib.h header file.
|
||||
FIND_PATH(JPEGLIB_H_INCLUDE_DIR jpeglib.h)
|
||||
IF(NOT JPEGLIB_H_INCLUDE_DIR)
|
||||
MESSAGE(FATAL_ERROR "HDF4 Support enabled but cannot find jpeglib.h")
|
||||
ELSE()
|
||||
SET(HAVE_JPEGLIB_H ON CACHE BOOL "")
|
||||
INCLUDE_DIRECTORIES(${JPEGLIB_H_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
FIND_LIBRARY(JPEG_LIB NAMES jpeg libjpeg)
|
||||
IF(NOT JPEG_LIB)
|
||||
MESSAGE(FATAL_ERROR "HDF4 Support enabled but cannot find libjpeg")
|
||||
ENDIF()
|
||||
SET(HDF4_LIBRARIES ${JPEG_LIB} ${HDF4_LIBRARIES})
|
||||
MESSAGE(STATUS "Found JPEG libraries: ${JPEG_LIB}")
|
||||
|
||||
# Option to enable HDF4 file tests.
|
||||
OPTION(ENABLE_HDF4_FILE_TESTS "Run HDF4 file tests. This fetches sample HDF4 files from the Unidata ftp site to test with (requires wget)." ON)
|
||||
IF(ENABLE_HDF4_FILE_TESTS)
|
||||
FIND_PROGRAM(PROG_WGET NAMES wget)
|
||||
IF(PROG_WGET)
|
||||
SET(USE_HDF4_FILE_TESTS ON)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Unable to locate 'wget'. Disabling hdf4 file tests.")
|
||||
SET(USE_HDF4_FILE_TESTS OFF)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
ENDIF ()
|
||||
|
||||
# Option to Build DLL
|
||||
IF(WIN32)
|
||||
@ -478,6 +547,7 @@ IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
ELSE()
|
||||
IF(MSVC)
|
||||
FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED)
|
||||
MESSAGE(STATUS "Found HDF5: ${HDF5_LIBRARIES}")
|
||||
ELSE()
|
||||
FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
|
||||
ENDIF()
|
||||
@ -525,7 +595,6 @@ IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
||||
# Option to Build DAP Client
|
||||
OPTION (ENABLE_DAP "Enable DAP Client." ON)
|
||||
IF (ENABLE_DAP)
|
||||
@ -590,11 +659,6 @@ ENDIF()
|
||||
# Location for large file tests.
|
||||
SET(TEMP_LARGE "." CACHE STRING "Location to store large file tests.")
|
||||
|
||||
OPTION (ENABLE_INTERNAL_DOCS "Enable documentation of library internals. This is of interest only to those developing the netCDF library." OFF)
|
||||
IF(ENABLE_INTERNAL_DOCS)
|
||||
SET(BUILD_INTERNAL_DOCS ON)
|
||||
ENDIF()
|
||||
|
||||
OPTION (ENABLE_FSYNC "Enable experimental fsync code." OFF)
|
||||
IF(ENABLE_FSYNC)
|
||||
SET(USE_FSYNC ON)
|
||||
@ -602,12 +666,13 @@ ENDIF()
|
||||
|
||||
# Linux specific large file support flags.
|
||||
# Modelled after check in CMakeLists.txt for hdf5.
|
||||
IF (NOT WINDOWS)
|
||||
OPTION(ENABLE_LFS "Enable large (64-bit) files on linux." ON)
|
||||
# TODO: There needs to be a check here to ensure
|
||||
# that large file support is actually supported.
|
||||
|
||||
IF(ENABLE_LFS)
|
||||
OPTION(ENABLE_LARGE_FILE_SUPPORT "Enable large file support." ON)
|
||||
IF(ENABLE_LARGE_FILE_SUPPORT)
|
||||
IF(MSVC)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
ELSE()
|
||||
SET(_FILE_OFFSET_BITS 64)
|
||||
SET(_LARGEFILE64_SOURCE TRUE)
|
||||
SET(_LARGEFILE_SOURCE TRUE)
|
||||
@ -616,23 +681,26 @@ ENDIF()
|
||||
|
||||
|
||||
# Provide the option to perform coverage tests.
|
||||
OPTION (ENABLE_COVERAGE_TESTS "Enable compiler flags needed to perform coverage tests." OFF)
|
||||
IF(ENABLE_COVERAGE_TESTS)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -W -profile-arcs -ftest-coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
MESSAGE(STATUS "Coverage Tests: On.")
|
||||
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
OPTION (ENABLE_COVERAGE_TESTS "Enable compiler flags needed to perform coverage tests." OFF)
|
||||
IF(ENABLE_COVERAGE_TESTS)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -profile-arcs -ftest-coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
MESSAGE(STATUS "Coverage Tests: On.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
OPTION (ENABLE_EXAMPLE_TESTS "Run extra example tests. Requires GNU Sed. Ignored if netCDF-4 is not Enabled" OFF)
|
||||
IF(NOT ENABLE_NETCDF_4 AND ENABLE_EXAMPLE_TESTS)
|
||||
SET (ENABLE_EXAMPLE_TESTS OFF)
|
||||
ENDIF()
|
||||
|
||||
# Enable Parallel (different than pnetcdf).
|
||||
SET(STATUS_PARALLEL "OFF")
|
||||
OPTION(ENABLE_PARALLEL "Build netCDF-4 with parallel IO" OFF)
|
||||
IF(ENABLE_PARALLEL AND ENABLE_NETCDF_4)
|
||||
MESSAGE(STATUS "Debug: ${HDF5_LIB}")
|
||||
SET(USE_PARALLEL ON CACHE BOOL "")
|
||||
# Check for H5Pget_fapl_mpiposx, define USE_PARALLEL_POSIX
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_LIB} H5Pget_fapl_mpioposix "" USE_PARALLEL_POSIX)
|
||||
@ -669,12 +737,13 @@ IF(ENABLE_PNETCDF)
|
||||
SET(STATUS_PARALLEL "ON")
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Enable Parallel Tests.
|
||||
OPTION (ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if netCDF4 is not enabled, or if there is no parallel I/O Support." ${USE_PARALLEL})
|
||||
IF(ENABLE_PARALLEL_TESTS AND USE_PARALLEL)
|
||||
SET(TEST_PARALLEL ON CACHE BOOL "")
|
||||
ENDIF()
|
||||
|
||||
# Determine whether or not to generate documentation.
|
||||
OPTION (ENABLE_DOXYGEN "Enable generation of doxygen." OFF)
|
||||
IF(ENABLE_DOXYGEN)
|
||||
SET(BUILD_DOCS ON CACHE BOOL "")
|
||||
@ -686,13 +755,37 @@ IF(ENABLE_DOXYGEN)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# By default, MSVC has a stack size of 1000000.
|
||||
# Allow a user to override this.
|
||||
IF(MSVC)
|
||||
SET(NC_MSVC_STACK_SIZE 40000000 CACHE STRING "Default stack size for MSVC-based projects.")
|
||||
|
||||
# By default, CMake sets the stack to 1000000.
|
||||
# Remove this limitation.
|
||||
# See here for more details:
|
||||
# http://www.cmake.org/pipermail/cmake/2009-April/028710.html
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:${NC_MSVC_STACK_SIZE}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /STACK:${NC_MSVC_STACK_SIZE}")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /STACK:${NC_MSVC_STACK_SIZE}")
|
||||
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Internal Documentation
|
||||
OPTION (ENABLE_INTERNAL_DOCS "Enable documentation of library internals. This is of interest only to those developing the netCDF library." OFF)
|
||||
IF(ENABLE_INTERNAL_DOCS)
|
||||
SET(BUILD_INTERNAL_DOCS ON)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Set some of the options as advanced.
|
||||
MARK_AS_ADVANCED(ENABLE_INTERNAL_DOCS VALGRIND_TESTS ENABLE_PNETCDF ENABLE_COVERAGE_TESTS)
|
||||
MARK_AS_ADVANCED(ENABLE_DAP_REMOTE_TESTS ENABLE_DAP_LONG_TESTS USE_REMOTE_CDASH)
|
||||
#####
|
||||
# End option checks.
|
||||
#####
|
||||
|
||||
################################
|
||||
# Option checks
|
||||
################################
|
||||
|
||||
|
||||
#####
|
||||
# System inspection checks
|
||||
@ -800,7 +893,7 @@ CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE)
|
||||
CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
|
||||
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
|
||||
CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(_filelengthi64 HAVE_FILE_LENGTH_I64)
|
||||
|
||||
#####
|
||||
# End system inspection checks.
|
||||
|
2
Doxyfile
2
Doxyfile
@ -32,7 +32,7 @@ PROJECT_NAME = netCDF-C
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.3.1-RC3
|
||||
PROJECT_NUMBER = 4.3.1-RC5
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
@ -8,13 +8,58 @@ information, where '[NCF-XXX]' refers to https://www.unidata.ucar.edu/jira/brows
|
||||
|
||||
## 4.3.1 Released TBD
|
||||
|
||||
### 4.3.1-rc4 Released TBD
|
||||
### 4.3.1-rc5 Released TBD
|
||||
|
||||
Fix bug introduced by [NCF-267] where octal constants above
|
||||
* When compiling with `hdf4` support, both autotools and cmake-based builds now properly look for the `libjpeg` dependency and will link against it when found (or complain if it's not). Also added `ENABLE_HDF4_FILE_TESTS` option to CMake-based builds.
|
||||
|
||||
* Fixed bug in ncgen; it was not properly filling empty string constants
|
||||
("") to be the proper length. [NCF-279]
|
||||
|
||||
[NCF-279]:https://bugtracking.unidata.ucar.edu/browse/NCF-279
|
||||
|
||||
* Fixed bug in ncgen where it was interpreting int64 constants
|
||||
as uint64 constants. [NCF-278]
|
||||
|
||||
[NCF-278]:https://bugtracking.unidata.ucar.edu/browse/NCF-278
|
||||
|
||||
* Fixed bug in handling Http Basic Authorization.
|
||||
The code was actually there but was not being
|
||||
executed. [NCF-277]
|
||||
|
||||
[NCF-277]:https://bugtracking.unidata.ucar.edu/browse/NCF-277
|
||||
|
||||
* Added hack to the DAP code to address a problem with the
|
||||
Columbia.edu server. That server does not serve up proper
|
||||
DAP2 DDS replies. The Dataset {...} name changes depending
|
||||
on if the request has certain kinds of
|
||||
constraints. [NCF-276]
|
||||
|
||||
[NCF-276]:https://bugtracking.unidata.ucar.edu/browse/NCF-276
|
||||
|
||||
* Fixed bugs with ncdump annotation of values, using -b or -f
|
||||
options. [NCF-275]
|
||||
|
||||
[NCF-275]:https://bugtracking.unidata.ucar.edu/browse/NCF-275
|
||||
|
||||
### 4.3.1-rc4 Released 2013-11-06
|
||||
|
||||
* Addressed an issue on Windows where `fstat` would report an incorrect file size on files > 4GB. [NCF-219]
|
||||
|
||||
|
||||
* Added better documentation about accessing ESG datasets.
|
||||
See http://www.unidata.ucar.edu/software/netcdf/docs/esg.html.
|
||||
|
||||
* Corrected an issue with CMake-based builds enabling HDF4 support where the HDF4 libraries were in a non-standard location.
|
||||
|
||||
* Fix bug introduced by [NCF-267] where octal constants above
|
||||
'\177' were not recognized as proper octal constants. [NCF-271]
|
||||
|
||||
[NCF-271]:https://bugtracking.unidata.ucar.edu/browse/NCF-271
|
||||
|
||||
* Fixed an issue where the `netcdf.3` man page was not being installed by CMake-based builds. [Github](https://github.com/Unidata/netcdf-c/issues/3)
|
||||
|
||||
|
||||
|
||||
### 4.3.1-rc3 Released 2013-09-24
|
||||
|
||||
* Modify ncgen to support NUL characters in character array
|
||||
|
6
cf
6
cf
@ -10,7 +10,6 @@ HDF5=1
|
||||
DAP=1
|
||||
#PNETCDF=1
|
||||
#HDF4=1
|
||||
#HDF4=1
|
||||
#RPC=1
|
||||
#PGI=1
|
||||
#M32=1
|
||||
@ -47,7 +46,8 @@ stddir="/share/ed/local/${HOST}"
|
||||
else
|
||||
stddir="/usr/local"
|
||||
fi
|
||||
stddir="/machine/local_szlib"
|
||||
#stddir="/machine/local_szlib"
|
||||
stddir="/usr/local"
|
||||
|
||||
if test "x$INSTALL" = "x1" ; then
|
||||
if test "x$PREFIX" = x ; then
|
||||
@ -149,7 +149,7 @@ FLAGS="$FLAGS --disable-examples"
|
||||
#FLAGS="$FLAGS --enable-dap-long-tests"
|
||||
#FLAGS="$FLAGS --enable-ffio"
|
||||
#FLAGS="$FLAGS --enable-benchmarks"
|
||||
#FLAGS="$FLAGS --enable-extra-tests"
|
||||
FLAGS="$FLAGS --enable-extra-tests"
|
||||
#FLAGS="$FLAGS --enable-large-file-tests"
|
||||
#FLAGS="$FLAGS --disable-testsets"
|
||||
#FLAGS="$FLAGS --disable-dap-remote-tests"
|
||||
|
@ -4,6 +4,10 @@
|
||||
/* Eliminate a number of warnings which come up based on deprecated
|
||||
POSIX naming conventions. */
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/* Define O_BINARY so that the appropriate flags
|
||||
are set when opening a binary file on Windows. */
|
||||
|
||||
/* Disable a few warnings under Visual Studio, for the
|
||||
time being. */
|
||||
#include <io.h>
|
||||
@ -14,6 +18,8 @@
|
||||
#define read _read
|
||||
#define lseek _lseeki64
|
||||
|
||||
#define fstat _fstat64
|
||||
|
||||
#define off_t __int64
|
||||
#define _off_t __int64
|
||||
|
||||
@ -191,6 +197,9 @@
|
||||
/* Define to 1 if you have the BaseTsd.h header file. */
|
||||
#cmakedefine HAVE_BASETSD_H @HAVE_BASETSD_H@
|
||||
|
||||
/* Define if we have filelengthi64. */
|
||||
#cmakedefine HAVE_FILE_LENGTH_I64 @HAVE_FILE_LENGTH_I64@
|
||||
|
||||
/* The size of `double` as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
|
||||
/* The size of `float` as computed by sizeof. */
|
||||
|
@ -15,7 +15,7 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
|
||||
AC_PREREQ([2.59])
|
||||
|
||||
# Initialize with name, version, and support email address.
|
||||
AC_INIT([netCDF], [4.3.1-rc4], [support-netcdf@unidata.ucar.edu])
|
||||
AC_INIT([netCDF], [4.3.1-rc5], [support-netcdf@unidata.ucar.edu])
|
||||
|
||||
# Create the VERSION file, which contains the package version from
|
||||
# AC_INIT.
|
||||
@ -732,8 +732,9 @@ if test "x$enable_netcdf_4" = xyes; then
|
||||
fi
|
||||
AC_CHECK_LIB([df], [Hclose], [], [AC_MSG_ERROR([Can't find or link to the hdf4 df library. See config.log for errors.])])
|
||||
AC_CHECK_LIB([mfhdf], [SDcreate], [], [AC_MSG_ERROR([Can't find or link to the hdf4 mfhdf library. See config.log for errors.])])
|
||||
#AC_SEARCH_LIBS([Hclose],[df], [], [AC_MSG_ERROR([Can't find or link to the hdf4 df library. See config.log for errors.])])
|
||||
#AC_SEARCH_LIBS([SDcreate],[mfhdf], [], [AC_MSG_ERROR([Can't find or link to the hdf4 mfhdf library. See config.log for errors.])])
|
||||
|
||||
AC_CHECK_LIB([jpeg], [jpeg_set_quality], [], [AC_MSG_ERROR([Can't find or link to the jpeg library (required by hdf4). See config.log for errors.])])
|
||||
|
||||
AC_DEFINE([USE_HDF4], [1], [if true, use HDF4 too])
|
||||
fi
|
||||
fi
|
||||
|
@ -2,12 +2,12 @@ NCLIB=../liblib/.libs/libnetcdf.a
|
||||
NCINCL=-I ../liblib
|
||||
|
||||
#CYGWIN
|
||||
LFLAG=-L/usr/lib -L/usr/local/lib
|
||||
HDF5LIB=/usr/lib/libhdf5_hl.a /usr/lib/libhdf5.a
|
||||
#LFLAG=-L/usr/lib -L/usr/local/lib
|
||||
#HDF5LIB=/usr/lib/libhdf5_hl.a /usr/lib/libhdf5.a
|
||||
|
||||
#!CYGWIN
|
||||
#LFLAG=-L/upc/share/ed/local/${HOST}/lib
|
||||
#HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
|
||||
LFLAG=-L/upc/share/ed/local/${HOST}/lib
|
||||
HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
|
||||
|
||||
CURLLIB=-lcurl
|
||||
ZLIB=-lz
|
||||
@ -15,7 +15,7 @@ ZLIB=-lz
|
||||
OTHERLIBS=-lm
|
||||
|
||||
LIBS=${NCLIB} ${LFLAG} ${CURLLIB} ${HDF5LIB} ${ZLIB} ${OTHERLIBS}
|
||||
INCL=-I. -I.. -I../include ${NCINCL}
|
||||
INCL=-I. -I.. -I../include -I../libsrc -I../libsrc4 ${NCINCL}
|
||||
RPATH=-Wl,-rpath,${LFLAG}
|
||||
|
||||
# Might want to specify a particular C compiler with flags
|
||||
@ -216,8 +216,7 @@ cpp::
|
||||
|
||||
##################################################
|
||||
# ncd
|
||||
NCDUMPC=../ncdump/dumplib.c ../ncdump/indent.c ../ncdump/ncdump.c ../ncdump/nctime0.c ../ncdump/vardata.c ../ncdump/utils.c ../ncdump/nciter.c
|
||||
NCDUMPH=../ncdump/cdl.h ../ncdump/dumplib.h ../ncdump/indent.h ../ncdump/isnan.h ../ncdump/ncdump.h ../ncdump/nctime0.h ../ncdump/vardata.h ../ncdump/utils.h
|
||||
NCDUMPC= ../ncdump/ncdump.c ../ncdump/vardata.c ../ncdump/dumplib.c ../ncdump/indent.c ../ncdump/nctime0.c ../ncdump/nciter.c ../ncdump/utils.c
|
||||
|
||||
NCDUMPOBJ=${NCDUMPC:../ncdump/%.c=%.o}
|
||||
|
||||
@ -258,7 +257,12 @@ fix::
|
||||
done
|
||||
|
||||
##################################################
|
||||
T=junk
|
||||
E=common34
|
||||
e::
|
||||
cc -E -g -c ${E}.c ${INCL} -I../oc2 >${E}.txt
|
||||
|
||||
##################################################
|
||||
T=
|
||||
|
||||
v::
|
||||
cc -g -c ${T}.c ${INCL}
|
||||
|
@ -162,8 +162,10 @@ nullfree(s);
|
||||
if(nclistlength(allvars) == nclistlength(vars)) flags |= NCF_PREFETCH_ALL;
|
||||
ncstat = buildcachenode34(nccomm,newconstraint,vars,&cache,flags);
|
||||
newconstraint = NULL; /* buildcachenode34 takes control of newconstraint */
|
||||
if(ncstat) goto done;
|
||||
cache->wholevariable = 1; /* All prefetches are whole variable */
|
||||
if(ncstat != OC_NOERR) goto done;
|
||||
else if(cache == NULL) goto done;
|
||||
else
|
||||
cache->wholevariable = 1; /* All prefetches are whole variable */
|
||||
/* Make cache node be the prefetch node */
|
||||
nccomm->cdf.cache->prefetch = cache;
|
||||
if(SHOWFETCH) {
|
||||
@ -190,7 +192,7 @@ ncbytesfree(buf);
|
||||
done:
|
||||
nclistfree(vars);
|
||||
dcefree((DCEnode*)newconstraint);
|
||||
if(ncstat) freenccachenode(nccomm,cache);
|
||||
if(ncstat && cache != NULL) freenccachenode(nccomm,cache);
|
||||
return THROW(ncstat);
|
||||
}
|
||||
|
||||
@ -292,9 +294,10 @@ done:
|
||||
if(constraint != NULL) dcefree((DCEnode*)constraint);
|
||||
if(cachep) *cachep = cachenode;
|
||||
if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat);
|
||||
if(ncstat) {
|
||||
if(ncstat != OC_NOERR) {
|
||||
freecdfroot34(dxdroot);
|
||||
freenccachenode(nccomm,cachenode);
|
||||
if(cachep) *cachep = NULL;
|
||||
}
|
||||
return THROW(ncstat);
|
||||
}
|
||||
@ -319,6 +322,7 @@ fprintf(stderr,"freecachenode: %s\n",
|
||||
freecdfroot34(node->datadds);
|
||||
nclistfree(node->vars);
|
||||
nullfree(node);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -721,15 +721,20 @@ simplenodematch34(CDFnode* node1, CDFnode* node2)
|
||||
/* Test all the obvious stuff */
|
||||
if(node1 == NULL || node2 == NULL)
|
||||
return 0;
|
||||
|
||||
/* Add hack to address the screwed up Columbia server
|
||||
which returns different Dataset {...} names
|
||||
depending on the constraint.
|
||||
*/
|
||||
if(FLAGSET(node1->root->tree->owner->controls,NCF_COLUMBIA)
|
||||
&& node1->nctype == NC_Dataset) return 1;
|
||||
|
||||
if(strcmp(node1->ocname,node2->ocname)!=0) /* same names */
|
||||
return 0;
|
||||
if(nclistlength(node1->array.dimset0)
|
||||
!= nclistlength(node2->array.dimset0)) /* same arity */
|
||||
return 0;
|
||||
|
||||
/* Add hack to address the screwed up Columbia server */
|
||||
if(node1->nctype == NC_Dataset) return 1;
|
||||
|
||||
if(node1->nctype != node2->nctype) {
|
||||
/* test for struct-grid match */
|
||||
int structgrid = ((node1->nctype == NC_Grid && node2->nctype == NC_Structure)
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#if 0
|
||||
#define DAPDEBUG 1
|
||||
#define OCDEBUG
|
||||
#define OCDEBUG 1
|
||||
#endif
|
||||
|
||||
#include "ocdebug.h"
|
||||
|
26
libdap2/env
26
libdap2/env
@ -1,21 +1,20 @@
|
||||
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#'
|
||||
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;
|
||||
|
||||
#CON='xpos'
|
||||
#VAR=data
|
||||
|
||||
TOP="/home/dmh/mach/trunk"
|
||||
#TOP="/cygdrive/f/svn/trunk"
|
||||
#TOP="/cygdrive/c/Users/dmh/svn/trunk"
|
||||
|
||||
#PROG=./ncd
|
||||
PROG="$TOP/ncdump/ncdump"
|
||||
F="file://${TOP}/ncdap_test/testdata3/synth9"
|
||||
|
||||
PROG=./ncd
|
||||
#PROG="$TOP/ncdump/ncdump"
|
||||
|
||||
P=`pwd`
|
||||
|
||||
#F='http://colossus.dl.stevens-tech.edu/thredds/dodsC/fmrc/NYBight/NYHOPS_Forecast_Collection_for_the_New_York_Bight_best.ncd'
|
||||
#CON='xpos'
|
||||
#VAR=data
|
||||
|
||||
F="http://opendap.deltares.nl/opendap/test/testNcWithManyVariables/test3000.nc"
|
||||
|
||||
PARMS="log"
|
||||
#PARMS="${PARMS}&netcdf3"
|
||||
#PARMS="${PARMS}&fetch=disk"
|
||||
@ -23,13 +22,15 @@ PARMS="log"
|
||||
#PARMS="${PARMS}&nocache"
|
||||
#PARMS="${PARMS}&wholevar"
|
||||
PARMS="${PARMS}&show=fetch"
|
||||
#PARMS="${PARMS}&noprefetch"
|
||||
PARMS="${PARMS}&noprefetch"
|
||||
#PARMS="${PARMS}&prefetch"
|
||||
#PARMS="${PARMS}&prefetch=eager"
|
||||
|
||||
VARGS="--leak-check=full"
|
||||
|
||||
# Pick in order
|
||||
if test "x$PROG" = x ; then
|
||||
for f in ../ncdump/.libs/lt-ncdump ../ncdump/.libs/ncdump ../ncdump/ncdump ./ncd ; do
|
||||
for f in ./ncd ../ncdump/.libs/lt-ncdump ../ncdump/.libs/ncdump ../ncdump/ncdump ; do
|
||||
if test -f $f ; then
|
||||
PROG="$f"
|
||||
break;
|
||||
@ -50,8 +51,6 @@ UALL="$U${PARMS}"
|
||||
#ARGS="-c $ARGS"
|
||||
if test "x$VAR" != "x" ; then ARGS="$ARGS -v $VAR" ; fi
|
||||
|
||||
VARGS="--leak-check=full"
|
||||
|
||||
alias qq="gdb --args $PROG $ARGS '$U'"
|
||||
alias qv="valgrind $VARGS PROG $ARGS '$U'"
|
||||
alias q0="$PROG $ARGS '$UALL'"
|
||||
@ -116,4 +115,7 @@ CON="U50M_EOSGRID_Data_Fields[0:23][282:282][441:441],XDim_EOSGRID"
|
||||
F="http://opendap.co-ops.nos.noaa.gov/dods/IOOS/SixMin_Verified_Water_Level"
|
||||
CON="&WATERLEVEL_6MIN_VFD_PX._STATION_ID=%228779770%22&WATERLEVEL_6MIN_VFD_PX._DATUM=%22MSL%22&WATERLEVEL_6MIN_VFD_PX._BEGIN_DATE=%2220061001%22&WATERLEVEL_6MIN_VFD_PX._END_DATE=%2220061030%22"
|
||||
|
||||
F="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/.NASA-GMAO/.MONTHLY/.sst/dods"
|
||||
F="http://tiggeUser:tigge@thredds-test.ucar.edu/thredds/dodsC/restrict/testData.nc"
|
||||
F="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/.NASA-GMAO/.MONTHLY/.sst/dods"
|
||||
fi
|
||||
|
@ -21,8 +21,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Misc. code controls */
|
||||
#define FILLCONSTRAINT TRUE
|
||||
|
||||
/* Hopefully, this flag will someday not be needed */
|
||||
#define COLUMBIA_HACK "columbia.edu"
|
||||
|
||||
/* Use an extended version of the netCDF-4 type system */
|
||||
#define NC_URL 50
|
||||
@ -79,6 +82,9 @@ typedef unsigned int NCFLAGS;
|
||||
#define NCF_PREFETCH (0x0200) /* Cache prefetch enabled/disabled */
|
||||
#define NCF_PREFETCH_EAGER (0x0400) /* Do eager prefetch; 0=>lazy */
|
||||
#define NCF_PREFETCH_ALL (0x0800) /* Prefetch all variables */
|
||||
#ifdef COLUMBIA_HACK
|
||||
#define NCF_COLUMBIA (0x80000000) /* Hack for columbia server */
|
||||
#endif
|
||||
|
||||
/* Define all the default on flags */
|
||||
#define DFALT_ON_FLAGS (NCF_CACHE|NCF_PREFETCH)
|
||||
|
@ -50,6 +50,7 @@ static int
|
||||
ncd3initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
compute_nccalignments();
|
||||
for(i=0;i<NC_MAX_VAR_DIMS;i++) {
|
||||
dap_one[i] = 1;
|
||||
@ -123,6 +124,19 @@ NCD3_open(const char * path, int mode,
|
||||
if(!constrainable34(dapcomm->oc.url))
|
||||
SETFLAG(dapcomm->controls,NCF_UNCONSTRAINABLE);
|
||||
|
||||
#ifdef COLUMBIA_HACK
|
||||
{
|
||||
const char* p;
|
||||
/* Does this url look like it is from columbia? */
|
||||
if(dapcomm->oc.url->host != NULL) {
|
||||
for(p=dapcomm->oc.url->host;*p;p++) {
|
||||
if(strncmp(p,COLUMBIA_HACK,strlen(COLUMBIA_HACK))==0)
|
||||
SETFLAG(dapcomm->controls,NCF_COLUMBIA);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* fail if we are unconstrainable but have constraints */
|
||||
if(FLAGSET(dapcomm->controls,NCF_UNCONSTRAINABLE)) {
|
||||
if(dapcomm->oc.url->constraint != NULL) {
|
||||
@ -169,6 +183,10 @@ NCD3_open(const char * path, int mode,
|
||||
ocstat = oc_open(dapcomm->oc.urltext,&dapcomm->oc.conn);
|
||||
if(ocstat != OC_NOERR) {THROWCHK(ocstat); goto done;}
|
||||
|
||||
#ifdef DEBUG1
|
||||
(void)oc_trace_curl(dapcomm->oc.conn);
|
||||
#endif
|
||||
|
||||
nullfree(dapcomm->oc.urltext); /* clean up */
|
||||
dapcomm->oc.urltext = NULL;
|
||||
|
||||
|
@ -151,7 +151,7 @@ defrecorddim3(NCDAPCOMMON* dapcomm)
|
||||
NCerror
|
||||
defseqdims(NCDAPCOMMON* dapcomm)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int i = 0;
|
||||
NCerror ncstat = NC_NOERR;
|
||||
int seqdims = 1; /* default is to compute seq dims counts */
|
||||
|
||||
@ -169,7 +169,7 @@ defseqdims(NCDAPCOMMON* dapcomm)
|
||||
|
||||
for(i=0;i<nclistlength(dapcomm->cdf.ddsroot->tree->seqnodes);i++) {
|
||||
CDFnode* seq = (CDFnode*)nclistget(dapcomm->cdf.ddsroot->tree->seqnodes,i);
|
||||
size_t seqsize;
|
||||
size_t seqsize = 0;
|
||||
CDFnode* sqdim = NULL;
|
||||
CDFnode* container;
|
||||
/* Does this sequence match the requirements for use ? */
|
||||
@ -214,7 +214,7 @@ getseqdimsize(NCDAPCOMMON* dapcomm, CDFnode* seq, size_t* sizep)
|
||||
CDFnode* dxdroot;
|
||||
CDFnode* xseq;
|
||||
NCbytes* seqcountconstraints = ncbytesnew();
|
||||
size_t seqsize;
|
||||
size_t seqsize = 0;
|
||||
|
||||
/* Read the minimal amount of data in order to get the count */
|
||||
/* If the url is unconstrainable, then get the whole thing */
|
||||
@ -524,7 +524,8 @@ computeseqcountconstraints3r(NCDAPCOMMON* dapcomm, CDFnode* node, CDFnode** cand
|
||||
|
||||
candidate = NULL;
|
||||
compound = NULL;
|
||||
|
||||
if(node == NULL)
|
||||
return;
|
||||
for(i=0;i<nclistlength(node->subnodes);i++) {
|
||||
CDFnode* subnode = (CDFnode*)nclistget(node->subnodes,i);
|
||||
if(subnode->nctype == NC_Structure || subnode->nctype == NC_Grid)
|
||||
|
@ -1593,8 +1593,8 @@ NC_open(const char *path, int cmode,
|
||||
/* Need two pieces of information for now */
|
||||
int model = 0;
|
||||
int isurl = 0;
|
||||
int version;
|
||||
enum FileType filetype;
|
||||
int version = 0;
|
||||
enum FileType filetype = FT_UNKNOWN;
|
||||
|
||||
if(!nc_initialized) {
|
||||
stat = NC_initialize();
|
||||
|
@ -49,11 +49,23 @@ IF(HAVE_LIBDL)
|
||||
ENDIF()
|
||||
|
||||
IF(USE_HDF5 OR USE_NETCDF4)
|
||||
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
|
||||
IF(NOT MSVC)
|
||||
# Some version of cmake define HDF5_hdf5_LIBRARY instead of
|
||||
# HDF5_LIBRARY. Same with HDF5_HL_LIBRARY
|
||||
IF(HDF5_hdf5_LIBRARY AND NOT HDF5_C_LIBRARY)
|
||||
SET(HDF5_C_LIBRARY ${HDF5_hdf5_LIBRARY})
|
||||
ENDIF()
|
||||
IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARY)
|
||||
SET(HDF5_HL_LIBRARY ${HDF5_hdf5_hl_LIBRARY})
|
||||
ENDIF()
|
||||
SET(TLL_LIBS ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY} ${TLL_LIBS} ${SZIP_LIBRARY})
|
||||
ELSE() # Windows CMake defines HDF5_LIBRARIES.
|
||||
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(USE_DAP)
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES})
|
||||
SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
IF(USE_HDF4)
|
||||
|
@ -13,6 +13,7 @@ foreach (f ${m4_SOURCES})
|
||||
endforeach(f)
|
||||
|
||||
SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c lookup3.c ncio.c)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} ncstdio.h pstdint.h)
|
||||
|
||||
IF (BUILD_DISKLESS)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} memio.c)
|
||||
|
@ -5,13 +5,16 @@
|
||||
/* $Id: posixio.c,v 1.89 2010/05/22 21:59:08 dmh Exp $ */
|
||||
|
||||
/* For MinGW Build */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@ -1658,7 +1661,8 @@ posixio_open(const char *path,
|
||||
if(nciop == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
#ifdef O_BINARY
|
||||
//#ifdef O_BINARY
|
||||
#if _MSC_VER
|
||||
fSet(oflags, O_BINARY);
|
||||
#endif
|
||||
#ifdef vms
|
||||
@ -1723,13 +1727,28 @@ unwind_new:
|
||||
static int
|
||||
ncio_px_filesize(ncio *nciop, off_t *filesizep)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
|
||||
/* There is a problem with fstat on Windows based systems
|
||||
which manifests (so far) when Config RELEASE is built.
|
||||
Use _filelengthi64 isntead. */
|
||||
#ifdef HAVE_FILE_LENGTH_I64
|
||||
|
||||
__int64 file_len = 0;
|
||||
if( (file_len = _filelengthi64(nciop->fd)) < 0) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
*filesizep = file_len;
|
||||
|
||||
#else
|
||||
struct stat sb;
|
||||
assert(nciop != NULL);
|
||||
if (fstat(nciop->fd, &sb) < 0)
|
||||
return errno;
|
||||
*filesizep = sb.st_size;
|
||||
return ENOERR;
|
||||
#endif
|
||||
return ENOERR;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1742,8 +1761,9 @@ ncio_px_filesize(ncio *nciop, off_t *filesizep)
|
||||
static int
|
||||
ncio_px_pad_length(ncio *nciop, off_t length)
|
||||
{
|
||||
int status = ENOERR;
|
||||
|
||||
int status = ENOERR;
|
||||
printf("\nncio_px_pad_length entered.\n");
|
||||
if(nciop == NULL)
|
||||
return EINVAL;
|
||||
|
||||
|
@ -201,12 +201,12 @@ nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep,
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* Check a set of chunksizes to see if they add up to a chunk that is too big. */
|
||||
/* Check a set of chunksizes to see if they specify a chunk that is too big. */
|
||||
static int
|
||||
check_chunksizes(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const size_t *chunksizes)
|
||||
{
|
||||
NC_TYPE_INFO_T *type_info;
|
||||
float total;
|
||||
double dprod;
|
||||
size_t type_len;
|
||||
int d;
|
||||
int retval;
|
||||
@ -216,17 +216,17 @@ check_chunksizes(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const size_t *chunksize
|
||||
if ((retval = nc4_find_type(grp->nc4_info, var->xtype, &type_info)))
|
||||
return retval;
|
||||
if (type_info && type_info->class == NC_VLEN)
|
||||
total = sizeof(hvl_t);
|
||||
dprod = (double) sizeof(hvl_t);
|
||||
else
|
||||
total = type_len;
|
||||
dprod = (double) type_len;
|
||||
for (d = 0; d < var->ndims; d++)
|
||||
{
|
||||
if (chunksizes[d] < 1)
|
||||
return NC_EINVAL;
|
||||
total *= chunksizes[d];
|
||||
dprod *= (double) chunksizes[d];
|
||||
}
|
||||
|
||||
if (total > NC_MAX_UINT)
|
||||
if (dprod > (double) NC_MAX_UINT)
|
||||
return NC_EBADCHUNK;
|
||||
|
||||
return NC_NOERR;
|
||||
@ -243,7 +243,7 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
int retval;
|
||||
#ifdef LOGGING
|
||||
int max_dim;
|
||||
float total_chunk_size;
|
||||
double total_chunk_size;
|
||||
#endif
|
||||
|
||||
if (var->type_info->nc_typeid == NC_STRING)
|
||||
@ -254,7 +254,7 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
/* Later this will become the total number of bytes in the default
|
||||
* chunk. */
|
||||
#ifdef LOGGING
|
||||
total_chunk_size = type_size;
|
||||
total_chunk_size = (double) type_size;
|
||||
#endif
|
||||
|
||||
/* How many values in the variable (or one record, if there are
|
||||
@ -297,7 +297,7 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
/* Find total chunk size. */
|
||||
#ifdef LOGGING
|
||||
for (d = 0; d < var->ndims; d++)
|
||||
total_chunk_size *= var->chunksizes[d];
|
||||
total_chunk_size *= (double) var->chunksizes[d];
|
||||
LOG((4, "total_chunk_size %f", total_chunk_size));
|
||||
#endif
|
||||
|
||||
|
221
man4/esg.html
Normal file
221
man4/esg.html
Normal file
@ -0,0 +1,221 @@
|
||||
<html><!-- InstanceBegin template="/Templates/MyUnidata.dwt" codeOutsideHTMLIsLocked="true" -->
|
||||
<!-- This document is kept in netcdf-c/man4;
|
||||
it is not normally included in the distribution.
|
||||
-->
|
||||
<head>
|
||||
<!-- InstanceBeginEditable name="Title" -->
|
||||
<TITLE>Accessing ESG Datasets</TITLE>
|
||||
<META NAME="UIINDEX" CONTENT="0">
|
||||
<META NAME="BOOKMARK" CONTENT="ESG Access">
|
||||
<META NAME="AUTHOR" CONTENT="Heimbigner">
|
||||
<META NAME="KEYWORDS" CONTENT="netcdf, authorization, ESG, truststore keystore">
|
||||
<META NAME="DESCRIPTION" CONTENT="Describe in detail how to establish access to ESG servers">
|
||||
<!-- InstanceEndEditable -->
|
||||
</head>
|
||||
<body>
|
||||
<h1>Accessing ESG Data Through netCDF</h1>
|
||||
|
||||
<h2><a name="Introduction"><u>Introduction</u></a></h2>
|
||||
It is possible to access Earth Systems Grid (ESG) datasets
|
||||
from ESG servers through the netCDF API.
|
||||
This requires building the netCDF library with DAP2 protocol support
|
||||
using the "--enable-dap" flag to the configure program.
|
||||
<p>
|
||||
In order to access ESG datasets, however, it is necessary to
|
||||
register as a user with ESG and to setup your environment
|
||||
so that proper authentication is established between a netCDF
|
||||
client program and the ESG data server. Specifically, it
|
||||
is necessary to use what is called "client-side keys" to
|
||||
enable this authentication. Normally, when a client accesses
|
||||
a server in a secure fashion (using "https"), the server
|
||||
provides an authentication certificate to the client.
|
||||
With client-side keys, the client must also provide a
|
||||
certificate to the server so that the server can know with
|
||||
whom it is communicating.
|
||||
<p>
|
||||
It is possible to set up the netCDF library to use
|
||||
client-side keys, although the process is
|
||||
somewhat complicated. The DAP2 support in netCDF
|
||||
uses the <i>curl</i> library and it is that underlying library
|
||||
that must be properly configured.
|
||||
|
||||
<h2><a name="terms"><u>Terminology</u></a></h2>
|
||||
The key elements for client-side keys requires the constructions of
|
||||
two "stores" on the client side.
|
||||
<ul>
|
||||
<li> Keystore - a repository to hold the client side key.
|
||||
<li> Truststore - a repository to hold a chain of certificates
|
||||
that can be used to validate the certificate
|
||||
sent by the server to the client.
|
||||
</ul>
|
||||
The server actually has a similar set of stores, but the client
|
||||
need not be concerned with those.
|
||||
|
||||
<h2><a name="steps1"><u>Initial Steps</u></a></h2>
|
||||
|
||||
The first step is to obtain authorization from ESG.
|
||||
Note that this information may evolve over time, and
|
||||
may be out of date.
|
||||
This discussion is in terms of BADC ESG. You will need
|
||||
to substitute the ESG site for BADC in the following.
|
||||
<ol>
|
||||
<li> Register at http://badc.nerc.ac.uk/register
|
||||
to obtain access to badc and to obtain an openid,
|
||||
which will looks something like:
|
||||
<pre>https://ceda.ac.uk/openid/Firstname.Lastname</pre>
|
||||
<li> Ask BADC for access to whatever datasets are of interest.
|
||||
<p>
|
||||
<li> Obtain short term credentials at
|
||||
http://grid.ncsa.illinois.edu/myproxy/MyProxyLogon/
|
||||
You will need to download and run the MyProxyLogon
|
||||
program.
|
||||
This will create a keyfile in, typically, the directory globus.
|
||||
The keyfile will have a name similar to this: x509up_u13615
|
||||
The other elements in ~/.globus are certificates to use in
|
||||
validating the certificate your client gets from the server.
|
||||
<p>
|
||||
<li> Obtain the program source ImportKey.java
|
||||
from this location: http://www.agentbob.info/agentbob/79-AB.html
|
||||
(read the whole page, it will help you understand the remaining steps).
|
||||
</ol>
|
||||
|
||||
<h2><a name="steps2"><u>Building the KeyStore</u></a></h2>
|
||||
You will have to modify the keyfile in the previous step
|
||||
and then create a keystore and install the key and a certificate.
|
||||
The commands are these:
|
||||
<pre>
|
||||
openssl pkcs8 -topk8 -nocrypt -in x509up_u13615 -inform PEM -out key.der -outform DER
|
||||
|
||||
openssl x509 -in x509up_u13615 -inform PEM -out cert.der -outform DER
|
||||
|
||||
java -classpath <path to ImportKey.class> -Dkeypassword="<password>" -Dkeystore=./<keystorefilename> key.der cert.der
|
||||
</pre>
|
||||
Note, the file names "key.der" and "cert.der" can be whatever you choose.
|
||||
It is probably best to leave the .der extension, though.
|
||||
|
||||
<h2><a name="steps2"><u>Building the TrustStore</u></a></h2>
|
||||
Building the truststore is a bit tricky because as provided, the
|
||||
certificates in "globus" need some massaging. See the script below
|
||||
for the details. The primary command is this, which is executed for every
|
||||
certificate, c, in globus. It sticks the certificate into the file
|
||||
named "truststore"
|
||||
<pre>
|
||||
keytool -trustcacerts -storepass "password" -v -keystore "truststore" -importcert -file "${c}"
|
||||
</pre>
|
||||
|
||||
<h2><a name="steps2"><u>Running the C Client</u></a></h2>
|
||||
|
||||
The file ".dodsrc" is used to configure curl. This file must
|
||||
reside either in the current directory or in your home directory.
|
||||
It has lines of the form
|
||||
<ul>
|
||||
<li>KEY=VALUE, or
|
||||
<li>[http//x.y/]KEY=VALUE
|
||||
</ul>
|
||||
The first form provides a configuration parameter that applies
|
||||
to all DAP2 accesses. The second form only applies
|
||||
to accesses to the server at "x.y".
|
||||
<p>
|
||||
The following keys must be set in ".dodsrc" to support
|
||||
ESG access.
|
||||
<ul>
|
||||
<li> HTTP.SSL.VALIDATE=1
|
||||
<li> HTTP.COOKIEJAR=.dods_cookies
|
||||
<li> HTTP.SSL.CERTIFICATE=esgkeystore
|
||||
<li> HTTP.SSL.KEY=esgkeystore
|
||||
<li> HTTP.SSL.CAPATH=.globus
|
||||
</ul>
|
||||
For ESG, the HTTP.SSL.CERTIFICATE and HTTP.SSL.KEY
|
||||
entries should have same value, which is the file path for the
|
||||
certificate produced by MyProxyLogon. The HTTP.SSL.CAPATH entry
|
||||
should be the path to the "certificates" directory produced by
|
||||
MyProxyLogon.
|
||||
|
||||
<h2><a name="steps2"><u>Running the Java Client</u></a></h2>
|
||||
If you are using the Java netCDF client, then you need to add
|
||||
some parameters to the "java" command. Specifically, add the following
|
||||
flags.
|
||||
<pre>
|
||||
-Dkeystore="path to keystore file" -Dkeystorepassword="keystore password"
|
||||
</pre>
|
||||
|
||||
<h2><a name="script"><u>Script for creating Stores</u></a></h2>
|
||||
The following script shows in detail how to actually construct the key
|
||||
and trust stores. It is specific to the format of the globus file
|
||||
as it was when ESG support was first added. It may have changed
|
||||
since then, in which case, you will need to seek some help
|
||||
in fixing this script. It would help if you communicated
|
||||
what you changed to the author so this document can be updated.
|
||||
<pre>
|
||||
#!/bin/sh -x
|
||||
KEYSTORE="esgkeystore"
|
||||
TRUSTSTORE="esgtruststore"
|
||||
GLOBUS="globus"
|
||||
TRUSTROOT="certificates"
|
||||
CERT="x509up_u13615"
|
||||
TRUSTROOTPATH="$GLOBUS/$TRUSTROOT"
|
||||
CERTFILE="$GLOBUS/$CERT"
|
||||
PWD="password"
|
||||
|
||||
D="-Dglobus=$GLOBUS"
|
||||
CCP="bcprov-jdk16-145.jar"
|
||||
CP="./build:${CCP}"
|
||||
JAR="myproxy.jar"
|
||||
|
||||
# Initialize needed directories
|
||||
rm -fr build
|
||||
mkdir build
|
||||
rm -fr $GLOBUS
|
||||
mkdir $GLOBUS
|
||||
rm -f $KEYSTORE
|
||||
rm -f $TRUSTSTORE
|
||||
|
||||
# Compile MyProxyCmd and ImportKey
|
||||
javac -d ./build -classpath "$CCP" *.java
|
||||
javac -d ./build ImportKey.java
|
||||
|
||||
# Execute MyProxyCmd
|
||||
java -cp "$CP myproxy.MyProxyCmd
|
||||
|
||||
# Build the keystore
|
||||
openssl pkcs8 -topk8 -nocrypt -in $CERTFILE -inform PEM -out key.der -outform DER
|
||||
openssl x509 -in $CERTFILE -inform PEM -out cert.der -outform DER
|
||||
java -Dkeypassword=$PWD -Dkeystore=./${KEYSTORE} -cp ./build ImportKey key.der cert.der
|
||||
|
||||
# Clean up the certificates in the globus directory
|
||||
for c in ${TRUSTROOTPATH}/*.0 ; do
|
||||
alias=`basename $c .0`
|
||||
sed -e '0,/---/d' <$c >/tmp/${alias}
|
||||
echo "-----BEGIN CERTIFICATE-----" >$c
|
||||
cat /tmp/${alias} >>$c
|
||||
done
|
||||
|
||||
# Build the truststore
|
||||
for c in ${TRUSTROOTPATH}/*.0 ; do
|
||||
alias=`basename $c .0`
|
||||
echo "adding: $TRUSTROOTPATH/${c}"
|
||||
echo "alias: $alias"
|
||||
yes | keytool -trustcacerts -storepass "$PWD" -v -keystore ./$TRUSTSTORE -alias $alias -importcert -file "${c}"
|
||||
done
|
||||
exit
|
||||
</pre>
|
||||
|
||||
<h2><a name="changelog"><u>Change Log</u></a></h2>
|
||||
<b>Version 1.0:</b>
|
||||
<ul>
|
||||
<li>10/17/2013 – Initial Release
|
||||
</ul>
|
||||
|
||||
<h2><a name="docinfo"><u>Document Information</u></a></h2>
|
||||
<table>
|
||||
<tr><td>Created:<td>10/17/2013
|
||||
<tr><td>Last Revised:<td>10/17/2013<br>
|
||||
<tr><td>Version:<td>1.0
|
||||
<tr><td>Author:<td>Dennis Heimbigner
|
||||
<tr><td>Affiliation:<td>Unidata/UCAR
|
||||
<tr><td>email:<td>dmh@unida.ucar.edu
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
|
@ -25,14 +25,14 @@ netCDF4+DAP | [netCDF4.3.0-NC4-DAP-32.exe][r4] | [netCDF4.3.0-NC4-DAP-64.exe][r
|
||||
|
||||
|
||||
|
||||
## Latest Release Candidate (netCDF-C 4.3.1-rc3)
|
||||
## Latest Release Candidate (netCDF-C 4.3.1-rc4)
|
||||
|
||||
Configuration | 32-bit | 64-bit |
|
||||
:-------------------|:-------- |:-------|
|
||||
netCDF 3 | [netCDF4.3.1-rc3-NC3-32.exe][rc1] | [netCDF4.3.1-rc3-NC3-64.exe][rc5]
|
||||
netCDF3+DAP | [netCDF4.3.1-rc3-NC3-DAP-32.exe][rc2] | [netCDF4.3.1-rc3-NC3-DAP-64.exe][rc6]
|
||||
netCDF4 | [netCDF4.3.1-rc3-NC4-32.exe][rc3] | [netCDF4.3.1-rc3-NC4-64.exe][rc7]
|
||||
netCDF4+DAP | [netCDF4.3.1-rc3-NC4-DAP-32.exe][rc4] | [netCDF4.3.1-rc3-NC4-DAP-64.exe][rc8]
|
||||
netCDF 3 | [netCDF4.3.1-rc4-NC3-32.exe][rc1] | [netCDF4.3.1-rc4-NC3-64.exe][rc5]
|
||||
netCDF3+DAP | [netCDF4.3.1-rc4-NC3-DAP-32.exe][rc2] | [netCDF4.3.1-rc4-NC3-DAP-64.exe][rc6]
|
||||
netCDF4 | [netCDF4.3.1-rc4-NC4-32.exe][rc3] | [netCDF4.3.1-rc4-NC4-64.exe][rc7]
|
||||
netCDF4+DAP | [netCDF4.3.1-rc4-NC4-DAP-32.exe][rc4] | [netCDF4.3.1-rc4-NC4-DAP-64.exe][rc8]
|
||||
|
||||
# Using the netCDF-C Libraries with Visual Studio
|
||||
In order to use the netcdf libraries, you must ensure that the .dll files (along with any dependencies from deps/shared/bin) are on the system path. In order to compile a program using these libraries, you must first link your program against the appropriate 'import' (.lib) libraries.
|
||||
@ -62,11 +62,11 @@ When installed, the netCDF libraries are placed in the specified locations, alon
|
||||
[r8]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.0-NC4-DAP-64.exe
|
||||
|
||||
|
||||
[rc1]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC3-32.exe
|
||||
[rc2]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC3-DAP-32.exe
|
||||
[rc3]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC4-32.exe
|
||||
[rc4]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC4-DAP-32.exe
|
||||
[rc5]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC3-64.exe
|
||||
[rc6]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC3-DAP-64.exe
|
||||
[rc7]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC4-64.exe
|
||||
[rc8]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc3-NC4-DAP-64.exe
|
||||
[rc1]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC3-32.exe
|
||||
[rc2]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC3-DAP-32.exe
|
||||
[rc3]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC4-32.exe
|
||||
[rc4]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC4-DAP-32.exe
|
||||
[rc5]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC3-64.exe
|
||||
[rc6]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC3-DAP-64.exe
|
||||
[rc7]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC4-64.exe
|
||||
[rc8]: http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3.1-rc4-NC4-DAP-64.exe
|
||||
|
@ -69,6 +69,10 @@ ENDIF()
|
||||
# Copy some test files from current source dir to out-of-tree build dir.
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
|
||||
IF(MSVC)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
|
||||
ENDIF()
|
||||
|
||||
|
||||
## Specify files to be distributed by 'make dist'
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
|
@ -10,6 +10,7 @@
|
||||
$Id: tst_big_var2.c,v 1.3 2010/05/19 16:38:44 russ Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <nc_tests.h>
|
||||
#include <netcdf.h>
|
||||
#include <stdio.h>
|
||||
@ -49,9 +50,10 @@ test_big_var(const char *testfile)
|
||||
size_t start[NUMDIMS] = {0, 0, 0};
|
||||
size_t count[NUMDIMS] = {1, DIM1, DIM2};
|
||||
signed char data[DIM1][DIM2];
|
||||
|
||||
int i, j;
|
||||
int nerrs = 0;
|
||||
|
||||
|
||||
/* Create a file with one big variable. */
|
||||
if (nc_create(testfile, NC_CLOBBER, &ncid)) ERR;
|
||||
if (nc_set_fill(ncid, NC_NOFILL, NULL)) ERR;
|
||||
@ -103,13 +105,14 @@ test_big_var(const char *testfile)
|
||||
{
|
||||
if (data[i][j] != 19 )
|
||||
{
|
||||
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
|
||||
start[0], i, j, 19, data[i][j]);
|
||||
ERR;
|
||||
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
|
||||
start[0], i, j, 19, data[i][j]);
|
||||
ERR;
|
||||
if(nerrs++ > 1)
|
||||
return nerrs;
|
||||
}
|
||||
}
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ main(int argc, char **argv)
|
||||
if (long_in != lval) ERR;
|
||||
|
||||
/* This should fail. */
|
||||
coord[3] = 100;
|
||||
if (nc_get_var1_ushort(ncid, varid, &coord[3],
|
||||
coord[0] = 5;
|
||||
if (nc_get_var1_ushort(ncid, varid, coord,
|
||||
&ushort_in) != NC_EINVALCOORDS) ERR;
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
@ -162,8 +162,8 @@ main(int argc, char **argv)
|
||||
if (long_in != lval) ERR;
|
||||
|
||||
/* This should fail. */
|
||||
coord[3] = 100;
|
||||
if (nc_get_var1_ushort(ncid, varid, &coord[3],
|
||||
coord[0] = 5;
|
||||
if (nc_get_var1_ushort(ncid, varid, coord,
|
||||
&ushort_in) != NC_EINVALCOORDS) ERR;
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
@ -40,6 +40,7 @@ IF(ENABLE_TESTS)
|
||||
add_bin_test(ncdap test_nstride_cached)
|
||||
add_bin_test(ncdap test_partvar)
|
||||
add_bin_test(ncdap test_varm3)
|
||||
add_bin_test(ncdap t_auth)
|
||||
|
||||
ENDIF()
|
||||
|
||||
@ -57,4 +58,4 @@ ADD_SUBDIRECTORY(testdata3)
|
||||
## Specify files to be distributed by 'make dist'
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
@ -37,16 +37,19 @@ test_partvar_SOURCES = test_partvar.c
|
||||
test_varm3_SOURCES = test_varm3.c
|
||||
t_dap3a_SOURCES = t_dap3a.c
|
||||
test_nstride_cached_SOURCE = test_nstride_cached.c
|
||||
t_auth_SOURCES = t_auth.c
|
||||
|
||||
TESTS += t_dap3a test_cvt3 test_vara test_partvar
|
||||
TESTS += test_varm3
|
||||
TESTS += t_dap3a
|
||||
TESTS += test_nstride_cached
|
||||
TESTS += t_auth
|
||||
|
||||
check_PROGRAMS += t_dap3a test_cvt3 test_vara test_partvar
|
||||
check_PROGRAMS += test_varm3
|
||||
check_PROGRAMS += t_dap3a
|
||||
check_PROGRAMS += test_nstride_cached
|
||||
check_PROGRAMS += t_auth
|
||||
|
||||
endif #ENABLE_DAP_REMOTE_TESTS
|
||||
|
||||
|
29
ncdap_test/t_auth.c
Normal file
29
ncdap_test/t_auth.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <netcdf.h>
|
||||
|
||||
#define BASICAUTHURL "http://tiggeUser:tigge@thredds-test.ucar.edu/thredds/dodsC/restrict/testData.nc"
|
||||
|
||||
static void
|
||||
CHECK(int e, const char* msg)
|
||||
{
|
||||
if(e == NC_NOERR) return;
|
||||
if(msg == NULL) msg = "Error";
|
||||
printf("%s: %s\n", msg, nc_strerror(e));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int ncid,retval;
|
||||
|
||||
printf("Testing: Http Basic Authorization\n");
|
||||
retval = nc_open(BASICAUTHURL, 0, &ncid);
|
||||
CHECK(retval,"*** Fail: Http Basic Authorization");
|
||||
retval = nc_close(ncid);
|
||||
printf("*** PASS: Http Basic Authorization\n");
|
||||
return 0;
|
||||
}
|
@ -30,8 +30,9 @@ if test "x$timing" = "x1" ; then leakcheck=0; fi
|
||||
|
||||
# get the list of test files
|
||||
# Currently C2 fails because server is not responding
|
||||
#WHICHTESTS="S1 C1 C2"
|
||||
WHICHTESTS="S1 C1"
|
||||
#WHICHTESTS="S1 C1 C2 CB"
|
||||
#WHICHTESTS="S1 C1 CB"
|
||||
WHICHTESTS="CB"
|
||||
if test -n "$longtests"; then
|
||||
WHICHTESTS="${WHICHTESTS} L1 LC1 LC2"
|
||||
fi
|
||||
@ -141,6 +142,10 @@ REMOTETESTSLC2="slp_aggregated;1;slp.slp[23255:23316][29:29][88:88]"
|
||||
# Unknown problem: test.07;2;&age>2
|
||||
IGNORE="test.07.2"
|
||||
|
||||
# Columbia hack test
|
||||
REMOTEURLCB="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/.NASA-GMAO/.MONTHLY/.sst"
|
||||
REMOTETESTSCB="dods"
|
||||
|
||||
# Known to fail
|
||||
|
||||
XFAILTESTS3=""
|
||||
|
@ -146,12 +146,12 @@ ADD_SUBDIRECTORY(expected4)
|
||||
|
||||
## Specify files to be distributed by 'make dist'
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} test0.cdl ref_ctest1_nc4.cdl ref_ctest1_nc4c.cdl ref_tst_solar_1.cdl ref_tst_solar_2.cdl ref_tst_small.cdl tst_ncml.cdl ref1.ncml ref_tst_group_data.cdl ref_tst_enum_data.cdl ref_tst_opaque_data.cdl ref_tst_string_data.cdl ref_tst_vlen_data.cdl ref_tst_comp.cdl ref_tst_unicode.cdl ref_tst_nans.cdl small.cdl small2.cdl ref_tst_utf8.cdl ref_tst_fillbug.cdl tst_calendars.cdl ref_times.cdl ref_tst_special_atts.cdl ref_tst_noncoord.cdl ref_tst_compounds2.nc ref_tst_compounds2.cdl ref_tst_compounds3.nc ref_tst_compounds3.cdl ref_tst_compounds4.nc ref_tst_compounds4.cdl ref_tst_group_data_v23.cdl tst_mslp.cdl ref_tst_format_att.cdl ref_tst_format_att_64.cdl ref_nc_test_netcdf4_4_0.nc ref_nc_test_netcdf4.cdl ref_tst_special_atts3.cdl tst_brecs.cdl ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl ref_tst_charfill.cdl tst_charfill.cdl ref_tst_mud4.cdl ref_tst_ncf213.cdl CMakeLists.txt Makefile.am XGetopt.c nccopy.1 ncdump.1)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} test0.cdl ref_ctest1_nc4.cdl ref_ctest1_nc4c.cdl ref_tst_solar_1.cdl ref_tst_solar_2.cdl ref_tst_small.cdl tst_ncml.cdl ref1.ncml ref_tst_group_data.cdl ref_tst_enum_data.cdl ref_tst_opaque_data.cdl ref_tst_string_data.cdl ref_tst_vlen_data.cdl ref_tst_comp.cdl ref_tst_unicode.cdl ref_tst_nans.cdl small.cdl small2.cdl ref_tst_utf8.cdl ref_tst_fillbug.cdl tst_calendars.cdl ref_times.cdl ref_tst_special_atts.cdl ref_tst_noncoord.cdl ref_tst_compounds2.nc ref_tst_compounds2.cdl ref_tst_compounds3.nc ref_tst_compounds3.cdl ref_tst_compounds4.nc ref_tst_compounds4.cdl ref_tst_group_data_v23.cdl tst_mslp.cdl ref_tst_format_att.cdl ref_tst_format_att_64.cdl ref_nc_test_netcdf4_4_0.nc ref_nc_test_netcdf4.cdl ref_tst_special_atts3.cdl tst_brecs.cdl ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl ref_tst_charfill.cdl tst_charfill.cdl ref_tst_mud4.cdl ref_tst_mud4-bc.cdl ref_tst_ncf213.cdl CMakeLists.txt Makefile.am XGetopt.c nccopy.1 ncdump.1)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
||||
|
||||
|
||||
SET(CLEANFILES test0.nc test1.cdl test1.nc test2.cdl ctest1.cdl ctest.c ctest64.c ctest0.nc ctest0_64.nc c1.cdl ctest1_64.cdl c0.nc small.nc small2.nc c0tmp.nc c1.ncml utf8.cdl utf8_64.cdl utf8.nc utf8_64.nc tmp.cdl tst_vlen_data.nc tst_utf8.nc tst_special_atts.nc tst_unicode.nc tst_solar_2.nc tst_string_data.nc tst_calendars.nc tst_nans.nc tst_opaque_data.nc tst_solar_cmp.nc tst_enum_data.nc tst_solar_1.nc tst_mslp_64.nc tst_mslp.nc tst_comp2.nc tst_ncml.nc tst_fillbug.nc tst_group_data.nc tst_small.nc tst_comp.nc tst_unicode.cdl tst_group_data.cdl tst_compounds2.cdl tst_comp.cdl tst_enum_data.cdl tst_small.cdl tst_times.cdl tst_solar_2.cdl tst_string_data.cdl tst_fillbug.cdl tst_opaque_data.cdl tst_compounds4.cdl tst_utf8.cdl tst_compounds3.cdl tst_special_atts.cdl tst_nans.cdl tst_format_att_64.cdl tst_vlen_data.cdl tst_solar_1.cdl tst_format_att.cdl tst_inflated.nc tmp_subset.cdl tst_inflated4.nc tst_deflated.nc tst_chunking.nc tmp*.nc tst_charfill.nc tmp_tst_charfill.cdl iter.* tst_nc_test_netcdf4_4_0.cdl)
|
||||
SET(CLEANFILES test0.nc test1.cdl test1.nc test2.cdl ctest1.cdl ctest.c ctest64.c ctest0.nc ctest0_64.nc c1.cdl c1_4.cdl ctest1_64.cdl c0.nc c0_4.nc small.nc small2.nc c0tmp.nc c1.ncml utf8.cdl utf8_64.cdl utf8.nc utf8_64.nc tmp.cdl tst_vlen_data.nc tst_utf8.nc tst_special_atts.nc tst_unicode.nc tst_solar_2.nc tst_string_data.nc tst_calendars.nc tst_nans.nc tst_opaque_data.nc tst_solar_cmp.nc tst_enum_data.nc tst_solar_1.nc tst_mslp_64.nc tst_mslp.nc tst_comp2.nc tst_ncml.nc tst_fillbug.nc tst_group_data.nc tst_small.nc tst_comp.nc tst_unicode.cdl tst_group_data.cdl tst_compounds2.cdl tst_comp.cdl tst_enum_data.cdl tst_small.cdl tst_times.cdl tst_solar_2.cdl tst_string_data.cdl tst_fillbug.cdl tst_opaque_data.cdl tst_compounds4.cdl tst_utf8.cdl tst_compounds3.cdl tst_special_atts.cdl tst_nans.cdl tst_format_att_64.cdl tst_vlen_data.cdl tst_solar_1.cdl tst_format_att.cdl tst_inflated.nc tmp_subset.cdl tst_inflated4.nc tst_deflated.nc tst_chunking.nc tmp*.nc tst_charfill.nc tmp_tst_charfill.cdl iter.* tst_nc_test_netcdf4_4_0.cdl tst_mud4.nc tst_mud4.cdl tst_mud4-bc.cdl)
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
||||
|
||||
|
@ -85,7 +85,7 @@ endif
|
||||
endif BUILD_TESTSETS
|
||||
|
||||
CLEANFILES = test0.nc test1.cdl test1.nc test2.cdl ctest1.cdl \
|
||||
ctest0.nc ctest0_64.nc c1.cdl ctest1_64.cdl c0.nc small.nc \
|
||||
ctest0.nc ctest0_64.nc c1.cdl c1_4.cdl ctest1_64.cdl c0.nc c0_4.nc small.nc \
|
||||
small2.nc c0tmp.nc c1.ncml utf8.cdl utf8_64.cdl utf8.nc utf8_64.nc \
|
||||
tmp.cdl tst_vlen_data.nc tst_utf8.nc tst_special_atts.nc \
|
||||
tst_unicode.nc tst_solar_2.nc tst_string_data.nc tst_calendars.nc \
|
||||
@ -101,7 +101,7 @@ tst_vlen_data.cdl tst_solar_1.cdl tst_format_att.cdl tst_inflated.nc \
|
||||
tmp_subset.cdl tst_inflated4.nc tst_deflated.nc tst_chunking.nc tmp*.nc \
|
||||
tst_charfill.nc tmp_tst_charfill.cdl \
|
||||
iter.* \
|
||||
tst_nc_test_netcdf4_4_0.cdl tst_mud4.nc tst_mud4.cdl \
|
||||
tst_nc_test_netcdf4_4_0.cdl tst_mud4.nc tst_mud4.cdl tst_mud4-bc.cdl \
|
||||
tst_ncf213.cdl tst_ncf213.nc tst_h_scalar.cdl tst_h_scalar.nc
|
||||
|
||||
# These files all have to be included with the distribution.
|
||||
@ -122,7 +122,7 @@ tst_nccopy4.sh ref_nc_test_netcdf4_4_0.nc run_back_comp_tests.sh \
|
||||
ref_nc_test_netcdf4.cdl ref_tst_special_atts3.cdl tst_brecs.cdl \
|
||||
ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl tst_grp_spec.sh \
|
||||
ref_tst_charfill.cdl tst_charfill.cdl tst_charfill.sh \
|
||||
tst_iter.sh tst_mud.sh ref_tst_mud4.cdl \
|
||||
tst_iter.sh tst_mud.sh ref_tst_mud4.cdl ref_tst_mud4-bc.cdl \
|
||||
ref_tst_ncf213.cdl cdl4/ref_tst_h_scalar.cdl tst_h_scalar.sh CMakeLists.txt \
|
||||
XGetopt.c
|
||||
|
||||
|
2587
ncdump/ctest.c
2587
ncdump/ctest.c
File diff suppressed because it is too large
Load Diff
2587
ncdump/ctest64.c
2587
ncdump/ctest64.c
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,10 @@ variables:
|
||||
f:c = "x" ;
|
||||
double d ;
|
||||
d:c = "abcd\tZ$&" ;
|
||||
int64 i64 ;
|
||||
i64:att_int64 = 1L ;
|
||||
uint64 ui64 ;
|
||||
ui64:att_uint64 = 1UL ;
|
||||
char cr(Dr) ;
|
||||
byte br(Dr) ;
|
||||
short sr(Dr) ;
|
||||
@ -123,6 +127,10 @@ data:
|
||||
|
||||
d = -10 ;
|
||||
|
||||
i64 = 9223372036854775807 ;
|
||||
|
||||
ui64 = 18446744073709551615 ;
|
||||
|
||||
cr = "ab" ;
|
||||
|
||||
br = -128, 127 ;
|
||||
|
176
ncdump/ref_tst_mud4-bc.cdl
Normal file
176
ncdump/ref_tst_mud4-bc.cdl
Normal file
@ -0,0 +1,176 @@
|
||||
netcdf tst_mud4 {
|
||||
dimensions:
|
||||
F0 = 1 ;
|
||||
F1 = 2 ;
|
||||
F2 = 3 ;
|
||||
F3 = 5 ;
|
||||
U0 = UNLIMITED ; // (1 currently)
|
||||
U1 = UNLIMITED ; // (2 currently)
|
||||
U2 = UNLIMITED ; // (3 currently)
|
||||
U3 = UNLIMITED ; // (5 currently)
|
||||
variables:
|
||||
int ff(F1, F2) ;
|
||||
int uf(U1, F2) ;
|
||||
int fu(F1, U2) ;
|
||||
int uu(U1, U2) ;
|
||||
int ufff(U0, F1, F2, F3) ;
|
||||
int uffu(U0, F1, F2, U3) ;
|
||||
int ufuf(U0, F1, U2, F3) ;
|
||||
int ufuu(U0, F1, U2, U3) ;
|
||||
int uuff(U0, U1, F2, F3) ;
|
||||
int uufu(U0, U1, F2, U3) ;
|
||||
int uuuf(U0, U1, U2, F3) ;
|
||||
int uuuu(U0, U1, U2, U3) ;
|
||||
int ffff(F0, F1, F2, F3) ;
|
||||
data:
|
||||
|
||||
ff =
|
||||
// ff(0, 0-2)
|
||||
1, 2, 3,
|
||||
// ff(1, 0-2)
|
||||
4, 5, 6 ;
|
||||
|
||||
uf =
|
||||
// uf(0, 0-2)
|
||||
1, 2, 3,
|
||||
// uf(1, 0-2)
|
||||
4, 5, 6 ;
|
||||
|
||||
fu =
|
||||
{// fu(0, 0-2)
|
||||
1, 2, 3},
|
||||
{// fu(1, 0-2)
|
||||
4, 5, 6} ;
|
||||
|
||||
uu =
|
||||
{// uu(0, 0-2)
|
||||
1, 2, 3},
|
||||
{// uu(1, 0-2)
|
||||
4, 5, 6} ;
|
||||
|
||||
ufff =
|
||||
// ufff(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5,
|
||||
// ufff(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10,
|
||||
// ufff(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15,
|
||||
// ufff(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20,
|
||||
// ufff(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25,
|
||||
// ufff(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30 ;
|
||||
|
||||
uffu =
|
||||
{// uffu(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5},
|
||||
{// uffu(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10},
|
||||
{// uffu(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15},
|
||||
{// uffu(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20},
|
||||
{// uffu(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25},
|
||||
{// uffu(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30} ;
|
||||
|
||||
ufuf =
|
||||
{// ufuf(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5,
|
||||
// ufuf(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10,
|
||||
// ufuf(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15},
|
||||
{// ufuf(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20,
|
||||
// ufuf(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25,
|
||||
// ufuf(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30} ;
|
||||
|
||||
ufuu =
|
||||
{{// ufuu(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5},
|
||||
{// ufuu(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10},
|
||||
{// ufuu(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15}},
|
||||
{{// ufuu(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20},
|
||||
{// ufuu(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25},
|
||||
{// ufuu(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30}} ;
|
||||
|
||||
uuff =
|
||||
{// uuff(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5,
|
||||
// uuff(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10,
|
||||
// uuff(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15,
|
||||
// uuff(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20,
|
||||
// uuff(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25,
|
||||
// uuff(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30} ;
|
||||
|
||||
uufu =
|
||||
{{// uufu(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5},
|
||||
{// uufu(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10},
|
||||
{// uufu(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15},
|
||||
{// uufu(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20},
|
||||
{// uufu(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25},
|
||||
{// uufu(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30}} ;
|
||||
|
||||
uuuf =
|
||||
{{// uuuf(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5,
|
||||
// uuuf(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10,
|
||||
// uuuf(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15},
|
||||
{// uuuf(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20,
|
||||
// uuuf(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25,
|
||||
// uuuf(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30}} ;
|
||||
|
||||
uuuu =
|
||||
{{{// uuuu(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5},
|
||||
{// uuuu(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10},
|
||||
{// uuuu(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15}},
|
||||
{{// uuuu(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20},
|
||||
{// uuuu(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25},
|
||||
{// uuuu(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30}}} ;
|
||||
|
||||
ffff =
|
||||
// ffff(0,0,0, 0-4)
|
||||
1, 2, 3, 4, 5,
|
||||
// ffff(0,0,1, 0-4)
|
||||
6, 7, 8, 9, 10,
|
||||
// ffff(0,0,2, 0-4)
|
||||
11, 12, 13, 14, 15,
|
||||
// ffff(0,1,0, 0-4)
|
||||
16, 17, 18, 19, 20,
|
||||
// ffff(0,1,1, 0-4)
|
||||
21, 22, 23, 24, 25,
|
||||
// ffff(0,1,2, 0-4)
|
||||
26, 27, 28, 29, 30 ;
|
||||
}
|
@ -19,5 +19,8 @@ echo "*** creating tst_mud4.cdl from tst_mud4.nc ..."
|
||||
./ncdump tst_mud4.nc > tst_mud4.cdl
|
||||
# echo "*** comparing tst_mud4.cdl with ref_tst_mud4.cdl..."
|
||||
diff -b tst_mud4.cdl $srcdir/ref_tst_mud4.cdl
|
||||
# echo "*** comparing annotation from ncdump -bc tst_mud4.nc with expected output..."
|
||||
./ncdump -bc tst_mud4.nc > tst_mud4-bc.cdl
|
||||
diff -b tst_mud4-bc.cdl $srcdir/ref_tst_mud4-bc.cdl
|
||||
echo "*** All ncdump test output for multiple unlimited dimensions passed!"
|
||||
exit 0
|
||||
|
@ -12,12 +12,12 @@ export srcdir;
|
||||
|
||||
echo ""
|
||||
echo "*** Testing ncgen and ncdump test output for netCDF-4 format."
|
||||
# echo "*** creating netcdf-4 file c0.nc from c0.cdl..."
|
||||
../ncgen/ncgen -k3 -b -o c0.nc $srcdir/../ncgen/c0.cdl
|
||||
# echo "*** creating c1.cdl from c0.nc..."
|
||||
./ncdump -n c1 c0.nc | sed 's/e+0/e+/g' > c1.cdl
|
||||
# echo "*** comparing c1.cdl with ref_ctest1_nc4.cdl..."
|
||||
diff -b c1.cdl $srcdir/ref_ctest1_nc4.cdl
|
||||
# echo "*** creating netcdf-4 file c0_4.nc from c0_4.cdl..."
|
||||
../ncgen/ncgen -k3 -b -o c0_4.nc $srcdir/../ncgen/c0_4.cdl
|
||||
# echo "*** creating c1_4.cdl from c0_4.nc..."
|
||||
./ncdump -n c1 c0_4.nc | sed 's/e+0/e+/g' > c1_4.cdl
|
||||
# echo "*** comparing c1_4.cdl with ref_ctest1_nc4.cdl..."
|
||||
diff -b c1_4.cdl $srcdir/ref_ctest1_nc4.cdl
|
||||
|
||||
echo "*** Testing ncgen and ncdump test output for netCDF-4 classic format."
|
||||
# echo "*** creating netcdf-4 classic file c0.nc from c0.cdl..."
|
||||
|
@ -472,6 +472,10 @@ print_rows(
|
||||
} else { /* bottom out of recursion */
|
||||
char *valp = vals;
|
||||
bool_t lastrow;
|
||||
int j;
|
||||
if(formatting_specs.brief_data_cmnts && rank > 1) {
|
||||
annotate_brief(vp, cor, vdims);
|
||||
}
|
||||
NC_CHECK(nc_get_vara(ncid, varid, cor, edg, (void *)valp));
|
||||
for(i=0; i < d0 - 1; i++) {
|
||||
print_any_val(sb, vp, (void *)valp);
|
||||
@ -487,21 +491,21 @@ print_rows(
|
||||
print_any_val(sb, vp, (void *)valp);
|
||||
/* determine if this is the last row */
|
||||
lastrow = true;
|
||||
for(i = 0; i < rank - 1; i++) {
|
||||
if (cor[i] != vdims[i] - 1) {
|
||||
for(j = 0; j < rank - 1; j++) {
|
||||
if (cor[j] != vdims[j] - 1) {
|
||||
lastrow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (formatting_specs.full_data_cmnts) {
|
||||
for (i = 0; i < marks_pending; i++) {
|
||||
for (j = 0; j < marks_pending; j++) {
|
||||
sbuf_cat(sb, "}");
|
||||
}
|
||||
printf("%s", sbuf_str(sb));
|
||||
lastdelim (0, lastrow);
|
||||
annotate (vp, cor, i);
|
||||
} else {
|
||||
for (i = 0; i < marks_pending; i++) {
|
||||
for (j = 0; j < marks_pending; j++) {
|
||||
sbuf_cat(sb, "}");
|
||||
}
|
||||
lput(sbuf_str(sb));
|
||||
|
@ -56,5 +56,5 @@ ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h)
|
||||
|
||||
## Specify files to be distributed by 'make dist'
|
||||
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenyy.c ncgen.l internals.html c0.cdl ref_camrun.cdl ncf199.cdl CMakeLists.txt Makefile.am ncgen.1)
|
||||
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenyy.c ncgen.l internals.html c0.cdl c0_4.cdl ref_camrun.cdl ncf199.cdl CMakeLists.txt Makefile.am ncgen.1)
|
||||
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
||||
|
14
ncgen/Make0
14
ncgen/Make0
@ -30,9 +30,9 @@ gtest::
|
||||
gdb --args ./${T}
|
||||
|
||||
vctest::
|
||||
gcc -o t ${CFLAGS} t.c ${LDFLAGS} -lm
|
||||
${VG} ./t
|
||||
../ncdump/ncdump ./t.nc |tee t.dmp
|
||||
gcc -c ${CFLAGS} ${T}.c
|
||||
gcc -o ./vt ${T}.o ${LDFLAGS}
|
||||
${VG} ./vt
|
||||
|
||||
ftest::
|
||||
./ncgen -k$K -lf77 ${T}.cdl >${T}.f77
|
||||
@ -45,3 +45,11 @@ jtest::
|
||||
# java -cp ${CPATH} ./${T}
|
||||
# ../ncdump/ncdump ./${T}.nc >${T}.dmp
|
||||
# diff -wBb ${T}.cdl ${T}.dmp
|
||||
|
||||
xtest::
|
||||
gcc -c ${CFLAGS} ${T}.c
|
||||
gcc -o ./vt ${T}.o ${LDFLAGS}
|
||||
rm -f ctest0.nc junk.cdl
|
||||
./vt
|
||||
../ncdump/ncdump ctest0.nc >junk.cdl
|
||||
# gdb --args ./vt
|
||||
|
@ -21,7 +21,7 @@ man_MANS = ncgen.1
|
||||
|
||||
# These files all need to be distributed.
|
||||
EXTRA_DIST = ncgen.y ncgenyy.c ncgen.l $(man_MANS) internals.html \
|
||||
run_tests.sh run_nc4_tests.sh c0.cdl ref_camrun.cdl \
|
||||
run_tests.sh run_nc4_tests.sh c0.cdl c0_4.cdl ref_camrun.cdl \
|
||||
ncf199.cdl CMakeLists.txt XGetopt.c
|
||||
|
||||
# This shell script causes ncgen to build a classic and a 64-bit
|
||||
@ -44,8 +44,8 @@ CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
|
||||
makeparser::
|
||||
flex -Pncg -8 ncgen.l
|
||||
rm -f ncgenyy.c
|
||||
mv lex.ncg.c ncgenyy.c
|
||||
sed -e s/lex.ncg.c/ncgenyy.c/g <lex.ncg.c >ncgenyy.c
|
||||
bison -pncg -t -d ncgen.y
|
||||
rm -f ncgentab.c ncgentab.h
|
||||
mv ncgen.tab.c ncgentab.c
|
||||
mv ncgen.tab.h ncgentab.h
|
||||
sed -e s/ncgen.tab.c/ncgentab.c/g -e s/ncgen.tab.h/ncgentab.h/g <ncgen.tab.c >ncgentab.c
|
||||
sed -e s/ncgen.tab.c/ncgentab.c/g -e s/ncgen.tab.h/ncgentab.h/g <ncgen.tab.h >ncgentab.h
|
||||
|
392
ncgen/c0_4.cdl
Normal file
392
ncgen/c0_4.cdl
Normal file
@ -0,0 +1,392 @@
|
||||
netcdf c0 {
|
||||
dimensions:
|
||||
Dr = UNLIMITED ; // (2 currently)
|
||||
D1 = 1 ;
|
||||
D2 = 2 ;
|
||||
D3 = 3 ;
|
||||
dim-name-dashes = 4 ;
|
||||
dim.name.dots = 5 ;
|
||||
dim+name+plusses = 6 ;
|
||||
dim@name@ats = 7;
|
||||
variables:
|
||||
char c ;
|
||||
c:att-name-dashes = 4 ;
|
||||
c:att.name.dots = 5 ;
|
||||
c:att+name+plusses = 6 ;
|
||||
c:att@name@ats = 7 ;
|
||||
byte b ;
|
||||
b:c = "" ;
|
||||
short s ;
|
||||
s:b = 0b, 127b, -128b, -1b ;
|
||||
s:s = -32768s, 0s, 32767s ;
|
||||
int i ;
|
||||
i:i = -2147483647, 0, 2147483647 ;
|
||||
i:f = -1.e+36f, 0.f, 1.e+36f ;
|
||||
i:d = -1.e+308, 0., 1.e+308 ;
|
||||
float f ;
|
||||
f:c = "x" ;
|
||||
double d ;
|
||||
d:c = "abcd\tZ$&" ;
|
||||
int64 i64 ;
|
||||
i64:att_int64 = 1L ;
|
||||
uint64 ui64 ;
|
||||
ui64:att_uint64 = 1UL ;
|
||||
char cr(Dr) ;
|
||||
byte br(Dr) ;
|
||||
short sr(Dr) ;
|
||||
int ir(Dr) ;
|
||||
float fr(Dr) ;
|
||||
double dr(Dr) ;
|
||||
char c1(D1) ;
|
||||
byte b1(D1) ;
|
||||
short s1(D1) ;
|
||||
int i1(D1) ;
|
||||
float f1(D1) ;
|
||||
double d1(D1) ;
|
||||
char c2(D2) ;
|
||||
byte b2(D2) ;
|
||||
short s2(D2) ;
|
||||
int i2(D2) ;
|
||||
float f2(D2) ;
|
||||
double d2(D2) ;
|
||||
char c3(D3) ;
|
||||
byte b3(D3) ;
|
||||
short s3(D3) ;
|
||||
int i3(D3) ;
|
||||
float f3(D3) ;
|
||||
double d3(D3) ;
|
||||
char cr1(Dr, D1) ;
|
||||
byte br2(Dr, D2) ;
|
||||
short sr3(Dr, D3) ;
|
||||
float f11(D1, D1) ;
|
||||
double d12(D1, D2) ;
|
||||
char c13(D1, D3) ;
|
||||
short s21(D2, D1) ;
|
||||
int i22(D2, D2) ;
|
||||
float f23(D2, D3) ;
|
||||
char c31(D3, D1) ;
|
||||
byte b32(D3, D2) ;
|
||||
short s33(D3, D3) ;
|
||||
short sr11(Dr, D1, D1) ;
|
||||
int ir12(Dr, D1, D2) ;
|
||||
float fr13(Dr, D1, D3) ;
|
||||
char cr21(Dr, D2, D1) ;
|
||||
byte br22(Dr, D2, D2) ;
|
||||
short sr23(Dr, D2, D3) ;
|
||||
float fr31(Dr, D3, D1) ;
|
||||
double dr32(Dr, D3, D2) ;
|
||||
char cr33(Dr, D3, D3) ;
|
||||
char c111(D1, D1, D1) ;
|
||||
byte b112(D1, D1, D2) ;
|
||||
short s113(D1, D1, D3) ;
|
||||
float f121(D1, D2, D1) ;
|
||||
double d122(D1, D2, D2) ;
|
||||
char c123(D1, D2, D3) ;
|
||||
short s131(D1, D3, D1) ;
|
||||
int i132(D1, D3, D2) ;
|
||||
float f133(D1, D3, D3) ;
|
||||
float f211(D2, D1, D1) ;
|
||||
double d212(D2, D1, D2) ;
|
||||
char c213(D2, D1, D3) ;
|
||||
short s221(D2, D2, D1) ;
|
||||
int i222(D2, D2, D2) ;
|
||||
float f223(D2, D2, D3) ;
|
||||
char c231(D2, D3, D1) ;
|
||||
byte b232(D2, D3, D2) ;
|
||||
short s233(D2, D3, D3) ;
|
||||
short s311(D3, D1, D1) ;
|
||||
int i312(D3, D1, D2) ;
|
||||
float f313(D3, D1, D3) ;
|
||||
double var-name-dashes ;
|
||||
double var.name.dots ;
|
||||
double var+name+plusses ;
|
||||
double var@name@ats ;
|
||||
|
||||
// global attributes:
|
||||
:Gc = "" ;
|
||||
:Gb = -128b, 127b ;
|
||||
:Gs = -32768s, 0s, 32767s ;
|
||||
:Gi = -2147483647, 0, 2147483647 ;
|
||||
:Gf = -1.e+36f, 0.f, 1.e+36f ;
|
||||
:Gd = -1.e+308, 0., 1.e+308 ;
|
||||
:Gatt-name-dashes = -1 ;
|
||||
:Gatt.name.dots = -2 ;
|
||||
:Gatt+name+plusses = -3 ;
|
||||
:Gatt@name@ats = -4 ;
|
||||
data:
|
||||
|
||||
c = "2" ;
|
||||
|
||||
b = -2 ;
|
||||
|
||||
s = -5 ;
|
||||
|
||||
i = -20 ;
|
||||
|
||||
f = -9 ;
|
||||
|
||||
d = -10 ;
|
||||
|
||||
i64 = 9223372036854775807L;
|
||||
|
||||
ui64 = 18446744073709551615UL;
|
||||
|
||||
cr = "ab" ;
|
||||
|
||||
br = -128, 127 ;
|
||||
|
||||
sr = -32768, 32767 ;
|
||||
|
||||
ir = -2147483646, 2147483647 ;
|
||||
|
||||
fr = -1e+36, 1e+36 ;
|
||||
|
||||
dr = -1e+308, 1e+308 ;
|
||||
|
||||
c1 = "" ;
|
||||
|
||||
b1 = -128 ;
|
||||
|
||||
s1 = -32768 ;
|
||||
|
||||
i1 = -2147483646 ;
|
||||
|
||||
f1 = -1e+36 ;
|
||||
|
||||
d1 = -1e+308 ;
|
||||
|
||||
c2 = "ab" ;
|
||||
|
||||
b2 = -128, 127 ;
|
||||
|
||||
s2 = -32768, 32767 ;
|
||||
|
||||
i2 = -2147483646, 2147483647 ;
|
||||
|
||||
f2 = -1e+36, 1e+36 ;
|
||||
|
||||
d2 = -1e+308, 1e+308 ;
|
||||
|
||||
c3 = "\001\300." ;
|
||||
|
||||
b3 = -128, 127, -1 ;
|
||||
|
||||
s3 = -32768, 0, 32767 ;
|
||||
|
||||
i3 = -2147483646, 0, 2147483647 ;
|
||||
|
||||
f3 = -1e+36, 0, 1e+36 ;
|
||||
|
||||
d3 = -1e+308, 0, 1e+308 ;
|
||||
|
||||
cr1 =
|
||||
"x",
|
||||
"y" ;
|
||||
|
||||
br2 =
|
||||
-24, -26,
|
||||
-20, -22 ;
|
||||
|
||||
sr3 =
|
||||
-375, -380, -385,
|
||||
-350, -355, -360 ;
|
||||
|
||||
f11 =
|
||||
-2187 ;
|
||||
|
||||
d12 =
|
||||
-3000, -3010 ;
|
||||
|
||||
c13 =
|
||||
"\tb\177" ;
|
||||
|
||||
s21 =
|
||||
-375,
|
||||
-350 ;
|
||||
|
||||
i22 =
|
||||
-24000, -24020,
|
||||
-23600, -23620 ;
|
||||
|
||||
f23 =
|
||||
-2187, -2196, -2205,
|
||||
-2106, -2115, -2124 ;
|
||||
|
||||
c31 =
|
||||
"+",
|
||||
"-",
|
||||
" " ;
|
||||
|
||||
b32 =
|
||||
-24, -26,
|
||||
-20, -22,
|
||||
-16, -18 ;
|
||||
|
||||
s33 =
|
||||
-375, -380, -385,
|
||||
-350, -355, -360,
|
||||
-325, -330, -335 ;
|
||||
|
||||
sr11 =
|
||||
2500,
|
||||
2375 ;
|
||||
|
||||
ir12 =
|
||||
640000, 639980,
|
||||
632000, 631980 ;
|
||||
|
||||
fr13 =
|
||||
26244, 26235, 26226,
|
||||
25515, 25506, 25497 ;
|
||||
|
||||
cr21 =
|
||||
"@",
|
||||
"D",
|
||||
"H",
|
||||
"L" ;
|
||||
|
||||
br22 =
|
||||
64, 62,
|
||||
68, 66,
|
||||
56, 54,
|
||||
60, 58 ;
|
||||
|
||||
sr23 =
|
||||
2500, 2495, 2490,
|
||||
2525, 2520, 2515,
|
||||
2375, 2370, 2365,
|
||||
2400, 2395, 2390 ;
|
||||
|
||||
fr31 =
|
||||
26244,
|
||||
26325,
|
||||
26406,
|
||||
25515,
|
||||
25596,
|
||||
25677 ;
|
||||
|
||||
dr32 =
|
||||
40000, 39990,
|
||||
40100, 40090,
|
||||
40200, 40190,
|
||||
39000, 38990,
|
||||
39100, 39090,
|
||||
39200, 39190 ;
|
||||
|
||||
cr33 =
|
||||
"1",
|
||||
"two",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"six" ;
|
||||
|
||||
c111 =
|
||||
"@" ;
|
||||
|
||||
b112 =
|
||||
64, 62 ;
|
||||
|
||||
s113 =
|
||||
2500, 2495, 2490 ;
|
||||
|
||||
f121 =
|
||||
26244,
|
||||
26325 ;
|
||||
|
||||
d122 =
|
||||
40000, 39990,
|
||||
40100, 40090 ;
|
||||
|
||||
c123 =
|
||||
"one",
|
||||
"2" ;
|
||||
|
||||
s131 =
|
||||
2500,
|
||||
2525,
|
||||
2550 ;
|
||||
|
||||
i132 =
|
||||
640000, 639980,
|
||||
640400, 640380,
|
||||
640800, 640780 ;
|
||||
|
||||
f133 =
|
||||
26244, 26235, 26226,
|
||||
26325, 26316, 26307,
|
||||
26406, 26397, 26388 ;
|
||||
|
||||
f211 =
|
||||
26244,
|
||||
25515 ;
|
||||
|
||||
d212 =
|
||||
40000, 39990,
|
||||
39000, 38990 ;
|
||||
|
||||
c213 =
|
||||
"",
|
||||
"" ;
|
||||
|
||||
s221 =
|
||||
2500,
|
||||
2525,
|
||||
2375,
|
||||
2400 ;
|
||||
|
||||
i222 =
|
||||
640000, 639980,
|
||||
640400, 640380,
|
||||
632000, 631980,
|
||||
632400, 632380 ;
|
||||
|
||||
f223 =
|
||||
26244, 26235, 26226,
|
||||
26325, 26316, 26307,
|
||||
25515, 25506, 25497,
|
||||
25596, 25587, 25578 ;
|
||||
|
||||
c231 =
|
||||
"@",
|
||||
"D",
|
||||
"H",
|
||||
"H",
|
||||
"L",
|
||||
"P" ;
|
||||
|
||||
b232 =
|
||||
64, 62,
|
||||
68, 66,
|
||||
72, 70,
|
||||
56, 54,
|
||||
60, 58,
|
||||
64, 62 ;
|
||||
|
||||
s233 =
|
||||
2500, 2495, 2490,
|
||||
2525, 2520, 2515,
|
||||
2550, 2545, 2540,
|
||||
2375, 2370, 2365,
|
||||
2400, 2395, 2390,
|
||||
2425, 2420, 2415 ;
|
||||
|
||||
s311 =
|
||||
2500,
|
||||
2375,
|
||||
2250 ;
|
||||
|
||||
i312 =
|
||||
640000, 639980,
|
||||
632000, 631980,
|
||||
624000, 623980 ;
|
||||
|
||||
f313 =
|
||||
26244, 26235, 26226,
|
||||
25515, 25506, 25497,
|
||||
24786, 24777, 24768 ;
|
||||
|
||||
var-name-dashes = -1 ;
|
||||
|
||||
var.name.dots = -2 ;
|
||||
}
|
@ -235,7 +235,7 @@ srcsetfill(Datasrc* ds, Datalist* list)
|
||||
|
||||
|
||||
/**************************************************/
|
||||
#ifdef DEBUG
|
||||
#ifdef GENDEBUG
|
||||
void
|
||||
report(char* lead, Datalist* list)
|
||||
{
|
||||
|
@ -17,15 +17,14 @@
|
||||
#endif
|
||||
|
||||
#ifdef GENDEBUG
|
||||
# define DEBUG
|
||||
# if GENDEBUG > 0
|
||||
# define DEBUG1
|
||||
# define GENDEBUG1
|
||||
# endif
|
||||
# if GENDEBUG > 1
|
||||
# define DEBUG2
|
||||
# define GENDEBUG2
|
||||
# endif
|
||||
# if GENDEBUG > 2
|
||||
# define DEBUG3
|
||||
# define GENDEBUG3
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# test: ../ncdump/cdl4/ref_const_test.cdl
|
||||
# test: ../ncdump/cdl4/ref_tst_chardata.cdl
|
||||
K="-k3"
|
||||
F="niltest.cdl"
|
||||
F="test.cdl"
|
||||
#B="-B12"
|
||||
DBG="-d"
|
||||
#DBG="-D2"
|
||||
|
@ -377,7 +377,7 @@ genbin_writevar(Generator* generator, Symbol* vsym, Bytebuffer* memory,
|
||||
{ int i; for(i=0;i<rank;i++) count[i] = indices[i] - start[i];}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef GENDEBUG
|
||||
{
|
||||
int i;
|
||||
fprintf(stderr,"startset = [");
|
||||
@ -498,7 +498,7 @@ genbin_writeattr(Generator* generator, Symbol* asym, Bytebuffer* databuf,
|
||||
stat = nc_put_att(grpid,varid,asym->name,typid,
|
||||
len,(void*)data);
|
||||
check_err(stat,__LINE__,__FILE__);
|
||||
#ifdef DEBUG
|
||||
#ifdef GENDEBUG
|
||||
{
|
||||
char out[4096];
|
||||
memset(out,0x77,sizeof(out));
|
||||
|
@ -253,7 +253,7 @@ gen_leafchararray(Dimset* dimset, int lastunlim, Datalist* data,
|
||||
int j;
|
||||
size_t constsize;
|
||||
constsize = gen_charconstant(c,databuf,fillchar);
|
||||
if(constsize % unitsize > 0) {
|
||||
if(constsize == 0 || constsize % unitsize > 0) {
|
||||
size_t padsize = unitsize - (constsize % unitsize);
|
||||
for(j=0;j<padsize;j++) bbAppend(databuf,fillchar);
|
||||
}
|
||||
|
@ -84,6 +84,10 @@ generate_vardata(Symbol* vsym, Generator* generator, Writer writer, Bytebuffer*
|
||||
|
||||
if(vsym->data == NULL) return;
|
||||
|
||||
if(strcmp(vsym->name,"c213")==0) {
|
||||
int x = 0;
|
||||
}
|
||||
|
||||
/* give the buffer a running start to be large enough*/
|
||||
bbSetalloc(code, nciterbuffersize);
|
||||
|
||||
|
@ -17,7 +17,6 @@ void
|
||||
define_netcdf(void)
|
||||
{
|
||||
char filename[2048+1];
|
||||
const char *fname;
|
||||
|
||||
/* Rule for specifying the dataset name:
|
||||
1. use -o name
|
||||
@ -28,8 +27,7 @@ define_netcdf(void)
|
||||
file name, but oh well.
|
||||
*/
|
||||
if(netcdf_name) { /* -o flag name */
|
||||
strcpy(filename,netcdf_name);
|
||||
fname = filename;
|
||||
strncpy(filename,netcdf_name,2048);
|
||||
} else { /* construct a usable output file name */
|
||||
if (cdlname != NULL && strcmp(cdlname,"-") != 0) {/* cmd line name */
|
||||
char* p;
|
||||
@ -39,16 +37,14 @@ define_netcdf(void)
|
||||
p = strrchr(filename,'.');
|
||||
if(p != NULL) {*p= '\0';}
|
||||
p = strrchr(filename,'/');
|
||||
if(p != NULL)
|
||||
fname = p + 1;
|
||||
else
|
||||
fname = filename;
|
||||
} else {/* construct name from dataset name */
|
||||
if(p != NULL) {memmove(filename,(p+1),2048);}
|
||||
|
||||
} else {/* construct name from dataset name */
|
||||
strncpy(filename,datasetname,2048); /* Reserve space for extension, terminating '\0' */
|
||||
fname = filename;
|
||||
}
|
||||
/* Append the proper extension */
|
||||
strcat(fname,binary_ext);
|
||||
strncat(filename,binary_ext,2048-(strlen(filename) + strlen(binary_ext)));
|
||||
}
|
||||
|
||||
/* Execute exactly one of these */
|
||||
|
@ -36,7 +36,7 @@ getfiller(Symbol* tvsym)
|
||||
filler = builddatalist(0);
|
||||
fill(tsym,filler);
|
||||
}
|
||||
#ifdef DEBUG2
|
||||
#ifdef GENDEBUG2
|
||||
dumpdatalist(filler,"getfiller");
|
||||
#endif
|
||||
if(tvsym->objectclass == NC_VAR) {
|
||||
|
@ -49,7 +49,7 @@ nc_get_iter(Symbol* vsym,
|
||||
Symbol* vartype;
|
||||
size_t value_size; /* size in bytes of each variable element */
|
||||
int ndims; /* number of dimensions for variable */
|
||||
size_t dimsizes[NC_MAX_VAR_DIMS]; /* variable dimension sizes */
|
||||
size_t dimsizes[NC_MAX_VAR_DIMS] = {0}; /* variable dimension sizes */
|
||||
long long nvalues = 1;
|
||||
int dim;
|
||||
|
||||
|
299
ncgen/ncgen.1
299
ncgen/ncgen.1
@ -906,3 +906,302 @@ The CDL syntax makes it easy to assign what looks like an array of
|
||||
variable-length strings to a netCDF variable, but the strings may simply be
|
||||
concatenated into a single array of characters.
|
||||
Specific use of the \fIstring\fP type specifier may solve the problem
|
||||
|
||||
.SH "CDL Grammar"
|
||||
.LP
|
||||
The file ncgen.y is the definitive grammar for CDL, but a stripped
|
||||
down version is included here for completeness.
|
||||
.RS
|
||||
.nf
|
||||
ncdesc: NETCDF
|
||||
datasetid
|
||||
rootgroup
|
||||
;
|
||||
|
||||
datasetid: DATASETID
|
||||
|
||||
rootgroup: '{'
|
||||
groupbody
|
||||
subgrouplist
|
||||
'}';
|
||||
|
||||
groupbody:
|
||||
attrdecllist
|
||||
typesection
|
||||
dimsection
|
||||
vasection
|
||||
datasection
|
||||
;
|
||||
|
||||
subgrouplist:
|
||||
/*empty*/
|
||||
| subgrouplist namedgroup
|
||||
;
|
||||
|
||||
namedgroup: GROUP ident '{'
|
||||
groupbody
|
||||
subgrouplist
|
||||
'}'
|
||||
attrdecllist
|
||||
;
|
||||
|
||||
typesection: /* empty */
|
||||
| TYPES
|
||||
| TYPES typedecls
|
||||
;
|
||||
|
||||
typedecls:
|
||||
type_or_attr_decl
|
||||
| typedecls type_or_attr_decl
|
||||
;
|
||||
|
||||
typename: ident ;
|
||||
|
||||
type_or_attr_decl:
|
||||
typedecl
|
||||
| attrdecl ';'
|
||||
;
|
||||
|
||||
typedecl:
|
||||
enumdecl optsemicolon
|
||||
| compounddecl optsemicolon
|
||||
| vlendecl optsemicolon
|
||||
| opaquedecl optsemicolon
|
||||
;
|
||||
|
||||
optsemicolon:
|
||||
/*empty*/
|
||||
| ';'
|
||||
;
|
||||
|
||||
enumdecl: primtype ENUM typename ;
|
||||
|
||||
enumidlist: enumid
|
||||
| enumidlist ',' enumid
|
||||
;
|
||||
|
||||
enumid: ident '=' constint ;
|
||||
|
||||
opaquedecl: OPAQUE '(' INT_CONST ')' typename ;
|
||||
|
||||
vlendecl: typeref '(' '*' ')' typename ;
|
||||
|
||||
compounddecl: COMPOUND typename '{' fields '}' ;
|
||||
|
||||
fields: field ';'
|
||||
| fields field ';'
|
||||
;
|
||||
|
||||
field: typeref fieldlist ;
|
||||
|
||||
primtype: CHAR_K
|
||||
| BYTE_K
|
||||
| SHORT_K
|
||||
| INT_K
|
||||
| FLOAT_K
|
||||
| DOUBLE_K
|
||||
| UBYTE_K
|
||||
| USHORT_K
|
||||
| UINT_K
|
||||
| INT64_K
|
||||
| UINT64_K
|
||||
;
|
||||
|
||||
dimsection: /* empty */
|
||||
| DIMENSIONS
|
||||
| DIMENSIONS dimdecls
|
||||
;
|
||||
|
||||
dimdecls: dim_or_attr_decl ';'
|
||||
| dimdecls dim_or_attr_decl ';'
|
||||
;
|
||||
|
||||
dim_or_attr_decl: dimdeclist | attrdecl ;
|
||||
|
||||
dimdeclist: dimdecl
|
||||
| dimdeclist ',' dimdecl
|
||||
;
|
||||
|
||||
dimdecl:
|
||||
dimd '=' UINT_CONST
|
||||
| dimd '=' INT_CONST
|
||||
| dimd '=' DOUBLE_CONST
|
||||
| dimd '=' NC_UNLIMITED_K
|
||||
;
|
||||
|
||||
dimd: ident ;
|
||||
|
||||
vasection: /* empty */
|
||||
| VARIABLES
|
||||
| VARIABLES vadecls
|
||||
;
|
||||
|
||||
vadecls: vadecl_or_attr ';'
|
||||
| vadecls vadecl_or_attr ';'
|
||||
;
|
||||
|
||||
vadecl_or_attr: vardecl | attrdecl ;
|
||||
|
||||
vardecl: typeref varlist ;
|
||||
|
||||
varlist: varspec
|
||||
| varlist ',' varspec
|
||||
;
|
||||
|
||||
varspec: ident dimspec ;
|
||||
|
||||
dimspec: /* empty */
|
||||
| '(' dimlist ')'
|
||||
;
|
||||
|
||||
dimlist: dimref
|
||||
| dimlist ',' dimref
|
||||
;
|
||||
|
||||
dimref: path ;
|
||||
|
||||
fieldlist:
|
||||
fieldspec
|
||||
| fieldlist ',' fieldspec
|
||||
;
|
||||
|
||||
fieldspec: ident fielddimspec ;
|
||||
|
||||
fielddimspec: /* empty */
|
||||
| '(' fielddimlist ')'
|
||||
;
|
||||
|
||||
fielddimlist:
|
||||
fielddim
|
||||
| fielddimlist ',' fielddim
|
||||
;
|
||||
|
||||
fielddim:
|
||||
UINT_CONST
|
||||
| INT_CONST
|
||||
;
|
||||
|
||||
/* Use this when referencing defined objects */
|
||||
varref: type_var_ref ;
|
||||
|
||||
typeref: type_var_ref ;
|
||||
|
||||
type_var_ref:
|
||||
path
|
||||
| primtype
|
||||
;
|
||||
|
||||
/* Use this for all attribute decls */
|
||||
/* Watch out; this is left recursive */
|
||||
attrdecllist: /*empty*/ | attrdecl ';' attrdecllist ;
|
||||
|
||||
attrdecl:
|
||||
':' ident '=' datalist
|
||||
| typeref type_var_ref ':' ident '=' datalist
|
||||
| type_var_ref ':' ident '=' datalist
|
||||
| type_var_ref ':' _FILLVALUE '=' datalist
|
||||
| typeref type_var_ref ':' _FILLVALUE '=' datalist
|
||||
| type_var_ref ':' _STORAGE '=' conststring
|
||||
| type_var_ref ':' _CHUNKSIZES '=' intlist
|
||||
| type_var_ref ':' _FLETCHER32 '=' constbool
|
||||
| type_var_ref ':' _DEFLATELEVEL '=' constint
|
||||
| type_var_ref ':' _SHUFFLE '=' constbool
|
||||
| type_var_ref ':' _ENDIANNESS '=' conststring
|
||||
| type_var_ref ':' _NOFILL '=' constbool
|
||||
| ':' _FORMAT '=' conststring
|
||||
;
|
||||
|
||||
path:
|
||||
ident
|
||||
| PATH
|
||||
;
|
||||
|
||||
datasection: /* empty */
|
||||
| DATA
|
||||
| DATA datadecls
|
||||
;
|
||||
|
||||
datadecls:
|
||||
datadecl ';'
|
||||
| datadecls datadecl ';'
|
||||
;
|
||||
|
||||
datadecl: varref '=' datalist ;
|
||||
datalist:
|
||||
datalist0
|
||||
| datalist1
|
||||
;
|
||||
|
||||
datalist0:
|
||||
/*empty*/
|
||||
;
|
||||
|
||||
/* Must have at least 1 element */
|
||||
datalist1:
|
||||
dataitem
|
||||
| datalist ',' dataitem
|
||||
;
|
||||
|
||||
dataitem:
|
||||
constdata
|
||||
| '{' datalist '}'
|
||||
;
|
||||
|
||||
constdata:
|
||||
simpleconstant
|
||||
| OPAQUESTRING
|
||||
| FILLMARKER
|
||||
| NIL
|
||||
| econstref
|
||||
| function
|
||||
;
|
||||
|
||||
econstref: path ;
|
||||
|
||||
function: ident '(' arglist ')' ;
|
||||
|
||||
arglist:
|
||||
simpleconstant
|
||||
| arglist ',' simpleconstant
|
||||
;
|
||||
|
||||
simpleconstant:
|
||||
CHAR_CONST /* never used apparently*/
|
||||
| BYTE_CONST
|
||||
| SHORT_CONST
|
||||
| INT_CONST
|
||||
| INT64_CONST
|
||||
| UBYTE_CONST
|
||||
| USHORT_CONST
|
||||
| UINT_CONST
|
||||
| UINT64_CONST
|
||||
| FLOAT_CONST
|
||||
| DOUBLE_CONST
|
||||
| TERMSTRING
|
||||
;
|
||||
|
||||
intlist:
|
||||
constint
|
||||
| intlist ',' constint
|
||||
;
|
||||
|
||||
constint:
|
||||
INT_CONST
|
||||
| UINT_CONST
|
||||
| INT64_CONST
|
||||
| UINT64_CONST
|
||||
;
|
||||
|
||||
conststring: TERMSTRING ;
|
||||
|
||||
constbool:
|
||||
conststring
|
||||
| constint
|
||||
;
|
||||
|
||||
/* Push all idents thru here for tracking */
|
||||
ident: IDENT ;
|
||||
.fi
|
||||
.RE
|
||||
|
||||
|
||||
|
@ -411,7 +411,15 @@ NIL|nil|Nil {
|
||||
yyerror(errstr);
|
||||
break;
|
||||
case -1: token = INT64_CONST; break;
|
||||
case 1: token = UINT64_CONST; break;
|
||||
case 1:
|
||||
/* if value is too big, complain */
|
||||
if(uint64_val > NC_MAX_INT64) {
|
||||
sprintf(errstr,"32 bit integer constant out of range: %s",(char*)yytext);
|
||||
yyerror(errstr);
|
||||
}
|
||||
int64_val = (long long)(uint64_val & 0x7fffffffffffffff);
|
||||
token = INT64_CONST;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:/*(optionally)signed string of digits; treat like int*/
|
||||
|
@ -441,7 +441,7 @@ dimdecl:
|
||||
dimd '=' UINT_CONST
|
||||
{
|
||||
$1->dim.declsize = (size_t)uint32_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
@ -452,7 +452,7 @@ fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize)
|
||||
YYABORT;
|
||||
}
|
||||
$1->dim.declsize = (size_t)int32_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
@ -465,7 +465,7 @@ fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize)
|
||||
if (double_val - (size_t) double_val > 0)
|
||||
yyerror("dimension length must be an integer");
|
||||
$1->dim.declsize = (size_t)double_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
@ -473,7 +473,7 @@ fprintf(stderr,"dimension: %s = %lu\n",$1->name,(unsigned long)$1->dim.declsize)
|
||||
{
|
||||
$1->dim.declsize = NC_UNLIMITED;
|
||||
$1->dim.isunlimited = 1;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = UNLIMITED\n",$1->name);
|
||||
#endif
|
||||
}
|
||||
@ -697,7 +697,7 @@ type_var_ref:
|
||||
} else tvsym = sym;
|
||||
} else tvsym = sym;
|
||||
if(tvsym == NULL) {
|
||||
derror("Undefined name: %s",$1->name);
|
||||
derror("Undefined name (line %d): %s",$1->lineno,$1->name);
|
||||
YYABORT;
|
||||
}
|
||||
$$=tvsym;
|
||||
|
266
ncgen/ncgentab.c
266
ncgen/ncgentab.c
@ -188,7 +188,7 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
|
||||
extern int lex_init(void);
|
||||
|
||||
|
||||
#line 192 "ncgen.tab.c" /* yacc.c:339 */
|
||||
#line 192 "ncgentab.c" /* yacc.c:339 */
|
||||
|
||||
# ifndef YY_NULL
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
@ -207,7 +207,7 @@ extern int lex_init(void);
|
||||
#endif
|
||||
|
||||
/* In a future release of Bison, this section will be replaced
|
||||
by #include "ncgen.tab.h". */
|
||||
by #include "ncgentab.h". */
|
||||
#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
|
||||
# define YY_NCG_NCGEN_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
@ -288,7 +288,7 @@ int nctype; /* for tracking attribute list type*/
|
||||
Datalist* datalist;
|
||||
NCConstant constant;
|
||||
|
||||
#line 292 "ncgen.tab.c" /* yacc.c:355 */
|
||||
#line 292 "ncgentab.c" /* yacc.c:355 */
|
||||
};
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
@ -303,7 +303,7 @@ int ncgparse (void);
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
|
||||
#line 307 "ncgen.tab.c" /* yacc.c:358 */
|
||||
#line 307 "ncgentab.c" /* yacc.c:358 */
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -1584,13 +1584,13 @@ yyreduce:
|
||||
case 2:
|
||||
#line 211 "ncgen.y" /* yacc.c:1646 */
|
||||
{if (error_count > 0) YYABORT;}
|
||||
#line 1588 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1588 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#line 214 "ncgen.y" /* yacc.c:1646 */
|
||||
{createrootgroup(datasetname);}
|
||||
#line 1594 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1594 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 8:
|
||||
@ -1602,25 +1602,25 @@ yyreduce:
|
||||
yyerror("duplicate group declaration within parent group for %s",
|
||||
id->name);
|
||||
}
|
||||
#line 1606 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1606 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 9:
|
||||
#line 242 "ncgen.y" /* yacc.c:1646 */
|
||||
{listpop(groupstack);}
|
||||
#line 1612 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1612 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 12:
|
||||
#line 248 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1618 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1618 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 13:
|
||||
#line 250 "ncgen.y" /* yacc.c:1646 */
|
||||
{markcdf4("Type specification");}
|
||||
#line 1624 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1624 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 16:
|
||||
@ -1632,19 +1632,19 @@ yyreduce:
|
||||
(yyvsp[0].sym)->name);
|
||||
listpush(typdefs,(void*)(yyvsp[0].sym));
|
||||
}
|
||||
#line 1636 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1636 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 17:
|
||||
#line 265 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1642 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1642 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 18:
|
||||
#line 265 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1648 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1648 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 25:
|
||||
@ -1675,13 +1675,13 @@ yyreduce:
|
||||
}
|
||||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||||
}
|
||||
#line 1679 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1679 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 26:
|
||||
#line 308 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 1685 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1685 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 27:
|
||||
@ -1700,7 +1700,7 @@ yyreduce:
|
||||
}
|
||||
listpush(stack,(void*)(yyvsp[0].sym));
|
||||
}
|
||||
#line 1704 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1704 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 28:
|
||||
@ -1711,7 +1711,7 @@ yyreduce:
|
||||
(yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant);
|
||||
(yyval.sym)=(yyvsp[-2].sym);
|
||||
}
|
||||
#line 1715 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1715 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 29:
|
||||
@ -1725,7 +1725,7 @@ yyreduce:
|
||||
(yyvsp[0].sym)->typ.size=int32_val;
|
||||
(yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
|
||||
}
|
||||
#line 1729 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1729 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 30:
|
||||
@ -1741,7 +1741,7 @@ yyreduce:
|
||||
(yyvsp[0].sym)->typ.size=VLENSIZE;
|
||||
(yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN);
|
||||
}
|
||||
#line 1745 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1745 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 31:
|
||||
@ -1775,19 +1775,19 @@ yyreduce:
|
||||
}
|
||||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||||
}
|
||||
#line 1779 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1779 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 32:
|
||||
#line 394 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-1].mark);}
|
||||
#line 1785 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1785 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 33:
|
||||
#line 395 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-2].mark);}
|
||||
#line 1791 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1791 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 34:
|
||||
@ -1803,108 +1803,108 @@ yyreduce:
|
||||
f->typ.basetype = (yyvsp[-1].sym);
|
||||
}
|
||||
}
|
||||
#line 1807 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1807 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 35:
|
||||
#line 412 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_CHAR]; }
|
||||
#line 1813 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1813 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 36:
|
||||
#line 413 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_BYTE]; }
|
||||
#line 1819 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1819 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 37:
|
||||
#line 414 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_SHORT]; }
|
||||
#line 1825 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1825 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 38:
|
||||
#line 415 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_INT]; }
|
||||
#line 1831 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1831 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 39:
|
||||
#line 416 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_FLOAT]; }
|
||||
#line 1837 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1837 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 40:
|
||||
#line 417 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym) = primsymbols[NC_DOUBLE]; }
|
||||
#line 1843 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1843 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 41:
|
||||
#line 418 "ncgen.y" /* yacc.c:1646 */
|
||||
{ vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; }
|
||||
#line 1849 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1849 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 42:
|
||||
#line 419 "ncgen.y" /* yacc.c:1646 */
|
||||
{ vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; }
|
||||
#line 1855 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1855 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 43:
|
||||
#line 420 "ncgen.y" /* yacc.c:1646 */
|
||||
{ vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; }
|
||||
#line 1861 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1861 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 44:
|
||||
#line 421 "ncgen.y" /* yacc.c:1646 */
|
||||
{ vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; }
|
||||
#line 1867 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1867 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 45:
|
||||
#line 422 "ncgen.y" /* yacc.c:1646 */
|
||||
{ vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; }
|
||||
#line 1873 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1873 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 47:
|
||||
#line 426 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1879 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1879 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 48:
|
||||
#line 427 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1885 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1885 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 51:
|
||||
#line 434 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1891 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1891 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 52:
|
||||
#line 434 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1897 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1897 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 55:
|
||||
#line 442 "ncgen.y" /* yacc.c:1646 */
|
||||
{
|
||||
(yyvsp[-2].sym)->dim.declsize = (size_t)uint32_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
#line 1908 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1908 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 56:
|
||||
@ -1915,11 +1915,11 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyv
|
||||
YYABORT;
|
||||
}
|
||||
(yyvsp[-2].sym)->dim.declsize = (size_t)int32_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
#line 1923 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1923 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 57:
|
||||
@ -1932,11 +1932,11 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyv
|
||||
if (double_val - (size_t) double_val > 0)
|
||||
yyerror("dimension length must be an integer");
|
||||
(yyvsp[-2].sym)->dim.declsize = (size_t)double_val;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyvsp[-2].sym)->dim.declsize);
|
||||
#endif
|
||||
}
|
||||
#line 1940 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1940 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 58:
|
||||
@ -1944,11 +1944,11 @@ fprintf(stderr,"dimension: %s = %lu\n",(yyvsp[-2].sym)->name,(unsigned long)(yyv
|
||||
{
|
||||
(yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED;
|
||||
(yyvsp[-2].sym)->dim.isunlimited = 1;
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
#endif
|
||||
}
|
||||
#line 1952 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1952 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 59:
|
||||
@ -1962,31 +1962,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyval.sym)=(yyvsp[0].sym);
|
||||
listpush(dimdefs,(void*)(yyvsp[0].sym));
|
||||
}
|
||||
#line 1966 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1966 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 61:
|
||||
#line 495 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1972 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1972 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 62:
|
||||
#line 496 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1978 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1978 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 65:
|
||||
#line 503 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1984 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1984 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 66:
|
||||
#line 503 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 1990 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 1990 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 67:
|
||||
@ -2010,7 +2010,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
}
|
||||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||||
}
|
||||
#line 2014 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2014 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 68:
|
||||
@ -2018,13 +2018,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
{(yyval.mark)=listlength(stack);
|
||||
listpush(stack,(void*)(yyvsp[0].sym));
|
||||
}
|
||||
#line 2022 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2022 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 69:
|
||||
#line 532 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2028 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2028 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 70:
|
||||
@ -2053,31 +2053,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyvsp[-1].sym)->objectclass=NC_VAR;
|
||||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||||
}
|
||||
#line 2057 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2057 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 71:
|
||||
#line 562 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=listlength(stack);}
|
||||
#line 2063 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2063 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 72:
|
||||
#line 563 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-1].mark);}
|
||||
#line 2069 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2069 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 73:
|
||||
#line 566 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2075 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2075 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 74:
|
||||
#line 568 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2081 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2081 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 75:
|
||||
@ -2092,7 +2092,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
}
|
||||
(yyval.sym)=dimsym;
|
||||
}
|
||||
#line 2096 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2096 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 76:
|
||||
@ -2100,13 +2100,13 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
{(yyval.mark)=listlength(stack);
|
||||
listpush(stack,(void*)(yyvsp[0].sym));
|
||||
}
|
||||
#line 2104 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2104 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 77:
|
||||
#line 590 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2110 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2110 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 78:
|
||||
@ -2137,31 +2137,31 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
listsetlength(stack,stackbase);/* remove stack nodes*/
|
||||
(yyval.sym) = (yyvsp[-1].sym);
|
||||
}
|
||||
#line 2141 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2141 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 79:
|
||||
#line 623 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=listlength(stack);}
|
||||
#line 2147 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2147 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 80:
|
||||
#line 624 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-1].mark);}
|
||||
#line 2153 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2153 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 81:
|
||||
#line 628 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2159 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2159 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 82:
|
||||
#line 630 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
|
||||
#line 2165 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2165 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 83:
|
||||
@ -2175,7 +2175,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyval.sym)->dim.isconstant = 1;
|
||||
(yyval.sym)->dim.declsize = uint32_val;
|
||||
}
|
||||
#line 2179 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2179 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 84:
|
||||
@ -2193,7 +2193,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyval.sym)->dim.isconstant = 1;
|
||||
(yyval.sym)->dim.declsize = int32_val;
|
||||
}
|
||||
#line 2197 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2197 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 85:
|
||||
@ -2205,7 +2205,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
}
|
||||
(yyval.sym)=vsym;
|
||||
}
|
||||
#line 2209 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2209 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 86:
|
||||
@ -2217,7 +2217,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
}
|
||||
(yyval.sym)=tsym;
|
||||
}
|
||||
#line 2221 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2221 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 87:
|
||||
@ -2235,36 +2235,36 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
} else tvsym = sym;
|
||||
} else tvsym = sym;
|
||||
if(tvsym == NULL) {
|
||||
derror("Undefined name: %s",(yyvsp[0].sym)->name);
|
||||
derror("Undefined name (line %d): %s",(yyvsp[0].sym)->lineno,(yyvsp[0].sym)->name);
|
||||
YYABORT;
|
||||
}
|
||||
(yyval.sym)=tvsym;
|
||||
}
|
||||
#line 2244 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2244 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 88:
|
||||
#line 705 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym)=(yyvsp[0].sym);}
|
||||
#line 2250 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2250 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 89:
|
||||
#line 712 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 2256 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2256 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 90:
|
||||
#line 712 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 2262 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2262 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 91:
|
||||
#line 716 "ncgen.y" /* yacc.c:1646 */
|
||||
{ (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
|
||||
#line 2268 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2268 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 92:
|
||||
@ -2277,7 +2277,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
#line 2281 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2281 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 93:
|
||||
@ -2292,67 +2292,67 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
#line 2296 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2296 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 94:
|
||||
#line 738 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
|
||||
#line 2302 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2302 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 95:
|
||||
#line 740 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);}
|
||||
#line 2308 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2308 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 96:
|
||||
#line 742 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2314 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2314 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 97:
|
||||
#line 744 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
|
||||
#line 2320 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2320 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 98:
|
||||
#line 746 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2326 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2326 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 99:
|
||||
#line 748 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2332 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2332 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 100:
|
||||
#line 750 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2338 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2338 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 101:
|
||||
#line 752 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2344 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2344 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 102:
|
||||
#line 754 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2350 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2350 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 103:
|
||||
#line 756 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);}
|
||||
#line 2356 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2356 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 104:
|
||||
@ -2363,7 +2363,7 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyvsp[0].sym)->is_prefixed=0;
|
||||
setpathcurrent((yyvsp[0].sym));
|
||||
}
|
||||
#line 2367 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2367 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 105:
|
||||
@ -2374,257 +2374,257 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
|
||||
(yyvsp[0].sym)->is_prefixed=1;
|
||||
/* path is set in ncgen.l*/
|
||||
}
|
||||
#line 2378 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2378 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 107:
|
||||
#line 777 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 2384 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2384 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 108:
|
||||
#line 778 "ncgen.y" /* yacc.c:1646 */
|
||||
{}
|
||||
#line 2390 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2390 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 111:
|
||||
#line 786 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyvsp[-2].sym)->data = (yyvsp[0].datalist);}
|
||||
#line 2396 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2396 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 112:
|
||||
#line 789 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = (yyvsp[0].datalist);}
|
||||
#line 2402 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2402 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 113:
|
||||
#line 790 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = (yyvsp[0].datalist);}
|
||||
#line 2408 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2408 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 114:
|
||||
#line 794 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = builddatalist(0);}
|
||||
#line 2414 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2414 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 115:
|
||||
#line 798 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
|
||||
#line 2420 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2420 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 116:
|
||||
#line 800 "ncgen.y" /* yacc.c:1646 */
|
||||
{datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
|
||||
#line 2426 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2426 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 117:
|
||||
#line 804 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=(yyvsp[0].constant);}
|
||||
#line 2432 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2432 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 118:
|
||||
#line 805 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=builddatasublist((yyvsp[-1].datalist));}
|
||||
#line 2438 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2438 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 119:
|
||||
#line 809 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=(yyvsp[0].constant);}
|
||||
#line 2444 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2444 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 120:
|
||||
#line 810 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_OPAQUE);}
|
||||
#line 2450 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2450 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 121:
|
||||
#line 811 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_FILLVALUE);}
|
||||
#line 2456 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2456 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 122:
|
||||
#line 812 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_NIL);}
|
||||
#line 2462 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2462 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 123:
|
||||
#line 813 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=(yyvsp[0].constant);}
|
||||
#line 2468 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2468 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 125:
|
||||
#line 818 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant) = makeenumconstref((yyvsp[0].sym));}
|
||||
#line 2474 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2474 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 126:
|
||||
#line 822 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));}
|
||||
#line 2480 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2480 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 127:
|
||||
#line 827 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
|
||||
#line 2486 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2486 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 128:
|
||||
#line 829 "ncgen.y" /* yacc.c:1646 */
|
||||
{datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
|
||||
#line 2492 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2492 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 129:
|
||||
#line 833 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_CHAR);}
|
||||
#line 2498 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2498 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 130:
|
||||
#line 834 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_BYTE);}
|
||||
#line 2504 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2504 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 131:
|
||||
#line 835 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_SHORT);}
|
||||
#line 2510 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2510 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 132:
|
||||
#line 836 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_INT);}
|
||||
#line 2516 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2516 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 133:
|
||||
#line 837 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_INT64);}
|
||||
#line 2522 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2522 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 134:
|
||||
#line 838 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_UBYTE);}
|
||||
#line 2528 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2528 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 135:
|
||||
#line 839 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_USHORT);}
|
||||
#line 2534 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2534 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 136:
|
||||
#line 840 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_UINT);}
|
||||
#line 2540 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2540 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 137:
|
||||
#line 841 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_UINT64);}
|
||||
#line 2546 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2546 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 138:
|
||||
#line 842 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_FLOAT);}
|
||||
#line 2552 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2552 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 139:
|
||||
#line 843 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_DOUBLE);}
|
||||
#line 2558 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2558 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 140:
|
||||
#line 844 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_STRING);}
|
||||
#line 2564 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2564 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 141:
|
||||
#line 848 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
|
||||
#line 2570 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2570 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 142:
|
||||
#line 849 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));}
|
||||
#line 2576 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2576 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 143:
|
||||
#line 854 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_INT);}
|
||||
#line 2582 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2582 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 144:
|
||||
#line 856 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_UINT);}
|
||||
#line 2588 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2588 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 145:
|
||||
#line 858 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_INT64);}
|
||||
#line 2594 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2594 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 146:
|
||||
#line 860 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_UINT64);}
|
||||
#line 2600 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2600 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 147:
|
||||
#line 864 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=makeconstdata(NC_STRING);}
|
||||
#line 2606 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2606 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 148:
|
||||
#line 868 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=(yyvsp[0].constant);}
|
||||
#line 2612 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2612 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 149:
|
||||
#line 869 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.constant)=(yyvsp[0].constant);}
|
||||
#line 2618 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2618 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
case 150:
|
||||
#line 875 "ncgen.y" /* yacc.c:1646 */
|
||||
{(yyval.sym)=(yyvsp[0].sym);}
|
||||
#line 2624 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2624 "ncgentab.c" /* yacc.c:1646 */
|
||||
break;
|
||||
|
||||
|
||||
#line 2628 "ncgen.tab.c" /* yacc.c:1646 */
|
||||
#line 2628 "ncgentab.c" /* yacc.c:1646 */
|
||||
default: break;
|
||||
}
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
|
@ -110,7 +110,7 @@ int nctype; /* for tracking attribute list type*/
|
||||
Datalist* datalist;
|
||||
NCConstant constant;
|
||||
|
||||
#line 114 "ncgen.tab.h" /* yacc.c:1909 */
|
||||
#line 114 "ncgentab.h" /* yacc.c:1909 */
|
||||
};
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#line 3 "lex.ncg.c"
|
||||
#line 3 "ncgenyy.c"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
@ -1231,7 +1231,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})*
|
||||
/* Note: this definition of string will work for utf8 as well,
|
||||
although it is a very relaxed definition
|
||||
*/
|
||||
#line 1235 "lex.ncg.c"
|
||||
#line 1235 "ncgenyy.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define ST_C_COMMENT 1
|
||||
@ -1322,7 +1322,7 @@ static int input (void );
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout )
|
||||
#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
@ -1333,7 +1333,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
int n; \
|
||||
unsigned n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1417,7 +1417,7 @@ YY_DECL
|
||||
|
||||
#line 167 "ncgen.l"
|
||||
|
||||
#line 1421 "lex.ncg.c"
|
||||
#line 1421 "ncgenyy.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -1874,7 +1874,15 @@ YY_RULE_SETUP
|
||||
yyerror(errstr);
|
||||
break;
|
||||
case -1: token = INT64_CONST; break;
|
||||
case 1: token = UINT64_CONST; break;
|
||||
case 1:
|
||||
/* if value is too big, complain */
|
||||
if(uint64_val > NC_MAX_INT64) {
|
||||
sprintf(errstr,"32 bit integer constant out of range: %s",(char*)ncgtext);
|
||||
yyerror(errstr);
|
||||
}
|
||||
int64_val = (long long)(uint64_val & 0x7fffffffffffffff);
|
||||
token = INT64_CONST;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:/*(optionally)signed string of digits; treat like int*/
|
||||
@ -1886,7 +1894,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 424 "ncgen.l"
|
||||
#line 432 "ncgen.l"
|
||||
{
|
||||
int slen = strlen(ncgtext);
|
||||
int tag = ncgtext[slen-1];
|
||||
@ -1929,7 +1937,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 463 "ncgen.l"
|
||||
#line 471 "ncgen.l"
|
||||
{
|
||||
int c;
|
||||
int token = 0;
|
||||
@ -1967,7 +1975,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 497 "ncgen.l"
|
||||
#line 505 "ncgen.l"
|
||||
{
|
||||
if (sscanf((char*)ncgtext, "%le", &double_val) != 1) {
|
||||
sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext);
|
||||
@ -1978,7 +1986,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 504 "ncgen.l"
|
||||
#line 512 "ncgen.l"
|
||||
{
|
||||
if (sscanf((char*)ncgtext, "%e", &float_val) != 1) {
|
||||
sprintf(errstr,"bad float constant: %s",(char*)ncgtext);
|
||||
@ -1990,7 +1998,7 @@ YY_RULE_SETUP
|
||||
case 41:
|
||||
/* rule 41 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 511 "ncgen.l"
|
||||
#line 519 "ncgen.l"
|
||||
{
|
||||
(void) sscanf((char*)&ncgtext[1],"%c",&byte_val);
|
||||
return lexdebug(BYTE_CONST);
|
||||
@ -1998,7 +2006,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 515 "ncgen.l"
|
||||
#line 523 "ncgen.l"
|
||||
{
|
||||
int oct = unescapeoct(&ncgtext[2]);
|
||||
if(oct < 0) {
|
||||
@ -2011,7 +2019,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 524 "ncgen.l"
|
||||
#line 532 "ncgen.l"
|
||||
{
|
||||
int hex = unescapehex(&ncgtext[3]);
|
||||
if(byte_val < 0) {
|
||||
@ -2024,7 +2032,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 533 "ncgen.l"
|
||||
#line 541 "ncgen.l"
|
||||
{
|
||||
switch ((char)ncgtext[2]) {
|
||||
case 'a': byte_val = '\007'; break; /* not everyone under-
|
||||
@ -2046,7 +2054,7 @@ YY_RULE_SETUP
|
||||
case 45:
|
||||
/* rule 45 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 551 "ncgen.l"
|
||||
#line 559 "ncgen.l"
|
||||
{
|
||||
lineno++ ;
|
||||
break;
|
||||
@ -2054,7 +2062,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 556 "ncgen.l"
|
||||
#line 564 "ncgen.l"
|
||||
{/*initial*/
|
||||
BEGIN(ST_C_COMMENT);
|
||||
break;
|
||||
@ -2063,21 +2071,21 @@ YY_RULE_SETUP
|
||||
case 47:
|
||||
/* rule 47 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 561 "ncgen.l"
|
||||
#line 569 "ncgen.l"
|
||||
{/* continuation */
|
||||
break;
|
||||
}
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 565 "ncgen.l"
|
||||
#line 573 "ncgen.l"
|
||||
{/* final */
|
||||
BEGIN(INITIAL);
|
||||
break;
|
||||
}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(ST_C_COMMENT):
|
||||
#line 570 "ncgen.l"
|
||||
#line 578 "ncgen.l"
|
||||
{/* final, error */
|
||||
fprintf(stderr,"unterminated /**/ comment");
|
||||
BEGIN(INITIAL);
|
||||
@ -2086,17 +2094,17 @@ case YY_STATE_EOF(ST_C_COMMENT):
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 576 "ncgen.l"
|
||||
#line 584 "ncgen.l"
|
||||
{/* Note: this next rule will not work for UTF8 characters */
|
||||
return lexdebug(ncgtext[0]) ;
|
||||
}
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 579 "ncgen.l"
|
||||
#line 587 "ncgen.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 2100 "lex.ncg.c"
|
||||
#line 2108 "ncgenyy.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(TEXT):
|
||||
yyterminate();
|
||||
@ -3095,7 +3103,7 @@ void ncgfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 579 "ncgen.l"
|
||||
#line 587 "ncgen.l"
|
||||
|
||||
|
||||
static int
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
echo "*** Testing ncgen for netCDF-4."
|
||||
set -e
|
||||
echo "*** creating netCDF-4 file c0_4.nc from c0.cdl..."
|
||||
./ncgen -k3 -b -o c0_4.nc $srcdir/c0.cdl
|
||||
echo "*** creating netCDF-4 file c0_4.nc from c0_4.cdl..."
|
||||
./ncgen -k3 -b -o c0_4.nc $srcdir/c0_4.cdl
|
||||
echo "*** creating netCDF-4 classic model file c0_4c.nc from c0.cdl..."
|
||||
./ncgen -k4 -b -o c0_4c.nc $srcdir/c0.cdl
|
||||
echo "*** creating C code for CAM file ref_camrun.cdl..."
|
||||
|
@ -471,7 +471,7 @@ fixeconstref(NCConstant* con)
|
||||
/* One hopes that 99% of the time, the match is unique */
|
||||
if(listlength(candidates) == 1) {
|
||||
con->value.enumv = (Symbol*)listget(candidates,0);
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
/* If this ref has a specified group prefix, then find that group
|
||||
and search only within it for matches to the candidates */
|
||||
@ -479,14 +479,15 @@ fixeconstref(NCConstant* con)
|
||||
parent = lookupgroup(refsym->prefix);
|
||||
if(parent == NULL) {
|
||||
semerror(con->lineno,"Undefined group reference: ",fullname(refsym));
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
/* Search this group only for matches */
|
||||
grpmatches = ecsearchgrp(parent,candidates);
|
||||
switch (listlength(grpmatches)) {
|
||||
case 0:
|
||||
semerror(con->lineno,"Undefined enum or enum constant reference: ",refsym->name);
|
||||
return;
|
||||
listfree(grpmatches);
|
||||
goto done;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
@ -494,11 +495,11 @@ fixeconstref(NCConstant* con)
|
||||
}
|
||||
con->value.enumv = listget(grpmatches,0);
|
||||
listfree(grpmatches);
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
/* Sigh, we have to search up the tree to see if any of our candidates are there */
|
||||
parent = refsym->container;
|
||||
assert(parent->objectclass == NC_GRP);
|
||||
assert(parent == NULL || parent->objectclass == NC_GRP);
|
||||
while(parent != NULL && match == NULL) {
|
||||
grpmatches = ecsearchgrp(parent,candidates);
|
||||
switch (listlength(grpmatches)) {
|
||||
@ -509,14 +510,17 @@ fixeconstref(NCConstant* con)
|
||||
match = listget(grpmatches,0);
|
||||
break;
|
||||
}
|
||||
listfree(grpmatches);
|
||||
}
|
||||
if(match != NULL) {
|
||||
con->value.enumv = match;
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
/* Not unique and not in the parent tree, so complains and pick the first candidate */
|
||||
semerror(con->lineno,"Ambiguous enum constant reference: %s", fullname(refsym));
|
||||
con->value.enumv = (Symbol*)listget(candidates,0);
|
||||
done:
|
||||
listfree(candidates);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1118,7 +1122,7 @@ computeunlimitedsizes(Dimset* dimset, int dimindex, Datalist* data, int ischar)
|
||||
unlimsize = length / xproduct;
|
||||
if(length % xproduct != 0)
|
||||
unlimsize++; /* => fill requires at some point */
|
||||
#ifdef DEBUG2
|
||||
#ifdef GENDEBUG2
|
||||
fprintf(stderr,"unlimsize: dim=%s declsize=%lu xproduct=%lu newsize=%lu\n",
|
||||
thisunlim->name,
|
||||
(unsigned long)thisunlim->dim.declsize,
|
||||
@ -1160,7 +1164,7 @@ thisunlim->name,
|
||||
unlimsize = length / xproduct;
|
||||
if(length % xproduct != 0)
|
||||
unlimsize++; /* => fill requires at some point */
|
||||
#ifdef DEBUG2
|
||||
#ifdef GENDEBUG2
|
||||
fprintf(stderr,"unlimsize: dim=%s declsize=%lu xproduct=%lu newsize=%lu\n",
|
||||
thisunlim->name,
|
||||
(unsigned long)thisunlim->dim.declsize,
|
||||
@ -1204,7 +1208,7 @@ processunlimiteddims(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG1
|
||||
#ifdef GENDEBUG1
|
||||
/* print unlimited dim size */
|
||||
if(listlength(dimdefs) == 0)
|
||||
fprintf(stderr,"unlimited: no unlimited dimensions\n");
|
||||
|
@ -415,7 +415,7 @@ char*
|
||||
pooldup(const char* s)
|
||||
{
|
||||
char* sdup = poolalloc(strlen(s)+1);
|
||||
strcpy(sdup,s);
|
||||
strncpy(sdup,s,(strlen(s)+1));
|
||||
return sdup;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
* $Header: /upc/share/CVS/netcdf-3/ncgen3/genlib.h,v 1.15 2009/12/29 18:42:35 dmh Exp $
|
||||
*********************************************************************/
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* $Id: load.c,v 1.35 2009/11/17 18:15:08 dmh Exp $
|
||||
*********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
1443
oc2/daptab.c
1443
oc2/daptab.c
File diff suppressed because it is too large
Load Diff
91
oc2/daptab.h
91
oc2/daptab.h
@ -1,19 +1,19 @@
|
||||
/* A Bison parser, made by GNU Bison 2.6.4. */
|
||||
/* A Bison parser, made by GNU Bison 3.0. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_DAP_DAP_TAB_H_INCLUDED
|
||||
# define YY_DAP_DAP_TAB_H_INCLUDED
|
||||
/* Enabling traces. */
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
@ -40,61 +40,48 @@
|
||||
extern int dapdebug;
|
||||
#endif
|
||||
|
||||
/* Tokens. */
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
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
|
||||
};
|
||||
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
|
||||
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef int YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int dapparse (void *YYPARSE_PARAM);
|
||||
#else
|
||||
int dapparse ();
|
||||
#endif
|
||||
#else /* ! YYPARSE_PARAM */
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
|
||||
int dapparse (DAPparsestate* parsestate);
|
||||
#else
|
||||
int dapparse ();
|
||||
#endif
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */
|
||||
|
28
oc2/oc.c
28
oc2/oc.c
@ -11,6 +11,7 @@
|
||||
#include "ocdump.h"
|
||||
#include "oclog.h"
|
||||
#include "occlientparams.h"
|
||||
#include "occurlfunctions.h"
|
||||
#include "ochttp.h"
|
||||
|
||||
#undef TRACK
|
||||
@ -966,7 +967,7 @@ OCerror
|
||||
oc_data_fieldbyname(OCobject link, OCobject datanode, const char* name, OCobject* fieldp)
|
||||
{
|
||||
OCerror err = OC_NOERR;
|
||||
size_t count,i;
|
||||
size_t i=0,count=0;
|
||||
OCobject ddsnode;
|
||||
OCVERIFY(OC_State,link);
|
||||
OCVERIFY(OC_Data,datanode);
|
||||
@ -1291,7 +1292,10 @@ oc_data_octype(OCobject link, OCobject datanode, OCtype* typep)
|
||||
|
||||
OCASSERT(data->template != NULL);
|
||||
if(typep == NULL) ocerr = OC_EINVAL;
|
||||
else *typep = data->template->octype;
|
||||
else if(data->template)
|
||||
*typep = data->template->octype;
|
||||
else
|
||||
ocerr = OC_EINVAL;
|
||||
return ocerr;
|
||||
}
|
||||
|
||||
@ -1929,6 +1933,26 @@ oc_set_useragent(OCobject link, const char* agent)
|
||||
return ocsetuseragent(state,agent);
|
||||
}
|
||||
|
||||
/*!
|
||||
Force the curl library to trace its actions.
|
||||
|
||||
\param[in] link The link through which the server is accessed.
|
||||
|
||||
\retval OC_NOERR if the request succeeded.
|
||||
\retval OC_EINVAL if the request failed.
|
||||
|
||||
*/
|
||||
|
||||
OCerror
|
||||
oc_trace_curl(OCobject link)
|
||||
{
|
||||
OCstate* state;
|
||||
OCVERIFY(OC_State,link);
|
||||
OCDEREF(OCstate*,state,link);
|
||||
oc_curl_debug(state);
|
||||
return OC_NOERR;
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**************************************************/
|
||||
|
6
oc2/oc.h
6
oc2/oc.h
@ -525,6 +525,12 @@ extern OCerror oc_svcerrordata(OClink link, char** codep,
|
||||
/**************************************************/
|
||||
/* Experimental/Undocumented */
|
||||
|
||||
/*
|
||||
Cause the curl library
|
||||
to be verbose
|
||||
*/
|
||||
extern OCerror oc_trace_curl(OClink link);
|
||||
|
||||
/* Given an arbitrary OCnode, return the connection of which it is a part */
|
||||
extern OCerror oc_get_connection(OCobject ocnode, OCobject* linkp);
|
||||
|
||||
|
@ -56,6 +56,10 @@ ocset_curl_flags(OCstate* state)
|
||||
CURL* curl = state->curl;
|
||||
struct OCcurlflags* flags = &state->curlflags;
|
||||
|
||||
#if 0
|
||||
cstat = curl_easy_reset(curl);
|
||||
#endif
|
||||
|
||||
#ifdef CURLOPT_ENCODING
|
||||
if (flags->compress) {
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_ENCODING,"deflate, gzip");
|
||||
@ -63,18 +67,19 @@ ocset_curl_flags(OCstate* state)
|
||||
OCDBG(1,"CURLOPT_ENCODING=deflate, gzip");
|
||||
}
|
||||
#endif
|
||||
if (flags->cookiejar || flags->cookiefile) {
|
||||
#if 0
|
||||
Do not think this is correct
|
||||
if (flags->cookiejar) {
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1);
|
||||
if (cstat != CURLE_OK) goto done;
|
||||
OCDBG(1,"CURLOPT_COOKIESESSION=1");
|
||||
}
|
||||
#endif
|
||||
if (flags->cookiejar) {
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_COOKIEJAR, flags->cookiejar);
|
||||
if (cstat != CURLE_OK) goto done;
|
||||
OCDBG1(1,"CURLOPT_COOKIEJAR=%s",flags->cookiejar);
|
||||
}
|
||||
if (flags->cookiefile) {
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_COOKIEFILE, flags->cookiefile);
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_COOKIEFILE, flags->cookiejar);
|
||||
if (cstat != CURLE_OK) goto done;
|
||||
OCDBG1(1,"CURLOPT_COOKIEFILE=%s",flags->cookiefile);
|
||||
}
|
||||
@ -101,6 +106,10 @@ ocset_curl_flags(OCstate* state)
|
||||
OCDBG1(1,"CURLOPT_FOLLOWLOCATION=%ld",1L);
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
|
||||
OCDBG1(1,"CURLOPT_MAXREDIRS=%ld",10L);
|
||||
#if 0
|
||||
cstat = curl_setopt(curl,CURLOPT_RETURNTRANSFER, 1L);
|
||||
OCDBG1(1,"CURLOPT_RETURNTRANSFER=%ld",1L);
|
||||
#endif
|
||||
|
||||
cstat = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, state->error.curlerrorbuf);
|
||||
OCDBG1(1,"CURLOPT_ERRORBUFFER",0);
|
||||
|
@ -247,7 +247,6 @@ ocdata_read(OCstate* state, OCdata* data, size_t start, size_t count,
|
||||
assert(memory != NULL);
|
||||
assert(memsize > 0);
|
||||
|
||||
data = data;
|
||||
template = data->template;
|
||||
octype = template->octype;
|
||||
assert(octype == OC_Atomic);
|
||||
|
208
oc2/ocinternal.c
208
oc2/ocinternal.c
@ -3,12 +3,14 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "ocinternal.h"
|
||||
#include "ocdebug.h"
|
||||
@ -21,14 +23,14 @@
|
||||
|
||||
/* Note: TMPPATH must end in '/' */
|
||||
#ifdef __CYGWIN__
|
||||
#define TMPPATH1 "/cygdrive/c/temp/"
|
||||
#define TMPPATH2 "./"
|
||||
#elif _WIN32
|
||||
#define TMPPATH1 "c:\\temp\\"
|
||||
#define TMPPATH2 ".\\"
|
||||
#define TMPPATH1 "/cygdrive/c/temp/datadds"
|
||||
#define TMPPATH2 "./datadds"
|
||||
#elif defined(_WIN32) || defined(_WIN64)
|
||||
#define TMPPATH1 "c:\\temp\\datadds"
|
||||
#define TMPPATH2 ".\\datadds"
|
||||
#else
|
||||
#define TMPPATH1 "/tmp/"
|
||||
#define TMPPATH2 "./"
|
||||
#define TMPPATH1 "/tmp/datadds"
|
||||
#define TMPPATH2 "./datadds"
|
||||
#endif
|
||||
|
||||
#define CLBRACE '{'
|
||||
@ -42,14 +44,13 @@ static int ocextractddsinmemory(OCstate*,OCtree*,int);
|
||||
static int ocextractddsinfile(OCstate*,OCtree*,int);
|
||||
static char* constraintescape(const char* url);
|
||||
static OCerror createtempfile(OCstate*,OCtree*);
|
||||
static int createtempfile1(char*,char**);
|
||||
static int dataError(XXDR* xdrs, OCstate*);
|
||||
|
||||
static void ocsetcurlproperties(OCstate*);
|
||||
static int ocsetcurlproperties(OCstate*);
|
||||
|
||||
extern OCnode* makeunlimiteddimension(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
@ -74,6 +75,32 @@ ocinternalinitialize(void)
|
||||
ocglobalstate.initialized = 1;
|
||||
}
|
||||
|
||||
/* Capture $HOME */
|
||||
{
|
||||
char* p;
|
||||
char* q;
|
||||
char* home = getenv("HOME");
|
||||
char cwd[4096];
|
||||
if(ocglobalstate.home == NULL) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
home = getenv("TEMP");
|
||||
#else
|
||||
home = "/tmp";
|
||||
#endif
|
||||
}
|
||||
if(home == NULL) {
|
||||
home = getcwd(cwd,sizeof(cwd));
|
||||
if(home == NULL || *home == '\0') home = ".";
|
||||
}
|
||||
|
||||
/* Convert '\' to '/' */
|
||||
ocglobalstate.home = (char*)malloc(strlen(home) + 1);
|
||||
for(p=home,q=ocglobalstate.home;*p;p++,q++) {
|
||||
if(*p == '\\') {*q = '/'; } else {*q = *p;}
|
||||
}
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
/* Compute some xdr related flags */
|
||||
xxdr_init();
|
||||
|
||||
@ -84,7 +111,6 @@ ocinternalinitialize(void)
|
||||
/* compile the .dodsrc, if any */
|
||||
{
|
||||
char* path = NULL;
|
||||
char* homepath = NULL;
|
||||
char** alias;
|
||||
FILE* f = NULL;
|
||||
/* locate the configuration files: . first in '.', then $HOME */
|
||||
@ -93,8 +119,8 @@ ocinternalinitialize(void)
|
||||
path = (char*)malloc(pathlen);
|
||||
if(path == NULL) return OC_ENOMEM;
|
||||
if(!occopycat(path,pathlen,2,"./",*alias)) {
|
||||
if(path) free(path);
|
||||
return OC_EOVERRUN;
|
||||
if(path) free(path);
|
||||
return OC_EOVERRUN;
|
||||
}
|
||||
/* see if file is readable */
|
||||
f = fopen(path,"r");
|
||||
@ -103,20 +129,17 @@ ocinternalinitialize(void)
|
||||
}
|
||||
if(f == NULL) { /* try $HOME */
|
||||
OCASSERT(path == NULL);
|
||||
homepath = getenv("HOME");
|
||||
if (homepath!= NULL) {
|
||||
for(alias=rcfilenames;*alias;alias++) {
|
||||
size_t pathlen = strlen(homepath)+1+strlen(*alias)+1;
|
||||
path = (char*)malloc(pathlen);
|
||||
if(path == NULL) return OC_ENOMEM;
|
||||
if(!occopycat(path,pathlen,3,homepath,"/",*alias)) {
|
||||
if(path) {free(path);}
|
||||
return OC_EOVERRUN;
|
||||
}
|
||||
f = fopen(path,"r");
|
||||
if(f != NULL) break;
|
||||
if(path != NULL) {free(path); path=NULL;}
|
||||
for(alias=rcfilenames;*alias;alias++) {
|
||||
size_t pathlen = strlen(ocglobalstate.home)+1+strlen(*alias)+1;
|
||||
path = (char*)malloc(pathlen);
|
||||
if(path == NULL) return OC_ENOMEM;
|
||||
if(!occopycat(path,pathlen,3,ocglobalstate.home,"/",*alias)) {
|
||||
if(path) free(path);
|
||||
return OC_EOVERRUN;
|
||||
}
|
||||
f = fopen(path,"r");
|
||||
if(f != NULL) break;
|
||||
if(path != NULL) {free(path); path=NULL;}
|
||||
}
|
||||
}
|
||||
if(f == NULL) {
|
||||
@ -131,6 +154,7 @@ ocinternalinitialize(void)
|
||||
}
|
||||
if(path != NULL) free(path);
|
||||
}
|
||||
|
||||
return OCTHROW(stat);
|
||||
}
|
||||
|
||||
@ -164,7 +188,7 @@ ocopen(OCstate** statep, const char* url)
|
||||
ocbytessetalloc(state->packet,DFALTPACKETSIZE); /*initial reasonable size*/
|
||||
|
||||
/* set curl properties for this link */
|
||||
ocsetcurlproperties(state);
|
||||
stat = ocsetcurlproperties(state);
|
||||
|
||||
if(statep) *statep = state;
|
||||
return OCTHROW(stat);
|
||||
@ -344,16 +368,14 @@ fail:
|
||||
static OCerror
|
||||
createtempfile(OCstate* state, OCtree* tree)
|
||||
{
|
||||
int stat = OC_NOERR;
|
||||
int fd = 0;
|
||||
char* name = NULL;
|
||||
fd = createtempfile1(TMPPATH1,&name);
|
||||
if(fd < 0)
|
||||
fd = createtempfile1(TMPPATH2,&name);
|
||||
if(fd < 0) {
|
||||
oclog(OCLOGERR,"oc_open: attempt to open tmp file failed: %s",name);
|
||||
if(name) free(name);
|
||||
return errno;
|
||||
}
|
||||
|
||||
stat = ocmktmp(TMPPATH1,&name, &fd);
|
||||
if(stat != OC_NOERR)
|
||||
stat = ocmktmp(TMPPATH2,&name,&fd);
|
||||
if(stat != OC_NOERR) goto fail;
|
||||
#ifdef OCDEBUG
|
||||
oclog(OCLOGNOTE,"oc_open: using tmp file: %s",name);
|
||||
#endif
|
||||
@ -362,49 +384,13 @@ createtempfile(OCstate* state, OCtree* tree)
|
||||
if(tree->data.file == NULL) return OC_EOPEN;
|
||||
/* unlink the temp file so it will automatically be reclaimed */
|
||||
if(ocdebug == 0) unlink(tree->data.filename);
|
||||
return OC_NOERR;
|
||||
}
|
||||
return stat;
|
||||
|
||||
int
|
||||
createtempfile1(char* tmppath, char** tmpnamep)
|
||||
{
|
||||
int fd = 0;
|
||||
char* tmpname = NULL;
|
||||
size_t tmpsize = strlen(tmppath)+strlen("dataddsXXXXXX") + 1;
|
||||
tmpname = (char*)malloc(tmpsize);
|
||||
if(tmpname == NULL) return -1;
|
||||
if(!occopycat(tmpname,tmpsize,1,tmppath))
|
||||
return OC_EOVERRUN;
|
||||
#ifdef HAVE_MKSTEMP
|
||||
if(!occoncat(tmpname,tmpsize,1,"dataddsXXXXXX"))
|
||||
return OC_EOVERRUN;
|
||||
/* Note Potential problem: old versions of this function
|
||||
leave the file in mode 0666 instead of 0600 */
|
||||
umask(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
fd = mkstemp(tmpname);
|
||||
#else /* !HAVE_MKSTEMP */
|
||||
/* Need to simulate by using some kind of pseudo-random number */
|
||||
if(!occoncat(tmpname,tmpsize,1,"datadds"))
|
||||
return OC_EOVERRUN;
|
||||
{
|
||||
int rno = rand();
|
||||
char spid[7];
|
||||
if(rno < 0) rno = -rno;
|
||||
snprintf(spid,sizeof(spid),"%06d",rno);
|
||||
if(!occoncat(tmpname,tmpsize,1,spid))
|
||||
return OC_EOVERRUN;
|
||||
# ifdef _WIN32
|
||||
fd=open(tmpname,O_RDWR|O_BINARY|O_CREAT|O_EXCL|FILE_ATTRIBUTE_TEMPORARY, _S_IREAD|_S_IWRITE);
|
||||
# else
|
||||
fd=open(tmpname,O_RDWR|O_CREAT|O_EXCL, S_IRWXU);
|
||||
# endif
|
||||
}
|
||||
#endif /* !HAVE_MKSTEMP */
|
||||
if(tmpname == NULL) return -1;
|
||||
if(tmpnamep) *tmpnamep = tmpname;
|
||||
else
|
||||
free(tmpname);
|
||||
return fd;
|
||||
fail:
|
||||
oclog(OCLOGERR,"oc_open: attempt to create tmp file failed: %s",name == NULL ? "[NULL]" : name);
|
||||
|
||||
if(name != NULL) {free(name);name=NULL;}
|
||||
return stat;
|
||||
}
|
||||
|
||||
void
|
||||
@ -425,8 +411,10 @@ occlose(OCstate* state)
|
||||
ocfree(state->error.code);
|
||||
ocfree(state->error.message);
|
||||
ocfree(state->curlflags.useragent);
|
||||
ocfree(state->curlflags.cookiejar);
|
||||
ocfree(state->curlflags.cookiefile);
|
||||
if(state->curlflags.cookiejar) {
|
||||
unlink(state->curlflags.cookiejar);
|
||||
ocfree(state->curlflags.cookiejar);
|
||||
}
|
||||
ocfree(state->ssl.certificate);
|
||||
ocfree(state->ssl.key);
|
||||
ocfree(state->ssl.keypasswd);
|
||||
@ -567,9 +555,9 @@ ocupdatelastmodifieddata(OCstate* state)
|
||||
}
|
||||
|
||||
/*
|
||||
Set curl properties for link based on rc files
|
||||
Set curl properties for link based on rc files etc.
|
||||
*/
|
||||
static void
|
||||
static int
|
||||
ocsetcurlproperties(OCstate* state)
|
||||
{
|
||||
CURLcode cstat = CURLE_OK;
|
||||
@ -592,16 +580,62 @@ ocsetcurlproperties(OCstate* state)
|
||||
size_t len = strlen(DFALTUSERAGENT) + strlen(VERSION) + 1;
|
||||
char* agent = (char*)malloc(len+1);
|
||||
if(occopycat(agent,len,2,DFALTUSERAGENT,VERSION))
|
||||
state->curlflags.useragent = agent;
|
||||
state->curlflags.useragent = agent;
|
||||
else
|
||||
free(agent);
|
||||
free(agent);
|
||||
}
|
||||
return;
|
||||
|
||||
/* Some servers (e.g. thredds and columbia) appear to require a place
|
||||
to put cookies in order for some security functions to work
|
||||
*/
|
||||
if(state->curlflags.cookiejar == NULL
|
||||
|| *state->curlflags.cookiejar) {
|
||||
#if 1
|
||||
/* Apparently anything non-null will work */
|
||||
state->curlflags.cookiejar = strdup("");
|
||||
#else
|
||||
/* If no cookie file was defined, define a default */
|
||||
char* tmp;
|
||||
int fd;
|
||||
int stat;
|
||||
|
||||
tmp = (char*)malloc(strlen(ocglobalstate.home)
|
||||
+strlen("/")
|
||||
+strlen(OCDIR)
|
||||
+strlen("/")
|
||||
+1);
|
||||
if(tmp == NULL)
|
||||
return OC_ENOMEM;
|
||||
strcpy(tmp,ocglobalstate.home);
|
||||
strcat(tmp,"/");
|
||||
strcat(tmp,OCDIR);
|
||||
strcat(tmp,"/");
|
||||
stat = mkdir(tmp,S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
if(stat != 0 && errno != EEXIST) {
|
||||
fprintf(stderr,"Cannot create cookie file\n");
|
||||
return stat;
|
||||
}
|
||||
errno = 0;
|
||||
/* Create the actual cookie file */
|
||||
stat = ocmktmp(tmp,&state->curlflags.cookiejar,&fd);
|
||||
close(fd);
|
||||
|
||||
#if 0
|
||||
fd = creat(tmp,S_IRUSR | S_IWUSR);
|
||||
if(fd < 0) {
|
||||
fprintf(stderr,"Cannot create cookie file\n");
|
||||
return OC_EPERM;
|
||||
}else
|
||||
close(fd);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return OC_NOERR;
|
||||
|
||||
fail:
|
||||
if(cstat != CURLE_OK)
|
||||
oclog(OCLOGERR, "curl error: %s", curl_easy_strerror(cstat));
|
||||
return;
|
||||
return OC_ECURL;
|
||||
}
|
||||
|
||||
OCerror
|
||||
|
@ -87,6 +87,8 @@ typedef struct OCheader {
|
||||
#define nullstring(s) (s==NULL?"(null)":s)
|
||||
#define PATHSEPARATOR "."
|
||||
|
||||
#define OCDIR ".oc"
|
||||
|
||||
/* Define infinity for memory size */
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
#define OCINFINITY ((size_t)0xffffffff)
|
||||
@ -114,6 +116,7 @@ extern struct OCGLOBALSTATE {
|
||||
int proto_https;
|
||||
} curl;
|
||||
struct OCTriplestore* ocdodsrc; /* the .dodsrc triple store */
|
||||
char* home; /* track $HOME for use in creating $HOME/.oc dir */
|
||||
} ocglobalstate;
|
||||
|
||||
/*! Specifies the OCstate = non-opaque version of OClink */
|
||||
@ -140,7 +143,6 @@ struct OCstate {
|
||||
int maxredirs;
|
||||
char* useragent;
|
||||
char* cookiejar;
|
||||
char* cookiefile;
|
||||
} curlflags;
|
||||
struct OCSSL {
|
||||
int validate;
|
||||
|
14
oc2/ocrc.c
14
oc2/ocrc.c
@ -387,12 +387,6 @@ ocdodsrc_process(OCstate* state)
|
||||
oclog(OCLOGNOTE,"USERAGENT: %s", state->curlflags.useragent);
|
||||
}
|
||||
|
||||
if((value = curllookup("COOKIEFILE",url)) != NULL) {
|
||||
state->curlflags.cookiefile = strdup(TRIM(value));
|
||||
if(!state->curlflags.cookiefile) {stat = OC_ENOMEM; goto done;}
|
||||
if(ocdebug > 0)
|
||||
oclog(OCLOGNOTE,"COOKIEFILE: %s", state->curlflags.cookiefile);
|
||||
}
|
||||
if((value = curllookup("COOKIEJAR",url))
|
||||
|| (value = curllookup("COOKIE_JAR",url))) {
|
||||
state->curlflags.cookiejar = strdup(TRIM(value));
|
||||
@ -401,14 +395,6 @@ ocdodsrc_process(OCstate* state)
|
||||
oclog(OCLOGNOTE,"COOKIEJAR: %s", state->curlflags.cookiejar);
|
||||
}
|
||||
|
||||
/* Some servers (e.g. thredds) appear to require a place
|
||||
to put cookies in order for some security functions to work
|
||||
*/
|
||||
if(state->curlflags.cookiejar == NULL
|
||||
&& state->curlflags.cookiefile == NULL) {
|
||||
state->curlflags.cookiefile = strdup("");
|
||||
}
|
||||
|
||||
if((value = curllookup("PROXY_SERVER",url)) != NULL) {
|
||||
stat = parseproxy(state,TRIM(value));
|
||||
if(stat != OC_NOERR) goto done;
|
||||
|
@ -104,7 +104,10 @@ readpacket(OCstate* state, OCURI* url,OCbytes* packet,OCdxd dxd,long* lastmodifi
|
||||
stat = readfile(fetchurl,suffix,packet);
|
||||
} else {
|
||||
int flags = 0;
|
||||
if(!fileprotocol) flags |= OCURICONSTRAINTS;
|
||||
if(!fileprotocol) {
|
||||
flags |= OCURICONSTRAINTS;
|
||||
flags |= OCURIUSERPWD;
|
||||
}
|
||||
flags |= OCURIENCODE;
|
||||
fetchurl = ocuribuild(url,NULL,suffix,flags);
|
||||
MEMCHECK(fetchurl,OC_ENOMEM);
|
||||
@ -153,6 +156,7 @@ fprintf(stderr,"readDATADDS:\n");
|
||||
int flags = 0;
|
||||
if(!fileprotocol) flags |= OCURICONSTRAINTS;
|
||||
flags |= OCURIENCODE;
|
||||
flags |= OCURIUSERPWD;
|
||||
ocurisetconstraints(url,tree->constraint);
|
||||
readurl = ocuribuild(url,NULL,".dods",flags);
|
||||
MEMCHECK(readurl,OC_ENOMEM);
|
||||
|
55
oc2/ocutil.c
55
oc2/ocutil.c
@ -8,6 +8,15 @@
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define mode_t int
|
||||
#endif
|
||||
|
||||
#include "ocinternal.h"
|
||||
#include "ocdebug.h"
|
||||
|
||||
@ -668,3 +677,49 @@ done:
|
||||
va_end(args);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Wrap mktmp
|
||||
*/
|
||||
|
||||
int
|
||||
ocmktmp(const char* base, char** tmpnamep, int* fdp)
|
||||
{
|
||||
int fd;
|
||||
char* tmpname = NULL;
|
||||
mode_t oldmask;
|
||||
size_t tmpsize = strlen(base)+strlen("XXXXXX") + 1;
|
||||
|
||||
tmpname = (char*)malloc(tmpsize);
|
||||
if(tmpname == NULL) return OC_ENOMEM;
|
||||
if(!occopycat(tmpname,tmpsize,1,base))
|
||||
return OC_EOVERRUN;
|
||||
#ifdef HAVE_MKSTEMP
|
||||
if(!occoncat(tmpname,tmpsize,1,"XXXXXX"))
|
||||
return OC_EOVERRUN;
|
||||
/* Note Potential problem: old versions of this function
|
||||
leave the file in mode 0666 instead of 0600 */
|
||||
oldmask= umask(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
fd = mkstemp(tmpname);
|
||||
umask(oldmask); /* restore */
|
||||
#else /* !HAVE_MKSTEMP */
|
||||
/* Need to simulate by using some kind of pseudo-random number */
|
||||
{
|
||||
int rno = rand();
|
||||
char spid[7];
|
||||
if(rno < 0) rno = -rno;
|
||||
snprintf(spid,sizeof(spid),"%06d",rno);
|
||||
if(!occoncat(tmpname,tmpsize,1,spid))
|
||||
return OC_EOVERRUN;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
fd=open(tmpname,O_RDWR|O_BINARY|O_CREAT|O_EXCL|FILE_ATTRIBUTE_TEMPORARY, _S_IREAD|_S_IWRITE);
|
||||
# else
|
||||
fd=open(tmpname,O_RDWR|O_CREAT|O_EXCL, S_IRWXU);
|
||||
# endif
|
||||
}
|
||||
#endif /* !HAVE_MKSTEMP */
|
||||
if(tmpnamep) *tmpnamep = tmpname;
|
||||
if(fdp) *fdp = fd;
|
||||
return OC_NOERR;
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ extern int ocfindbod(OCbytes* buffer, size_t*, size_t*);
|
||||
extern void ocfreeprojectionclause(OCprojectionclause* clause);
|
||||
|
||||
/* Misc. */
|
||||
|
||||
extern int ocmktmp(const char* base, char** tmpnamep, int* fdp);
|
||||
|
||||
extern void ocdataddsmsg(struct OCstate*, struct OCtree*);
|
||||
|
||||
extern const char* ocdtmodestring(OCDT mode,int compact);
|
||||
|
@ -222,7 +222,8 @@ xxdr_skip(XXDR* xdrs, off_t len)
|
||||
unsigned int pos;
|
||||
pos = xxdr_getpos(xdrs);
|
||||
pos = (pos + len);
|
||||
if(pos < 0) pos = 0;
|
||||
// Removed the following; pos is unsigned. jhrg 9/30/13
|
||||
// if(pos < 0) pos = 0;
|
||||
return xxdr_setpos(xdrs,pos);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user